* Attempt to boot from an INT 13 drive
*
* @v drive Drive number
- * @v filename Filename (or NULL to use default)
+ * @v config Boot configuration parameters
* @ret rc Return status code
*
* This boots from the specified INT 13 drive by loading the Master
*
* Note that this function can never return success, by definition.
*/
-static int int13_boot ( unsigned int drive, const char *filename __unused ) {
+static int int13_boot ( unsigned int drive,
+ struct san_boot_config *config __unused ) {
struct memory_map memmap;
struct segoff address;
int rc;
* Boot from dummy SAN device
*
* @v drive Drive number
- * @v filename Filename (or NULL to use default)
+ * @v config Boot configuration parameters
* @ret rc Return status code
*/
static int dummy_san_boot ( unsigned int drive __unused,
- const char *filename __unused ) {
+ struct san_boot_config *config __unused ) {
return -EOPNOTSUPP;
}
}
static int null_san_boot ( unsigned int drive __unused,
- const char *filename __unused ) {
+ struct san_boot_config *config __unused ) {
return -EOPNOTSUPP;
}
struct command_descriptor *cmd,
int default_flags, int no_root_path_flags ) {
struct sanboot_options opts;
+ struct san_boot_config config;
struct uri *uris[argc];
int count;
int flags;
}
}
+ /* Construct configuration parameters */
+ config.filename = opts.filename;
+
/* Construct flags */
flags = default_flags;
if ( opts.no_describe )
flags |= no_root_path_flags;
/* Boot from root path */
- if ( ( rc = uriboot ( NULL, uris, count, opts.drive, opts.filename,
+ if ( ( rc = uriboot ( NULL, uris, count, opts.drive, &config,
flags ) ) != 0 )
goto err_uriboot;
SAN_NO_DESCRIBE = 0x0001,
};
+/** SAN boot configuration parameters */
+struct san_boot_config {
+ /** Boot filename (or NULL to use default) */
+ const char *filename;
+};
+
/**
* Calculate static inline sanboot API function name
*
* Attempt to boot from a SAN device
*
* @v drive Drive number
- * @v filename Filename (or NULL to use default)
+ * @v config Boot configuration parameters
* @ret rc Return status code
*/
-int san_boot ( unsigned int drive, const char *filename );
+int san_boot ( unsigned int drive, struct san_boot_config *config );
/**
* Describe SAN devices for SAN-booted operating system
struct net_device;
struct uri;
struct settings;
+struct san_boot_config;
/** uriboot() flags */
enum uriboot_flags {
extern int uriboot ( struct uri *filename, struct uri **root_paths,
unsigned int root_path_count, int drive,
- const char *san_filename, unsigned int flags );
+ struct san_boot_config *san_config, unsigned int flags );
extern struct uri *
fetch_next_server_and_filename ( struct settings *settings );
extern int netboot ( struct net_device *netdev );
* @v drive Drive number
* @v handle Filesystem handle
* @v path Block device path
- * @v filename Filename (or NULL to use default)
+ * @v config Boot configuration parameters
* @v fspath Filesystem device path to fill in
* @ret rc Return status code
*/
static int efi_block_match ( unsigned int drive, EFI_HANDLE handle,
EFI_DEVICE_PATH_PROTOCOL *path,
- const char *filename,
+ struct san_boot_config *config,
EFI_DEVICE_PATH_PROTOCOL **fspath ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
EFI_GUID *protocol = &efi_device_path_protocol_guid;
drive, efi_devpath_text ( u.path ) );
/* Check if filesystem contains boot filename */
- if ( ( rc = efi_block_filename ( drive, handle, filename ) ) != 0 )
+ if ( ( rc = efi_block_filename ( drive, handle,
+ config->filename ) ) != 0 ) {
goto err_filename;
+ }
/* Success */
rc = 0;
*
* @v drive Drive number
* @v handle Block device handle
- * @v filename Filename (or NULL to use default)
+ * @v config Boot configuration parameters
* @v fspath Filesystem device path to fill in
* @ret rc Return status code
*/
static int efi_block_scan ( unsigned int drive, EFI_HANDLE handle,
- const char *filename,
+ struct san_boot_config *config,
EFI_DEVICE_PATH_PROTOCOL **fspath ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
EFI_GUID *protocol = &efi_device_path_protocol_guid;
/* Check for a matching filesystem */
if ( ( rc = efi_block_match ( drive, handles[i], u.path,
- filename, fspath ) ) != 0 )
+ config, fspath ) ) != 0 )
continue;
break;
* Boot from EFI block device
*
* @v drive Drive number
- * @v filename Filename (or NULL to use default)
+ * @v config Boot configuration parameters
* @ret rc Return status code
*/
-static int efi_block_boot ( unsigned int drive, const char *filename ) {
+static int efi_block_boot ( unsigned int drive,
+ struct san_boot_config *config ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
EFI_DEVICE_PATH_PROTOCOL *fspath = NULL;
EFI_HANDLE *handles;
DBGC ( vdrive, "EFIBLK %#02x attempting to boot\n", vdrive );
/* Scan for a matching filesystem within this drive */
- if ( ( rc = efi_block_scan ( vdrive, handle, filename,
+ if ( ( rc = efi_block_scan ( vdrive, handle, config,
&fspath ) ) != 0 ) {
continue;
}
/* Attempt to boot from the matched filesystem */
- rc = efi_block_exec ( vdrive, fspath, filename );
+ rc = efi_block_exec ( vdrive, fspath, config->filename );
break;
}
* @v root_paths Root path(s)
* @v root_path_count Number of root paths
* @v drive SAN drive (if applicable)
- * @v san_filename SAN filename (or NULL to use default)
+ * @v san_config SAN boot configuration parameters
* @v flags Boot action flags
* @ret rc Return status code
*
*/
int uriboot ( struct uri *filename, struct uri **root_paths,
unsigned int root_path_count, int drive,
- const char *san_filename, unsigned int flags ) {
+ struct san_boot_config *san_config, unsigned int flags ) {
struct image *image;
+ const char *san_filename;
int rc;
/* Hook SAN device, if applicable */
/* Attempt SAN boot if applicable */
if ( ! ( flags & URIBOOT_NO_SAN_BOOT ) ) {
+ san_filename = san_config->filename;
if ( fetch_intz_setting ( NULL, &skip_san_boot_setting) == 0 ) {
printf ( "Booting%s%s from SAN device %#02x\n",
( san_filename ? " " : "" ),
( san_filename ? san_filename : "" ), drive );
- rc = san_boot ( drive, san_filename );
+ rc = san_boot ( drive, san_config );
printf ( "Boot from SAN device %#02x failed: %s\n",
drive, strerror ( rc ) );
} else {
* @ret rc Return status code
*/
int netboot ( struct net_device *netdev ) {
+ struct san_boot_config san_config;
struct uri *filename;
struct uri *root_path;
char *san_filename;
/* Fetch SAN filename (if any) */
san_filename = fetch_san_filename ( NULL );
+ /* Construct SAN boot configuration parameters */
+ memset ( &san_config, 0, sizeof ( san_config ) );
+ san_config.filename = san_filename;
+
/* If we have both a filename and a root path, ignore an
* unsupported or missing URI scheme in the root path, since
* it may represent an NFS root.
/* Boot using next server, filename and root path */
if ( ( rc = uriboot ( filename, &root_path, ( root_path ? 1 : 0 ),
- san_default_drive(), san_filename,
+ san_default_drive(), &san_config,
( root_path ? 0 : URIBOOT_NO_SAN ) ) ) != 0 )
goto err_uriboot;