• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*++
2 
3 Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution.  The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8 
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11 
12 Module Name:
13 
14  EfiPciCfg.h
15 
16 Abstract:
17 
18   Abstract the common fields of PciCfg definition between Framework 0.9x
19   and PI 1.0.
20 
21 --*/
22 
23 #ifndef _EFI_PCI_CFG_H_
24 #define _EFI_PCI_CFG_H_
25 
26 //
27 // Framework specification 0.9x definition.
28 //
29 typedef enum {
30   PeiPciCfgWidthUint8   = 0,
31   PeiPciCfgWidthUint16  = 1,
32   PeiPciCfgWidthUint32  = 2,
33   PeiPciCfgWidthUint64  = 3,
34   PeiPciCfgWidthMaximum
35 } PEI_PCI_CFG_PPI_WIDTH;
36 
37 #define PEI_PCI_CFG_ADDRESS(bus, dev, func, reg)  ( \
38       (UINT64) ((((UINTN) bus) << 24) + (((UINTN) dev) << 16) + (((UINTN) func) << 8) + ((UINTN) reg)) \
39     ) & 0x00000000ffffffff
40 
41 //
42 // PI 1.0 definition.
43 //
44 typedef enum {
45   EfiPeiPciCfgWidthUint8   = 0,
46   EfiPeiPciCfgWidthUint16  = 1,
47   EfiPeiPciCfgWidthUint32  = 2,
48   EfiPeiPciCfgWidthUint64  = 3,
49   EfiPeiPciCfgWidthMaximum
50 } EFI_PEI_PCI_CFG_PPI_WIDTH;
51 
52 #define EFI_PEI_PCI_CFG_ADDRESS(bus, dev, func, reg)   \
53       (UINT64) ((((UINTN) (bus)) << 24) | \
54                 (((UINTN) (dev)) << 16) | \
55                 (((UINTN) (func)) << 8) | \
56                 ((reg) < 256 ? ((UINTN) (reg)): ((UINT64) (reg) << 32)))
57 
58 #if (PI_SPECIFICATION_VERSION < 0x00010000)
59 
60 typedef struct {
61   UINT8 Register;
62   UINT8 Function;
63   UINT8 Device;
64   UINT8 Bus;
65   UINT8 Reserved[4];
66 } PEI_PCI_CFG_PPI_PCI_ADDRESS;
67 
68 typedef PEI_PCI_CFG_PPI_PCI_ADDRESS        EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS;
69 
70 #else
71 
72 typedef struct {
73   UINT8 Register;
74   UINT8 Function;
75   UINT8 Device;
76   UINT8 Bus;
77   UINT32 ExtendedRegister;
78 } EFI_PEI_PCI_CFG_PPI_PCI_ADDRESS;
79 #endif
80 
81 #endif
82