summaryrefslogtreecommitdiffstats
path: root/sys/sys/pciio.h
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2020-06-22 04:11:37 +0000
committerdlg <dlg@openbsd.org>2020-06-22 04:11:37 +0000
commit530b71a3fb371d37e6c1a05f23641d53e9bf7478 (patch)
treece941ca1cd0c1ba67f6e8b82435d0043f0eda1a6 /sys/sys/pciio.h
parentdeprecate network livelock detection using the softclock. (diff)
downloadwireguard-openbsd-530b71a3fb371d37e6c1a05f23641d53e9bf7478.tar.xz
wireguard-openbsd-530b71a3fb371d37e6c1a05f23641d53e9bf7478.zip
let userland read vpd info from a pci device.
reading vpd stuff is useful when you're trying to get support information about a pci device, eg, if you want a serial number, or firmware versions, or specific part name or number, it's likely available via vpd. also, im sick of having the diff in my tree. the vpd info is not accessed as bytes read from a capability, but is read via a register in the capability. the same register also supports updating or writing vpd info, which sounds like a bad idea to let userland have raw access to. this adds an ioctl so that userland can ask the kernel to read via the vpd register on its behalf. this ensures that the only access is read access, and it's sanity checked. tested by hrvoje popovski on many devices. ok jmatthew@
Diffstat (limited to 'sys/sys/pciio.h')
-rw-r--r--sys/sys/pciio.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/sys/pciio.h b/sys/sys/pciio.h
index 713e798e02f..394dd083dd9 100644
--- a/sys/sys/pciio.h
+++ b/sys/sys/pciio.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pciio.h,v 1.7 2010/09/05 18:14:33 kettenis Exp $ */
+/* $OpenBSD: pciio.h,v 1.8 2020/06/22 04:11:37 dlg Exp $ */
/*-
* Copyright (c) 1997, Stefan Esser <se@FreeBSD.ORG>
@@ -54,6 +54,13 @@ struct pci_rom {
char *pr_rom;
};
+struct pci_vpd_req {
+ struct pcisel pv_sel;
+ int pv_offset;
+ int pv_count;
+ uint32_t *pv_data;
+};
+
struct pci_vga {
struct pcisel pv_sel;
int pv_lock;
@@ -74,5 +81,6 @@ struct pci_vga {
#define PCIOCGETVGA _IOWR('p', 6, struct pci_vga)
#define PCIOCSETVGA _IOWR('p', 7, struct pci_vga)
#define PCIOCREADMASK _IOWR('p', 8, struct pci_io)
+#define PCIOCGETVPD _IOWR('p', 9, struct pci_vpd_req)
#endif /* !_SYS_PCIIO_H_ */