]> git.proxmox.com Git - mirror_edk2.git/blob - Vlv2TbltDevicePkg/PlatformDxe/Observable/Observable.h
Upload BSD-licensed Vlv2TbltDevicePkg and Vlv2DeviceRefCodePkg to
[mirror_edk2.git] / Vlv2TbltDevicePkg / PlatformDxe / Observable / Observable.h
1 /*++
2
3 Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>
4
5 This program and the accompanying materials are licensed and made available under
6 the terms and conditions of the BSD License that accompanies this distribution.
7 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 Module Name:
15
16 Observable.h
17
18 Abstract:
19
20 Prototypes for Observable protocol implementation
21 --*/
22
23 #ifndef _OBSERVABLE_H_
24 #define _OBSERVABLE_H_
25 #include "PlatformDxe.h"
26 #include "Protocol/Observable.h"
27
28 //
29 // Prototypes
30 //
31
32 /** Install observable protocol.
33 *
34 * Install interface and initialize the observable protocol.
35 *
36 * @param VOID No parameters.
37 *
38 * @return EFI_SUCCESS Successfully installed and initialized the protocol.
39 **/
40 EFI_STATUS
41 InitializeObservableProtocol(
42 VOID
43 );
44
45 /** Remove all observables.
46 *
47 * Remove all observable guids and all interfaces subscribed to them.
48 *
49 * @param VOID No parameters.
50 *
51 * @return EFI_SUCCESS Successfully removed all observables and subscribed interfaces.
52 **/
53 EFI_STATUS
54 EFIAPI
55 RemoveAllObservables(
56 VOID
57 );
58
59 /** Subscribe an interface with an observable guid.
60 *
61 * Use this to register a callback function with a guid. The function provided by CallbackInterface will be executed
62 * whenever the appropriate observable instance specified by ReferenceGuid calls Publish.
63 *
64 * @param EFI_GUID ReferenceGuid The observable guid that the callback interface will subscribe to.
65 * OBS_CALLBACK CallbackInterface A pointer to the function that is subscribing to the observable.
66 *
67 * @return EFI_SUCCESS Successfully subscribed the interface to the observable guid.
68 * EFI_NOT_FOUND No match could be found between the provided guid and existing observables.
69 * EFI_OUT_OF_RESOURCES Could not subscribe to this observer due to resource limitations.
70 * EFI_INVALID_PARAMETER Interface is already subscribed to this observer.
71 **/
72 EFI_STATUS
73 EFIAPI
74 Subscribe (
75 IN EFI_GUID ReferenceGuid,
76 IN OBS_CALLBACK CallbackInterface
77 );
78
79 /** Unsubscribe an interface with an observable guid.
80 *
81 * Use this to remove an interface from the callback list associated with an observable guid.
82 *
83 * @param EFI_GUID ReferenceGuid The observable guid to unsubscribe the interface from.
84 * OBS_CALLBACK CallbackInterface A pointer to the interface that is being unsubscribed.
85 *
86 * @return EFI_SUCCESS Successfully unsubscribed the interface from the observable guid.
87 **/
88 EFI_STATUS
89 EFIAPI
90 Unsubscribe (
91 IN EFI_GUID ReferenceGuid,
92 IN OBS_CALLBACK CallbackInterface
93 );
94
95 /** Notify observing functions.
96 *
97 * Use this to notify all functions who are subscribed to the guid specified by ReferenceGuid.
98 *
99 * @param EFI_GUID ReferenceGuid The observable guid that contains the list of interfaces to be notified.
100 * VOID* Data Parameter context to be passed to the subscribed function.
101 *
102 * @return EFI_SUCCESS Successfully notified all observers listening to this guid.
103 * EFI_NOT_FOUND No match could be found between the provided guid and existing observables.
104 **/
105 EFI_STATUS
106 EFIAPI
107 Publish (
108 IN EFI_GUID ReferenceGuid,
109 IN OUT VOID* Data
110 );
111
112 /** Creates a new observable.
113 *
114 * Create a new observable that can be observed with the use of Subscribe function.
115 *
116 * @param EFI_GUID ReferenceGuid The observable guid to add.
117 *
118 * @return EFI_SUCCESS Successfully added observable.
119 * EFI_INVALID_PARAMETER Observable already exists.
120 **/
121 EFI_STATUS
122 EFIAPI
123 AddObservable (
124 IN EFI_GUID ReferenceGuid
125 );
126
127 /** Remove an observable.
128 *
129 * Remove an observable so that it can no longer be subscribed to. In addition, unsubscribe any functions
130 * that are subscribed to this guid.
131 *
132 * @param EFI_GUID ReferenceGuid The observable guid to remove.
133 *
134 * @return EFI_SUCCESS Successfully removed observable.
135 **/
136 EFI_STATUS
137 EFIAPI
138 RemoveObservable (
139 IN EFI_GUID ReferenceGuid
140 );
141
142 #endif