Sophie

Sophie

distrib > Mageia > 2 > i586 > by-pkgid > b30107eb07e57ab7103b0581b7316395 > files > 1

pciutils-3.2.0-2.mga2.src.rpm

From 215105913df7ff726e21b21a93cc8c8b43f344e8 Mon Sep 17 00:00:00 2001
From: Matthew Wilcox <matthew@wil.cx>
Date: Sat, 20 Apr 2013 07:45:32 -0600
Subject: [PATCH 1/5] lspci: Display CardBus bridge capabilities

CardBus bridges can have capabilities, but the CAP_PTR register is at a
different location.  This one has Power Management:

CardBus bridge: O2 Micro, Inc. OZ711SP1 Memory CardBus Controller (rev 01)
+       Capabilities: [a0] Power Management version 2
---
 lib/header.h | 3 ++-
 ls-caps.c    | 4 ++--
 lspci.c      | 5 +++--
 lspci.h      | 2 +-
 4 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/lib/header.h b/lib/header.h
index b418982..69518fd 100644
--- a/lib/header.h
+++ b/lib/header.h
@@ -144,7 +144,8 @@
 #define  PCI_BRIDGE_CTL_DISCARD_TIMER_SERR_EN 0x800	/* PCI-X? */
 
 /* Header type 2 (CardBus bridges) */
-/* 0x14-0x15 reserved */
+#define PCI_CB_CAPABILITY_LIST	0x14
+/* 0x15 reserved */
 #define PCI_CB_SEC_STATUS	0x16	/* Secondary status */
 #define PCI_CB_PRIMARY_BUS	0x18	/* PCI bus number */
 #define PCI_CB_CARD_BUS		0x19	/* CardBus bus number */
diff --git a/ls-caps.c b/ls-caps.c
index 0f6fab3..bddb455 100644
--- a/ls-caps.c
+++ b/ls-caps.c
@@ -1242,13 +1242,13 @@ cap_sata_hba(struct device *d, int where, int cap)
 }
 
 void
-show_caps(struct device *d)
+show_caps(struct device *d, int where)
 {
   int can_have_ext_caps = 0;
 
   if (get_conf_word(d, PCI_STATUS) & PCI_STATUS_CAP_LIST)
     {
-      int where = get_conf_byte(d, PCI_CAPABILITY_LIST) & ~3;
+      where = get_conf_byte(d, where) & ~3;
       byte been_there[256];
       memset(been_there, 0, 256);
       while (where)
diff --git a/lspci.c b/lspci.c
index bd81014..dbba678 100644
--- a/lspci.c
+++ b/lspci.c
@@ -461,7 +461,7 @@ show_htype0(struct device *d)
 {
   show_bases(d, 6);
   show_rom(d, PCI_ROM_ADDRESS);
-  show_caps(d);
+  show_caps(d, PCI_CAPABILITY_LIST);
 }
 
 static void
@@ -567,7 +567,7 @@ show_htype1(struct device *d)
 	FLAG(brc, PCI_BRIDGE_CTL_DISCARD_TIMER_SERR_EN));
     }
 
-  show_caps(d);
+  show_caps(d, PCI_CAPABILITY_LIST);
 }
 
 static void
@@ -635,6 +635,7 @@ show_htype2(struct device *d)
   exca = get_conf_word(d, PCI_CB_LEGACY_MODE_BASE);
   if (exca)
     printf("\t16-bit legacy interface ports at %04x\n", exca);
+  show_caps(d, PCI_CB_CAPABILITY_LIST);
 }
 
 static void
diff --git a/lspci.h b/lspci.h
index 81aca26..86429b2 100644
--- a/lspci.h
+++ b/lspci.h
@@ -64,7 +64,7 @@ void cap_vpd(struct device *d);
 
 /* ls-caps.c */
 
-void show_caps(struct device *d);
+void show_caps(struct device *d, int where);
 
 /* ls-ecaps.c */
 
-- 
1.8.1.5