1. 17 Jul, 2017 1 commit
  2. 09 Jun, 2017 10 commits
  3. 13 Nov, 2016 1 commit
    • Lukas Wunner's avatar
      thunderbolt: Use Device ROM retrieved from EFI · c9cc3aaa
      Lukas Wunner authored
      
      
      Macs with Thunderbolt 1 do not have a unit-specific DROM: The DROM is
      empty with uid 0x1000000000000. (Apple started factory-burning a unit-
      specific DROM with Thunderbolt 2.)
      
      Instead, the NHI EFI driver supplies a DROM in a device property. Use
      it if available. It's only available when booting with the efistub.
      If it's not available, silently fall back to our hardcoded DROM.
      
      The size of the DROM is always 256 bytes. The number is hardcoded into
      the NHI EFI driver. This commit can deal with an arbitrary size however,
      just in case they ever change that.
      
      Background information: The EFI firmware volume contains ROM files for
      the NHI, GMUX and several other chips as well as key material. This
      strategy allows Apple to deploy ROM or key updates by simply publishing
      an EFI firmware update on their website. Drivers do not access those
      files directly but rather through a file server via EFI protocol
      AC5E4829-A8FD-440B-AF33-9FFE013B12D8. Files are identified by GUID, the
      NHI DROM has 339370BD-CFC6-4454-8EF7-704653120818.
      
      The NHI EFI driver amends that file with a unit-specific uid. The uid
      has 64 bit but its entropy is much lower: 24 bit represent the model,
      24 bit are taken from a serial number, 16 bit are fixed. The NHI EFI
      driver obtains the serial number via the DataHub protocol, copies it
      into the DROM, calculates the CRC and submits the result as a device
      property.
      
      A modification is needed in the resume code where we currently read the
      uid of all switches in the hierarchy to detect plug events that occurred
      during sleep. On Thunderbolt 1 root switches this will now lead to a
      mismatch between the uid of the empty DROM and the EFI DROM. Exempt the
      root switch from this check: It's built in, so the uid should never
      change. However we continue to *read* the uid of the root switch, this
      seems like a good way to test its reachability after resume.
      
      Tested-by: Lukas Wunner <lukas@wunner.de> [MacBookPro9,1]
      Tested-by: Pierre Moreau <pierre.morrow@free.fr> [MacBookPro11,3]
      Signed-off-by: default avatarLukas Wunner <lukas@wunner.de>
      Signed-off-by: default avatarMatt Fleming <matt@codeblueprint.co.uk>
      Acked-by: default avatarAndreas Noever <andreas.noever@gmail.com>
      Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Pedro Vilaça <reverser@put.as>
      Cc: Peter Jones <pjones@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-efi@vger.kernel.org
      Link: http://lkml.kernel.org/r/20161112213237.8804-10-matt@codeblueprint.co.uk
      
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      c9cc3aaa
  4. 31 Aug, 2016 1 commit
  5. 08 Apr, 2016 3 commits
    • Lukas Wunner's avatar
      thunderbolt: Support 1st gen Light Ridge controller · 19bf4d4f
      Lukas Wunner authored
      
      
      Add support for the 1st gen Light Ridge controller, which is built into
      these systems:
      
        iMac12,1       2011  21.5"
        iMac12,2       2011  27"
        Macmini5,1     2011  i5 2.3 GHz
        Macmini5,2     2011  i5 2.5 GHz
        Macmini5,3     2011  i7 2.0 GHz
        MacBookPro8,1  2011  13"
        MacBookPro8,2  2011  15"
        MacBookPro8,3  2011  17"
        MacBookPro9,1  2012  15"
        MacBookPro9,2  2012  13"
      
      Light Ridge (CV82524) was the very first copper Thunderbolt controller,
      introduced 2010 alongside its fiber-optic cousin Light Peak (CVL2510).
      Consequently the chip suffers from some teething troubles:
      
        - MSI is broken for hotplug signaling on the downstream bridges: The chip
          just never sends an interrupt.  It requests 32 MSIs for each of its six
          bridges and the pcieport driver only allocates one per bridge.  However
          I've verified that even if 32 MSIs are allocated there's no interrupt
          on hotplug.  The only option is thus to disable MSI, which is also what
          OS X does.  Apparently all Thunderbolt chips up to revision 1 of Cactus
          Ridge 4C are plagued by this issue so quirk those as well.
      
        - The chip supports a maximum hop_count of 32, unlike its successors
          which support only 12.  Fixup ring_interrupt_active() to cope with
          values >= 32.
      
        - Another peculiarity is that the chip supports a maximum of 13 ports
          whereas its successors support 12.  However the additional port (#5)
          seems to be unusable as reading its TB_CFG_PORT config space results in
          TB_CFG_ERROR_INVALID_CONFIG_SPACE.  Add a quirk to mark the port
          disabled on the root switch, assuming that's necessary on all Macs
          using this chip.
      
      Tested-by: Lukas Wunner <lukas@wunner.de> [MacBookPro9,1]
      Tested-by: William Brown <william@blackhats.net.au> [MacBookPro8,2]
      Signed-off-by: default avatarLukas Wunner <lukas@wunner.de>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Acked-by: default avatarAndreas Noever <andreas.noever@gmail.com>
      19bf4d4f
    • Lukas Wunner's avatar
      thunderbolt: Fix typos and magic number · aae20bb6
      Lukas Wunner authored
      
      
      Fix typo in tb_cfg_print_error() message.  Fix bytecount in struct
      tb_drom_entry_port comment.  Replace magic number in tb_switch_alloc().
      Rename tb_sw_set_unpplugged() and TB_CAL_IECS to fix typos.
      
      [bhelgaas: no functional change intended]
      Signed-off-by: default avatarLukas Wunner <lukas@wunner.de>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Acked-by: default avatarAndreas Noever <andreas.noever@gmail.com>
      aae20bb6
    • Lukas Wunner's avatar
      PCI: Add Intel Thunderbolt device IDs · 1d111406
      Lukas Wunner authored
      
      
      Intel Gen 1 and 2 chips use the same ID for NHI, bridges and switch.  Gen 3
      chips and onward use a distinct ID for the NHI.
      
      No functional change intended.
      Signed-off-by: default avatarLukas Wunner <lukas@wunner.de>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Acked-by: default avatarAndreas Noever <andreas.noever@gmail.com>
      1d111406
  6. 20 Jun, 2014 2 commits
  7. 19 Jun, 2014 9 commits