Changeset View
Changeset View
Standalone View
Standalone View
sys/boot/efi/boot1/boot_module.h
Show All 30 Lines | |||||
#include <stdbool.h> | #include <stdbool.h> | ||||
#include <efi.h> | #include <efi.h> | ||||
#include <efilib.h> | #include <efilib.h> | ||||
#include <eficonsctl.h> | #include <eficonsctl.h> | ||||
#ifdef EFI_DEBUG | #ifdef EFI_DEBUG | ||||
#define DPRINTF(fmt, ...) printf(fmt, __VA_ARGS__) | #define DPRINTF(fmt, args...) printf(fmt, ##args) | ||||
#define DSTALL(d) bs->Stall(d) | |||||
#else | #else | ||||
#define DPRINTF(fmt, ...) {} | #define DPRINTF(fmt, ...) {} | ||||
#define DSTALL(d) {} | |||||
#endif | #endif | ||||
/* EFI device info */ | /* EFI device info */ | ||||
typedef struct dev_info | typedef struct dev_info | ||||
{ | { | ||||
EFI_BLOCK_IO *dev; | EFI_BLOCK_IO *dev; | ||||
EFI_DEVICE_PATH *devpath; | EFI_DEVICE_PATH *devpath; | ||||
EFI_HANDLE *devhandle; | EFI_HANDLE *devhandle; | ||||
void *devdata; | void *devdata; | ||||
BOOLEAN preferred; | |||||
struct dev_info *next; | struct dev_info *next; | ||||
} dev_info_t; | } dev_info_t; | ||||
/* | /* | ||||
* A boot loader module. | * A boot loader module. | ||||
* | * | ||||
* This is a standard interface for filesystem modules in the EFI system. | * This is a standard interface for filesystem modules in the EFI system. | ||||
*/ | */ | ||||
Show All 11 Lines | typedef struct boot_module_t | ||||
* EFI_SUCCESS = The module can handle the device. | * EFI_SUCCESS = The module can handle the device. | ||||
* EFI_NOT_FOUND = The module can not handle the device. | * EFI_NOT_FOUND = The module can not handle the device. | ||||
* Other = The module encountered an error. | * Other = The module encountered an error. | ||||
*/ | */ | ||||
EFI_STATUS (*probe)(dev_info_t* dev); | EFI_STATUS (*probe)(dev_info_t* dev); | ||||
/* | /* | ||||
* load should select the best out of a set of devices that probe | * load should select the best out of a set of devices that probe | ||||
* indicated were loadable and load it. | * indicated were loadable and load the specified file. | ||||
* | * | ||||
* Return codes: | * Return codes: | ||||
* EFI_SUCCESS = The module can handle the device. | * EFI_SUCCESS = The module can handle the device. | ||||
* EFI_NOT_FOUND = The module can not handle the device. | * EFI_NOT_FOUND = The module can not handle the device. | ||||
* Other = The module encountered an error. | * Other = The module encountered an error. | ||||
*/ | */ | ||||
EFI_STATUS (*load)(const char *loader_path, dev_info_t **devinfo, | EFI_STATUS (*load)(const char *filepath, dev_info_t *devinfo, | ||||
void **buf, size_t *bufsize); | void **buf, size_t *bufsize); | ||||
/* status outputs information about the probed devices. */ | /* status outputs information about the probed devices. */ | ||||
void (*status)(); | void (*status)(); | ||||
/* valid devices as found by probe. */ | |||||
dev_info_t *(*devices)(); | |||||
} boot_module_t; | } boot_module_t; | ||||
/* Standard boot modules. */ | /* Standard boot modules. */ | ||||
#ifdef EFI_UFS_BOOT | #ifdef EFI_UFS_BOOT | ||||
extern const boot_module_t ufs_module; | extern const boot_module_t ufs_module; | ||||
#endif | #endif | ||||
#ifdef EFI_ZFS_BOOT | #ifdef EFI_ZFS_BOOT | ||||
extern const boot_module_t zfs_module; | extern const boot_module_t zfs_module; | ||||
#endif | #endif | ||||
/* Functions available to modules. */ | /* Functions available to modules. */ | ||||
extern void add_device(dev_info_t **devinfop, dev_info_t *devinfo); | extern void add_device(dev_info_t **devinfop, dev_info_t *devinfo); | ||||
extern void panic(const char *fmt, ...) __dead2; | extern void panic(const char *fmt, ...) __dead2; | ||||
extern int printf(const char *fmt, ...); | extern int printf(const char *fmt, ...); | ||||
extern int vsnprintf(char *str, size_t sz, const char *fmt, va_list ap); | extern int vsnprintf(char *str, size_t sz, const char *fmt, va_list ap); | ||||
extern EFI_SYSTEM_TABLE *systab; | extern EFI_SYSTEM_TABLE *systab; | ||||
extern EFI_BOOT_SERVICES *bs; | extern EFI_BOOT_SERVICES *bs; | ||||
extern int devpath_strlcat(char *buf, size_t size, EFI_DEVICE_PATH *devpath); | |||||
extern char *devpath_str(EFI_DEVICE_PATH *devpath); | |||||
#endif | #endif |