Skip to content

Commit 8c0a839

Browse files
xypronardbiesheuvel
authored andcommitted
efi/libstub: Descriptions for stub helper functions
Provide missing descriptions for EFI stub helper functions. Adjust formatting of existing descriptions to kernel style. Signed-off-by: Heinrich Schuchardt <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ard Biesheuvel <[email protected]>
1 parent 7a88a62 commit 8c0a839

File tree

2 files changed

+75
-13
lines changed

2 files changed

+75
-13
lines changed

drivers/firmware/efi/libstub/efi-stub-helper.c

Lines changed: 67 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ bool __pure __efi_soft_reserve_enabled(void)
3232
return !efi_nosoftreserve;
3333
}
3434

35+
/**
36+
* efi_char16_puts() - Write a UCS-2 encoded string to the console
37+
* @str: UCS-2 encoded string
38+
*/
3539
void efi_char16_puts(efi_char16_t *str)
3640
{
3741
efi_call_proto(efi_table_attr(efi_system_table, con_out),
@@ -83,6 +87,10 @@ u32 utf8_to_utf32(const u8 **s8)
8387
return c32;
8488
}
8589

90+
/**
91+
* efi_puts() - Write a UTF-8 encoded string to the console
92+
* @str: UTF-8 encoded string
93+
*/
8694
void efi_puts(const char *str)
8795
{
8896
efi_char16_t buf[128];
@@ -113,6 +121,16 @@ void efi_puts(const char *str)
113121
}
114122
}
115123

124+
/**
125+
* efi_printk() - Print a kernel message
126+
* @fmt: format string
127+
*
128+
* The first letter of the format string is used to determine the logging level
129+
* of the message. If the level is less then the current EFI logging level, the
130+
* message is suppressed. The message will be truncated to 255 bytes.
131+
*
132+
* Return: number of printed characters
133+
*/
116134
int efi_printk(const char *fmt, ...)
117135
{
118136
char printf_buf[256];
@@ -154,13 +172,18 @@ int efi_printk(const char *fmt, ...)
154172
return printed;
155173
}
156174

157-
/*
158-
* Parse the ASCII string 'cmdline' for EFI options, denoted by the efi=
175+
/**
176+
* efi_parse_options() - Parse EFI command line options
177+
* @cmdline: kernel command line
178+
*
179+
* Parse the ASCII string @cmdline for EFI options, denoted by the efi=
159180
* option, e.g. efi=nochunk.
160181
*
161182
* It should be noted that efi= is parsed in two very different
162183
* environments, first in the early boot environment of the EFI boot
163184
* stub, and subsequently during the kernel boot.
185+
*
186+
* Return: status code
164187
*/
165188
efi_status_t efi_parse_options(char const *cmdline)
166189
{
@@ -286,13 +309,21 @@ char *efi_convert_cmdline(efi_loaded_image_t *image, int *cmd_line_len)
286309
return (char *)cmdline_addr;
287310
}
288311

289-
/*
312+
/**
313+
* efi_exit_boot_services() - Exit boot services
314+
* @handle: handle of the exiting image
315+
* @map: pointer to receive the memory map
316+
* @priv: argument to be passed to @priv_func
317+
* @priv_func: function to process the memory map before exiting boot services
318+
*
290319
* Handle calling ExitBootServices according to the requirements set out by the
291320
* spec. Obtains the current memory map, and returns that info after calling
292321
* ExitBootServices. The client must specify a function to perform any
293322
* processing of the memory map data prior to ExitBootServices. A client
294323
* specific structure may be passed to the function via priv. The client
295324
* function may be called multiple times.
325+
*
326+
* Return: status code
296327
*/
297328
efi_status_t efi_exit_boot_services(void *handle,
298329
struct efi_boot_memmap *map,
@@ -361,6 +392,11 @@ efi_status_t efi_exit_boot_services(void *handle,
361392
return status;
362393
}
363394

395+
/**
396+
* get_efi_config_table() - retrieve UEFI configuration table
397+
* @guid: GUID of the configuration table to be retrieved
398+
* Return: pointer to the configuration table or NULL
399+
*/
364400
void *get_efi_config_table(efi_guid_t guid)
365401
{
366402
unsigned long tables = efi_table_attr(efi_system_table, tables);
@@ -408,17 +444,18 @@ static const struct {
408444
};
409445

410446
/**
411-
* efi_load_initrd_dev_path - load the initrd from the Linux initrd device path
447+
* efi_load_initrd_dev_path() - load the initrd from the Linux initrd device path
412448
* @load_addr: pointer to store the address where the initrd was loaded
413449
* @load_size: pointer to store the size of the loaded initrd
414450
* @max: upper limit for the initrd memory allocation
415-
* @return: %EFI_SUCCESS if the initrd was loaded successfully, in which
416-
* case @load_addr and @load_size are assigned accordingly
417-
* %EFI_NOT_FOUND if no LoadFile2 protocol exists on the initrd
418-
* device path
419-
* %EFI_INVALID_PARAMETER if load_addr == NULL or load_size == NULL
420-
* %EFI_OUT_OF_RESOURCES if memory allocation failed
421-
* %EFI_LOAD_ERROR in all other cases
451+
*
452+
* Return:
453+
* * %EFI_SUCCESS if the initrd was loaded successfully, in which
454+
* case @load_addr and @load_size are assigned accordingly
455+
* * %EFI_NOT_FOUND if no LoadFile2 protocol exists on the initrd device path
456+
* * %EFI_INVALID_PARAMETER if load_addr == NULL or load_size == NULL
457+
* * %EFI_OUT_OF_RESOURCES if memory allocation failed
458+
* * %EFI_LOAD_ERROR in all other cases
422459
*/
423460
static
424461
efi_status_t efi_load_initrd_dev_path(unsigned long *load_addr,
@@ -481,6 +518,16 @@ efi_status_t efi_load_initrd_cmdline(efi_loaded_image_t *image,
481518
load_addr, load_size);
482519
}
483520

521+
/**
522+
* efi_load_initrd() - Load initial RAM disk
523+
* @image: EFI loaded image protocol
524+
* @load_addr: pointer to loaded initrd
525+
* @load_size: size of loaded initrd
526+
* @soft_limit: preferred size of allocated memory for loading the initrd
527+
* @hard_limit: minimum size of allocated memory
528+
*
529+
* Return: status code
530+
*/
484531
efi_status_t efi_load_initrd(efi_loaded_image_t *image,
485532
unsigned long *load_addr,
486533
unsigned long *load_size,
@@ -505,6 +552,15 @@ efi_status_t efi_load_initrd(efi_loaded_image_t *image,
505552
return status;
506553
}
507554

555+
/**
556+
* efi_wait_for_key() - Wait for key stroke
557+
* @usec: number of microseconds to wait for key stroke
558+
* @key: key entered
559+
*
560+
* Wait for up to @usec microseconds for a key stroke.
561+
*
562+
* Return: status code, EFI_SUCCESS if key received
563+
*/
508564
efi_status_t efi_wait_for_key(unsigned long usec, efi_input_key_t *key)
509565
{
510566
efi_event_t events[2], timer;

drivers/firmware/efi/libstub/efistub.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,14 @@ typedef void (__efiapi *efi_event_notify_t)(efi_event_t, void *);
157157
#define EFI_EVT_NOTIFY_WAIT 0x00000100U
158158
#define EFI_EVT_NOTIFY_SIGNAL 0x00000200U
159159

160-
/*
161-
* boottime->wait_for_event takes an array of events as input.
160+
/**
161+
* efi_set_event_at() - add event to events array
162+
*
163+
* @events: array of UEFI events
164+
* @ids: index where to put the event in the array
165+
* @event: event to add to the aray
166+
*
167+
* boottime->wait_for_event() takes an array of events as input.
162168
* Provide a helper to set it up correctly for mixed mode.
163169
*/
164170
static inline

0 commit comments

Comments
 (0)