-
Notifications
You must be signed in to change notification settings - Fork 0
/
IOACPIPlatformExpert.cpp
164 lines (143 loc) · 6.32 KB
/
IOACPIPlatformExpert.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/*
* Copyright (c) 2003-2005 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* The contents of this file constitute Original Code as defined in and
* are subject to the Apple Public Source License Version 1.1 (the
* "License"). You may not use this file except in compliance with the
* License. Please obtain a copy of the License at
* http://www.apple.com/publicsource and read it before using this file.
*
* This Original Code and all software distributed under the License are
* distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
* License for the specific language governing rights and limitations
* under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
#include <IOKit/acpi/IOACPIPlatformExpert.h>
const IORegistryPlane * gIOACPIPlane = 0;
const OSSymbol * gIOACPIHardwareIDKey = 0;
const OSSymbol * gIOACPIUniqueIDKey = 0;
const OSSymbol * gIOACPIAddressKey = 0;
const OSSymbol * gIOACPIDeviceStatusKey = 0;
class IOACPIPlatformExpertGlobals
{
public:
IOACPIPlatformExpertGlobals();
~IOACPIPlatformExpertGlobals();
inline bool isValid() const;
};
static IOACPIPlatformExpertGlobals gIOACPIPlatformExpertGlobals;
IOACPIPlatformExpertGlobals::IOACPIPlatformExpertGlobals()
{
gIOACPIPlane = IORegistryEntry::makePlane("IOACPIPlane");
gIOACPIHardwareIDKey = OSSymbol::withCString("_HID");
gIOACPIUniqueIDKey = OSSymbol::withCString("_UID");
gIOACPIAddressKey = OSSymbol::withCString("_ADR");
gIOACPIDeviceStatusKey = OSSymbol::withCString("_STA");
}
IOACPIPlatformExpertGlobals::~IOACPIPlatformExpertGlobals()
{
if (gIOACPIHardwareIDKey) gIOACPIHardwareIDKey->release();
if (gIOACPIUniqueIDKey) gIOACPIUniqueIDKey->release();
if (gIOACPIAddressKey) gIOACPIAddressKey->release();
if (gIOACPIDeviceStatusKey) gIOACPIDeviceStatusKey->release();
}
bool IOACPIPlatformExpertGlobals::isValid() const
{
return ( gIOACPIPlane &&
gIOACPIHardwareIDKey &&
gIOACPIUniqueIDKey &&
gIOACPIAddressKey &&
gIOACPIDeviceStatusKey );
}
//---------------------------------------------------------------------------
#define super IODTPlatformExpert
OSDefineMetaClassAndAbstractStructors( IOACPIPlatformExpert,
IODTPlatformExpert )
OSMetaClassDefineReservedUnused( IOACPIPlatformExpert, 0 );
OSMetaClassDefineReservedUnused( IOACPIPlatformExpert, 1 );
OSMetaClassDefineReservedUnused( IOACPIPlatformExpert, 2 );
OSMetaClassDefineReservedUnused( IOACPIPlatformExpert, 3 );
OSMetaClassDefineReservedUnused( IOACPIPlatformExpert, 4 );
OSMetaClassDefineReservedUnused( IOACPIPlatformExpert, 5 );
OSMetaClassDefineReservedUnused( IOACPIPlatformExpert, 6 );
OSMetaClassDefineReservedUnused( IOACPIPlatformExpert, 7 );
OSMetaClassDefineReservedUnused( IOACPIPlatformExpert, 8 );
OSMetaClassDefineReservedUnused( IOACPIPlatformExpert, 9 );
OSMetaClassDefineReservedUnused( IOACPIPlatformExpert, 10 );
OSMetaClassDefineReservedUnused( IOACPIPlatformExpert, 11 );
OSMetaClassDefineReservedUnused( IOACPIPlatformExpert, 12 );
OSMetaClassDefineReservedUnused( IOACPIPlatformExpert, 13 );
OSMetaClassDefineReservedUnused( IOACPIPlatformExpert, 14 );
OSMetaClassDefineReservedUnused( IOACPIPlatformExpert, 15 );
OSMetaClassDefineReservedUnused( IOACPIPlatformExpert, 16 );
OSMetaClassDefineReservedUnused( IOACPIPlatformExpert, 17 );
OSMetaClassDefineReservedUnused( IOACPIPlatformExpert, 18 );
OSMetaClassDefineReservedUnused( IOACPIPlatformExpert, 19 );
OSMetaClassDefineReservedUnused( IOACPIPlatformExpert, 20 );
OSMetaClassDefineReservedUnused( IOACPIPlatformExpert, 21 );
OSMetaClassDefineReservedUnused( IOACPIPlatformExpert, 22 );
OSMetaClassDefineReservedUnused( IOACPIPlatformExpert, 23 );
OSMetaClassDefineReservedUnused( IOACPIPlatformExpert, 24 );
OSMetaClassDefineReservedUnused( IOACPIPlatformExpert, 25 );
OSMetaClassDefineReservedUnused( IOACPIPlatformExpert, 26 );
OSMetaClassDefineReservedUnused( IOACPIPlatformExpert, 27 );
OSMetaClassDefineReservedUnused( IOACPIPlatformExpert, 28 );
OSMetaClassDefineReservedUnused( IOACPIPlatformExpert, 29 );
OSMetaClassDefineReservedUnused( IOACPIPlatformExpert, 30 );
OSMetaClassDefineReservedUnused( IOACPIPlatformExpert, 31 );
//---------------------------------------------------------------------------
bool IOACPIPlatformExpert::start( IOService * provider )
{
if ( super::start(provider) == false )
return false;
if ( gIOACPIPlatformExpertGlobals.isValid() == false )
return false;
//
// Useless test to work around 3261751. This expands the alignment
// of (__cstring, __TEXT) from 1 to 32 byte aligned.
//
if ( gIOACPIPlane == 0 )
{
IOLog("IOACPIPlatformExpert::start <<<< gIOACPIPlane == 0 >>>>\n");
}
return true;
}
//---------------------------------------------------------------------------
IOReturn IOACPIPlatformExpert::validateObject(
IOACPIPlatformDevice * device,
const char * objectName )
{
IOReturn ret = kIOReturnNotFound;
const OSSymbol * sym = OSSymbol::withCString(objectName);
if ( sym )
{
ret = validateObject( device, sym );
sym->release();
}
return ret;
}
//---------------------------------------------------------------------------
IOReturn IOACPIPlatformExpert::evaluateObject(
IOACPIPlatformDevice * device,
const char * objectName,
OSObject ** result,
OSObject * params[],
IOItemCount paramCount,
IOOptionBits options )
{
IOReturn ret = kIOReturnNoMemory;
const OSSymbol * sym = OSSymbol::withCStringNoCopy(objectName);
if ( sym )
{
ret = evaluateObject( device, sym, result, params, paramCount, options );
sym->release();
}
return ret;
}