Changeset View
Changeset View
Standalone View
Standalone View
head/sys/boot/ofw/libofw/openfirm.c
Show First 20 Lines • Show All 616 Lines • ▼ Show 20 Lines | OF_seek(ihandle_t instance, u_int64_t pos) | ||||
args.instance = instance; | args.instance = instance; | ||||
args.poshi = pos >> 32; | args.poshi = pos >> 32; | ||||
args.poslo = pos; | args.poslo = pos; | ||||
if (openfirmware(&args) == -1) | if (openfirmware(&args) == -1) | ||||
return (-1); | return (-1); | ||||
return (args.status); | return (args.status); | ||||
} | } | ||||
/* Blocks. */ | |||||
unsigned int | |||||
OF_blocks(ihandle_t instance) | |||||
{ | |||||
static struct { | |||||
cell_t name; | |||||
cell_t nargs; | |||||
cell_t nreturns; | |||||
cell_t instance; | |||||
cell_t result; | |||||
cell_t blocks; | |||||
} args = { | |||||
(cell_t)"#blocks", | |||||
2, | |||||
1, | |||||
}; | |||||
args.instance = instance; | |||||
if (openfirmware(&args) == -1) | |||||
return ((unsigned int)-1); | |||||
return (args.blocks); | |||||
} | |||||
/* Block size. */ | |||||
int | |||||
OF_block_size(ihandle_t instance) | |||||
{ | |||||
static struct { | |||||
cell_t name; | |||||
cell_t nargs; | |||||
cell_t nreturns; | |||||
cell_t instance; | |||||
cell_t result; | |||||
cell_t size; | |||||
} args = { | |||||
(cell_t)"block-size", | |||||
2, | |||||
1, | |||||
}; | |||||
args.instance = instance; | |||||
if (openfirmware(&args) == -1) | |||||
return (512); | |||||
return (args.size); | |||||
} | |||||
/* | |||||
/* | /* | ||||
* Memory functions | * Memory functions | ||||
*/ | */ | ||||
/* Claim an area of memory. */ | /* Claim an area of memory. */ | ||||
void * | void * | ||||
OF_claim(void *virt, u_int size, u_int align) | OF_claim(void *virt, u_int size, u_int align) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 153 Lines • Show Last 20 Lines |