Fixed Issue 86.
1 //-----------------------------------------------------------------------------
3 // Mail : hiyohiyo@crystalmark.info
4 // Web : http://openlibsys.org/
5 // License : The modified BSD license
7 // Copyright 2007-2008 OpenLibSys.org. All rights reserved.
8 //-----------------------------------------------------------------------------
12 //-----------------------------------------------------------------------------
14 // The Device type codes form 32768 to 65535 are for customer use.
16 //-----------------------------------------------------------------------------
18 #define OLS_TYPE 40000
20 //-----------------------------------------------------------------------------
22 // Version Information
24 //-----------------------------------------------------------------------------
26 #define OLS_DRIVER_ID _T("WinRing0_1_2_0")
28 #define OLS_DRIVER_MAJOR_VERSION 1
29 #define OLS_DRIVER_MINOR_VERSION 2
30 #define OLS_DRIVER_REVISION 0
31 #define OLS_DRIVER_RELESE 5
33 #define OLS_DRIVER_VERSION \
34 ((OLS_DRIVER_MAJOR_VERSION << 24) | (OLS_DRIVER_MINOR_VERSION << 16) \
35 | (OLS_DRIVER_REVISION << 8) | OLS_DRIVER_RELESE)
37 //-----------------------------------------------------------------------------
39 // The IOCTL function codes from 0x800 to 0xFFF are for customer use.
41 //-----------------------------------------------------------------------------
42 #define IOCTL_OLS_GET_DRIVER_VERSION \
43 CTL_CODE(OLS_TYPE, 0x800, METHOD_BUFFERED, FILE_ANY_ACCESS)
45 #define IOCTL_OLS_GET_REFCOUNT \
46 CTL_CODE(OLS_TYPE, 0x801, METHOD_BUFFERED, FILE_ANY_ACCESS)
48 #define IOCTL_OLS_READ_MSR \
49 CTL_CODE(OLS_TYPE, 0x821, METHOD_BUFFERED, FILE_ANY_ACCESS)
51 #define IOCTL_OLS_WRITE_MSR \
52 CTL_CODE(OLS_TYPE, 0x822, METHOD_BUFFERED, FILE_ANY_ACCESS)
54 #define IOCTL_OLS_READ_PMC \
55 CTL_CODE(OLS_TYPE, 0x823, METHOD_BUFFERED, FILE_ANY_ACCESS)
57 #define IOCTL_OLS_HALT \
58 CTL_CODE(OLS_TYPE, 0x824, METHOD_BUFFERED, FILE_ANY_ACCESS)
60 #define IOCTL_OLS_READ_IO_PORT \
61 CTL_CODE(OLS_TYPE, 0x831, METHOD_BUFFERED, FILE_READ_ACCESS)
63 #define IOCTL_OLS_WRITE_IO_PORT \
64 CTL_CODE(OLS_TYPE, 0x832, METHOD_BUFFERED, FILE_WRITE_ACCESS)
66 #define IOCTL_OLS_READ_IO_PORT_BYTE \
67 CTL_CODE(OLS_TYPE, 0x833, METHOD_BUFFERED, FILE_READ_ACCESS)
69 #define IOCTL_OLS_READ_IO_PORT_WORD \
70 CTL_CODE(OLS_TYPE, 0x834, METHOD_BUFFERED, FILE_READ_ACCESS)
72 #define IOCTL_OLS_READ_IO_PORT_DWORD \
73 CTL_CODE(OLS_TYPE, 0x835, METHOD_BUFFERED, FILE_READ_ACCESS)
75 #define IOCTL_OLS_WRITE_IO_PORT_BYTE \
76 CTL_CODE(OLS_TYPE, 0x836, METHOD_BUFFERED, FILE_WRITE_ACCESS)
78 #define IOCTL_OLS_WRITE_IO_PORT_WORD \
79 CTL_CODE(OLS_TYPE, 0x837, METHOD_BUFFERED, FILE_WRITE_ACCESS)
81 #define IOCTL_OLS_WRITE_IO_PORT_DWORD \
82 CTL_CODE(OLS_TYPE, 0x838, METHOD_BUFFERED, FILE_WRITE_ACCESS)
84 #define IOCTL_OLS_READ_MEMORY \
85 CTL_CODE(OLS_TYPE, 0x841, METHOD_BUFFERED, FILE_READ_ACCESS)
87 #define IOCTL_OLS_WRITE_MEMORY \
88 CTL_CODE(OLS_TYPE, 0x842, METHOD_BUFFERED, FILE_WRITE_ACCESS)
90 #define IOCTL_OLS_READ_PCI_CONFIG \
91 CTL_CODE(OLS_TYPE, 0x851, METHOD_BUFFERED, FILE_READ_ACCESS)
93 #define IOCTL_OLS_WRITE_PCI_CONFIG \
94 CTL_CODE(OLS_TYPE, 0x852, METHOD_BUFFERED, FILE_WRITE_ACCESS)
96 //-----------------------------------------------------------------------------
100 //-----------------------------------------------------------------------------
102 #define OLS_ERROR_PCI_BUS_NOT_EXIST (0xE0000001L)
103 #define OLS_ERROR_PCI_NO_DEVICE (0xE0000002L)
104 #define OLS_ERROR_PCI_WRITE_CONFIG (0xE0000003L)
105 #define OLS_ERROR_PCI_READ_CONFIG (0xE0000004L)
107 //-----------------------------------------------------------------------------
111 //-----------------------------------------------------------------------------
113 // Bus Number, Device Number and Function Number to PCI Device Address
114 #define PciBusDevFunc(Bus, Dev, Func) ((Bus&0xFF)<<8) | ((Dev&0x1F)<<3) | (Func&7)
115 // PCI Device Address to Bus Number
116 #define PciGetBus(address) ((address>>8) & 0xFF)
117 // PCI Device Address to Device Number
118 #define PciGetDev(address) ((address>>3) & 0x1F)
119 // PCI Device Address to Function Number
120 #define PciGetFunc(address) (address&7)
122 //-----------------------------------------------------------------------------
126 //-----------------------------------------------------------------------------
130 typedef struct _OLS_WRITE_MSR_INPUT {
132 ULARGE_INTEGER Value;
133 } OLS_WRITE_MSR_INPUT;
135 typedef struct _OLS_WRITE_IO_PORT_INPUT {
142 } OLS_WRITE_IO_PORT_INPUT;
144 typedef struct _OLS_READ_PCI_CONFIG_INPUT {
147 } OLS_READ_PCI_CONFIG_INPUT;
149 typedef struct _OLS_WRITE_PCI_CONFIG_INPUT {
153 } OLS_WRITE_PCI_CONFIG_INPUT;
155 typedef LARGE_INTEGER PHYSICAL_ADDRESS;
157 typedef struct _OLS_READ_MEMORY_INPUT {
158 PHYSICAL_ADDRESS Address;
161 } OLS_READ_MEMORY_INPUT;
163 typedef struct _OLS_WRITE_MEMORY_INPUT {
164 PHYSICAL_ADDRESS Address;
168 } OLS_WRITE_MEMORY_INPUT;