Changeset View
Changeset View
Standalone View
Standalone View
stand/efi/boot1/ufs_module.c
Show All 32 Lines | |||||
*/ | */ | ||||
#include <stdarg.h> | #include <stdarg.h> | ||||
#include <stdbool.h> | #include <stdbool.h> | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <efi.h> | #include <efi.h> | ||||
#include <ufs/ffs/fs.h> | |||||
#include "boot_module.h" | #include "boot_module.h" | ||||
#include "ufsread.h" | |||||
static dev_info_t *devinfo; | static dev_info_t *devinfo; | ||||
static dev_info_t *devices; | static dev_info_t *devices; | ||||
static int | int | ||||
dskread(void *buf, u_int64_t lba, int nblk) | dskread(void *buf, u_int64_t lba, int nblk) | ||||
{ | { | ||||
int size; | int size; | ||||
EFI_STATUS status; | EFI_STATUS status; | ||||
lba = lba / (devinfo->dev->Media->BlockSize / DEV_BSIZE); | lba = lba / (devinfo->dev->Media->BlockSize / DEV_BSIZE); | ||||
size = nblk * DEV_BSIZE; | size = nblk * DEV_BSIZE; | ||||
status = devinfo->dev->ReadBlocks(devinfo->dev, | status = devinfo->dev->ReadBlocks(devinfo->dev, | ||||
devinfo->dev->Media->MediaId, lba, size, buf); | devinfo->dev->Media->MediaId, lba, size, buf); | ||||
if (status != EFI_SUCCESS) { | if (status != EFI_SUCCESS) { | ||||
DPRINTF("dskread: failed dev: %p, id: %u, lba: %ju, size: %d, " | DPRINTF("dskread: failed dev: %p, id: %u, lba: %ju, size: %d, " | ||||
"status: %lu\n", devinfo->dev, | "status: %lu\n", devinfo->dev, | ||||
devinfo->dev->Media->MediaId, (uintmax_t)lba, size, | devinfo->dev->Media->MediaId, (uintmax_t)lba, size, | ||||
EFI_ERROR_CODE(status)); | EFI_ERROR_CODE(status)); | ||||
return (-1); | return (-1); | ||||
} | } | ||||
return (0); | return (0); | ||||
} | } | ||||
#include "ufsread.c" | |||||
static struct dmadat __dmadat; | static struct dmadat __dmadat; | ||||
static int | static int | ||||
init_dev(dev_info_t* dev) | init_dev(dev_info_t* dev) | ||||
{ | { | ||||
devinfo = dev; | devinfo = dev; | ||||
▲ Show 20 Lines • Show All 108 Lines • Show Last 20 Lines |