decode sata capability Reference: /n/atom/patch/applied/pcisatacap Date: Sat Jan 4 00:25:57 CET 2014 Signed-off-by: quanstro@quanstro.net --- /sys/src/cmd/pci/pci.c Sat Jan 4 00:25:50 2014 +++ /sys/src/cmd/pci/pci.c Sat Jan 4 00:25:51 2014 @@ -120,6 +120,23 @@ Bprint(&o, "\t\t" "pba: offset %.8ux; bar %d\n", u&~7, u&7); } +void +satadump(Pcidev *p, int off) +{ + char buf[32]; + u32int u; + + Bprint(&o, "\t" "sata\n"); + u = pcicfgr16(p, off + 2); + Bprint(&o, "\t\t" "version: %d.%d\n", u>>4 & 0xf, u&0xf); + u = pcicfgr32(p, off + 4); + if((u & 0xf) == 0xf) + snprint(buf, sizeof buf, "pci cfg space"); + else + snprint(buf, sizeof buf, "bar %d", u>>2 & ~3); + Bprint(&o, "\t\t" "bar: offset %.8ux; %s\n", u&~0xf, buf); +} + typedef struct Captab Captab; struct Captab { int id; @@ -145,7 +162,7 @@ 0x0f, "secure", nil, 0x10, "pcie", pciedump, 0x11, "msi-x", msixdump, -0x12, "satad/i", nil, +0x12, "satad/i", satadump, 0x13, "advfeat", nil, };