1 /** @file
2 PciHostBridge driver module, part of QNC module.
3
4 Provides the basic interfaces to abstract a PCI Host Bridge Resource Allocation.
5
6 Copyright (c) 2013-2015 Intel Corporation.
7
8 This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
12
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15
16 **/
17 #include "CommonHeader.h"
18 #include "QNCInit.h"
19
20 UINT32 mS3ParameterRootPortDownstream = 0;
21 EFI_QNC_S3_DISPATCH_ITEM mS3DispatchItem = {
22 QncS3ItemTypeInitPcieRootPortDownstream,
23 &mS3ParameterRootPortDownstream
24 };
25
26 EFI_STATUS
QncInitRootPorts()27 QncInitRootPorts (
28 )
29 /*++
30
31 Routine Description:
32
33 Perform Initialization of the Downstream Root Ports
34
35 Arguments:
36
37 Returns:
38
39 EFI_SUCCESS The function completed successfully
40
41 --*/
42 {
43 EFI_STATUS Status;
44 EFI_QNC_S3_SUPPORT_PROTOCOL *QncS3Support;
45 VOID *Context;
46 VOID *S3DispatchEntryPoint;
47
48 Status = PciExpressInit ();
49 ASSERT_EFI_ERROR (Status);
50
51 //
52 // Get the QNC S3 Support Protocol
53 //
54 Status = gBS->LocateProtocol (
55 &gEfiQncS3SupportProtocolGuid,
56 NULL,
57 (VOID **) &QncS3Support
58 );
59 ASSERT_EFI_ERROR (Status);
60 if (EFI_ERROR (Status)) {
61 return Status;
62 }
63
64 //
65 // Get the QNC S3 Support Protocol
66 //
67 Status = QncS3Support->SetDispatchItem (
68 QncS3Support,
69 &mS3DispatchItem,
70 &S3DispatchEntryPoint,
71 &Context
72 );
73 ASSERT_EFI_ERROR (Status);
74
75 //
76 // Save the script dispatch item in the Boot Script
77 //
78 Status = S3BootScriptSaveDispatch2 (S3DispatchEntryPoint, Context);
79 ASSERT_EFI_ERROR (Status);
80
81 return Status;
82 }
83