layout: Introduce flashrom_layout_new()

It initializes an empty layout. Currently the maximum number of entries
has to be specified, which will vanish once we use dynamic allocation
per entry.

We replace the two special cases `single_layout` and `ich_layout` with
dynamically allocated layouts. As a result, we have to take care to
release the `default_layout` in a flashctx once we are done with it.

Change-Id: I2ae7246493ff592e631cce924777925c7825e398
Signed-off-by: Nico Huber <nico.h@gmx.de>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/33543
Original-Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Original-Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/72214
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
diff --git a/ich_descriptors.h b/ich_descriptors.h
index cc40c1f..5a6cdf1 100644
--- a/ich_descriptors.h
+++ b/ich_descriptors.h
@@ -573,11 +573,6 @@
 	struct ich_desc_upper_map upper;
 };
 
-struct ich_layout {
-	struct flashrom_layout base;
-	struct romentry entries[MAX_NUM_FLREGS];
-};
-
 ssize_t ich_number_of_regions(enum ich_chipset cs, const struct ich_desc_content *content);
 ssize_t ich_number_of_masters(enum ich_chipset cs, const struct ich_desc_content *content);
 
@@ -596,6 +591,6 @@
 int read_ich_descriptors_via_fdo(enum ich_chipset cs, void *spibar, struct ich_descriptors *desc);
 int getFCBA_component_density(enum ich_chipset cs, const struct ich_descriptors *desc, uint8_t idx);
 
-int layout_from_ich_descriptors(struct ich_layout *, const void *dump, size_t len);
+int layout_from_ich_descriptors(struct flashrom_layout **, const void *dump, size_t len);
 
 #endif /* __ICH_DESCRIPTORS_H__ */