pciio.h 2.6 KB

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