pci: Add PCI device infrastructure

Add generic PCI packages:

o HW.PCI containing basic definitions for PCI devices and
  configuration space headers,
o HW.PCI.MMConf that provides access to memory mapped confi-
  guration space of a PCI device, and
o HW.PCI.Dev adding a method to map resources of a PCI device.

Change-Id: I266ea35e273ff49fdb3176d617bb0b4ab1f13f93
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/20258
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
diff --git a/common/hw-pci-mmconf.ads b/common/hw-pci-mmconf.ads
new file mode 100644
index 0000000..03c9f44
--- /dev/null
+++ b/common/hw-pci-mmconf.ads
@@ -0,0 +1,46 @@
+--
+-- 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.
+--
+
+with System;
+with HW.MMIO_Range;
+
+pragma Elaborate_All (HW.MMIO_Range);
+
+private generic
+   Dev : Address := (0, 0, 0);
+package HW.PCI.MMConf
+with
+   Abstract_State => (Address_State, (PCI_State with External)),
+   Initializes => Address_State
+is
+
+   procedure Read8 (Value : out Word8; Offset : Index);
+   procedure Read16 (Value : out Word16; Offset : Index)
+   with
+      Pre => Offset mod 2 = 0;
+   procedure Read32 (Value : out Word32; Offset : Index)
+   with
+      Pre => Offset mod 4 = 0;
+
+   procedure Write8 (Offset : Index; Value : Word8);
+   procedure Write16 (Offset : Index; Value : Word16)
+   with
+      Pre => Offset mod 2 = 0;
+   procedure Write32 (Offset : Index; Value : Word32)
+   with
+      Pre => Offset mod 4 = 0;
+
+   procedure Set_Base_Address (Base : Word64);
+
+end HW.PCI.MMConf;