1//
2//  AppleARMPE.cpp
3//  AppleARMPlatform
4//
5//  Created by rms on 5/21/13.
6//  Copyright (c) 2013 rms. All rights reserved.
7//
8
9#include "AppleARMPE.h"
10#include <kern/debug.h>
11#include <pexpert/device_tree.h>
12
13#define HIGH_SCORE  100000
14#define super IOPlatformExpert
15
16OSDefineMetaClassAndStructors(AppleARMPE, IODTPlatformExpert);
17
18bool AppleARMPE::init(OSDictionary * propTable)
19{
20    if (!super::init(propTable)) {
21        panic("IOPlatformExpert failed to initialize");
22    }
23    return true;
24}
25
26extern const IORegistryPlane *gIODTPlane;
27
28void AppleARMPE::registerNVRAMController(IONVRAMController * caller)
29{
30    publishResource("IONVRAM");
31}
32
33bool AppleARMPE::start(IOService * provider)
34{
35    DTEntry entry;
36    char *dtype;
37    unsigned int size;
38
39    IOLog("AppleARMPE::start: Welcome to the NeXT generation.\n");
40
41    if (!super::start(provider)) {
42        panic("IOPlatformExpert failed to start");
43    }
44
45    removeProperty(kIOPlatformMapperPresentKey);
46    assert(IOService::getPlatform() == this);
47
48    registerService();
49
50    /*
51     * Let these time out to let everything else initialize right.
52     */
53#if 0
54    publishResource("IONVRAM");
55    publishResource("IORTC");
56#endif
57
58    OSData *        prop;
59    bool        ok = false;
60
61    prop = (OSData *) getProvider()->getProperty( gIODTModelKey );
62    ok = (0 != prop);
63
64    if( ok )
65        populate_model_name((char *) prop->getBytesNoCopy());
66    else
67        populate_model_name("Power Macintosh");
68
69    return true;
70}
71
72const char *AppleARMPE::deleteList(void)
73{
74    return "";
75}
76
77const char *AppleARMPE::excludeList(void)
78{
79    return ("'chosen', 'memory', 'options', 'aliases'");
80}
81
82IOService *AppleARMPE::probe(IOService * provider, SInt32 * score)
83{
84    return this;
85}
86
87bool AppleARMPE::getMachineName(char *name, int maxLength)
88{
89    OSData *        prop;
90    bool        ok = false;
91
92    maxLength--;
93    prop = (OSData *) getProvider()->getProperty( gIODTModelKey );
94    ok = (0 != prop);
95
96    if( ok )
97        strlcpy( name, (const char *) prop->getBytesNoCopy(), maxLength );
98    else
99        strlcpy( name, "Power Macintosh", maxLength );
100
101    return(true);
102}
103