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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/sys/efi_partition.h
          +++ new/usr/src/uts/common/sys/efi_partition.h
↓ open down ↓ 14 lines elided ↑ open up ↑
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
  23   23   * Copyright 2012 Nexenta Systems, Inc.  All rights reserved.
  24   24   * Copyright 2014 Toomas Soome <tsoome@me.com>
       25 + * Copyright (c) 2019, Joyent, Inc.
  25   26   */
  26   27  
  27   28  #ifndef _SYS_EFI_PARTITION_H
  28   29  #define _SYS_EFI_PARTITION_H
  29   30  
  30   31  #include <sys/uuid.h>
       32 +#include <sys/stddef.h>
  31   33  
  32   34  #ifdef  __cplusplus
  33   35  extern "C" {
  34   36  #endif
  35   37  
  36   38  /*
  37   39   * GUID Partition Table Header
  38   40   */
  39   41  
  40   42  #define EFI_LABEL_SIZE  512
  41   43  #define LEN_EFI_PAD     (EFI_LABEL_SIZE - \
  42   44                              ((5 * sizeof (diskaddr_t)) + \
  43   45                              (7 * sizeof (uint_t)) + \
  44   46                              (8 * sizeof (char)) + \
  45   47                              (1 * (sizeof (struct uuid)))))
  46   48  
  47   49  #define EFI_SIGNATURE   0x5452415020494645ULL
  48   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 +
  49   61  /* EFI Guid Partition Table Header -- little endian on-disk format */
  50   62  typedef struct efi_gpt {
  51   63          uint64_t        efi_gpt_Signature;
  52   64          uint_t          efi_gpt_Revision;
  53   65          uint_t          efi_gpt_HeaderSize;
  54   66          uint_t          efi_gpt_HeaderCRC32;
  55   67          uint_t          efi_gpt_Reserved1;
  56   68          diskaddr_t      efi_gpt_MyLBA;
  57   69          diskaddr_t      efi_gpt_AlternateLBA;
  58   70          diskaddr_t      efi_gpt_FirstUsableLBA;
↓ open down ↓ 156 lines elided ↑ open up ↑
 215  227  } dk_gpt_t;
 216  228  
 217  229  /* possible values for "efi_flags" */
 218  230  #define EFI_GPT_PRIMARY_CORRUPT 0x1     /* primary label corrupt */
 219  231  
 220  232  /* the private ioctl between libefi and the driver */
 221  233  typedef struct dk_efi {
 222  234          diskaddr_t       dki_lba;       /* starting block */
 223  235          len_t            dki_length;    /* length in bytes */
 224  236          union {
 225      -                efi_gpt_t       *_dki_data;
      237 +                efi_gpt_t       *_dki_data;
 226  238                  uint64_t        _dki_data_64;
 227  239          } dki_un;
 228  240  #define dki_data        dki_un._dki_data
 229  241  #define dki_data_64     dki_un._dki_data_64
 230  242  } dk_efi_t;
 231  243  
 232  244  struct partition64 {
 233  245          struct uuid     p_type;
 234  246          uint_t          p_partno;
 235  247          uint_t          p_resv1;
↓ open down ↓ 25 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX