From 18b36fb339904518e127c4fe64629febba31cf86 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Wed, 15 Apr 2015 09:39:21 +0200 Subject: [PATCH] acpi: provide pci policy to pci driver Issue #1486 --- repos/os/src/drivers/acpi/acpi.cc | 17 ++++++++++++++--- repos/os/src/drivers/acpi/main.cc | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/repos/os/src/drivers/acpi/acpi.cc b/repos/os/src/drivers/acpi/acpi.cc index 7608a0350..ab3a1fe4c 100644 --- a/repos/os/src/drivers/acpi/acpi.cc +++ b/repos/os/src/drivers/acpi/acpi.cc @@ -19,6 +19,7 @@ #include #include #include +#include #include "acpi.h" #include "memory.h" @@ -1016,9 +1017,19 @@ class Element : public List::Element text += len; max -= len; } - len = snprintf(text, max, ""); - text += len; - max -= len; + + Attached_rom_dataspace rom("config"); + char * rom_text = rom.local_addr(); + size_t rom_len = strlen(rom_text); + + if (max > rom_len - 9) { + rom_text += 9; + rom_len -= 9; + memcpy(text, rom_text, rom_len); + text += rom_len; + max -= rom_len; + } else + PERR("could not add pci_drv policy"); if (max < 2) PERR("config file could not be generated, buffer to small"); diff --git a/repos/os/src/drivers/acpi/main.cc b/repos/os/src/drivers/acpi/main.cc index ea7435556..51afef532 100644 --- a/repos/os/src/drivers/acpi/main.cc +++ b/repos/os/src/drivers/acpi/main.cc @@ -265,7 +265,7 @@ int main(int argc, char **argv) static Pci_policy pci_policy(pci_ep, ep, irq_ep); /* generate config file for pci_drv */ - char buf[256]; + char buf[1024]; Acpi::create_pci_config_file(buf, sizeof(buf)); pci_policy.configure(buf);