Skip to content

Commit

Permalink
efi: Add Auxiliary Data Vector support
Browse files Browse the repository at this point in the history
Including deleting some ADV code that found its way into core/elflink.

Also, move the __syslinux_adv_ptr and __syslinux_adv_size symbols out
of ldlinux.c32 and into the core. Normally we don't want to move
symbols into the core (as it increases the size), but we do in this
case because the values for these symbols are firmware dependent.

Signed-off-by: Chandramouli Narayanan <[email protected]>
Signed-off-by: Matt Fleming <[email protected]>
  • Loading branch information
Chandramouli Narayanan authored and Matt Fleming committed Feb 2, 2012
1 parent 98bf451 commit e5b9b7e
Show file tree
Hide file tree
Showing 12 changed files with 784 additions and 189 deletions.
19 changes: 2 additions & 17 deletions com32/elflink/ldlinux/adv.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,9 @@
*/

#include <syslinux/adv.h>
#include <klibc/compiler.h>
#include <inttypes.h>
#include <com32.h>
#include <syslinux/firmware.h>

void *__syslinux_adv_ptr;
size_t __syslinux_adv_size;

extern void adv_init(void);
void __syslinux_init(void)
{
static com32sys_t reg;

/* Initialize the ADV structure */
reg.eax.w[0] = 0x0025;
__intcall(0x22, &reg, NULL);

reg.eax.w[0] = 0x001c;
__intcall(0x22, &reg, &reg);
__syslinux_adv_ptr = MK_PTR(reg.es, reg.ebx.w[0]);
__syslinux_adv_size = reg.ecx.w[0];
firmware->adv_ops->init();
}
9 changes: 2 additions & 7 deletions com32/elflink/ldlinux/advwrite.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,9 @@
*/

#include <syslinux/adv.h>
#include <klibc/compiler.h>
#include <com32.h>
#include <syslinux/firmware.h>

int syslinux_adv_write(void)
{
static com32sys_t reg;

reg.eax.w[0] = 0x001d;
__intcall(0x22, &reg, &reg);
return (reg.eflags.l & EFLAGS_CF) ? -1 : 0;
return firmware->adv_ops->write();
}
7 changes: 7 additions & 0 deletions com32/include/syslinux/firmware.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ struct input_ops {
char (*getchar)(void);
};

struct adv_ops {
void (*init)(void);
int (*write)(void);
};

struct firmware {
void (*init)(void);
int (*scan_memory)(scan_memory_callback_t, void *);
Expand All @@ -30,10 +35,12 @@ struct firmware {
char *(*get_config_file_name)(void);
void (*get_serial_console_info)(uint16_t *, uint16_t *, uint16_t *);
bool (*ipappend_strings)(char **, int *);
struct adv_ops *adv_ops;
};

extern struct firmware *firmware;

extern void syslinux_register_bios(void);
extern void init(void);

#endif /* _SYSLINUX_FIRMWARE_H */
31 changes: 31 additions & 0 deletions core/bios.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,36 @@ bool bios_ipappend_strings(char **list, int *count)
extern char *bios_get_config_file_name(void);
extern void bios_get_serial_console_info(uint16_t *, uint16_t *, uint16_t *);

void *__syslinux_adv_ptr;
size_t __syslinux_adv_size;

void bios_adv_init(void)
{
static com32sys_t reg;

reg.eax.w[0] = 0x0025;
__intcall(0x22, &reg, &reg);

reg.eax.w[0] = 0x001c;
__intcall(0x22, &reg, &reg);
__syslinux_adv_ptr = MK_PTR(reg.es, reg.ebx.w[0]);
__syslinux_adv_size = reg.ecx.w[0];
}

int bios_adv_write(void)
{
static com32sys_t reg;

reg.eax.w[0] = 0x001d;
__intcall(0x22, &reg, &reg);
return (reg.eflags.l & EFLAGS_CF) ? -1 : 0;
}

struct adv_ops bios_adv_ops = {
.init = bios_adv_init,
.write = bios_adv_write,
};

struct firmware bios_fw = {
.init = bios_init,
.scan_memory = bios_scan_memory,
Expand All @@ -74,6 +104,7 @@ struct firmware bios_fw = {
.ipappend_strings = bios_ipappend_strings,
.get_config_file_name = bios_get_config_file_name,
.get_serial_console_info = bios_get_serial_console_info,
.adv_ops = &bios_adv_ops,
};

void syslinux_register_bios(void)
Expand Down
45 changes: 0 additions & 45 deletions core/elflink/advwrite.c

This file was deleted.

116 changes: 0 additions & 116 deletions core/elflink/setadv.c

This file was deleted.

Loading

0 comments on commit e5b9b7e

Please sign in to comment.