Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/pciconf/cap.c
Context not available. | |||||
#ifndef lint | #ifndef lint | ||||
static const char rcsid[] = | static const char rcsid[] = | ||||
"$FreeBSD$"; | "$FreeBSD: head/usr.sbin/pciconf/cap.c 290412 2015-11-05 20:24:56Z jhb $"; | ||||
#endif /* not lint */ | #endif /* not lint */ | ||||
#include <sys/types.h> | #include <sys/types.h> | ||||
#include <err.h> | #include <err.h> | ||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <strings.h> | |||||
#include <sys/agpio.h> | #include <sys/agpio.h> | ||||
#include <sys/pciio.h> | #include <sys/pciio.h> | ||||
Context not available. | |||||
printf(" %d fatal", bitcount32(sta & mask)); | printf(" %d fatal", bitcount32(sta & mask)); | ||||
printf(" %d non-fatal", bitcount32(sta & ~mask)); | printf(" %d non-fatal", bitcount32(sta & ~mask)); | ||||
sta = read_config(fd, &p->pc_sel, ptr + PCIR_AER_COR_STATUS, 4); | sta = read_config(fd, &p->pc_sel, ptr + PCIR_AER_COR_STATUS, 4); | ||||
printf(" %d corrected", bitcount32(sta)); | printf(" %d corrected\n", bitcount32(sta)); | ||||
} | } | ||||
static void | static void | ||||
Context not available. | |||||
if ((cap1 & PCIM_VC_CAP1_LOWPRI_EXT_COUNT) != 0) | if ((cap1 & PCIM_VC_CAP1_LOWPRI_EXT_COUNT) != 0) | ||||
printf(" lowpri VC0-VC%d", | printf(" lowpri VC0-VC%d", | ||||
(cap1 & PCIM_VC_CAP1_LOWPRI_EXT_COUNT) >> 4); | (cap1 & PCIM_VC_CAP1_LOWPRI_EXT_COUNT) >> 4); | ||||
printf("\n"); | |||||
} | } | ||||
static void | static void | ||||
Context not available. | |||||
return; | return; | ||||
low = read_config(fd, &p->pc_sel, ptr + PCIR_SERIAL_LOW, 4); | low = read_config(fd, &p->pc_sel, ptr + PCIR_SERIAL_LOW, 4); | ||||
high = read_config(fd, &p->pc_sel, ptr + PCIR_SERIAL_HIGH, 4); | high = read_config(fd, &p->pc_sel, ptr + PCIR_SERIAL_HIGH, 4); | ||||
printf(" %08x%08x", high, low); | printf(" %08x%08x\n", high, low); | ||||
} | } | ||||
static void | static void | ||||
Context not available. | |||||
if (ver < 1) | if (ver < 1) | ||||
return; | return; | ||||
val = read_config(fd, &p->pc_sel, ptr + 4, 4); | val = read_config(fd, &p->pc_sel, ptr + 4, 4); | ||||
printf(" ID %d", val & 0xffff); | printf(" ID %d\n", val & 0xffff); | ||||
} | } | ||||
static void | static void | ||||
Context not available. | |||||
if (ver < 1) | if (ver < 1) | ||||
return; | return; | ||||
val = read_config(fd, &p->pc_sel, ptr + 8, 4); | val = read_config(fd, &p->pc_sel, ptr + 8, 4); | ||||
printf(" lane errors %#x", val); | printf(" lane errors %#x\n", val); | ||||
} | |||||
static const char * | |||||
check_enabled(int value) | |||||
{ | |||||
return (value ? "enabled" : "disabled"); | |||||
} | |||||
static void | |||||
ecap_sriov(int fd, struct pci_conf *p, uint16_t ptr, uint8_t ver) | |||||
{ | |||||
const char *comma, *enabled; | |||||
uint16_t iov_ctl, total_vfs, num_vfs, vf_offset, vf_stride, vf_did; | |||||
uint32_t page_caps, page_size, page_shift, size; | |||||
int i; | |||||
printf("SR-IOV %d ", ver); | |||||
iov_ctl = read_config(fd, &p->pc_sel, ptr + PCIR_SRIOV_CTL, 2); | |||||
printf("IOV %s, Memory Space %s, ARI %s\n", | |||||
check_enabled(iov_ctl & PCIM_SRIOV_VF_EN), | |||||
check_enabled(iov_ctl & PCIM_SRIOV_VF_MSE), | |||||
check_enabled(iov_ctl & PCIM_SRIOV_ARI_EN)); | |||||
total_vfs = read_config(fd, &p->pc_sel, ptr + PCIR_SRIOV_TOTAL_VFS, 2); | |||||
num_vfs = read_config(fd, &p->pc_sel, ptr + PCIR_SRIOV_NUM_VFS, 2); | |||||
printf(" "); | |||||
printf("%d VFs configured out of %d supported\n", num_vfs, total_vfs); | |||||
vf_offset = read_config(fd, &p->pc_sel, ptr + PCIR_SRIOV_VF_OFF, 2); | |||||
vf_stride = read_config(fd, &p->pc_sel, ptr + PCIR_SRIOV_VF_STRIDE, 2); | |||||
printf(" "); | |||||
printf("First VF RID Offset 0x%04x, VF RID Stride 0x%04x\n", vf_offset, | |||||
vf_stride); | |||||
vf_did = read_config(fd, &p->pc_sel, ptr + PCIR_SRIOV_VF_DID, 2); | |||||
printf(" VF Device ID 0x%04x\n", vf_did); | |||||
page_caps = read_config(fd, &p->pc_sel, ptr + PCIR_SRIOV_PAGE_CAP, 4); | |||||
page_size = read_config(fd, &p->pc_sel, ptr + PCIR_SRIOV_PAGE_SIZE, 4); | |||||
printf(" "); | |||||
printf("Page Sizes: "); | |||||
comma = ""; | |||||
while (page_caps != 0) { | |||||
page_shift = ffs(page_caps) - 1; | |||||
if (page_caps & page_size) | |||||
enabled = " (enabled)"; | |||||
else | |||||
enabled = ""; | |||||
size = (1 << (page_shift + PCI_SRIOV_BASE_PAGE_SHIFT)); | |||||
printf("%s%d%s", comma, size, enabled); | |||||
comma = ", "; | |||||
page_caps &= ~(1 << page_shift); | |||||
} | |||||
printf("\n"); | |||||
for (i = 0; i <= PCIR_MAX_BAR_0; i++) | |||||
print_bar(fd, p, "iov bar ", ptr + PCIR_SRIOV_BAR(i)); | |||||
} | } | ||||
struct { | struct { | ||||
Context not available. | |||||
{ PCIZ_ACS, "ACS" }, | { PCIZ_ACS, "ACS" }, | ||||
{ PCIZ_ARI, "ARI" }, | { PCIZ_ARI, "ARI" }, | ||||
{ PCIZ_ATS, "ATS" }, | { PCIZ_ATS, "ATS" }, | ||||
{ PCIZ_SRIOV, "SRIOV" }, | |||||
{ PCIZ_MULTICAST, "Multicast" }, | { PCIZ_MULTICAST, "Multicast" }, | ||||
{ PCIZ_RESIZE_BAR, "Resizable BAR" }, | { PCIZ_RESIZE_BAR, "Resizable BAR" }, | ||||
{ PCIZ_DPA, "DPA" }, | { PCIZ_DPA, "DPA" }, | ||||
Context not available. | |||||
case PCIZ_SEC_PCIE: | case PCIZ_SEC_PCIE: | ||||
ecap_sec_pcie(fd, p, ptr, PCI_EXTCAP_VER(ecap)); | ecap_sec_pcie(fd, p, ptr, PCI_EXTCAP_VER(ecap)); | ||||
break; | break; | ||||
case PCIZ_SRIOV: | |||||
ecap_sriov(fd, p, ptr, PCI_EXTCAP_VER(ecap)); | |||||
break; | |||||
default: | default: | ||||
name = "unknown"; | name = "unknown"; | ||||
for (i = 0; ecap_names[i].name != NULL; i++) | for (i = 0; ecap_names[i].name != NULL; i++) | ||||
Context not available. | |||||
name = ecap_names[i].name; | name = ecap_names[i].name; | ||||
break; | break; | ||||
} | } | ||||
printf("%s %d", name, PCI_EXTCAP_VER(ecap)); | printf("%s %d\n", name, PCI_EXTCAP_VER(ecap)); | ||||
break; | break; | ||||
} | } | ||||
printf("\n"); | |||||
ptr = PCI_EXTCAP_NEXTPTR(ecap); | ptr = PCI_EXTCAP_NEXTPTR(ecap); | ||||
if (ptr == 0) | if (ptr == 0) | ||||
break; | break; | ||||
Context not available. |