1 /** @file
2   Functions declaration for Bus Specific Driver Override protoocl.
3 
4 Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution.  The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9 
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 
13 **/
14 
15 
16 #ifndef _EFI_PCI_DRIVER_OVERRRIDE_H_
17 #define _EFI_PCI_DRIVER_OVERRRIDE_H_
18 
19 #define DRIVER_OVERRIDE_SIGNATURE SIGNATURE_32 ('d', 'r', 'o', 'v')
20 
21 //
22 // PCI driver override driver image list
23 //
24 typedef struct {
25   UINT32          Signature;
26   LIST_ENTRY      Link;
27   EFI_HANDLE      DriverImageHandle;
28 } PCI_DRIVER_OVERRIDE_LIST;
29 
30 
31 #define DRIVER_OVERRIDE_FROM_LINK(a) \
32   CR (a, PCI_DRIVER_OVERRIDE_LIST, Link, DRIVER_OVERRIDE_SIGNATURE)
33 
34 /**
35   Initializes a PCI Driver Override Instance.
36 
37   @param  PciIoDevice   PCI Device instance.
38 
39 **/
40 VOID
41 InitializePciDriverOverrideInstance (
42   IN OUT PCI_IO_DEVICE          *PciIoDevice
43   );
44 
45 /**
46   Add an overriding driver image.
47 
48   @param PciIoDevice        Instance of PciIo device.
49   @param DriverImageHandle  new added driver image.
50 
51   @retval EFI_SUCCESS          Successfully added driver.
52   @retval EFI_OUT_OF_RESOURCES No memory resource for new driver instance.
53   @retval other                Some error occurred when locating gEfiLoadedImageProtocolGuid.
54 
55 **/
56 EFI_STATUS
57 AddDriver (
58   IN PCI_IO_DEVICE     *PciIoDevice,
59   IN EFI_HANDLE        DriverImageHandle
60   );
61 
62 
63 /**
64   Uses a bus specific algorithm to retrieve a driver image handle for a controller.
65 
66   @param  This                  A pointer to the EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL instance.
67   @param  DriverImageHandle     On input, a pointer to the previous driver image handle returned
68                                 by GetDriver(). On output, a pointer to the next driver
69                                 image handle. Passing in a NULL, will return the first driver
70                                 image handle.
71 
72   @retval EFI_SUCCESS           A bus specific override driver is returned in DriverImageHandle.
73   @retval EFI_NOT_FOUND         The end of the list of override drivers was reached.
74                                 A bus specific override driver is not returned in DriverImageHandle.
75   @retval EFI_INVALID_PARAMETER DriverImageHandle is not a handle that was returned on a
76                                 previous call to GetDriver().
77 
78 **/
79 EFI_STATUS
80 EFIAPI
81 GetDriver (
82   IN EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL              *This,
83   IN OUT EFI_HANDLE                                         *DriverImageHandle
84   );
85 
86 #endif
87