diff mbox

[U-Boot,v2,01/11] video: vesa_fb: Look up VGA device by class instead of id

Message ID BLU436-SMTP134956FCFAE24BE622ED81BF930@phx.gbl
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Bin Meng July 6, 2015, 8:31 a.m. UTC
Per PCI spec, VGA device reports its class as standard 030000h in
its configuration space, so we can use it to determine if we need
run option rom instead of testing the supported vendor/device ids.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 drivers/video/vesa_fb.c | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

Comments

Simon Glass July 7, 2015, 10:54 p.m. UTC | #1
On 6 July 2015 at 02:31, Bin Meng <bmeng.cn@gmail.com> wrote:
> Per PCI spec, VGA device reports its class as standard 030000h in
> its configuration space, so we can use it to determine if we need
> run option rom instead of testing the supported vendor/device ids.
>
> Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
> Acked-by: Simon Glass <sjg@chromium.org>
> ---
>
> Changes in v2: None
>
>  drivers/video/vesa_fb.c | 16 ++--------------
>  1 file changed, 2 insertions(+), 14 deletions(-)

Applied to u-boot-x86, thanks!
diff mbox

Patch

diff --git a/drivers/video/vesa_fb.c b/drivers/video/vesa_fb.c
index 47f824a..909f8e8 100644
--- a/drivers/video/vesa_fb.c
+++ b/drivers/video/vesa_fb.c
@@ -1,6 +1,5 @@ 
 /*
- *
- * Vesa frame buffer driver for x86
+ * VESA frame buffer driver
  *
  * Copyright (C) 2014 Google, Inc
  *
@@ -17,16 +16,6 @@ 
  */
 GraphicDevice ctfb;
 
-/* Devices to allow - only the last one works fully */
-struct pci_device_id vesa_video_ids[] = {
-	{ .vendor = 0x102b, .device = 0x0525 },
-	{ .vendor = 0x1002, .device = 0x5159 },
-	{ .vendor = 0x1002, .device = 0x4752 },
-	{ .vendor = 0x1002, .device = 0x5452 },
-	{ .vendor = 0x8086, .device = 0x0f31 },
-	{},
-};
-
 void *video_hw_init(void)
 {
 	GraphicDevice *gdev = &ctfb;
@@ -36,8 +25,7 @@  void *video_hw_init(void)
 
 	printf("Video: ");
 	if (vbe_get_video_info(gdev)) {
-		/* TODO: Should we look these up by class? */
-		dev = pci_find_devices(vesa_video_ids, 0);
+		dev = pci_find_class(PCI_CLASS_DISPLAY_VGA << 8, 0);
 		if (dev == -1) {
 			printf("no card detected\n");
 			return NULL;