drivers/interrupt_controller: Get the IOAPIC RTEs dynamically

The fixed number of 24 RTEs is a legacy thing, and long gone by now.
IOAPICs expose the maximum number of RTEs they have via the version
register, so let's use it.

This avoids to manually tweak a Kconfig option (which is now removed)
and fixes the RTE number for all x86 targets relevantly.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
diff --git a/drivers/interrupt_controller/intc_loapic.c b/drivers/interrupt_controller/intc_loapic.c
index 527c7bf..7fe2e4f 100644
--- a/drivers/interrupt_controller/intc_loapic.c
+++ b/drivers/interrupt_controller/intc_loapic.c
@@ -20,6 +20,7 @@
 #include <drivers/interrupt_controller/loapic.h> /* public API declarations */
 #include <device.h>
 #include <drivers/interrupt_controller/sysapic.h>
+#include <drivers/interrupt_controller/ioapic.h>
 
 /* Local APIC Version Register Bits */
 
@@ -192,6 +193,12 @@
 	return 0;
 }
 
+
+uint32_t z_loapic_irq_base(void)
+{
+	return z_ioapic_num_rtes();
+}
+
 /**
  *
  * @brief Set the vector field in the specified RTE
@@ -344,7 +351,7 @@
 
 	for (loapic_irq = 0; loapic_irq < LOAPIC_IRQ_COUNT; loapic_irq++) {
 
-		if (_irq_to_interrupt_vector[LOAPIC_IRQ_BASE + loapic_irq]) {
+		if (_irq_to_interrupt_vector[z_loapic_irq_base() + loapic_irq]) {
 
 			/* Since vector numbers are already present in RAM/ROM,
 			 * We save only the mask bits here.
@@ -374,10 +381,11 @@
 
 	for (loapic_irq = 0; loapic_irq < LOAPIC_IRQ_COUNT; loapic_irq++) {
 
-		if (_irq_to_interrupt_vector[LOAPIC_IRQ_BASE + loapic_irq]) {
+		if (_irq_to_interrupt_vector[z_loapic_irq_base() + loapic_irq]) {
 			/* Configure vector and enable the required ones*/
 			z_loapic_int_vec_set(loapic_irq,
-				_irq_to_interrupt_vector[LOAPIC_IRQ_BASE + loapic_irq]);
+				_irq_to_interrupt_vector[z_loapic_irq_base() +
+							 loapic_irq]);
 
 			if (sys_bitfield_test_bit((mem_addr_t) loapic_suspend_buf,
 							loapic_irq)) {