Changeset View
Changeset View
Standalone View
Standalone View
sys/boot/ofw/libofw/ofw_disk.c
Show All 31 Lines | |||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <netinet/in.h> | #include <netinet/in.h> | ||||
#include <machine/stdarg.h> | #include <machine/stdarg.h> | ||||
#include <stand.h> | #include <stand.h> | ||||
#include <sys/disk.h> | |||||
#include "bootstrap.h" | #include "bootstrap.h" | ||||
#include "libofw.h" | #include "libofw.h" | ||||
static int ofwd_init(void); | static int ofwd_init(void); | ||||
static int ofwd_strategy(void *devdata, int flag, daddr_t dblk, | static int ofwd_strategy(void *devdata, int flag, daddr_t dblk, | ||||
size_t size, char *buf, size_t *rsize); | size_t size, char *buf, size_t *rsize); | ||||
static int ofwd_open(struct open_file *f, ...); | static int ofwd_open(struct open_file *f, ...); | ||||
▲ Show 20 Lines • Show All 101 Lines • ▼ Show 20 Lines | #if !defined(__powerpc__) | ||||
OF_close(dev->d_handle); | OF_close(dev->d_handle); | ||||
#endif | #endif | ||||
kdp = NULL; | kdp = NULL; | ||||
} | } | ||||
return (0); | return (0); | ||||
} | } | ||||
static int | static int | ||||
ofwd_ioctl(struct open_file *f __unused, u_long cmd __unused, | ofwd_ioctl(struct open_file *f, u_long cmd, void *data) | ||||
void *data __unused) | |||||
{ | { | ||||
struct ofw_devdesc *dev = f->f_devdata; | |||||
int block_size; | |||||
unsigned int n; | |||||
return (EINVAL); | switch (cmd) { | ||||
case DIOCGSECTORSIZE: | |||||
block_size = OF_block_size(dev->d_handle); | |||||
*(u_int *)data = block_size; | |||||
break; | |||||
case DIOCGMEDIASIZE: | |||||
block_size = OF_block_size(dev->d_handle); | |||||
n = OF_blocks(dev->d_handle); | |||||
*(uint64_t *)data = (uint64_t)(n * block_size); | |||||
break; | |||||
default: | |||||
return (ENOTTY); | |||||
} | |||||
return (0); | |||||
} | } | ||||
static int | static int | ||||
ofwd_print(int verbose __unused) | ofwd_print(int verbose __unused) | ||||
{ | { | ||||
return (0); | return (0); | ||||
} | } |