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-dev.ads b/common/hw-pci-dev.ads
new file mode 100644
index 0000000..b08f9ab
--- /dev/null
+++ b/common/hw-pci-dev.ads
@@ -0,0 +1,50 @@
+--
+-- 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.
+--
+
+generic
+   Dev : PCI.Address := (0, 0, 0);
+package HW.PCI.Dev
+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 Map
+     (Addr     :    out Word64;
+      Res      : in     Resource;
+      Length   : in     Natural := 0;
+      Offset   : in     Natural := 0;
+      WC       : in     Boolean := False);
+
+   procedure Resource_Size (Length : out Natural; Res : Resource);
+
+   procedure Initialize (Success : out Boolean; MMConf_Base : Word64 := 0);
+
+end HW.PCI.Dev;