Chameleon

Chameleon Svn Source Tree

Root/tags/2.0/i386/include/IOKit/IONVRAM.h

Source at commit 1808 created 12 years 4 months ago.
By blackosx, Revise layout of package installer 'Welcome' file so it looks cleaner. Change the copyright notice to begin from 2009 as seen in the Chameleon 2.0 r431 installer. Should this date be set earlier?
1/*
2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28
29#ifndef _IOKIT_IONVRAM_H
30#define _IOKIT_IONVRAM_H
31
32#include <IOKit/IOKitKeys.h>
33#include <IOKit/IOService.h>
34#include <IOKit/IODeviceTreeSupport.h>
35#include <IOKit/nvram/IONVRAMController.h>
36
37
38#define kIODTNVRAMOFPartitionName "common"
39#define kIODTNVRAMXPRAMPartitionName "APL,MacOS75"
40#define kIODTNVRAMPanicInfoPartitonName "APL,OSXPanic"
41#define kIODTNVRAMFreePartitionName "wwwwwwwwwwww"
42
43enum {
44 kIODTNVRAMImageSize = 0x2000,
45 kIODTNVRAMXPRAMSize = 0x0100,
46 kIODTNVRAMNameRegistrySize = 0x0400
47};
48
49enum {
50 kOFVariableTypeBoolean = 1,
51 kOFVariableTypeNumber,
52 kOFVariableTypeString,
53 kOFVariableTypeData
54};
55
56enum {
57 kOFVariablePermRootOnly = 0,
58 kOFVariablePermUserRead,
59 kOFVariablePermUserWrite,
60 kOFVariablePermKernelOnly
61};
62
63class IODTNVRAM : public IOService
64{
65 OSDeclareDefaultStructors(IODTNVRAM);
66
67private:
68 IONVRAMController *_nvramController;
69 const OSSymbol *_registryPropertiesKey;
70 UInt8 *_nvramImage;
71 bool _nvramImageDirty;
72 UInt32 _ofPartitionOffset;
73 UInt32 _ofPartitionSize;
74 UInt8 *_ofImage;
75 bool _ofImageDirty;
76 OSDictionary *_ofDict;
77 OSDictionary *_nvramPartitionOffsets;
78 OSDictionary *_nvramPartitionLengths;
79 UInt32 _xpramPartitionOffset;
80 UInt32 _xpramPartitionSize;
81 UInt8 *_xpramImage;
82 UInt32 _nrPartitionOffset;
83 UInt32 _nrPartitionSize;
84 UInt8 *_nrImage;
85 UInt32 _piPartitionOffset;
86 UInt32 _piPartitionSize;
87 UInt8 *_piImage;
88 bool _systemPaniced;
89
90 virtual UInt8 calculatePartitionChecksum(UInt8 *partitionHeader);
91 virtual IOReturn initOFVariables(void);
92public:
93 virtual IOReturn syncOFVariables(void);
94private:
95 virtual UInt32 getOFVariableType(const OSSymbol *propSymbol) const;
96 virtual UInt32 getOFVariablePerm(const OSSymbol *propSymbol) const;
97 virtual bool getOWVariableInfo(UInt32 variableNumber, const OSSymbol **propSymbol,
98 UInt32 *propType, UInt32 *propOffset);
99 virtual bool convertPropToObject(UInt8 *propName, UInt32 propNameLength,
100 UInt8 *propData, UInt32 propDataLength,
101 const OSSymbol **propSymbol,
102 OSObject **propObject);
103 virtual bool convertObjectToProp(UInt8 *buffer, UInt32 *length,
104 const OSSymbol *propSymbol, OSObject *propObject);
105 virtual UInt16 generateOWChecksum(UInt8 *buffer);
106 virtual bool validateOWChecksum(UInt8 *buffer);
107 virtual void updateOWBootArgs(const OSSymbol *key, OSObject *value);
108 virtual bool searchNVRAMProperty(struct IONVRAMDescriptor *hdr,
109 UInt32 *where);
110
111 virtual IOReturn readNVRAMPropertyType0(IORegistryEntry *entry,
112 const OSSymbol **name,
113 OSData **value);
114 virtual IOReturn writeNVRAMPropertyType0(IORegistryEntry *entry,
115 const OSSymbol *name,
116 OSData * value);
117
118 virtual OSData *unescapeBytesToData(const UInt8 *bytes, UInt32 length);
119 virtual OSData *escapeDataToData(OSData * value);
120
121 virtual IOReturn readNVRAMPropertyType1(IORegistryEntry *entry,
122 const OSSymbol **name,
123 OSData **value);
124 virtual IOReturn writeNVRAMPropertyType1(IORegistryEntry *entry,
125 const OSSymbol *name,
126 OSData *value);
127
128public:
129 virtual bool init(IORegistryEntry *old, const IORegistryPlane *plane);
130
131 virtual void registerNVRAMController(IONVRAMController *nvram);
132
133 virtual void sync(void);
134
135 virtual bool serializeProperties(OSSerialize *s) const;
136 virtual OSObject *getProperty(const OSSymbol *aKey) const;
137 virtual OSObject *getProperty(const char *aKey) const;
138 virtual bool setProperty(const OSSymbol *aKey, OSObject *anObject);
139 virtual void removeProperty(const OSSymbol *aKey);
140 virtual IOReturn setProperties(OSObject *properties);
141
142 virtual IOReturn readXPRAM(IOByteCount offset, UInt8 *buffer,
143 IOByteCount length);
144 virtual IOReturn writeXPRAM(IOByteCount offset, UInt8 *buffer,
145 IOByteCount length);
146
147 virtual IOReturn readNVRAMProperty(IORegistryEntry *entry,
148 const OSSymbol **name,
149 OSData **value);
150 virtual IOReturn writeNVRAMProperty(IORegistryEntry *entry,
151 const OSSymbol *name,
152 OSData *value);
153
154 virtual OSDictionary *getNVRAMPartitions(void);
155
156 virtual IOReturn readNVRAMPartition(const OSSymbol *partitionID,
157 IOByteCount offset, UInt8 *buffer,
158 IOByteCount length);
159
160 virtual IOReturn writeNVRAMPartition(const OSSymbol *partitionID,
161 IOByteCount offset, UInt8 *buffer,
162 IOByteCount length);
163
164 virtual IOByteCount savePanicInfo(UInt8 *buffer, IOByteCount length);
165};
166
167#endif /* !_IOKIT_IONVRAM_H */
168

Archive Download this file

Revision: 1808