Commit 95aa08a0 authored by Matt Domsch's avatar Matt Domsch Committed by David Mosberger

[PATCH] IA-64 specific part of Matt's patch:

changes:
* EFI_GUID macro defined per your suggestion - efi_guid_t is now a struct of
char[16].  Fixed all GUID definitions.
* Made one unified efi_guid_unparse() static inline in asm-ia64/efi.h.
Removed three other definitions of similar in efivars.c and mca.c.
* fixed endianness of fs/partitions/efi.c - thanks to Richard Hirst and his
GPT work in Parted.
* cleaned up find_valid_gpt() to make it easier to see what's going on and
avoid future NULL ptr deref cases if this code gets modified yet again.
* Only use partition table slots 0..max_p.  The previous behaviour would let
you delete a partition in the middle of the table, and on next boot all the
partition numbers above that would switch down.  This change makes it
consistent with the MSDOS concept of primary partitions.  /dev/sdaX exists
iff the partition type is not NULL.
* Moved CONFIG_PARTITION_EFI help text to fs/partitions/Config.help
parent 1088ca0a
...@@ -29,6 +29,9 @@ ...@@ -29,6 +29,9 @@
* *
* Changelog: * Changelog:
* *
* 25 Mar 2002 - Matt Domsch <Matt_Domsch@dell.com>
* move uuid_unparse() to include/asm-ia64/efi.h:efi_guid_unparse()
*
* 12 Feb 2002 - Matt Domsch <Matt_Domsch@dell.com> * 12 Feb 2002 - Matt Domsch <Matt_Domsch@dell.com>
* use list_for_each_safe when deleting vars. * use list_for_each_safe when deleting vars.
* remove ifdef CONFIG_SMP around include <linux/smp.h> * remove ifdef CONFIG_SMP around include <linux/smp.h>
...@@ -70,7 +73,7 @@ MODULE_AUTHOR("Matt Domsch <Matt_Domsch@Dell.com>"); ...@@ -70,7 +73,7 @@ MODULE_AUTHOR("Matt Domsch <Matt_Domsch@Dell.com>");
MODULE_DESCRIPTION("/proc interface to EFI Variables"); MODULE_DESCRIPTION("/proc interface to EFI Variables");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
#define EFIVARS_VERSION "0.04 2002-Feb-12" #define EFIVARS_VERSION "0.05 2002-Mar-26"
static int static int
efivar_read(char *page, char **start, off_t off, efivar_read(char *page, char **start, off_t off,
...@@ -141,20 +144,6 @@ proc_calc_metrics(char *page, char **start, off_t off, ...@@ -141,20 +144,6 @@ proc_calc_metrics(char *page, char **start, off_t off,
return len; return len;
} }
static void
uuid_unparse(efi_guid_t *guid, char *out)
{
sprintf(out, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
guid->data1, guid->data2, guid->data3,
guid->data4[0], guid->data4[1], guid->data4[2], guid->data4[3],
guid->data4[4], guid->data4[5], guid->data4[6], guid->data4[7]);
}
/* /*
* efivar_create_proc_entry() * efivar_create_proc_entry()
* Requires: * Requires:
...@@ -197,7 +186,7 @@ efivar_create_proc_entry(unsigned long variable_name_size, ...@@ -197,7 +186,7 @@ efivar_create_proc_entry(unsigned long variable_name_size,
private variables from another's. */ private variables from another's. */
*(short_name + strlen(short_name)) = '-'; *(short_name + strlen(short_name)) = '-';
uuid_unparse(vendor_guid, short_name + strlen(short_name)); efi_guid_unparse(vendor_guid, short_name + strlen(short_name));
/* Create the entry in proc */ /* Create the entry in proc */
......
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
* Purpose: Generic MCA handling layer * Purpose: Generic MCA handling layer
* *
* Updated for latest kernel * Updated for latest kernel
* Copyright (C) 2002 Dell Computer Corporation
* Copyright (C) Matt Domsch (Matt_Domsch@dell.com)
*
* Copyright (C) 2002 Intel * Copyright (C) 2002 Intel
* Copyright (C) Jenna Hall (jenna.s.hall@intel.com) * Copyright (C) Jenna Hall (jenna.s.hall@intel.com)
* *
...@@ -15,6 +18,8 @@ ...@@ -15,6 +18,8 @@
* Copyright (C) 1999 Silicon Graphics, Inc. * Copyright (C) 1999 Silicon Graphics, Inc.
* Copyright (C) Vijay Chander(vijay@engr.sgi.com) * Copyright (C) Vijay Chander(vijay@engr.sgi.com)
* *
* 02/03/25 M. Domsch GUID cleanups
*
* 02/01/04 J. Hall Aligned MCA stack to 16 bytes, added platform vs. CPU * 02/01/04 J. Hall Aligned MCA stack to 16 bytes, added platform vs. CPU
* error flag, set SAL default return values, changed * error flag, set SAL default return values, changed
* error record structure to linked list, added init call * error record structure to linked list, added init call
...@@ -348,17 +353,13 @@ static int ...@@ -348,17 +353,13 @@ static int
verify_guid (efi_guid_t *test, efi_guid_t *target) verify_guid (efi_guid_t *test, efi_guid_t *target)
{ {
int rc; int rc;
char out[40];
if ((rc = memcmp((void *)test, (void *)target, sizeof(efi_guid_t)))) { if ((rc = efi_guidcmp(*test, *target))) {
IA64_MCA_DEBUG("ia64_mca_print: invalid guid = " IA64_MCA_DEBUG(KERN_DEBUG
"{ %08x, %04x, %04x, { %#02x, %#02x, %#02x, %#02x, " "verify_guid: invalid GUID = %s\n",
"%#02x, %#02x, %#02x, %#02x, } } \n ", efi_guid_unparse(test, out));
test->data1, test->data2, test->data3, test->data4[0],
test->data4[1], test->data4[2], test->data4[3],
test->data4[4], test->data4[5], test->data4[6],
test->data4[7]);
} }
return rc; return rc;
} }
...@@ -856,11 +857,8 @@ ia64_init_handler (struct pt_regs *regs) ...@@ -856,11 +857,8 @@ ia64_init_handler (struct pt_regs *regs)
void void
ia64_log_prt_guid (efi_guid_t *p_guid, prfunc_t prfunc) ia64_log_prt_guid (efi_guid_t *p_guid, prfunc_t prfunc)
{ {
printk("GUID = { %08x, %04x, %04x, { %#02x, %#02x, %#02x, %#02x, " char out[40];
"%#02x, %#02x, %#02x, %#02x, } } \n ", p_guid->data1, printk(KERN_DEBUG "GUID = %s\n", efi_guid_unparse(p_guid, out));
p_guid->data2, p_guid->data3, p_guid->data4[0], p_guid->data4[1],
p_guid->data4[2], p_guid->data4[3], p_guid->data4[4],
p_guid->data4[5], p_guid->data4[6], p_guid->data4[7]);
} }
static void static void
...@@ -1754,7 +1752,7 @@ ia64_log_processor_info_print(sal_log_record_header_t *lh, prfunc_t prfunc) ...@@ -1754,7 +1752,7 @@ ia64_log_processor_info_print(sal_log_record_header_t *lh, prfunc_t prfunc)
ia64_log_prt_section_header(slsh, prfunc); ia64_log_prt_section_header(slsh, prfunc);
#endif // MCA_PRT_XTRA_DATA for test only @FVL #endif // MCA_PRT_XTRA_DATA for test only @FVL
if (verify_guid((void *)&slsh->guid, (void *)&(SAL_PROC_DEV_ERR_SECT_GUID))) { if (verify_guid(&slsh->guid, &(SAL_PROC_DEV_ERR_SECT_GUID))) {
IA64_MCA_DEBUG("ia64_mca_log_print: unsupported record section\n"); IA64_MCA_DEBUG("ia64_mca_log_print: unsupported record section\n");
continue; continue;
} }
......
...@@ -32,13 +32,18 @@ typedef unsigned long efi_status_t; ...@@ -32,13 +32,18 @@ typedef unsigned long efi_status_t;
typedef u8 efi_bool_t; typedef u8 efi_bool_t;
typedef u16 efi_char16_t; /* UNICODE character */ typedef u16 efi_char16_t; /* UNICODE character */
typedef struct { typedef struct {
u32 data1; u8 b[16];
u16 data2;
u16 data3;
u8 data4[8];
} efi_guid_t; } efi_guid_t;
#define EFI_GUID(a,b,c,d0,d1,d2,d3,d4,d5,d6,d7) \
((efi_guid_t) \
{{ (a) & 0xff, ((a) >> 8) & 0xff, ((a) >> 16) & 0xff, ((a) >> 24) & 0xff, \
(b) & 0xff, ((b) >> 8) & 0xff, \
(c) & 0xff, ((c) >> 8) & 0xff, \
(d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7) }})
/* /*
* Generic EFI table header * Generic EFI table header
*/ */
...@@ -165,21 +170,23 @@ typedef void efi_reset_system_t (int reset_type, efi_status_t status, ...@@ -165,21 +170,23 @@ typedef void efi_reset_system_t (int reset_type, efi_status_t status,
/* /*
* EFI Configuration Table and GUID definitions * EFI Configuration Table and GUID definitions
*/ */
#define NULL_GUID \
EFI_GUID( 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 )
#define MPS_TABLE_GUID \ #define MPS_TABLE_GUID \
((efi_guid_t) { 0xeb9d2d2f, 0x2d88, 0x11d3, { 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d }}) EFI_GUID( 0xeb9d2d2f, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d )
#define ACPI_TABLE_GUID \ #define ACPI_TABLE_GUID \
((efi_guid_t) { 0xeb9d2d30, 0x2d88, 0x11d3, { 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d }}) EFI_GUID( 0xeb9d2d30, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d )
#define ACPI_20_TABLE_GUID \ #define ACPI_20_TABLE_GUID \
((efi_guid_t) { 0x8868e871, 0xe4f1, 0x11d3, { 0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 }}) EFI_GUID( 0x8868e871, 0xe4f1, 0x11d3, 0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 )
#define SMBIOS_TABLE_GUID \ #define SMBIOS_TABLE_GUID \
((efi_guid_t) { 0xeb9d2d31, 0x2d88, 0x11d3, { 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d }}) EFI_GUID( 0xeb9d2d31, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d )
#define SAL_SYSTEM_TABLE_GUID \ #define SAL_SYSTEM_TABLE_GUID \
((efi_guid_t) { 0xeb9d2d32, 0x2d88, 0x11d3, { 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d }}) EFI_GUID( 0xeb9d2d32, 0x2d88, 0x11d3, 0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d )
typedef struct { typedef struct {
efi_guid_t guid; efi_guid_t guid;
...@@ -233,6 +240,17 @@ efi_guidcmp (efi_guid_t left, efi_guid_t right) ...@@ -233,6 +240,17 @@ efi_guidcmp (efi_guid_t left, efi_guid_t right)
return memcmp(&left, &right, sizeof (efi_guid_t)); return memcmp(&left, &right, sizeof (efi_guid_t));
} }
static inline char *
efi_guid_unparse(efi_guid_t *guid, char *out)
{
sprintf(out, "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
guid->b[0], guid->b[1], guid->b[2], guid->b[3],
guid->b[4], guid->b[5], guid->b[6], guid->b[7],
guid->b[8], guid->b[9], guid->b[10], guid->b[11],
guid->b[12], guid->b[13], guid->b[14], guid->b[15]);
return out;
}
extern void efi_init (void); extern void efi_init (void);
extern void efi_map_pal_code (void); extern void efi_map_pal_code (void);
extern void efi_memmap_walk (efi_freemem_callback_t callback, void *arg); extern void efi_memmap_walk (efi_freemem_callback_t callback, void *arg);
......
...@@ -241,32 +241,32 @@ enum { ...@@ -241,32 +241,32 @@ enum {
/* SAL Error Record Section GUID Definitions */ /* SAL Error Record Section GUID Definitions */
#define SAL_PROC_DEV_ERR_SECT_GUID \ #define SAL_PROC_DEV_ERR_SECT_GUID \
((efi_guid_t) { 0xe429faf1, 0x3cb7, 0x11d4, { 0xbc, 0xa7, 0x0, 0x80, \ EFI_GUID ( 0xe429faf1, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, \
0xc7, 0x3c, 0x88, 0x81 }} ) 0xc7, 0x3c, 0x88, 0x81 )
#define SAL_PLAT_MEM_DEV_ERR_SECT_GUID \ #define SAL_PLAT_MEM_DEV_ERR_SECT_GUID \
((efi_guid_t) { 0xe429faf2, 0x3cb7, 0x11d4, { 0xbc, 0xa7, 0x0, 0x80, \ EFI_GUID( 0xe429faf2, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, \
0xc7, 0x3c, 0x88, 0x81 }} ) 0xc7, 0x3c, 0x88, 0x81 )
#define SAL_PLAT_SEL_DEV_ERR_SECT_GUID \ #define SAL_PLAT_SEL_DEV_ERR_SECT_GUID \
((efi_guid_t) { 0xe429faf3, 0x3cb7, 0x11d4, { 0xbc, 0xa7, 0x0, 0x80, \ EFI_GUID( 0xe429faf3, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, \
0xc7, 0x3c, 0x88, 0x81 }} ) 0xc7, 0x3c, 0x88, 0x81 )
#define SAL_PLAT_PCI_BUS_ERR_SECT_GUID \ #define SAL_PLAT_PCI_BUS_ERR_SECT_GUID \
((efi_guid_t) { 0xe429faf4, 0x3cb7, 0x11d4, { 0xbc, 0xa7, 0x0, 0x80, \ EFI_GUID( 0xe429faf4, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, \
0xc7, 0x3c, 0x88, 0x81 }} ) 0xc7, 0x3c, 0x88, 0x81 )
#define SAL_PLAT_SMBIOS_DEV_ERR_SECT_GUID \ #define SAL_PLAT_SMBIOS_DEV_ERR_SECT_GUID \
((efi_guid_t) { 0xe429faf5, 0x3cb7, 0x11d4, { 0xbc, 0xa7, 0x0, 0x80, \ EFI_GUID( 0xe429faf5, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, \
0xc7, 0x3c, 0x88, 0x81 }} ) 0xc7, 0x3c, 0x88, 0x81 )
#define SAL_PLAT_PCI_COMP_ERR_SECT_GUID \ #define SAL_PLAT_PCI_COMP_ERR_SECT_GUID \
((efi_guid_t) { 0xe429faf6, 0x3cb7, 0x11d4, { 0xbc, 0xa7, 0x0, 0x80, \ EFI_GUID( 0xe429faf6, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, \
0xc7, 0x3c, 0x88, 0x81 }} ) 0xc7, 0x3c, 0x88, 0x81 )
#define SAL_PLAT_SPECIFIC_ERR_SECT_GUID \ #define SAL_PLAT_SPECIFIC_ERR_SECT_GUID \
((efi_guid_t) { 0xe429faf7, 0x3cb7, 0x11d4, { 0xbc, 0xa7, 0x0, 0x80, \ EFI_GUID( 0xe429faf7, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, \
0xc7, 0x3c, 0x88, 0x81 }} ) 0xc7, 0x3c, 0x88, 0x81 )
#define SAL_PLAT_HOST_CTLR_ERR_SECT_GUID \ #define SAL_PLAT_HOST_CTLR_ERR_SECT_GUID \
((efi_guid_t) { 0xe429faf8, 0x3cb7, 0x11d4, { 0xbc, 0xa7, 0x0, 0x80, \ EFI_GUID( 0xe429faf8, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, \
0xc7, 0x3c, 0x88, 0x81 }} ) 0xc7, 0x3c, 0x88, 0x81 )
#define SAL_PLAT_BUS_ERR_SECT_GUID \ #define SAL_PLAT_BUS_ERR_SECT_GUID \
((efi_guid_t) { 0xe429faf9, 0x3cb7, 0x11d4, { 0xbc, 0xa7, 0x0, 0x80, \ EFI_GUID( 0xe429faf9, 0x3cb7, 0x11d4, 0xbc, 0xa7, 0x0, 0x80, \
0xc7, 0x3c, 0x88, 0x81 }} ) 0xc7, 0x3c, 0x88, 0x81 )
#define MAX_CACHE_ERRORS 6 #define MAX_CACHE_ERRORS 6
#define MAX_TLB_ERRORS 6 #define MAX_TLB_ERRORS 6
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment