Examples – Intel Extensible Firmware Interface User Manual

Page 152

Advertising
background image

Extensible Firmware Interface Specification

5-54

12/01/02

Version 1.10

Examples

EFI_BOOT_SERVICES_TABLE

*gBS;

EFI_HANDLE

ImageHandle;

EFI_DRIVER_BINDING_PROTOCOL

*This;

IN EFI_HANDLE

ControllerHandle,

extern EFI_GUID

gEfiXyzIoProtocol;

EFI_XYZ_IO_PROTOCOL

*XyzIo;

EFI_STATUS

Status;

//
// EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL example
//

Retrieves the XYZ I/O Protocol instance from ControllerHandle

//

The application that is opening the protocol is identified by ImageHandle

//

Possible return status codes:

//

EFI_SUCCESS

: The protocol was opened and returned in XyzIo

//

EFI_UNSUPPORTED

: The protocol is not present on ControllerHandle

//

Status = gBS->OpenProtocol (

ControllerHandle,
&gEfiXyzIoProtocol,
&XyzIo,
ImageHandle,
NULL,
EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL
);

//
// EFI_OPEN_PROTOCOL_GET_PROTOCOL example
//

Retrieves the XYZ I/O Protocol instance from ControllerHandle

//

The driver that is opening the protocol is identified by the

//

Driver Binding Protocol instance This.

This->DriverBindingHandle

//

identifies the agent that is opening the protocol interface, and it

//

is opening this protocol on behalf of ControllerHandle.

//

Possible return status codes:

//

EFI_SUCCESS

: The protocol was opened and returned in XyzIo

//

EFI_UNSUPPORTED

: The protocol is not present on ControllerHandle

//
Status = gBS->OpenProtocol (

ControllerHandle,
&gEfiXyzIoProtocol,
&XyzIo,
This->DriverBindingHandle,
ControllerHandle,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);

//
// EFI_OPEN_PROTOCOL_TEST_PROTOCOL example
//

Tests to see if the XYZ I/O Protocol is present on ControllerHandle

//

The driver that is opening the protocol is identified by the

//

Driver Binding Protocol instance This.

This->DriverBindingHandle

//

identifies the agent that is opening the protocol interface, and it

//

is opening this protocol on behalf of ControllerHandle.

//

EFI_SUCCESS

: The protocol was opened and returned in XyzIo

//

EFI_UNSUPPORTED

: The protocol is not present on ControllerHandle

//

Status = gBS->OpenProtocol (

ControllerHandle,
&gEfiXyzIoProtocol,

Advertising