x86: queensbay: Optimize disable_igd() a little
PATCH 1/2 x86: queensbay: Optimize disable_igd() a little
Initialize igd and sdvo to NULL so that we don't need to test the return value of dm_pci_bus_find_bdf() later.
---
arch/x86/cpu/queensbay/tnc.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
arch/x86/cpu/queensbay/tnc.c +2 -5
@@ -18,18 +18,15 @@static int __maybe_unused disable_igd (void ) { -struct udevice *igd, *sdvo; +struct udevice *igd =NULL ; +struct udevice *sdvo =NULL ;int ret; ret =dm_pci_bus_find_bdf (TNC_IGD , &igd); -if (ret) -return ret;if (!igd)return 0 ; ret =dm_pci_bus_find_bdf (TNC_SDVO , &sdvo); -if (ret) -return ret;if (!sdvo)return 0 ;
Signature · 1 line
2.25.1
PATCH 2/2 x86: crownbay: Use external graphics card by default
The board routes the Integrated Graphics Device (IGD) to an LVDS panel, which is less popular than a PCIe based graphics card.
Disable the IGD so that it does not show up in the PCI configuration space as a VGA display controller, so we can use an external PCIe graphics card with whatever cable we have.
---
configs/crownbay_defconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
configs/crownbay_defconfig +1 -2
@@ -8,9 +8,8 @@ CONFIG_MAX_CPUS=2 CONFIG_DEFAULT_DEVICE_TREE="crownbay" CONFIG_VENDOR_INTEL=y CONFIG_TARGET_CROWNBAY=y +CONFIG_DISABLE_IGD=y CONFIG_SMP=y -CONFIG_HAVE_VGA_BIOS=y -CONFIG_VGA_BIOS_ADDR=0xfffa0000 CONFIG_GENERATE_PIRQ_TABLE=y CONFIG_GENERATE_MP_TABLE=y CONFIG_FIT=y
Signature · 1 line
2.25.1
Re: [PATCH 2/2] x86: crownbay: Use external graphics card by default
Quoted 27 lines · Bin Meng
The board routes the Integrated Graphics Device (IGD) to an LVDS panel, which is less popular than a PCIe based graphics card.
Disable the IGD so that it does not show up in the PCI configuration space as a VGA display controller, so we can use an external PCIe graphics card with whatever cable we have.
configs/crownbay_defconfig +1
-3@@ -8,9 +8,8 @@ CONFIG_MAX_CPUS=2 CONFIG_DEFAULT_DEVICE_TREE="crownbay" CONFIG_VENDOR_INTEL=y CONFIG_TARGET_CROWNBAY=y +CONFIG_DISABLE_IGD=y CONFIG_SMP=y -CONFIG_HAVE_VGA_BIOS=y -CONFIG_VGA_BIOS_ADDR=0xfffa0000 CONFIG_GENERATE_PIRQ_TABLE=y CONFIG_GENERATE_MP_TABLE=y CONFIG_FIT=y --2.25.1
Quoted 5 lines
Signed-off-by Bin Meng <[email protected]>---
configs/crownbay_defconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
Hi Bin,
Quoted 18 lines · Bin Meng
Initialize igd and sdvo to NULL so that we don't need to test the return value of
dm_pci_bus_find_bdf()later.Signed-off-by Bin Meng <[email protected]>---
arch/x86/cpu/queensbay/tnc.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)arch/x86/cpu/queensbay/tnc.c +0
-0@@ -18,18 +18,15 @@static int __maybe_unused disable_igd (void ) {
arch/x86/cpu/queensbay/tnc.c line 27
Quoted 10 lines
arch/x86/cpu/queensbay/tnc.c +2
-3-struct udevice *igd, *sdvo; +struct udevice *igd =NULL ; +struct udevice *sdvo =NULL ;int ret; ret =dm_pci_bus_find_bdf (TNC_IGD , &igd); -if (ret) -return ret;if (!igd)return 0 ;
This is backwards. If ret returns 0 then we know igd is non-NULL. So check the return value. That is what it is for. You can drop the check of igd. Same below.
Quoted 10 lines
arch/x86/cpu/queensbay/tnc.c +0
-3ret =dm_pci_bus_find_bdf (TNC_SDVO , &sdvo); -if (ret) -return ret;if (!sdvo)return 0 ; --2.25.1
Regards,
Simon
Hi Simon,
Quoted 27 lines · Simon Glass
Hi Bin,
Quoted 23 lines · Bin Meng
Initialize igd and sdvo to NULL so that we don't need to test the return value of
dm_pci_bus_find_bdf()later.Signed-off-by Bin Meng <[email protected]>---
arch/x86/cpu/queensbay/tnc.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)arch/x86/cpu/queensbay/tnc.c +2
-1@@ -18,18 +18,15 @@static int __maybe_unused disable_igd (void ) { -struct udevice *igd, *sdvo; +struct udevice *igd =NULL ; +struct udevice *sdvo =NULL ;int ret;
Quoted 10 lines
arch/x86/cpu/queensbay/tnc.c line 27
Quoted 5 lines
arch/x86/cpu/queensbay/tnc.c +0
-2ret =dm_pci_bus_find_bdf (TNC_IGD , &igd); -if (ret) -return ret;if (!igd)return 0 ;This is backwards. If ret returns 0 then we know igd is non-NULL. So check the return value. That is what it is for. You can drop the check of igd. Same below.
Ah, yes. I remembered why the original codes were written like this. Actually the codes tried to be compatible that if the device is already disabled it should not return error. I will reword the commit message and add some comments here.
Regards,
Bin