Added an "align" parameter to of_claim().
Added prototype for of_call_method(). gChosen is now declared and initialized in this file, therefore, of_init() can now fail (in case gChosen cannot be set). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4963 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -10,12 +10,19 @@
|
||||
|
||||
// OpenFirmware entry function
|
||||
static int (*gCallOpenFirmware)(void *) = 0;
|
||||
int gChosen;
|
||||
|
||||
|
||||
void
|
||||
status_t
|
||||
of_init(int (*openFirmwareEntry)(void *))
|
||||
{
|
||||
gCallOpenFirmware = openFirmwareEntry;
|
||||
|
||||
gChosen = of_finddevice("/chosen");
|
||||
if (gChosen == OF_FAILED)
|
||||
return B_ERROR;
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -395,7 +402,7 @@ of_release(void *virtual, int size)
|
||||
|
||||
|
||||
void *
|
||||
of_claim(void *virtual, int size)
|
||||
of_claim(void *virtual, int size, int align)
|
||||
{
|
||||
struct {
|
||||
const char *name;
|
||||
@@ -405,7 +412,7 @@ of_claim(void *virtual, int size)
|
||||
int size;
|
||||
int align;
|
||||
void *address;
|
||||
} args = {"claim", 3, 1, virtual, size, 64};
|
||||
} args = {"claim", 3, 1, virtual, size, align};
|
||||
|
||||
if (gCallOpenFirmware(&args) == OF_FAILED)
|
||||
return NULL;
|
||||
|
||||
@@ -15,11 +15,17 @@
|
||||
extern int gChosen;
|
||||
|
||||
|
||||
struct of_region {
|
||||
void *base;
|
||||
uint32 size;
|
||||
};
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void of_init(int (*openFirmwareEntry)(void *));
|
||||
extern status_t of_init(int (*openFirmwareEntry)(void *));
|
||||
|
||||
/* device tree functions */
|
||||
extern int of_finddevice(const char *device);
|
||||
@@ -43,9 +49,10 @@ extern int of_seek(int handle, off_t pos);
|
||||
|
||||
/* memory functions */
|
||||
extern int of_release(void *virtualAddress, int size);
|
||||
extern void *of_claim(void *virtualAddress, int size);
|
||||
extern void *of_claim(void *virtualAddress, int size, int align);
|
||||
|
||||
/* misc functions */
|
||||
extern int of_call_method(const char *method, int numArgs, int numReturns, ...);
|
||||
extern int of_test(const char *service);
|
||||
extern int of_milliseconds(void);
|
||||
extern void of_exit(void);
|
||||
|
||||
Reference in New Issue
Block a user