Add HW.Config for configuration constants

Change-Id: Id60c61fc53c6e153dcb3cf9f5c55668e38072817
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/20556
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
diff --git a/common/Makefile.inc b/common/Makefile.inc
index a08a7df..8759664 100644
--- a/common/Makefile.inc
+++ b/common/Makefile.inc
@@ -11,3 +11,11 @@
 hw-y += hw-time-timer.ads
 
 hw-$(CONFIG_HWBASE_POSIX_FILE) += hw-file.ads
+
+hw-config-ads := $(subst //,/,$(call src-to-obj,,$(dir)/hw-config).ads)
+$(hw-config-ads): $(dir)/hw-config.ads.template $(cnf)
+	printf "    GENERATE   $(patsubst /%,%,$(subst $(obj)/,,$@))\n"
+	sed \
+	    -e's/<<DYNAMIC_MMIO>>/$(if $(filter y,$(CONFIG_HWBASE_DYNAMIC_MMIO)),True,False)/' \
+	    $< >$@
+hw-gen-y += $(hw-config-ads)
diff --git a/common/hw-config.ads.template b/common/hw-config.ads.template
new file mode 100644
index 0000000..5a25ccb
--- /dev/null
+++ b/common/hw-config.ads.template
@@ -0,0 +1,20 @@
+--
+-- Copyright (C) 2017 Nico Huber <nico.h@gmx.de>
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 2 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+-- GNU General Public License for more details.
+--
+
+package HW.Config
+is
+
+   Dynamic_MMIO : constant Boolean := <<DYNAMIC_MMIO>>;
+
+end HW.Config;