Print this page
10570 Need workaround to EFI boot on AMI BIOS


   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright 2012 Nexenta Systems, Inc.  All rights reserved.
  24  * Copyright 2014 Toomas Soome <tsoome@me.com>

  25  */
  26 
  27 #ifndef _SYS_EFI_PARTITION_H
  28 #define _SYS_EFI_PARTITION_H
  29 
  30 #include <sys/uuid.h>

  31 
  32 #ifdef  __cplusplus
  33 extern "C" {
  34 #endif
  35 
  36 /*
  37  * GUID Partition Table Header
  38  */
  39 
  40 #define EFI_LABEL_SIZE  512
  41 #define LEN_EFI_PAD     (EFI_LABEL_SIZE - \
  42                             ((5 * sizeof (diskaddr_t)) + \
  43                             (7 * sizeof (uint_t)) + \
  44                             (8 * sizeof (char)) + \
  45                             (1 * (sizeof (struct uuid)))))
  46 
  47 #define EFI_SIGNATURE   0x5452415020494645ULL
  48 










  49 /* EFI Guid Partition Table Header -- little endian on-disk format */
  50 typedef struct efi_gpt {
  51         uint64_t        efi_gpt_Signature;
  52         uint_t          efi_gpt_Revision;
  53         uint_t          efi_gpt_HeaderSize;
  54         uint_t          efi_gpt_HeaderCRC32;
  55         uint_t          efi_gpt_Reserved1;
  56         diskaddr_t      efi_gpt_MyLBA;
  57         diskaddr_t      efi_gpt_AlternateLBA;
  58         diskaddr_t      efi_gpt_FirstUsableLBA;
  59         diskaddr_t      efi_gpt_LastUsableLBA;
  60         struct uuid     efi_gpt_DiskGUID;
  61         diskaddr_t      efi_gpt_PartitionEntryLBA;
  62         uint_t          efi_gpt_NumberOfPartitionEntries;
  63         uint_t          efi_gpt_SizeOfPartitionEntry;
  64         uint_t          efi_gpt_PartitionEntryArrayCRC32;
  65         char            efi_gpt_Reserved2[LEN_EFI_PAD];
  66 } efi_gpt_t;
  67 
  68 /* EFI Guid Partition Entry Attributes -- little endian format */




   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright 2012 Nexenta Systems, Inc.  All rights reserved.
  24  * Copyright 2014 Toomas Soome <tsoome@me.com>
  25  * Copyright (c) 2019, Joyent, Inc.
  26  */
  27 
  28 #ifndef _SYS_EFI_PARTITION_H
  29 #define _SYS_EFI_PARTITION_H
  30 
  31 #include <sys/uuid.h>
  32 #include <sys/stddef.h>
  33 
  34 #ifdef  __cplusplus
  35 extern "C" {
  36 #endif
  37 
  38 /*
  39  * GUID Partition Table Header
  40  */
  41 
  42 #define EFI_LABEL_SIZE  512
  43 #define LEN_EFI_PAD     (EFI_LABEL_SIZE - \
  44                             ((5 * sizeof (diskaddr_t)) + \
  45                             (7 * sizeof (uint_t)) + \
  46                             (8 * sizeof (char)) + \
  47                             (1 * (sizeof (struct uuid)))))
  48 
  49 #define EFI_SIGNATURE   0x5452415020494645ULL
  50 
  51 /*
  52  * Although the EFI spec is clear that sizeof (efi_gpt_t) is a valid value
  53  * (512), at least one EFI system (AMI v4.6.4.1) incorrectly expects this to be
  54  * exactly the size of the structure defined in the spec, that is, 92.
  55  *
  56  * As the reserved section is never used, the modified value works fine
  57  * everywhere else.
  58  */
  59 #define EFI_HEADER_SIZE (offsetof(efi_gpt_t, efi_gpt_Reserved2))
  60 
  61 /* EFI Guid Partition Table Header -- little endian on-disk format */
  62 typedef struct efi_gpt {
  63         uint64_t        efi_gpt_Signature;
  64         uint_t          efi_gpt_Revision;
  65         uint_t          efi_gpt_HeaderSize;
  66         uint_t          efi_gpt_HeaderCRC32;
  67         uint_t          efi_gpt_Reserved1;
  68         diskaddr_t      efi_gpt_MyLBA;
  69         diskaddr_t      efi_gpt_AlternateLBA;
  70         diskaddr_t      efi_gpt_FirstUsableLBA;
  71         diskaddr_t      efi_gpt_LastUsableLBA;
  72         struct uuid     efi_gpt_DiskGUID;
  73         diskaddr_t      efi_gpt_PartitionEntryLBA;
  74         uint_t          efi_gpt_NumberOfPartitionEntries;
  75         uint_t          efi_gpt_SizeOfPartitionEntry;
  76         uint_t          efi_gpt_PartitionEntryArrayCRC32;
  77         char            efi_gpt_Reserved2[LEN_EFI_PAD];
  78 } efi_gpt_t;
  79 
  80 /* EFI Guid Partition Entry Attributes -- little endian format */