chipset_enable/intel: Rework handling of what is memory mapped

Filter out any bus types in `internal_buses_supported` that aren't
memory mapped (we can't probe these), and consolidate the unknown-
laptop handling for the SPI case.

Change-Id: I9a9ad1c97756dfdba0ea0accb3091cd1fef2f08e
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.sourcearcade.org/c/flashprog/+/404
Tested-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Nico Huber <nico.h@gmx.de>
diff --git a/chipset_enable.c b/chipset_enable.c
index c7b9327..2603840 100644
--- a/chipset_enable.c
+++ b/chipset_enable.c
@@ -748,6 +748,13 @@
 	if (ich_generation != CHIPSET_TUNNEL_CREEK && ich_generation != CHIPSET_CENTERTON)
 		msg_pdbg("Top Swap: %s\n", (top_swap) ? "enabled (A16(+) inverted)" : "not enabled");
 
+	/* We can't probe legacy chips if their bus isn't memory mapped. */
+	internal_buses_supported &= boot_straps[bbs].bus;
+
+	/* Suppress unknown laptop warning if we booted from SPI. */
+	if (boot_straps[bbs].bus == BUS_SPI)
+		laptop_ok = true;
+
 	return boot_straps[bbs].bus;
 }
 
@@ -810,10 +817,6 @@
 	if (((boot_buses & BUS_FWH) && ret_fwh) || ((boot_buses & BUS_SPI) && ret_spi))
 		return ERROR_NONFATAL;
 
-	/* Suppress unknown laptop warning if we booted from SPI. */
-	if (boot_buses & BUS_SPI)
-		laptop_ok = true;
-
 	return 0;
 }
 
@@ -906,7 +909,7 @@
 		struct pci_dev *const spi_dev, const char *const name,
 		const enum ich_chipset pch_generation)
 {
-	const enum chipbustype boot_buses = enable_flash_ich_report_gcs(spi_dev, pch_generation, NULL);
+	enable_flash_ich_report_gcs(spi_dev, pch_generation, NULL);
 
 	const int ret_bc = enable_flash_ich_bios_cntl_config_space(spi_dev, pch_generation, 0xdc);
 	if (ret_bc == ERROR_FATAL)
@@ -926,10 +929,6 @@
 	if (ret_bc || ret_spi)
 		return ERROR_NONFATAL;
 
-	/* Suppress unknown laptop warning if we booted from SPI. */
-	if (boot_buses & BUS_SPI)
-		laptop_ok = true;
-
 	return 0;
 }
 
@@ -1106,10 +1105,6 @@
 	if (((boot_buses & BUS_FWH) && ret_fwh) || ((boot_buses & BUS_SPI) && ret_spi))
 		return ERROR_NONFATAL;
 
-	/* Suppress unknown laptop warning if we booted from SPI. */
-	if (boot_buses & BUS_SPI)
-		laptop_ok = true;
-
 	return 0;
 }