diff --git a/os/src/drivers/acpi/main.cc b/os/src/drivers/acpi/main.cc index 218ad81af7..24282b1095 100644 --- a/os/src/drivers/acpi/main.cc +++ b/os/src/drivers/acpi/main.cc @@ -237,7 +237,17 @@ int main(int argc, char **argv) { using namespace Genode; - enum { STACK_SIZE = 2*4096 }; + enum { STACK_SIZE = 2*4096, ACPI_MEMORY_SIZE = 2 * 1024 * 1024 }; + + /* reserve portion for acpi and give rest to pci_drv */ + Genode::addr_t avail_size = Genode::env()->ram_session()->avail(); + if (avail_size < ACPI_MEMORY_SIZE) { + PERR("not enough memory"); + return 1; + } + avail_size -= ACPI_MEMORY_SIZE; + PINF("available memory for ACPI %d kiB, for PCI_DRV %lu kiB", + ACPI_MEMORY_SIZE / 1024, avail_size / 1024); static Cap_connection cap; static Rpc_entrypoint ep(&cap, STACK_SIZE, "acpi_ep"); @@ -256,7 +266,7 @@ int main(int argc, char **argv) pci_policy.configure(buf); /* use 'pci_drv' as slave service */ - static Genode::Slave pci_slave(pci_ep, pci_policy, 1024 * 1024); + static Genode::Slave pci_slave(pci_ep, pci_policy, avail_size); /* wait until pci drv is online and then make the acpi work */ pci_policy.wait_for_pci_drv();