1 /* $OpenBSD: pciio.h,v 1.8 2020/06/22 04:11:37 dlg Exp $ */ 2 3 /*- 4 * Copyright (c) 1997, Stefan Esser <se@FreeBSD.ORG> 5 * Copyright (c) 1997, 1998, 1999, Kenneth D. Merry <ken@FreeBSD.ORG> 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice unmodified, this list of conditions, and the following 13 * disclaimer. 14 * 2. Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * 29 * $FreeBSD: src/sys/sys/pciio.h,v 1.5 1999/12/08 17:44:04 ken Exp $ 30 * 31 */ 32 33 #ifndef _SYS_PCIIO_H_ 34 #define _SYS_PCIIO_H_ 35 36 #include <sys/ioccom.h> 37 38 struct pcisel { 39 u_int8_t pc_bus; /* bus number */ 40 u_int8_t pc_dev; /* device on this bus */ 41 u_int8_t pc_func; /* function on this device */ 42 }; 43 44 struct pci_io { 45 struct pcisel pi_sel; /* device to operate on */ 46 int pi_reg; /* configuration register to examine */ 47 int pi_width; /* width (in bytes) of read or write */ 48 u_int32_t pi_data; /* data to write or result of read */ 49 }; 50 51 struct pci_rom { 52 struct pcisel pr_sel; 53 int pr_romlen; 54 char *pr_rom; 55 }; 56 57 struct pci_vpd_req { 58 struct pcisel pv_sel; 59 int pv_offset; 60 int pv_count; 61 uint32_t *pv_data; 62 }; 63 64 struct pci_vga { 65 struct pcisel pv_sel; 66 int pv_lock; 67 int pv_decode; 68 }; 69 70 #define PCI_VGA_UNLOCK 0x00 71 #define PCI_VGA_LOCK 0x01 72 #define PCI_VGA_TRYLOCK 0x02 73 74 #define PCI_VGA_IO_ENABLE 0x01 75 #define PCI_VGA_MEM_ENABLE 0x02 76 77 #define PCIOCREAD _IOWR('p', 2, struct pci_io) 78 #define PCIOCWRITE _IOWR('p', 3, struct pci_io) 79 #define PCIOCGETROMLEN _IOWR('p', 4, struct pci_rom) 80 #define PCIOCGETROM _IOWR('p', 5, struct pci_rom) 81 #define PCIOCGETVGA _IOWR('p', 6, struct pci_vga) 82 #define PCIOCSETVGA _IOWR('p', 7, struct pci_vga) 83 #define PCIOCREADMASK _IOWR('p', 8, struct pci_io) 84 #define PCIOCGETVPD _IOWR('p', 9, struct pci_vpd_req) 85 86 #endif /* !_SYS_PCIIO_H_ */ 87