42 #define colour FADT_SIGNATURE 45 #define AMAC_SIGNATURE ACPI_SIGNATURE ( 'A', 'M', 'A', 'C' ) 48 #define MACA_SIGNATURE ACPI_SIGNATURE ( 'M', 'A', 'C', 'A' ) 51 #define RTMA_SIGNATURE ACPI_SIGNATURE ( 'R', 'T', 'M', 'A' ) 57 #define ACPIMAC_MAX_SKIP 8 89 DBGC (
colour,
"ACPI could not decode base16 MAC \"%s\": %s\n",
151 char buf[ prefix_len + extractor->
len + 1 + 1 ];
152 char *
mac = &buf[prefix_len];
161 (
offset + skip +
sizeof ( buf ) ) <=
len ) ;
165 memcpy ( buf, ( ( (
const void * ) zsdt ) +
offset + skip ),
169 if (
memcmp ( buf, extractor->
prefix, prefix_len ) != 0 )
171 if ( buf[
sizeof ( buf ) - 2 ] !=
'#' )
173 if ( buf[
sizeof ( buf ) - 1 ] !=
'\0' )
179 mac[extractor->
len] =
'\0';
182 if ( (
rc = extractor->
decode (
mac, hw_addr ) ) != 0 )
271 if (
len >
sizeof (
mac ) )
274 return (
sizeof (
mac ) );
280 .description =
"System MAC",
281 .type = &setting_type_hex,
#define EINVAL
Invalid argument.
struct arbelprm_rc_send_wqe rc
static int acpimac_extract_rtxmac(const struct acpi_header *zsdt, size_t len, size_t offset, void *data)
Extract "_RTXMAC_" MAC address from DSDT/SSDT.
static int acpimac_extract_auxmac(const struct acpi_header *zsdt, size_t len, size_t offset, void *data)
Extract "_AUXMAC_" MAC address from DSDT/SSDT.
#define ACPIMAC_MAX_SKIP
Maximum number of bytes to skip after ACPI signature.
#define MACA_SIGNATURE
MACA signature.
#define AMAC_SIGNATURE
AMAC signature.
#define ENOENT
No such file or directory.
static int acpimac_extract(const struct acpi_header *zsdt, size_t len, size_t offset, void *data, struct acpimac_extractor *extractor)
Extract MAC address from DSDT/SSDT.
#define SETTING_MISC
Miscellaneous settings.
uint8_t mac[ETH_ALEN]
MAC address.
const struct setting sysmac_setting __setting(SETTING_MISC, sysmac)
System MAC address setting.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
int acpi_mac(uint8_t *hw_addr)
Extract MAC address from DSDT/SSDT.
const struct setting * setting
Setting.
static int acpimac_decode_base16(const char *mac, uint8_t *hw_addr)
Decode Base16-encoded MAC address.
static int acpimac_decode_raw(const char *mac, uint8_t *hw_addr)
Decode raw MAC address.
char * strerror(int errno)
Retrieve string representation of error number.
#define colour
Colour for debug messages.
const char * eth_ntoa(const void *ll_addr)
Transcribe Ethernet address.
size_t strlen(const char *src)
Get length of string.
static int is_valid_ether_addr(const void *addr)
Check if Ethernet address is valid.
const struct settings_scope builtin_scope
Built-in setting scope.
static struct acpimac_extractor acpimac_auxmac
"_AUXMAC_" extraction mechanism
struct builtin_setting sysmac_builtin_setting __builtin_setting
System MAC address built-in setting.
#define RTMA_SIGNATURE
RTMA signature.
uint8_t data[48]
Additional event data.
int acpi_extract(uint32_t signature, void *data, int(*extract)(const struct acpi_header *zsdt, size_t len, size_t offset, void *data))
Extract value from DSDT/SSDT.
static struct acpimac_extractor acpimac_rtxmac
"_RTXMAC_" extraction mechanism
uint16_t offset
Offset to command line.
static int sysmac_fetch(void *data, size_t len)
Fetch system MAC address setting.
int memcmp(const void *first, const void *second, size_t len)
Compare memory regions.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)