20 #include "pedigree/kernel/machine/openfirmware/Device.h" 21 #include "pedigree/kernel/Log.h" 22 #include "pedigree/kernel/machine/openfirmware/OpenFirmware.h" 24 OFDevice::OFDevice(OFHandle handle) : m_Handle(handle)
36 "instance-to-package", 1, static_cast<OFParam>(m_Handle));
37 if (reinterpret_cast<int>(ret) == -1)
38 ret =
static_cast<OFParam
>(m_Handle);
41 reinterpret_cast<OFParam>(const_cast<char *>(pProperty)),
42 static_cast<OFParam>(buf2), reinterpret_cast<OFParam>(64));
46 OFHandle OFDevice::getProperty(
const char *pProperty)
50 "instance-to-package", 1, static_cast<OFParam>(m_Handle));
51 if (reinterpret_cast<int>(ret) == -1)
52 ret =
static_cast<OFParam
>(m_Handle);
55 reinterpret_cast<OFParam>(const_cast<char *>(pProperty)),
56 reinterpret_cast<OFParam>(&h),
57 reinterpret_cast<OFParam>(
sizeof(OFHandle)));
61 int OFDevice::getProperty(
const char *pProperty,
void *buf,
size_t bufLen)
64 "instance-to-package", 1, static_cast<OFParam>(m_Handle));
65 if (reinterpret_cast<int>(ret) == -1)
66 ret =
static_cast<OFParam
>(m_Handle);
69 reinterpret_cast<OFParam>(const_cast<char *>(pProperty)),
70 reinterpret_cast<OFParam>(buf), reinterpret_cast<OFParam>(bufLen)));
73 bool OFDevice::propertyExists(
const char *pProperty)
77 "instance-to-package", 1, static_cast<OFParam>(m_Handle));
78 if (reinterpret_cast<int>(ret) == -1)
79 ret =
static_cast<OFParam
>(m_Handle);
82 reinterpret_cast<OFParam>(const_cast<char *>(pProperty)),
83 reinterpret_cast<OFParam>(&h),
84 reinterpret_cast<OFParam>(
sizeof(OFHandle))) !=
85 reinterpret_cast<OFHandle
>(-1);
88 OFHandle OFDevice::getParent()
91 "instance-to-package", 1, static_cast<OFParam>(m_Handle));
92 if (reinterpret_cast<int>(ret) == -1)
93 ret =
static_cast<OFParam
>(m_Handle);
95 "parent", 1, reinterpret_cast<OFParam>(ret)));
98 int OFDevice::getPropertyLength(
const char *pProperty)
101 "instance-to-package", 1, static_cast<OFParam>(m_Handle));
102 if (reinterpret_cast<int>(ret) == -1)
103 ret =
static_cast<OFParam
>(m_Handle);
105 "getproplen", 2, ret,
106 reinterpret_cast<OFParam>(const_cast<char *>(pProperty))));
109 int OFDevice::getNextProperty(
const char *pPrevious,
const char *pNext)
113 "instance-to-package", 1, static_cast<OFParam>(m_Handle));
114 if (reinterpret_cast<int>(ret) == -1)
115 ret =
static_cast<OFParam
>(m_Handle);
118 reinterpret_cast<OFParam>(const_cast<char *>(pPrevious)),
119 reinterpret_cast<OFParam>(const_cast<char *>(pNext))));
127 OFHandle OFDevice::executeMethod(
128 const char *method,
size_t nArgs, OFParam p1, OFParam p2, OFParam p3,
129 OFParam p4, OFParam p5, OFParam p6)
132 "call-method", nArgs + 2,
133 reinterpret_cast<OFParam>(const_cast<char *>(method)),
134 static_cast<OFParam>(m_Handle), p1, p2, p3, p4, p5, p6);
static OpenFirmware & instance()
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)
virtual void setProperty(const char *pProperty, NormalStaticString &val)