diff mbox series

[5/5] pci: Avoid auto-config when chain loading

Message ID 20191221161340.27047-6-sjg@chromium.org
State Superseded
Delegated to: Bin Meng
Headers show
Series x86: Improve support for chain-loading U-Boot | expand

Commit Message

Simon Glass Dec. 21, 2019, 4:13 p.m. UTC
When U-Boot is not the first-stage bootloader we don't want to
re-configure the PCI devices, since this has already been done. Add a
check to avoid this.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/pci/pci-uclass.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Bin Meng Feb. 3, 2020, 11:21 a.m. UTC | #1
Hi Simon,

On Sun, Dec 22, 2019 at 12:13 AM Simon Glass <sjg@chromium.org> wrote:
>
> When U-Boot is not the first-stage bootloader we don't want to
> re-configure the PCI devices, since this has already been done. Add a
> check to avoid this.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  drivers/pci/pci-uclass.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
> index 7308f612b6..6af97cd797 100644
> --- a/drivers/pci/pci-uclass.c
> +++ b/drivers/pci/pci-uclass.c
> @@ -991,7 +991,7 @@ static int pci_uclass_post_probe(struct udevice *bus)
>         if (ret)
>                 return ret;
>
> -       if (CONFIG_IS_ENABLED(PCI_PNP) &&
> +       if (CONFIG_IS_ENABLED(PCI_PNP) && ll_boot_init() &&

Doesn't the PCI_PNP option already cover such situation?

>             (!hose->skip_auto_config_until_reloc ||
>              (gd->flags & GD_FLG_RELOC))) {
>                 ret = pci_auto_config_devices(bus);
> @@ -1013,7 +1013,7 @@ static int pci_uclass_post_probe(struct udevice *bus)
>          * Note we only call this 1) after U-Boot is relocated, and 2)
>          * root bus has finished probing.
>          */
> -       if ((gd->flags & GD_FLG_RELOC) && (bus->seq == 0)) {
> +       if ((gd->flags & GD_FLG_RELOC) && bus->seq == 0 && ll_boot_init()) {

So CONFIG_HAVE_FSP already covers this. In such configuration, U-Boot
should not turn on CONFIG_HAVE_FSP hence there is no need to check
ll_boot_init().

>                 ret = fsp_init_phase_pci();
>                 if (ret)
>                         return ret;
> --

Regards,
Bin
Simon Glass Feb. 3, 2020, 5:15 p.m. UTC | #2
Hi Bin,

On Mon, 3 Feb 2020 at 04:21, Bin Meng <bmeng.cn@gmail.com> wrote:
>
> Hi Simon,
>
> On Sun, Dec 22, 2019 at 12:13 AM Simon Glass <sjg@chromium.org> wrote:
> >
> > When U-Boot is not the first-stage bootloader we don't want to
> > re-configure the PCI devices, since this has already been done. Add a
> > check to avoid this.
> >
> > Signed-off-by: Simon Glass <sjg@chromium.org>
> > ---
> >
> >  drivers/pci/pci-uclass.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
> > index 7308f612b6..6af97cd797 100644
> > --- a/drivers/pci/pci-uclass.c
> > +++ b/drivers/pci/pci-uclass.c
> > @@ -991,7 +991,7 @@ static int pci_uclass_post_probe(struct udevice *bus)
> >         if (ret)
> >                 return ret;
> >
> > -       if (CONFIG_IS_ENABLED(PCI_PNP) &&
> > +       if (CONFIG_IS_ENABLED(PCI_PNP) && ll_boot_init() &&
>
> Doesn't the PCI_PNP option already cover such situation?
>
> >             (!hose->skip_auto_config_until_reloc ||
> >              (gd->flags & GD_FLG_RELOC))) {
> >                 ret = pci_auto_config_devices(bus);
> > @@ -1013,7 +1013,7 @@ static int pci_uclass_post_probe(struct udevice *bus)
> >          * Note we only call this 1) after U-Boot is relocated, and 2)
> >          * root bus has finished probing.
> >          */
> > -       if ((gd->flags & GD_FLG_RELOC) && (bus->seq == 0)) {
> > +       if ((gd->flags & GD_FLG_RELOC) && bus->seq == 0 && ll_boot_init()) {
>
> So CONFIG_HAVE_FSP already covers this. In such configuration, U-Boot
> should not turn on CONFIG_HAVE_FSP hence there is no need to check
> ll_boot_init().

Same comment as with patch 1. See if that explains things enough, and
if so I can send a v2.

Regards,
Simon
diff mbox series

Patch

diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
index 7308f612b6..6af97cd797 100644
--- a/drivers/pci/pci-uclass.c
+++ b/drivers/pci/pci-uclass.c
@@ -991,7 +991,7 @@  static int pci_uclass_post_probe(struct udevice *bus)
 	if (ret)
 		return ret;
 
-	if (CONFIG_IS_ENABLED(PCI_PNP) &&
+	if (CONFIG_IS_ENABLED(PCI_PNP) && ll_boot_init() &&
 	    (!hose->skip_auto_config_until_reloc ||
 	     (gd->flags & GD_FLG_RELOC))) {
 		ret = pci_auto_config_devices(bus);
@@ -1013,7 +1013,7 @@  static int pci_uclass_post_probe(struct udevice *bus)
 	 * Note we only call this 1) after U-Boot is relocated, and 2)
 	 * root bus has finished probing.
 	 */
-	if ((gd->flags & GD_FLG_RELOC) && (bus->seq == 0)) {
+	if ((gd->flags & GD_FLG_RELOC) && bus->seq == 0 && ll_boot_init()) {
 		ret = fsp_init_phase_pci();
 		if (ret)
 			return ret;