The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/iokit/IOKit/IONVRAM.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    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 
   43 enum {
   44   kIODTNVRAMImageSize        = 0x2000,
   45   kIODTNVRAMXPRAMSize        = 0x0100,
   46   kIODTNVRAMNameRegistrySize = 0x0400
   47 };
   48 
   49 enum {
   50   kOFVariableTypeBoolean = 1,
   51   kOFVariableTypeNumber,
   52   kOFVariableTypeString,
   53   kOFVariableTypeData
   54 };
   55 
   56 enum {
   57   kOFVariablePermRootOnly = 0,
   58   kOFVariablePermUserRead,
   59   kOFVariablePermUserWrite
   60 };
   61 
   62 class IODTNVRAM : public IOService
   63 {
   64   OSDeclareDefaultStructors(IODTNVRAM);
   65   
   66 private:
   67   IONVRAMController *_nvramController;
   68   const OSSymbol    *_registryPropertiesKey;
   69   UInt8             *_nvramImage;
   70   bool              _nvramImageDirty;
   71   UInt32            _ofPartitionOffset;
   72   UInt32            _ofPartitionSize;
   73   UInt8             *_ofImage;
   74   bool              _ofImageDirty;
   75   OSDictionary      *_ofDict;
   76   OSDictionary      *_nvramPartitionOffsets;
   77   OSDictionary      *_nvramPartitionLengths;
   78   UInt32            _xpramPartitionOffset;
   79   UInt32            _xpramPartitionSize;
   80   UInt8             *_xpramImage;
   81   UInt32            _nrPartitionOffset;
   82   UInt32            _nrPartitionSize;
   83   UInt8             *_nrImage;
   84   UInt32            _piPartitionOffset;
   85   UInt32            _piPartitionSize;
   86   UInt8             *_piImage;
   87   bool              _systemPaniced;
   88   
   89   virtual UInt8 calculatePartitionChecksum(UInt8 *partitionHeader);
   90   virtual IOReturn initOFVariables(void);
   91 public:
   92   virtual IOReturn syncOFVariables(void);
   93 private:
   94   virtual UInt32 getOFVariableType(const OSSymbol *propSymbol) const;
   95   virtual UInt32 getOFVariablePerm(const OSSymbol *propSymbol) const;
   96   virtual bool getOWVariableInfo(UInt32 variableNumber, const OSSymbol **propSymbol,
   97                                  UInt32 *propType, UInt32 *propOffset);
   98   virtual bool convertPropToObject(UInt8 *propName, UInt32 propNameLength,
   99                                    UInt8 *propData, UInt32 propDataLength,
  100                                    const OSSymbol **propSymbol,
  101                                    OSObject **propObject);
  102   virtual bool convertObjectToProp(UInt8 *buffer, UInt32 *length,
  103                                    const OSSymbol *propSymbol, OSObject *propObject);
  104   virtual UInt16 generateOWChecksum(UInt8 *buffer);
  105   virtual bool validateOWChecksum(UInt8 *buffer);
  106   virtual void updateOWBootArgs(const OSSymbol *key, OSObject *value);
  107   virtual bool searchNVRAMProperty(struct IONVRAMDescriptor *hdr,
  108                                    UInt32 *where);
  109   
  110   virtual IOReturn readNVRAMPropertyType0(IORegistryEntry *entry,
  111                                           const OSSymbol **name,
  112                                           OSData **value);
  113   virtual IOReturn writeNVRAMPropertyType0(IORegistryEntry *entry,
  114                                            const OSSymbol *name,
  115                                            OSData * value);
  116   
  117   virtual OSData *unescapeBytesToData(const UInt8 *bytes, UInt32 length);
  118   virtual OSData *escapeDataToData(OSData * value);
  119 
  120   virtual IOReturn readNVRAMPropertyType1(IORegistryEntry *entry,
  121                                           const OSSymbol **name,
  122                                           OSData **value);
  123   virtual IOReturn writeNVRAMPropertyType1(IORegistryEntry *entry,
  124                                            const OSSymbol *name,
  125                                            OSData *value);
  126   
  127 public:
  128   virtual bool init(IORegistryEntry *old, const IORegistryPlane *plane);
  129   
  130   virtual void registerNVRAMController(IONVRAMController *nvram);
  131   
  132   virtual void sync(void);
  133   
  134   virtual bool serializeProperties(OSSerialize *s) const;
  135   virtual OSObject *getProperty(const OSSymbol *aKey) const;
  136   virtual OSObject *getProperty(const char *aKey) const;
  137   virtual bool setProperty(const OSSymbol *aKey, OSObject *anObject);
  138   virtual void removeProperty(const OSSymbol *aKey);
  139   virtual IOReturn setProperties(OSObject *properties);
  140   
  141   virtual IOReturn readXPRAM(IOByteCount offset, UInt8 *buffer,
  142                              IOByteCount length);
  143   virtual IOReturn writeXPRAM(IOByteCount offset, UInt8 *buffer,
  144                               IOByteCount length);
  145   
  146   virtual IOReturn readNVRAMProperty(IORegistryEntry *entry,
  147                                      const OSSymbol **name,
  148                                      OSData **value);
  149   virtual IOReturn writeNVRAMProperty(IORegistryEntry *entry,
  150                                       const OSSymbol *name,
  151                                       OSData *value);
  152   
  153   virtual OSDictionary *getNVRAMPartitions(void);
  154   
  155   virtual IOReturn readNVRAMPartition(const OSSymbol *partitionID,
  156                                       IOByteCount offset, UInt8 *buffer,
  157                                       IOByteCount length);
  158   
  159   virtual IOReturn writeNVRAMPartition(const OSSymbol *partitionID,
  160                                        IOByteCount offset, UInt8 *buffer,
  161                                        IOByteCount length);  
  162   
  163   virtual IOByteCount savePanicInfo(UInt8 *buffer, IOByteCount length);
  164 };
  165 
  166 #endif /* !_IOKIT_IONVRAM_H */

Cache object: 4e32628bafecdce2b0fbd4e2bc133bdb


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.