1 /*++
2 
3 Copyright (c) 2005 - 2006, 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     PcatPciRootBridgeDevicePath.c
14 
15 Abstract:
16 
17     EFI PCAT PCI Root Bridge Device Path Protocol
18 
19 Revision History
20 
21 --*/
22 
23 #include "PcatPciRootBridge.h"
24 
25 //
26 // Static device path declarations for this driver.
27 //
28 
29 typedef struct {
30   ACPI_HID_DEVICE_PATH              AcpiDevicePath;
31   EFI_DEVICE_PATH_PROTOCOL          EndDevicePath;
32 } EFI_PCI_ROOT_BRIDGE_DEVICE_PATH;
33 
34 EFI_PCI_ROOT_BRIDGE_DEVICE_PATH mEfiPciRootBridgeDevicePath = {
35   {
36     {
37       ACPI_DEVICE_PATH,
38       ACPI_DP,
39       {
40         (UINT8) (sizeof(ACPI_HID_DEVICE_PATH)),
41         (UINT8) ((sizeof(ACPI_HID_DEVICE_PATH)) >> 8),
42       }
43     },
44     EISA_PNP_ID(0x0A03),
45     0
46   },
47   {
48     END_DEVICE_PATH_TYPE,
49     END_ENTIRE_DEVICE_PATH_SUBTYPE,
50     {
51       END_DEVICE_PATH_LENGTH,
52       0
53     }
54   }
55 };
56 
57 EFI_STATUS
PcatRootBridgeDevicePathConstructor(IN EFI_DEVICE_PATH_PROTOCOL ** Protocol,IN UINTN RootBridgeNumber,IN BOOLEAN IsPciExpress)58 PcatRootBridgeDevicePathConstructor (
59   IN EFI_DEVICE_PATH_PROTOCOL  **Protocol,
60   IN UINTN                     RootBridgeNumber,
61   IN BOOLEAN                   IsPciExpress
62   )
63 /*++
64 
65 Routine Description:
66 
67     Construct the device path protocol
68 
69 Arguments:
70 
71     Protocol - protocol to initialize
72 
73 Returns:
74 
75     None
76 
77 --*/
78 {
79   ACPI_HID_DEVICE_PATH  *AcpiDevicePath;
80 
81   *Protocol = DuplicateDevicePath((EFI_DEVICE_PATH_PROTOCOL *)(&mEfiPciRootBridgeDevicePath));
82 
83   AcpiDevicePath = (ACPI_HID_DEVICE_PATH *)(*Protocol);
84 
85   AcpiDevicePath->UID = (UINT32)RootBridgeNumber;
86 
87   if (IsPciExpress) {
88     AcpiDevicePath->HID = EISA_PNP_ID(0x0A08);
89   }
90 
91   return EFI_SUCCESS;
92 }
93 
94