acpi/acpigen: add acpigen_resource_io to generate I/O resource

Add the acpigen_resource_io helper function to generate an I/O range
resource.

Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Signed-off-by: Arthur Heymans <arthur@aheymans.xyz>
Change-Id: I177f59b52d4dbbff0a3ceeef5fc8c7455cef9ff8
Reviewed-on: https://review.coreboot.org/c/coreboot/+/75044
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <inforichland@gmail.com>
diff --git a/src/acpi/acpigen.c b/src/acpi/acpigen.c
index 8d25114..6bc5875 100644
--- a/src/acpi/acpigen.c
+++ b/src/acpi/acpigen.c
@@ -2251,6 +2251,20 @@
 			      bus_limit - bus_base + 1); /* length */
 }
 
+void acpigen_resource_io(u16 io_base, u16 io_limit)
+{
+	acpigen_resource_word(RSRC_TYPE_IO, /* res_type */
+			      ADDR_SPACE_GENERAL_FLAG_MAX_FIXED
+			      | ADDR_SPACE_GENERAL_FLAG_MIN_FIXED
+			      | ADDR_SPACE_GENERAL_FLAG_DEC_POS, /* gen_flags */
+			      IO_RSRC_FLAG_ENTIRE_RANGE, /* type_flags */
+			      0, /* gran */
+			      io_base, /* range_min */
+			      io_limit, /* range_max */
+			      0x0, /* translation */
+			      io_limit - io_base + 1); /* length */
+}
+
 void acpigen_write_ADR(uint64_t adr)
 {
 	acpigen_write_name_qword("_ADR", adr);
diff --git a/src/include/acpi/acpigen.h b/src/include/acpi/acpigen.h
index efd26e4..35d14ab 100644
--- a/src/include/acpi/acpigen.h
+++ b/src/include/acpi/acpigen.h
@@ -694,6 +694,7 @@
 	u64 gran, u64 range_min, u64 range_max, u64 translation, u64 length);
 
 void acpigen_resource_bus_number(u16 bus_base, u16 bus_limit);
+void acpigen_resource_io(u16 io_base, u16 io_limit);
 
 /* Emits Notify(namestr, value) */
 void acpigen_notify(const char *namestr, int value);