beautypg.com

Intel Extensible Firmware Interface User Manual

Page 257

background image

Protocols

— EFI Driver Model

Version 1.10

12/01/02

9-15

Bus Driver that is able to create all or one of its child handles on each call to Start():

1. Open all required protocols with

OpenProtocol()

. A standard driver should use an

Attribute

of

EFI_OPEN_PROTOCOL_BY_DRIVER

. If this driver needs exclusive access

to a protocol interface, and it requires any drivers that may be using the protocol interface to
disconnect, then the driver should use an

Attribute

of

EFI_OPEN_PROTOCOL_BY_DRIVER

|

EFI_OPEN_PROTOCOL_EXCLUSIVE

. It must

use the same

Attribute

value that was used in

Supported()

.

2. If any of the calls to

OpenProtocol()

in (1) returned an error, then close all of the protocols

opened in (1) with

CloseProtocol()

, and return the status code from the call to

OpenProtocol()

that returned an error.

3. Initialize the device specified by

ControllerHandle

. If an error occurs, close all of the

protocols opened in (1) with

CloseProtocol()

, and return

EFI_DEVICE_ERROR

.

4. IF

RemainingDevicePath

is not

NULL

, THEN

a. C is the child device specified by

RemainingDevicePath

.

b. Allocate and initialize all of the data structures that this driver requires to manage the child

device C. This would include space for public protocols and space for any additional
private data structures that are related to the child device C. If an error occurs allocating
the resources, then close all of the protocols opened in (1) with

CloseProtocol()

, and

return

EFI_OUT_OF_RESOURCES

.

c. If the bus driver creates device paths for the child devices, then create a device path for the

child C based upon the device path attached to

ControllerHandle

.

d. Initialize the child device C.
e. Create a new handle for C, and install the protocol interfaces for child device C using

InstallMultipleProtocolInterfaces()

. This may include the

EFI_DEVICE_PATH

protocol.

f. Call

OpenProtocol()

on behalf of the child C with an

Attribute

of

EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER

.

ELSE

5. Discover all the child devices of the bus controller specified by

ControllerHandle

.

6. If the bus requires it, allocate resources to all the child devices of the bus controller specified by

ControllerHandle

.

7. FOR each child C of

ControllerHandle

a. Allocate and initialize all of the data structures that this driver requires to manage the child

device C. This would include space for public protocols and space for any additional
private data structures that are related to the child device C. If an error occurs allocating
the resources, then close all of the protocols opened in (1) with

CloseProtocol()

, and

return

EFI_OUT_OF_RESOURCES

.

b. If the bus driver creates device paths for the child devices, then create a device path for the

child C based upon the device path attached to

ControllerHandle

.

c. Initialize the child device C.
d. Create a new handle for C, and install the protocol interfaces for child device C using

InstallMultipleProtocolInterfaces()

. This may include the

EFI_DEVICE_PATH

protocol.