mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
Linux 3.9
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iQEcBAABAgAGBQJRfcB+AAoJEHm+PkMAQRiGmLAH/0bIpdOYylJhRDmVOztXpANP jRYYH00UiSIBz8XO463dbbtevT2pB8pIw5TCxBWBi/V5rnJS9X5pvAHyNZBDUvYd 3BQCQ2cnQ+6stFpi4o6NciZzQShDGMmUxAOD6ejZM35/P2l+ZKrNqBwy3R4oeMuZ /WUYZTCfFF3G7qgkHoOwIjM6c34v0tpqLfx4R5CdTnKe0Ow0OGb5ko5+lefD6i9m 6cd2GFlWeIUvw0FSMLyB+HN6Tkf3JnwrklP+vuLNV+uOq5BLwggGc6A1eS51IuVJ e/ZkGTtirz+mZiG5lvqSXHaVEObPsbm32XfVVHp1SiE+TIugDb2uhtEQEv+a43w= =UOGY -----END PGP SIGNATURE----- Merge tag 'v3.9' into efi-for-tip2 Resolve conflicts for Ingo. Conflicts: drivers/firmware/Kconfig drivers/firmware/efivars.c Signed-off-by: Matt Fleming <[email protected]>
This commit is contained in:
commit
a614e1923d
615 changed files with 6458 additions and 4050 deletions
|
|
@ -1,6 +1,7 @@
|
|||
#include <linux/efi.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/pstore.h>
|
||||
#include <linux/ucs2_string.h>
|
||||
|
||||
#define DUMP_NAME_LEN 52
|
||||
|
||||
|
|
@ -140,15 +141,15 @@ static int efi_pstore_erase_func(struct efivar_entry *entry, void *data)
|
|||
efi_guid_t vendor = LINUX_EFI_CRASH_GUID;
|
||||
efi_char16_t efi_name_old[DUMP_NAME_LEN];
|
||||
efi_char16_t *efi_name = ed->name;
|
||||
unsigned long utf16_len = utf16_strlen(ed->name);
|
||||
unsigned long ucs2_len = ucs2_strlen(ed->name);
|
||||
char name_old[DUMP_NAME_LEN];
|
||||
int i;
|
||||
|
||||
if (efi_guidcmp(entry->var.VendorGuid, vendor))
|
||||
return 0;
|
||||
|
||||
if (utf16_strncmp(entry->var.VariableName,
|
||||
efi_name, (size_t)utf16_len)) {
|
||||
if (ucs2_strncmp(entry->var.VariableName,
|
||||
efi_name, (size_t)ucs2_len)) {
|
||||
/*
|
||||
* Check if an old format, which doesn't support
|
||||
* holding multiple logs, remains.
|
||||
|
|
@ -159,8 +160,8 @@ static int efi_pstore_erase_func(struct efivar_entry *entry, void *data)
|
|||
for (i = 0; i < DUMP_NAME_LEN; i++)
|
||||
efi_name_old[i] = name_old[i];
|
||||
|
||||
if (utf16_strncmp(entry->var.VariableName, efi_name_old,
|
||||
utf16_strlen(efi_name_old)))
|
||||
if (ucs2_strncmp(entry->var.VariableName, efi_name_old,
|
||||
ucs2_strlen(efi_name_old)))
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ static int generic_ops_register(void)
|
|||
generic_ops.get_variable = efi.get_variable;
|
||||
generic_ops.set_variable = efi.set_variable;
|
||||
generic_ops.get_next_variable = efi.get_next_variable;
|
||||
generic_ops.query_variable_info = efi.query_variable_info;
|
||||
generic_ops.query_variable_store = efi_query_variable_store;
|
||||
|
||||
return efivars_register(&generic_efivars, &generic_ops, efi_kobj);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@
|
|||
|
||||
#include <linux/efi.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/ucs2_string.h>
|
||||
|
||||
#define EFIVARS_VERSION "0.08"
|
||||
#define EFIVARS_DATE "2004-May-17"
|
||||
|
|
@ -407,7 +408,7 @@ efivar_create_sysfs_entry(struct efivar_entry *new_var)
|
|||
efi_char16_t *variable_name;
|
||||
|
||||
variable_name = new_var->var.VariableName;
|
||||
variable_name_size = utf16_strlen(variable_name) * sizeof(efi_char16_t);
|
||||
variable_name_size = ucs2_strlen(variable_name) * sizeof(efi_char16_t);
|
||||
|
||||
/*
|
||||
* Length of the variable bytes in ASCII, plus the '-' separator,
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@
|
|||
#include <linux/device.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/ctype.h>
|
||||
#include <linux/ucs2_string.h>
|
||||
|
||||
/* Private pointer to registered efivars */
|
||||
static struct efivars *__efivars;
|
||||
|
|
@ -91,7 +92,7 @@ validate_load_option(struct efi_variable *var, int match, u8 *buffer,
|
|||
u16 filepathlength;
|
||||
int i, desclength = 0, namelen;
|
||||
|
||||
namelen = utf16_strnlen(var->VariableName, sizeof(var->VariableName));
|
||||
namelen = ucs2_strnlen(var->VariableName, sizeof(var->VariableName));
|
||||
|
||||
/* Either "Boot" or "Driver" followed by four digits of hex */
|
||||
for (i = match; i < match+4; i++) {
|
||||
|
|
@ -114,7 +115,7 @@ validate_load_option(struct efi_variable *var, int match, u8 *buffer,
|
|||
* There's no stored length for the description, so it has to be
|
||||
* found by hand
|
||||
*/
|
||||
desclength = utf16_strsize((efi_char16_t *)(buffer + 6), len - 6) + 2;
|
||||
desclength = ucs2_strsize((efi_char16_t *)(buffer + 6), len - 6) + 2;
|
||||
|
||||
/* Each boot entry must have a descriptor */
|
||||
if (!desclength)
|
||||
|
|
@ -228,24 +229,12 @@ EXPORT_SYMBOL_GPL(efivar_validate);
|
|||
static efi_status_t
|
||||
check_var_size(u32 attributes, unsigned long size)
|
||||
{
|
||||
u64 storage_size, remaining_size, max_size;
|
||||
efi_status_t status;
|
||||
const struct efivar_operations *fops = __efivars->ops;
|
||||
|
||||
if (!fops->query_variable_info)
|
||||
if (!fops->query_variable_store)
|
||||
return EFI_UNSUPPORTED;
|
||||
|
||||
status = fops->query_variable_info(attributes, &storage_size,
|
||||
&remaining_size, &max_size);
|
||||
|
||||
if (status != EFI_SUCCESS)
|
||||
return status;
|
||||
|
||||
if (!storage_size || size > remaining_size || size > max_size ||
|
||||
(remaining_size - size) < (storage_size / 2))
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
|
||||
return status;
|
||||
return fops->query_variable_store(attributes, size);
|
||||
}
|
||||
|
||||
static int efi_status_to_err(efi_status_t status)
|
||||
|
|
@ -288,9 +277,9 @@ static bool variable_is_present(efi_char16_t *variable_name, efi_guid_t *vendor,
|
|||
unsigned long strsize1, strsize2;
|
||||
bool found = false;
|
||||
|
||||
strsize1 = utf16_strsize(variable_name, 1024);
|
||||
strsize1 = ucs2_strsize(variable_name, 1024);
|
||||
list_for_each_entry_safe(entry, n, head, list) {
|
||||
strsize2 = utf16_strsize(entry->var.VariableName, 1024);
|
||||
strsize2 = ucs2_strsize(entry->var.VariableName, 1024);
|
||||
if (strsize1 == strsize2 &&
|
||||
!memcmp(variable_name, &(entry->var.VariableName),
|
||||
strsize2) &&
|
||||
|
|
@ -594,7 +583,7 @@ int efivar_entry_set(struct efivar_entry *entry, u32 attributes,
|
|||
return -EEXIST;
|
||||
}
|
||||
|
||||
status = check_var_size(attributes, size + utf16_strsize(name, 1024));
|
||||
status = check_var_size(attributes, size + ucs2_strsize(name, 1024));
|
||||
if (status == EFI_SUCCESS || status == EFI_UNSUPPORTED)
|
||||
status = ops->set_variable(name, &vendor,
|
||||
attributes, size, data);
|
||||
|
|
@ -630,7 +619,7 @@ int efivar_entry_set_safe(efi_char16_t *name, efi_guid_t vendor, u32 attributes,
|
|||
unsigned long flags;
|
||||
efi_status_t status;
|
||||
|
||||
if (!ops->query_variable_info)
|
||||
if (!ops->query_variable_store)
|
||||
return -ENOSYS;
|
||||
|
||||
if (!block && spin_trylock_irqsave(&__efivars->lock, flags))
|
||||
|
|
@ -638,7 +627,7 @@ int efivar_entry_set_safe(efi_char16_t *name, efi_guid_t vendor, u32 attributes,
|
|||
else
|
||||
spin_lock_irqsave(&__efivars->lock, flags);
|
||||
|
||||
status = check_var_size(attributes, size + utf16_strsize(name, 1024));
|
||||
status = check_var_size(attributes, size + ucs2_strsize(name, 1024));
|
||||
if (status != EFI_SUCCESS) {
|
||||
spin_unlock_irqrestore(&__efivars->lock, flags);
|
||||
return -ENOSPC;
|
||||
|
|
@ -679,8 +668,8 @@ struct efivar_entry *efivar_entry_find(efi_char16_t *name, efi_guid_t guid,
|
|||
WARN_ON(!spin_is_locked(&__efivars->lock));
|
||||
|
||||
list_for_each_entry_safe(entry, n, head, list) {
|
||||
strsize1 = utf16_strsize(name, 1024);
|
||||
strsize2 = utf16_strsize(entry->var.VariableName, 1024);
|
||||
strsize1 = ucs2_strsize(name, 1024);
|
||||
strsize2 = ucs2_strsize(entry->var.VariableName, 1024);
|
||||
if (strsize1 == strsize2 &&
|
||||
!memcmp(name, &(entry->var.VariableName), strsize1) &&
|
||||
!efi_guidcmp(guid, entry->var.VendorGuid)) {
|
||||
|
|
@ -818,7 +807,7 @@ int efivar_entry_set_get_size(struct efivar_entry *entry, u32 attributes,
|
|||
/*
|
||||
* Ensure that the available space hasn't shrunk below the safe level
|
||||
*/
|
||||
status = check_var_size(attributes, *size + utf16_strsize(name, 1024));
|
||||
status = check_var_size(attributes, *size + ucs2_strsize(name, 1024));
|
||||
if (status != EFI_SUCCESS) {
|
||||
if (status != EFI_UNSUPPORTED) {
|
||||
err = efi_status_to_err(status);
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include <linux/reboot.h>
|
||||
#include <linux/efi.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/ucs2_string.h>
|
||||
|
||||
#define GSMI_SHUTDOWN_CLEAN 0 /* Clean Shutdown */
|
||||
/* TODO([email protected]): Tie in HARDLOCKUP_DETECTOR with NMIWDT */
|
||||
|
|
@ -300,7 +301,7 @@ static efi_status_t gsmi_get_variable(efi_char16_t *name,
|
|||
};
|
||||
efi_status_t ret = EFI_SUCCESS;
|
||||
unsigned long flags;
|
||||
size_t name_len = utf16_strnlen(name, GSMI_BUF_SIZE / 2);
|
||||
size_t name_len = ucs2_strnlen(name, GSMI_BUF_SIZE / 2);
|
||||
int rc;
|
||||
|
||||
if (name_len >= GSMI_BUF_SIZE / 2)
|
||||
|
|
@ -369,7 +370,7 @@ static efi_status_t gsmi_get_next_variable(unsigned long *name_size,
|
|||
return EFI_BAD_BUFFER_SIZE;
|
||||
|
||||
/* Let's make sure the thing is at least null-terminated */
|
||||
if (utf16_strnlen(name, GSMI_BUF_SIZE / 2) == GSMI_BUF_SIZE / 2)
|
||||
if (ucs2_strnlen(name, GSMI_BUF_SIZE / 2) == GSMI_BUF_SIZE / 2)
|
||||
return EFI_INVALID_PARAMETER;
|
||||
|
||||
spin_lock_irqsave(&gsmi_dev.lock, flags);
|
||||
|
|
@ -397,7 +398,7 @@ static efi_status_t gsmi_get_next_variable(unsigned long *name_size,
|
|||
|
||||
/* Copy the name back */
|
||||
memcpy(name, gsmi_dev.name_buf->start, GSMI_BUF_SIZE);
|
||||
*name_size = utf16_strnlen(name, GSMI_BUF_SIZE / 2) * 2;
|
||||
*name_size = ucs2_strnlen(name, GSMI_BUF_SIZE / 2) * 2;
|
||||
|
||||
/* copy guid to return buffer */
|
||||
memcpy(vendor, ¶m.guid, sizeof(param.guid));
|
||||
|
|
@ -423,7 +424,7 @@ static efi_status_t gsmi_set_variable(efi_char16_t *name,
|
|||
EFI_VARIABLE_BOOTSERVICE_ACCESS |
|
||||
EFI_VARIABLE_RUNTIME_ACCESS,
|
||||
};
|
||||
size_t name_len = utf16_strnlen(name, GSMI_BUF_SIZE / 2);
|
||||
size_t name_len = ucs2_strnlen(name, GSMI_BUF_SIZE / 2);
|
||||
efi_status_t ret = EFI_SUCCESS;
|
||||
int rc;
|
||||
unsigned long flags;
|
||||
|
|
|
|||
Loading…
Reference in a new issue