1. 05 Mar, 2018 15 commits
    • Eric Snowberg's avatar
      sparc64: #blocks disk node method · ab4c93cb
      Eric Snowberg authored
      Return the number of blocks of storage associated with the device or
      instance. Where a "block" is a unit of storage consisting of the number
      of bytes returned by the package's "block-size" method. If the size cannot
      be determined, the #blocks method returns the maximum unsigned integer
      (which, because of Open Firmware's assumption of two's complement arithmetic,
      is equivalent to the signed number -1). If the number of blocks exceeds
      the range of an unsigned number, return 0 to alert the caller to try
      the #blocks64 command.
      Signed-off-by: default avatarEric Snowberg <eric.snowberg@oracle.com>
      Reviewed-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>
      ab4c93cb
    • Eric Snowberg's avatar
      ieee1275: block-size deblocker support method · ad6d8f50
      Eric Snowberg authored
      IEEE Std 1275-1994 Standard for Boot (Initialization Configuration)
      Firmware: Core Requirements and Practices
      
      3.8.3 deblocker support package
      
      Any package that uses the "deblocker" support package must define
      the following method, which the deblocker uses as a low-level
      interface to the device
      
      block-size ( -- block-len ) Return "granularity" for accesses to this
      device.
      Signed-off-by: default avatarEric Snowberg <eric.snowberg@oracle.com>
      Reviewed-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>
      ad6d8f50
    • Daniel Kiper's avatar
      ieee1275: no-data-command bus specific method · c422bb60
      Daniel Kiper authored
      IEEE 1275-1994 Standard for Boot (Initialization Configuration)
      Firmware: Core Requirements and Practices
      
      E.3.2.2 Bus-specific methods for bus nodes
      
      A package implementing the scsi-2 device type shall implement the
      following bus-specific method:
      
      no-data-command ( cmd-addr -- error? )
      Executes a simple SCSI command, automatically retrying under
      certain conditions.  cmd-addr is the address of a 6-byte command buffer
      containing an SCSI command that does not have a data transfer phase.
      Executes the command, retrying indefinitely with the same retry criteria
      as retry-command.
      
      error? is nonzero if an error occurred, zero otherwise.
      NOTE no-data-command is a convenience function. It provides
      no capabilities that are not present in retry-command, but for
      those commands that meet its restrictions, it is easier to use.
      Signed-off-by: default avatarEric Snowberg <eric.snowberg@oracle.com>
      Reviewed-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>
      c422bb60
    • Eric Snowberg's avatar
      ieee1275: set-address bus specific method · f02037af
      Eric Snowberg authored
      IEEE 1275-1994 Standard for Boot (Initialization Configuration)
      Firmware: Core Requirements and Practices
      E.3.2.2 Bus-specific methods for bus nodes
      
      A package implementing the scsi-2 device type shall implement the
      following bus-specific method:
      
       set-address ( unit# target# -- )
         Sets the SCSI target number (0x0..0xf) and unit number (0..7) to which
         subsequent commands apply.
      
      This function is for devices with #address-cells == 2
      Signed-off-by: default avatarEric Snowberg <eric.snowberg@oracle.com>
      Reviewed-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>
      f02037af
    • Eric Snowberg's avatar
      ieee1275: encode-unit command for 4 addr cell devs · 820c64e4
      Eric Snowberg authored
      Convert physical address to text unit-string.
      
      Convert phys.lo ... phys-high, the numerical representation, to unit-string,
      the text string representation of a physical address within the address
      space defined by this device node. The number of cells in the list
      phys.lo ... phys.hi is determined by the value of the #address-cells property
      of this node.
      
      This function is for devices with #address-cells == 4
      Signed-off-by: default avatarEric Snowberg <eric.snowberg@oracle.com>
      Reviewed-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>
      820c64e4
    • Eric Snowberg's avatar
      ieee1275: decode-unit command for 4 addr cell devs · 6003eb2f
      Eric Snowberg authored
      decode-unit ( addr len -- phys.lo ... phys.hi )
      
      Convert text unit-string to physical address.
      
      Convert unit-string, the text string representation, to phys.lo ... phys.hi,
      the numerical representation of a physical address within the address space
      defined by this device node. The number of cells in the list
      phys.lo ... phys.hi is determined by the value of the #address-cells
      property of this node.
      
      This function is for devices with #address-cells == 4
      Signed-off-by: default avatarEric Snowberg <eric.snowberg@oracle.com>
      Reviewed-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>
      6003eb2f
    • Eric Snowberg's avatar
      sparc64: Limit nvme of_path_of_nvme to just SPARC · f3582642
      Eric Snowberg authored
      Limit NVMe of_path_of_nvme to just SPARC hardware for now.  It has been
      found that non-Open Firmware hardware platforms can some how access
      this function.
      Signed-off-by: default avatarEric Snowberg <eric.snowberg@oracle.com>
      Reviewed-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>
      f3582642
    • John Paul Adrian Glaubitz's avatar
      ieee1275: Fix crash in of_path_of_nvme when of_path is empty · 25b2b22d
      John Paul Adrian Glaubitz authored
      The of_path_of_nvme function (commit 2391d579, ieee1275: add nvme
      support within ofpath) introduced a functional regression:
      
      On systems which are not based on Open Firmware but have at
      least one NVME device, find_obppath will return NULL and thus
      trying to append the disk name to of_path will result in a
      crash.
      
      The proper behavior of of_path_of_nvme is, however, to just
      return NULL in such cases, like other users of find_obppath,
      such as of_path_of_scsi.
      Signed-off-by: default avatarJohn Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
      Reviewed-by: default avatarEric Snowberg <eric.snowberg@oracle.com>
      Reviewed-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>
      25b2b22d
    • Peter Jones's avatar
      .mod files: Strip annobin annotations and .eh_frame, and their relocations · 413f1e13
      Peter Jones authored
      This way debuginfo built from the .module will still include this
      information, but the final result won't have the data we don't actually
      need in the modules, either on-disk, loaded at runtime, or in prebuilt
      images.
      Signed-off-by: default avatarPeter Jones <pjones@redhat.com>
      Reviewed-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>
      413f1e13
    • Peter Jones's avatar
      mkimage: avoid copying relocations for sections that won't be copied. · ebc825b5
      Peter Jones authored
      Some versions of gcc include a plugin called "annobin", and in some
      build systems this is enabled by default.  This plugin creates special
      ELF note sections to track which ABI-breaking features are used by a
      binary, as well as a series of relocations to annotate where.
      
      If grub is compiled with this feature, then when grub-mkimage translates
      the binary to another file format which does not strongly associate
      relocation data with sections (i.e. when platform is *-efi), these
      relocations appear to be against the .text section rather than the
      original note section.  When the binary is loaded by the PE runtime
      loader, hilarity ensues.
      
      This issue is not necessarily limited to the annobin, but could arise
      any time there are relocations in sections that are not represented in
      grub-mkimage's output.
      
      This patch seeks to avoid this issue by only including relocations that
      refer to sections which will be included in the final binary.
      
      As an aside, this should also obviate the need to avoid -funwind-tables,
      -fasynchronous-unwind-tables, and any sections similar to .eh_frame in
      the future.  I've tested it on x86-64-efi with the following gcc command
      line options (as recorded by -grecord-gcc-flags), but I still need to
      test the result on some other platforms that have been problematic in
      the past (especially ARM Aarch64) before I feel comfortable making
      changes to the configure.ac bits:
      
      GNU C11 7.2.1 20180116 (Red Hat 7.2.1-7) -mno-mmx -mno-sse -mno-sse2 -mno-sse3 -mno-3dnow -msoft-float -mno-stack-arg-probe -mcmodel=large -mno-red-zone -m64 -mtune=generic -march=x86-64 -g3 -Os -freg-struct-return -fno-stack-protector -ffreestanding -funwind-tables -fasynchronous-unwind-tables -fno-strict-aliasing -fstack-clash-protection -fno-ident -fplugin=annobin
      Signed-off-by: default avatarPeter Jones <pjones@redhat.com>
      Reviewed-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>
      ebc825b5
    • Peter Jones's avatar
      mkimage: refactor a bunch of section data into a struct. · 7542af69
      Peter Jones authored
      This basically moves a bunch of the section information we pass around a
      lot into a struct, and passes a pointer to a single one of those
      instead.
      
      This shouldn't change the binary file output or the "grub-mkimage -v"
      output in any way.
      Signed-off-by: default avatarPeter Jones <pjones@redhat.com>
      Reviewed-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>
      7542af69
    • Peter Jones's avatar
      mkimage: make locate_sections() set up vaddresses as well. · e30de949
      Peter Jones authored
      This puts both kinds of address initialization at the same place, and also lets
      us iterate through the section list one time fewer.
      Signed-off-by: default avatarPeter Jones <pjones@redhat.com>
      Reviewed-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>
      e30de949
    • Peter Jones's avatar
      mkimage: rename a couple of things to be less confusing later. · 594ac315
      Peter Jones authored
      This renames some things:
      
      - the "strtab" and "strtab_section" in relocate_symbols are changed to "symtab"
        instead, so as to be less confusing when "strtab" is moved to a struct in a
        later patch.
      
      - The places where we pass section_vaddresses to functions are changed to also
        be called section_vaddresses"inside those functions, so I get less confused
        when I put addresses and vaddresses in a struct in a later patch.
      Signed-off-by: default avatarPeter Jones <pjones@redhat.com>
      Reviewed-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>
      594ac315
    • Peter Jones's avatar
      mkimage: make it easier to run syntax checkers on grub-mkimagexx.c · 352868d1
      Peter Jones authored
      This makes it so you can treat grub-mkimagexx.c as a file you can build
      directly, so syntax checkers like vim's "syntastic" plugin, which uses
      "gcc -x c -fsyntax-only" to build it, will work.
      
      One still has to do whatever setup is required to make it pick the right
      include dirs, which -W options we use, etc., but this makes it so you
      can do the checking on the file you're editing, rather than on a
      different file.
      Signed-off-by: default avatarPeter Jones <pjones@redhat.com>
      Reviewed-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>
      352868d1
    • Peter Jones's avatar
      aout.h: Fix missing include. · e1ead149
      Peter Jones authored
      grub_aout_load() has a grub_file_t parameter, and depending on what order
      includes land in, it's sometimes not defined.  This patch explicitly adds
      file.h to aout.h so that it will always be defined.
      Signed-off-by: default avatarPeter Jones <pjones@redhat.com>
      Reviewed-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>
      e1ead149
  2. 26 Feb, 2018 1 commit
  3. 23 Feb, 2018 12 commits
  4. 14 Feb, 2018 3 commits
    • Steve McIntyre's avatar
      Make grub-install check for errors from efibootmgr · 6400613a
      Steve McIntyre authored
      Code is currently ignoring errors from efibootmgr, giving users
      clearly bogus output like:
      
              Setting up grub-efi-amd64 (2.02~beta3-4) ...
              Installing for x86_64-efi platform.
              Could not delete variable: No space left on device
              Could not prepare Boot variable: No space left on device
              Installation finished. No error reported.
      
      and then potentially unbootable systems. If efibootmgr fails, grub-install
      should know that and report it!
      
      We've been using similar patch in Debian now for some time, with no ill effects.
      Signed-off-by: default avatarSteve McIntyre <93sam@debian.org>
      Reviewed-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>
      6400613a
    • Eric Snowberg's avatar
      sparc64: fix OF path names for sun4v systems · d85c76b5
      Eric Snowberg authored
      Fix the Open Firmware (OF) path property for sun4v SPARC systems.
      These platforms do not have a /sas/ within their path. Over time
      different OF addressing schemes have been supported. There
      is no generic addressing scheme that works across every HBA.
      
      It looks that this functionality will not work if you try to cross-install
      SPARC GRUB2 binary using e.g. x86 grub-install. By default it should work.
      However, we will also have other issues here, like lack of access to OF
      firmware/paths, which make such configs unusable anyway. So, let's leave
      this patch as is for time being. If somebody cares then he/she should fix
      the issue(s) at some point.
      Signed-off-by: default avatarEric Snowberg <eric.snowberg@oracle.com>
      Signed-off-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>
      Reviewed-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>
      d85c76b5
    • Eric Snowberg's avatar
      sparc64: Add blocklist GPT support for SPARC · 69e0a67b
      Eric Snowberg authored
      Add block-list GPT support for SPARC.  The OBP "load" and "boot" methods
      are partition aware and neither command can see the partition table. Also
      neither command can address the entire physical disk. When the install
      happens, grub generates the block-list entries based on the beginning of the
      physical disk, not the beginning of the partition. This patch fixes the
      block-list entries so they match what OBP expects during boot for a GPT disk.
      
      T5 and above now supports GPT as well as VTOC.
      
      This patch has been tested on T5-2 and newer SPARC systems.
      Signed-off-by: default avatarEric Snowberg <eric.snowberg@oracle.com>
      Reviewed-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>
      69e0a67b
  5. 29 Jan, 2018 2 commits
    • Stefan Fritsch's avatar
      ahci: Improve error handling · 566a03a6
      Stefan Fritsch authored
      Check the error bits in the interrupt status register. According to the
      AHCI 1.2 spec, "Interrupt sources that are disabled (‘0’) are still
      reflected in the status registers.", so this should work even though
      grub uses polling
      
      This fixes the following problem on a Fujitsu E744 laptop:
      
      Sometimes there is a very long delay (up to several minutes) when
      booting from hard disk. It seems accessing the DVD drive (which has no
      disk inserted) sometimes fails with some errors, which leads to each
      access being stalled until the 20s timeout triggers. This seems to
      happen when grub is trying to read filesystem/partition data.
      
      The problem is that the command_issue bit that is checked in the loop is
      only reset if the "HBA receives a FIS which clears the BSY, DRQ, and ERR
      bits for the command", but the ERR bit is never cleared. Therefore
      command_issue is never reset and grub waits for the timeout.
      
      The relevant bit in our case is the Task File Error Status (TFES), which
      is equivalent to the ERR bit 0 in tfd. But this patch also checks
      the other error bits except for the "Interface non-fatal error status"
      bit.
      Signed-off-by: default avatarStefan Fritsch <fritsch@genua.de>
      Reviewed-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>
      566a03a6
    • dann frazier's avatar
      Keep the native terminal active when enabling gfxterm · 52ef7b23
      dann frazier authored
      grub-mkconfig will set GRUB_TERMINAL_OUTPUT to "gfxterm" unless the user
      has overridden it. On EFI systems, this will stop output from going to the
      default "console" terminal. When the EFI fw console is configured to output to
      both serial and video, this will cause GRUB to only display on video - while
      continuing to accept input from both video and serial.
      
      Instead of switching from "console" to "gfxterm", let's output to both.
      Reviewed-by: default avatarDaniel Kiper <daniel.kiper@oracle.com>
      52ef7b23
  6. 06 Dec, 2017 3 commits
  7. 28 Nov, 2017 1 commit
  8. 24 Nov, 2017 1 commit
  9. 06 Oct, 2017 1 commit
  10. 07 Sep, 2017 1 commit