From d51aad39f128dc5294f7ed846e194cdf3f4e0e68 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Mon, 10 Jun 2013 10:30:49 +0200 Subject: [PATCH] Read out comport on x86 from BDA area With this patch the comport are tried to read out from the BIOS Data Area on x86 machines. The BDA Area are part of the first physical page and may contain the non-default io ports of the comport. When used together with 'bender' from the 'morbo' toolchain, even serial PCI cards (also Intel's AMT Serial Over Line adapter) are detected automatically. --- l4/pkg/bootstrap/server/src/platform/x86_pc.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/l4/pkg/bootstrap/server/src/platform/x86_pc.cc b/l4/pkg/bootstrap/server/src/platform/x86_pc.cc index abad7f30..2e66c73d 100644 --- a/l4/pkg/bootstrap/server/src/platform/x86_pc.cc +++ b/l4/pkg/bootstrap/server/src/platform/x86_pc.cc @@ -612,8 +612,15 @@ public: printf("PCI IO port = %x\n", comport); } - if (comport == -1) - comport = 1; + if (comport == -1) { + /* try to read Bios Data Area (BDA) to get comport information */ + unsigned short comport_count = (*((unsigned short *)0x410) >> 9) & 0x7; + if (comport_count) + comport = *((unsigned short *)0x400); + else + /* give up and try default values */ + comport = 1; + } if (init_uart(comport, comirq, &du)) printf("UART init failed\n");