The Pedigree Project  0.1
OpenFirmware.h
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifndef MACHINE_OF_OF_H
21 #define MACHINE_OF_OF_H
22 
23 #include "pedigree/kernel/machine/openfirmware/types.h"
24 #include "pedigree/kernel/processor/types.h"
25 
30 {
31  private:
33  struct PromArgs
34  {
35  const char *service;
36  int nargs;
37  int nret;
38  void *args[10];
39  };
40 
41  public:
42  typedef int (*OFInterface)(PromArgs *);
43 
46  {
47  return m_Instance;
48  }
49 
51  void initialise(OFInterface interface);
52 
54  OFHandle findDevice(const char *pName);
55 
57  OFHandle getSibling(class OFDevice *pDev);
58 
60  OFHandle getFirstChild(class OFDevice *pDev);
61 
63  OFParam call(
64  const char *pService, int nArgs, OFParam p1 = 0, OFParam p2 = 0,
65  OFParam p3 = 0, OFParam p4 = 0, OFParam p5 = 0, OFParam p6 = 0,
66  OFParam p7 = 0, OFParam p8 = 0);
67 
68  private:
70  OpenFirmware();
71  ~OpenFirmware();
72 
74  OFInterface m_Interface;
75 
78 
81  processor_register_t m_Sprg0;
82  processor_register_t m_Sprg1;
83  processor_register_t m_Sprg2;
84  processor_register_t m_Sprg3;
85 };
86 
87 #endif
OFHandle findDevice(const char *pName)
Definition: OpenFirmware.cc:46
static OpenFirmware & instance()
Definition: OpenFirmware.h:45
OFParam call(const char *pService, int nArgs, OFParam p1=0, OFParam p2=0, OFParam p3=0, OFParam p4=0, OFParam p5=0, OFParam p6=0, OFParam p7=0, OFParam p8=0)
Definition: OpenFirmware.cc:64
processor_register_t m_Sprg0
Definition: OpenFirmware.h:81
OFHandle getSibling(class OFDevice *pDev)
Definition: OpenFirmware.cc:52
void initialise(OFInterface interface)
Definition: OpenFirmware.cc:35
OFHandle getFirstChild(class OFDevice *pDev)
Definition: OpenFirmware.cc:58
OFInterface m_Interface
Definition: OpenFirmware.h:74
static OpenFirmware m_Instance
Definition: OpenFirmware.h:77