@@ -399,6 +399,8 @@
useful so that a dump capture kernel won't be
shot down by NMI
+ apple_set_os [KNL] Report that macOS is being booted to the firmware
+
autoconf= [IPV6]
See Documentation/networking/ipv6.rst.
@@ -19,6 +19,7 @@
bool efi_nochunk;
bool efi_nokaslr = !IS_ENABLED(CONFIG_RANDOMIZE_BASE);
bool efi_novamap;
+bool efi_apple_set_os;
static bool efi_noinitrd;
static bool efi_nosoftreserve;
@@ -73,6 +74,8 @@ efi_status_t efi_parse_options(char const *cmdline)
efi_loglevel = CONSOLE_LOGLEVEL_QUIET;
} else if (!strcmp(param, "noinitrd")) {
efi_noinitrd = true;
+ } else if (!strcmp(param, "apple_set_os")) {
+ efi_apple_set_os = true;
} else if (IS_ENABLED(CONFIG_X86_64) && !strcmp(param, "no5lvl")) {
efi_no5lvl = true;
} else if (IS_ENABLED(CONFIG_ARCH_HAS_MEM_ENCRYPT) &&
@@ -38,6 +38,7 @@ extern bool efi_nochunk;
extern int efi_loglevel;
extern int efi_mem_encrypt;
extern bool efi_novamap;
+extern bool efi_apple_set_os;
extern const efi_system_table_t *efi_system_table;
typedef union efi_dxe_services_table efi_dxe_services_table_t;
@@ -825,6 +826,19 @@ union apple_properties_protocol {
} mixed_mode;
};
+typedef struct apple_set_os_protocol apple_set_os_protocol_t;
+
+struct apple_set_os_protocol {
+ u64 version;
+ efi_status_t (__efiapi *set_os_version) (const char *);
+ efi_status_t (__efiapi *set_os_vendor) (const char *);
+ struct {
+ u32 version;
+ u32 set_os_version;
+ u32 set_os_vendor;
+ } mixed_mode;
+};
+
typedef u32 efi_tcg2_event_log_format;
#define INITRD_EVENT_TAG_ID 0x8F3B22ECU
@@ -223,6 +223,30 @@ static void retrieve_apple_device_properties(struct boot_params *boot_params)
}
}
+static void apple_set_os(void)
+{
+ efi_guid_t guid = APPLE_SET_OS_PROTOCOL_GUID;
+ apple_set_os_protocol_t *set_os;
+ efi_status_t status;
+
+ status = efi_bs_call(locate_protocol, &guid, NULL, (void **)&set_os);
+ if (status != EFI_SUCCESS)
+ return;
+
+ if (efi_table_attr(set_os, version) >= 2) {
+ status = efi_fn_call(set_os, set_os_vendor, "Apple Inc.");
+ if (status != EFI_SUCCESS)
+ efi_err("Failed to set OS vendor via apple_set_os\n");
+ }
+
+ /* The version being set doesn't seem to matter */
+ if (efi_table_attr(set_os, version) > 0) {
+ status = efi_fn_call(set_os, set_os_version, "Mac OS X 10.9");
+ if (status != EFI_SUCCESS)
+ efi_err("Failed to set OS version via apple_set_os\n");
+ }
+}
+
efi_status_t efi_adjust_memory_range_protection(unsigned long start,
unsigned long size)
{
@@ -321,6 +345,9 @@ static void setup_quirks(struct boot_params *boot_params)
if (IS_ENABLED(CONFIG_APPLE_PROPERTIES) &&
!memcmp(efistub_fw_vendor(), apple, sizeof(apple)))
retrieve_apple_device_properties(boot_params);
+
+ if (efi_apple_set_os)
+ apple_set_os();
}
/*
@@ -387,6 +387,7 @@ void efi_native_runtime_setup(void);
#define EFI_MEMORY_ATTRIBUTES_TABLE_GUID EFI_GUID(0xdcfa911d, 0x26eb, 0x469f, 0xa2, 0x20, 0x38, 0xb7, 0xdc, 0x46, 0x12, 0x20)
#define EFI_CONSOLE_OUT_DEVICE_GUID EFI_GUID(0xd3b36f2c, 0xd551, 0x11d4, 0x9a, 0x46, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d)
#define APPLE_PROPERTIES_PROTOCOL_GUID EFI_GUID(0x91bd12fe, 0xf6c3, 0x44fb, 0xa5, 0xb7, 0x51, 0x22, 0xab, 0x30, 0x3a, 0xe0)
+#define APPLE_SET_OS_PROTOCOL_GUID EFI_GUID(0xc5c5da95, 0x7d5c, 0x45e6, 0xb2, 0xf1, 0x3f, 0xd5, 0x2b, 0xb1, 0x00, 0x77)
#define EFI_TCG2_PROTOCOL_GUID EFI_GUID(0x607f766c, 0x7455, 0x42be, 0x93, 0x0b, 0xe4, 0xd7, 0x6d, 0xb2, 0x72, 0x0f)
#define EFI_TCG2_FINAL_EVENTS_TABLE_GUID EFI_GUID(0x1e2ed096, 0x30e2, 0x4254, 0xbd, 0x89, 0x86, 0x3b, 0xbe, 0xf8, 0x23, 0x25)
#define EFI_LOAD_FILE_PROTOCOL_GUID EFI_GUID(0x56ec3091, 0x954c, 0x11d2, 0x8e, 0x3f, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b)