lol

flashrom: 1.3 -> 1.5.1 (#382143)

authored by

Pavol Rusnak and committed by
GitHub
f0204ef4 810d3098

+137 -19
+103
pkgs/by-name/fl/flashrom/0001-sb600spi.c-Drop-Promontory-support.patch
··· 1 + From 38b2cb092e866dede6b6ffddd135ff54a9bda69e Mon Sep 17 00:00:00 2001 2 + From: Angel Pons <th3fanbus@gmail.com> 3 + Date: Wed, 2 Nov 2022 22:45:52 +0100 4 + Subject: [PATCH] sb600spi.c: Drop "Promontory" support 5 + 6 + The "Promontory" code is riddled with issues, some of them can result in 7 + soft bricks. Moreover, Promontory doesn't have a SPI controller. 8 + 9 + Drop support for "Promontory" in flashrom for now: it's holding back the 10 + entire project and it's unlikely that it'll be fixed in a timely manner. 11 + 12 + Change-Id: I1457946dce68321b496d9ffa40a0c5ab46455f72 13 + Signed-off-by: Angel Pons <th3fanbus@gmail.com> 14 + Reviewed-on: https://review.coreboot.org/c/flashrom/+/68824 15 + Tested-by: build bot (Jenkins) <no-reply@coreboot.org> 16 + Reviewed-by: Felix Singer <felixsinger@posteo.net> 17 + Reviewed-by: Swift Geek (Sebastian Grzywna) <swiftgeek@gmail.com> 18 + Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> 19 + (cherry picked from commit 664c58f32af45b2acf7520c05bb40ef2c2f0891e) 20 + --- 21 + sb600spi.c | 31 ++----------------------------- 22 + 1 file changed, 2 insertions(+), 29 deletions(-) 23 + 24 + diff --git a/sb600spi.c b/sb600spi.c 25 + index cec7e0a5..e84bb8d6 100644 26 + --- a/sb600spi.c 27 + +++ b/sb600spi.c 28 + @@ -48,7 +48,6 @@ enum amd_chipset { 29 + CHIPSET_HUDSON234, 30 + CHIPSET_BOLTON, 31 + CHIPSET_YANGTZE, 32 + - CHIPSET_PROMONTORY, 33 + }; 34 + 35 + #define FIFO_SIZE_OLD 8 36 + @@ -135,7 +134,8 @@ static enum amd_chipset determine_generation(struct pci_dev *dev) 37 + */ 38 + } else if (rev == 0x4b || rev == 0x51 || rev == 0x59 || rev == 0x61 || rev == 0x71) { 39 + msg_pdbg("Promontory (rev 0x%02x) detected.\n", rev); 40 + - return CHIPSET_PROMONTORY; 41 + + msg_perr("AMD \"Promontory\" chipsets are currently not supported (https://ticket.coreboot.org/issues/370)"); 42 + + return CHIPSET_AMD_UNKNOWN; 43 + } else { 44 + msg_pwarn("FCH device found but SMBus revision 0x%02x does not match known values.\n" 45 + "Please report this to flashrom@flashrom.org and include this log and\n" 46 + @@ -572,18 +572,6 @@ static int handle_imc(const struct programmer_cfg *cfg, struct pci_dev *dev, enu 47 + return amd_imc_shutdown(dev); 48 + } 49 + 50 + -static int promontory_read_memmapped(struct flashctx *flash, uint8_t *buf, 51 + - unsigned int start, unsigned int len) 52 + -{ 53 + - struct sb600spi_data * data = (struct sb600spi_data *)flash->mst->spi.data; 54 + - if (!data->flash) { 55 + - map_flash(flash); 56 + - data->flash = flash; /* keep a copy of flashctx for unmap() on tear-down. */ 57 + - } 58 + - mmio_readn((void *)(flash->virtual_memory + start), buf, len); 59 + - return 0; 60 + -} 61 + - 62 + static int sb600spi_shutdown(void *data) 63 + { 64 + struct sb600spi_data *sb600_data = data; 65 + @@ -617,17 +605,6 @@ static const struct spi_master spi_master_yangtze = { 66 + .shutdown = sb600spi_shutdown, 67 + }; 68 + 69 + -static const struct spi_master spi_master_promontory = { 70 + - .max_data_read = MAX_DATA_READ_UNLIMITED, 71 + - .max_data_write = FIFO_SIZE_YANGTZE - 3, 72 + - .command = spi100_spi_send_command, 73 + - .map_flash_region = physmap, 74 + - .unmap_flash_region = physunmap, 75 + - .read = promontory_read_memmapped, 76 + - .write_256 = default_spi_write_256, 77 + - .shutdown = sb600spi_shutdown, 78 + -}; 79 + - 80 + int sb600_probe_spi(const struct programmer_cfg *cfg, struct pci_dev *dev) 81 + { 82 + struct pci_dev *smbus_dev; 83 + @@ -731,8 +708,6 @@ int sb600_probe_spi(const struct programmer_cfg *cfg, struct pci_dev *dev) 84 + case CHIPSET_SB89XX: 85 + case CHIPSET_HUDSON234: 86 + case CHIPSET_YANGTZE: 87 + - case CHIPSET_PROMONTORY: 88 + - msg_pdbg(", SpiBusy=%"PRIi32"", (tmp >> 31) & 0x1); 89 + default: break; 90 + } 91 + msg_pdbg("\n"); 92 + @@ -808,8 +783,6 @@ int sb600_probe_spi(const struct programmer_cfg *cfg, struct pci_dev *dev) 93 + register_spi_master(&spi_master_sb600, data); 94 + else if (amd_gen == CHIPSET_YANGTZE) 95 + register_spi_master(&spi_master_yangtze, data); 96 + - else 97 + - register_spi_master(&spi_master_promontory, data); 98 + 99 + return 0; 100 + } 101 + -- 102 + 2.45.2 103 +
+34 -19
pkgs/by-name/fl/flashrom/package.nix
··· 1 1 { 2 2 fetchurl, 3 3 stdenv, 4 - installShellFiles, 4 + bash-completion, 5 + cmocka, 5 6 lib, 6 7 libftdi1, 7 8 libjaylink, 8 9 libusb1, 10 + openssl, 11 + meson, 12 + ninja, 9 13 pciutils, 10 14 pkg-config, 15 + sphinx, 11 16 jlinkSupport ? false, 12 17 }: 13 18 14 - stdenv.mkDerivation rec { 19 + stdenv.mkDerivation (finalAttrs: { 15 20 pname = "flashrom"; 16 - version = "1.3.0"; 21 + version = "1.5.1"; 17 22 18 23 src = fetchurl { 19 - url = "https://download.flashrom.org/releases/flashrom-v${version}.tar.bz2"; 20 - hash = "sha256-oFMjRFPM0BLnnzRDvcxhYlz5e3/Xy0zdi/v/vosUliM="; 24 + url = "https://download.flashrom.org/releases/flashrom-v${finalAttrs.version}.tar.xz"; 25 + hash = "sha256-H5NLB27UnqziA2Vewkn8eGGmuOh/5K73MuR7bkhbYpM="; 21 26 }; 22 27 28 + patches = [ 29 + # Release notes for 1.4.0 state that Promontory chipsets are unsupported, and that attempting to read flash on those systems may crash the system. 30 + # The patch that removes this (broken) support only made it into the 1.3.0 release, seemingly by mistake, and the relevant code has been essentially untouched since. 31 + # We cherry-pick the upstream patch from 1.3.0, though amended to reference the relevant bug in the error message, rather than requesting the user email upstream. 32 + # https://ticket.coreboot.org/issues/370 33 + # https://review.coreboot.org/c/flashrom/+/68824 34 + ./0001-sb600spi.c-Drop-Promontory-support.patch 35 + ]; 36 + 23 37 nativeBuildInputs = [ 38 + meson 39 + ninja 24 40 pkg-config 25 - installShellFiles 41 + sphinx 42 + bash-completion 26 43 ]; 27 44 buildInputs = 28 45 [ 46 + openssl 47 + cmocka 29 48 libftdi1 30 49 libusb1 31 50 ] ··· 37 56 --replace 'GROUP="plugdev"' 'TAG+="uaccess", TAG+="udev-acl"' 38 57 ''; 39 58 40 - makeFlags = 41 - [ 42 - "PREFIX=$(out)" 43 - "libinstall" 44 - ] 45 - ++ lib.optional jlinkSupport "CONFIG_JLINK_SPI=yes" 46 - ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [ 47 - "CONFIG_INTERNAL_X86=no" 48 - "CONFIG_INTERNAL_DMI=no" 49 - "CONFIG_RAYER_SPI=no" 50 - ]; 59 + mesonFlags = [ 60 + (lib.mesonOption "programmer" "auto") 61 + (lib.mesonEnable "man-pages" true) 62 + (lib.mesonEnable "tests" (!stdenv.buildPlatform.isDarwin)) 63 + ]; 64 + 65 + doCheck = !stdenv.hostPlatform.isDarwin; 51 66 52 67 postInstall = '' 53 - install -Dm644 util/flashrom_udev.rules $out/lib/udev/rules.d/flashrom.rules 68 + install -Dm644 $NIX_BUILD_TOP/$sourceRoot/util/flashrom_udev.rules $out/lib/udev/rules.d/flashrom.rules 54 69 ''; 55 70 56 71 NIX_CFLAGS_COMPILE = lib.optionalString ( ··· 65 80 platforms = platforms.all; 66 81 mainProgram = "flashrom"; 67 82 }; 68 - } 83 + })