pci: When disabling pref MEM set all base bits
PATCH 1/1 pci: When disabling pref MEM set all base bits
It is common to set all base address bits to one and all limit address bits to zero for disabling address forwarding. Forwarding is disabled when base address is higher than limit address, so this change should not have any effect.
--- drivers/pci/pci_auto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pci_auto.c +1 -1
@@ -243,7 +243,7 @@ void dm_pciauto_prescan_setup_bridge(struct udevice *dev, int sub_bus) cmdstat |=PCI_COMMAND_MEMORY ; }else {/* We don't support prefetchable memory for now, so disable */ -dm_pci_write_config16 (dev,PCI_PREF_MEMORY_BASE ,0x1000 | +dm_pci_write_config16 (dev,PCI_PREF_MEMORY_BASE ,0xfff0 | prefechable_64);dm_pci_write_config16 (dev,PCI_PREF_MEMORY_LIMIT ,0x0 | prefechable_64);
Signature · 1 line
2.20.1
Quoted 15 lines · Pali Rohár
It is common to set all base address bits to one and all limit address bits to zero for disabling address forwarding. Forwarding is disabled when base address is higher than limit address, so this change should not have any effect.
Signed-off-by Pali Rohár <[email protected]>--- drivers/pci/pci_auto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/pci/pci_auto.c +0
-0
drivers/pci/pci_auto.c void dm_pciauto_prescan_setup_bridge(struct udevice *dev, int sub_bus) · line 247
Quoted 6 lines
drivers/pci/pci_auto.c +1
-1@@ -243,7 +243,7 @@ void dm_pciauto_prescan_setup_bridge(struct udevice *dev, int sub_bus) cmdstat |=PCI_COMMAND_MEMORY ; }else {/* We don't support prefetchable memory for now, so disable */ -dm_pci_write_config16 (dev,PCI_PREF_MEMORY_BASE ,0x1000 | +dm_pci_write_config16 (dev,PCI_PREF_MEMORY_BASE ,0xfff0 | prefechable_64);
Again, does it make sense to add / use a macro for this 0xfff0 above?
Other than this:
Thanks,
Stefan
drivers/pci/pci_auto.c void dm_pciauto_prescan_setup_bridge(struct udevice *dev, int sub_bus) · line 249
Quoted 3 lines
drivers/pci/pci_auto.c +0
-0dm_pci_write_config16 (dev,PCI_PREF_MEMORY_LIMIT ,0x0 | prefechable_64);
Viele Grüße,
Stefan Roese
Signature · 3 lines
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: [email protected]
Quoted 11 lines · On Tuesday 30 November 2021 07:10:37 Stefan Roese wrote:
Quoted 10 lines · Pali Rohár
It is common to set all base address bits to one and all limit address bits to zero for disabling address forwarding. Forwarding is disabled when base address is higher than limit address, so this change should not have any effect.
Signed-off-by Pali Rohár <[email protected]>--- drivers/pci/pci_auto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 13 lines
drivers/pci/pci_auto.c void dm_pciauto_prescan_setup_bridge(struct udevice *dev, int sub_bus) · line 247
Quoted 11 lines
drivers/pci/pci_auto.c +1
-1@@ -243,7 +243,7 @@ void dm_pciauto_prescan_setup_bridge(struct udevice *dev, int sub_bus) cmdstat |=PCI_COMMAND_MEMORY ; }else {/* We don't support prefetchable memory for now, so disable */ -dm_pci_write_config16 (dev,PCI_PREF_MEMORY_BASE ,0x1000 | +dm_pci_write_config16 (dev,PCI_PREF_MEMORY_BASE ,0xfff0 | prefechable_64);Again, does it make sense to add / use a macro for this
0xfff0above?
This is again setting all range bits in this register to ones. So (~0 & PCI_PREF_RANGE_MASK) or (0xffff & PCI_PREF_RANGE_MASK).
Quoted 10 lines
Other than this:
Reviewed-by Stefan Roese <[email protected]>Thanks,
StefanQuoted 2 lines
drivers/pci/pci_auto.c +0
-0dm_pci_write_config16 (dev,PCI_PREF_MEMORY_LIMIT ,0x0 | prefechable_64);
And then 0x0 here can be expressed similarly via that macro by:
(0x0 & PCI_PREF_RANGE_MASK)
It is verbose, but would follow style if want to use macros for values.
Quoted 9 lines
Quoted 1 line
Viele Grüße,
Stefan RoeseSignature · 3 lines
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: [email protected]
Quoted 26 lines · Pali Rohár
Quoted 11 lines · On Tuesday 30 November 2021 07:10:37 Stefan Roese wrote:
Quoted 10 lines · Pali Rohár
It is common to set all base address bits to one and all limit address bits to zero for disabling address forwarding. Forwarding is disabled when base address is higher than limit address, so this change should not have any effect.
Signed-off-by Pali Rohár <[email protected]>--- drivers/pci/pci_auto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 13 lines
drivers/pci/pci_auto.c void dm_pciauto_prescan_setup_bridge(struct udevice *dev, int sub_bus) · line 247
Quoted 11 lines
drivers/pci/pci_auto.c +1
-1@@ -243,7 +243,7 @@ void dm_pciauto_prescan_setup_bridge(struct udevice *dev, int sub_bus) cmdstat |=PCI_COMMAND_MEMORY ; }else {/* We don't support prefetchable memory for now, so disable */ -dm_pci_write_config16 (dev,PCI_PREF_MEMORY_BASE ,0x1000 | +dm_pci_write_config16 (dev,PCI_PREF_MEMORY_BASE ,0xfff0 | prefechable_64);Again, does it make sense to add / use a macro for this
0xfff0above?
Quoted 2 lines
This is again setting all range bits in this register to ones. So (~0 &
PCI_PREF_RANGE_MASK) or (0xffff&PCI_PREF_RANGE_MASK).
Again, no real issue IMHO - was just checking. Perhaps someone else has more thoughts on this.
Thanks,
Stefan
Quoted 8 lines
Quoted 8 lines
Other than this:
Reviewed-by Stefan Roese <[email protected]>Thanks,
Stefan
Quoted 17 lines
Quoted 2 lines
drivers/pci/pci_auto.c void dm_pciauto_prescan_setup_bridge(struct udevice *dev, int sub_bus) · line 249
Quoted 2 lines
drivers/pci/pci_auto.c +0
-0dm_pci_write_config16 (dev,PCI_PREF_MEMORY_LIMIT ,0x0 | prefechable_64);And then
0x0here can be expressed similarly via that macro by:
(0x0&PCI_PREF_RANGE_MASK)It is verbose, but would follow style if want to use macros for values.
Quoted 9 lines
Quoted 1 line
Viele Grüße,
Stefan RoeseSignature · 3 lines
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: [email protected]
Viele Grüße,
Stefan Roese
Signature · 3 lines
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: [email protected]
Quoted 7 lines · Pali Rohár
It is common to set all base address bits to one and all limit address bits to zero for disabling address forwarding. Forwarding is disabled when base address is higher than limit address, so this change should not have any effect.
Signed-off-by Pali Rohár <[email protected]>Reviewed-by Stefan Roese <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom