Re: Teach pcidump(8) about another capability
ok On 12/01/2011, at 8:44 AM, Mark Kettenis wrote: Capability 0x12 is called SATA. I have a diff to add PCI_CAP_SATA to pcireg.h, but given the fact that we're in ABI lock, that'll have to wait. But it is anyhow better to use the number of elements in the array to decide whether we know about a capability or not. ok? Index: pcidump.c === RCS file: /cvs/src/usr.sbin/pcidump/pcidump.c,v retrieving revision 1.26 diff -u -p -r1.26 pcidump.c --- pcidump.c 19 Dec 2010 23:23:21 - 1.26 +++ pcidump.c 11 Jan 2011 22:41:28 - @@ -35,6 +35,10 @@ #define PCIDEV/dev/pci +#ifndef nitems +#define nitems(_a) (sizeof((_a)) / sizeof((_a)[0])) +#endif + __dead void usage(void); void scanpcidomain(void); int probe(int, int, int); @@ -86,9 +90,9 @@ const char *pci_capnames[] = { AGP8, Secure, PCI Express, - Extended Message Signaled Interrupts (MSI-X) + Extended Message Signaled Interrupts (MSI-X), + SATA }; -#define PCI_CAPNAMES_MAX PCI_CAP_MSIX int main(int argc, char *argv[]) @@ -337,7 +341,7 @@ dump_caplist(int bus, int dev, int func, return; cap = PCI_CAPLIST_CAP(reg); printf(\t0x%04x: Capability 0x%02x: , ptr, cap); - if (cap PCI_CAPNAMES_MAX) + if (cap nitems(pci_capnames)) cap = 0; printf(%s\n, pci_capnames[cap]); if (cap == PCI_CAP_PCIEXPRESS)
Re: Teach pcidump(8) about another capability
ok, but you should add 0x13 Advanced Features as well: http://www.pcisig.com/specifications/conventional/pci_30/ECN_Conventional_Adv_Caps_27Jul06.pdf On Tue, Jan 11, 2011 at 11:44:54PM +0100, Mark Kettenis wrote: Capability 0x12 is called SATA. I have a diff to add PCI_CAP_SATA to pcireg.h, but given the fact that we're in ABI lock, that'll have to wait. But it is anyhow better to use the number of elements in the array to decide whether we know about a capability or not. ok? Index: pcidump.c === RCS file: /cvs/src/usr.sbin/pcidump/pcidump.c,v retrieving revision 1.26 diff -u -p -r1.26 pcidump.c --- pcidump.c 19 Dec 2010 23:23:21 - 1.26 +++ pcidump.c 11 Jan 2011 22:41:28 - @@ -35,6 +35,10 @@ #define PCIDEV /dev/pci +#ifndef nitems +#define nitems(_a) (sizeof((_a)) / sizeof((_a)[0])) +#endif + __dead void usage(void); void scanpcidomain(void); int probe(int, int, int); @@ -86,9 +90,9 @@ const char *pci_capnames[] = { AGP8, Secure, PCI Express, - Extended Message Signaled Interrupts (MSI-X) + Extended Message Signaled Interrupts (MSI-X), + SATA }; -#define PCI_CAPNAMES_MAX PCI_CAP_MSIX int main(int argc, char *argv[]) @@ -337,7 +341,7 @@ dump_caplist(int bus, int dev, int func, return; cap = PCI_CAPLIST_CAP(reg); printf(\t0x%04x: Capability 0x%02x: , ptr, cap); - if (cap PCI_CAPNAMES_MAX) + if (cap nitems(pci_capnames)) cap = 0; printf(%s\n, pci_capnames[cap]); if (cap == PCI_CAP_PCIEXPRESS)
Re: Teach pcidump(8) about another capability
Date: Thu, 13 Jan 2011 03:10:58 +1100 From: Jonathan Gray j...@goblin.cx ok, but you should add 0x13 Advanced Features as well: http://www.pcisig.com/specifications/conventional/pci_30/ECN_Conventional_Adv_Caps_27Jul06.pdf Never seen that one. What a horrible name. Feel free to add it if you think there's hardware out there that implements it.
Teach pcidump(8) about another capability
Capability 0x12 is called SATA. I have a diff to add PCI_CAP_SATA to pcireg.h, but given the fact that we're in ABI lock, that'll have to wait. But it is anyhow better to use the number of elements in the array to decide whether we know about a capability or not. ok? Index: pcidump.c === RCS file: /cvs/src/usr.sbin/pcidump/pcidump.c,v retrieving revision 1.26 diff -u -p -r1.26 pcidump.c --- pcidump.c 19 Dec 2010 23:23:21 - 1.26 +++ pcidump.c 11 Jan 2011 22:41:28 - @@ -35,6 +35,10 @@ #define PCIDEV /dev/pci +#ifndef nitems +#define nitems(_a) (sizeof((_a)) / sizeof((_a)[0])) +#endif + __dead void usage(void); void scanpcidomain(void); int probe(int, int, int); @@ -86,9 +90,9 @@ const char *pci_capnames[] = { AGP8, Secure, PCI Express, - Extended Message Signaled Interrupts (MSI-X) + Extended Message Signaled Interrupts (MSI-X), + SATA }; -#define PCI_CAPNAMES_MAX PCI_CAP_MSIX int main(int argc, char *argv[]) @@ -337,7 +341,7 @@ dump_caplist(int bus, int dev, int func, return; cap = PCI_CAPLIST_CAP(reg); printf(\t0x%04x: Capability 0x%02x: , ptr, cap); - if (cap PCI_CAPNAMES_MAX) + if (cap nitems(pci_capnames)) cap = 0; printf(%s\n, pci_capnames[cap]); if (cap == PCI_CAP_PCIEXPRESS)
Re: Teach pcidump(8) about another capability
On Tue, Jan 11, 2011 at 11:44:54PM +0100, Mark Kettenis wrote: Capability 0x12 is called SATA. I have a diff to add PCI_CAP_SATA to pcireg.h, but given the fact that we're in ABI lock, that'll have to wait. But it is anyhow better to use the number of elements in the array to decide whether we know about a capability or not. ok? Index: pcidump.c === RCS file: /cvs/src/usr.sbin/pcidump/pcidump.c,v retrieving revision 1.26 diff -u -p -r1.26 pcidump.c --- pcidump.c 19 Dec 2010 23:23:21 - 1.26 +++ pcidump.c 11 Jan 2011 22:41:28 - @@ -35,6 +35,10 @@ #define PCIDEV /dev/pci +#ifndef nitems +#define nitems(_a) (sizeof((_a)) / sizeof((_a)[0])) +#endif + __dead void usage(void); void scanpcidomain(void); int probe(int, int, int); @@ -86,9 +90,9 @@ const char *pci_capnames[] = { AGP8, Secure, PCI Express, - Extended Message Signaled Interrupts (MSI-X) + Extended Message Signaled Interrupts (MSI-X), + SATA }; -#define PCI_CAPNAMES_MAX PCI_CAP_MSIX int main(int argc, char *argv[]) @@ -337,7 +341,7 @@ dump_caplist(int bus, int dev, int func, return; cap = PCI_CAPLIST_CAP(reg); printf(\t0x%04x: Capability 0x%02x: , ptr, cap); - if (cap PCI_CAPNAMES_MAX) + if (cap nitems(pci_capnames)) cap = 0; printf(%s\n, pci_capnames[cap]); if (cap == PCI_CAP_PCIEXPRESS) Seems reasonable to me. I can't see a downside. Ken