Starts a device controller or a bus controller
2021/12/24 6:09:11
本文主要是介绍Starts a device controller or a bus controller,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
/** Starts a device controller or a bus controller. The Start() function is designed to be invoked from the EFI boot service ConnectController(). As a result, much of the error checking on the parameters to Start() has been moved into this common boot service. It is legal to call Start() from other locations, but the following calling restrictions must be followed, or the system behavior will not be deterministic. 1. ControllerHandle must be a valid EFI_HANDLE. 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned EFI_DEVICE_PATH_PROTOCOL. 3. Prior to calling Start(), the Supported() function for the driver specified by This must have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS. @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. @param[in] ControllerHandle The handle of the controller to start. This handle must support a protocol interface that supplies an I/O abstraction to the driver. @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This parameter is ignored by device drivers, and is optional for bus drivers. For a bus driver, if this parameter is NULL, then handles for all the children of Controller are created by this driver. If this parameter is not NULL and the first Device Path Node is not the End of Device Path Node, then only the handle for the child device specified by the first Device Path Node of RemainingDevicePath is created by this driver. If the first Device Path Node of RemainingDevicePath is the End of Device Path Node, no child handle is created by this driver. @retval EFI_SUCCESS The device was started. @retval EFI_DEVICE_ERROR The device could not be started due to a device error.Currently not implemented. @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources. @retval Others The driver failded to start the device. **/ EFI_STATUS EFIAPI EmuBlockIoDriverBindingStart ( IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Handle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath ) { EFI_STATUS Status; EMU_IO_THUNK_PROTOCOL *EmuIoThunk; EMU_BLOCK_IO_PRIVATE *Private = NULL; // // Grab the protocols we need // Status = gBS->OpenProtocol ( Handle, &gEmuIoThunkProtocolGuid, (void *)&EmuIoThunk, This->DriverBindingHandle, Handle, EFI_OPEN_PROTOCOL_BY_DRIVER ); if (EFI_ERROR (Status)) { return Status; } if (!CompareGuid (EmuIoThunk->Protocol, &gEmuBlockIoProtocolGuid)) { Status = EFI_UNSUPPORTED; goto Done; } Status = EmuIoThunk->Open (EmuIoThunk); if (EFI_ERROR (Status)) { goto Done; } Private = AllocatePool (sizeof (EMU_BLOCK_IO_PRIVATE)); if (Private == NULL) { goto Done; } Private->Signature = EMU_BLOCK_IO_PRIVATE_SIGNATURE; Private->IoThunk = EmuIoThunk; Private->Io = EmuIoThunk->Interface; Private->EfiHandle = Handle; Private->BlockIo.Revision = EFI_BLOCK_IO_PROTOCOL_REVISION2; Private->BlockIo.Media = &Private->Media; Private->BlockIo.Reset = EmuBlockIoReset; Private->BlockIo.ReadBlocks = EmuBlockIoReadBlocks; Private->BlockIo.WriteBlocks = EmuBlockIoWriteBlocks; Private->BlockIo.FlushBlocks = EmuBlockIoFlushBlocks; Private->BlockIo2.Media = &Private->Media; Private->BlockIo2.Reset = EmuBlockIo2Reset; Private->BlockIo2.ReadBlocksEx = EmuBlockIo2ReadBlocksEx; Private->BlockIo2.WriteBlocksEx = EmuBlockIo2WriteBlocksEx; Private->BlockIo2.FlushBlocksEx = EmuBlockIo2Flush; Private->ControllerNameTable = NULL; Status = Private->Io->CreateMapping (Private->Io, &Private->Media); if (EFI_ERROR (Status)) { goto Done; } AddUnicodeString2 ( "eng", gEmuBlockIoComponentName.SupportedLanguages, &Private->ControllerNameTable, EmuIoThunk->ConfigString, TRUE ); AddUnicodeString2 ( "en", gEmuBlockIoComponentName2.SupportedLanguages, &Private->ControllerNameTable, EmuIoThunk->ConfigString, FALSE ); Status = gBS->InstallMultipleProtocolInterfaces ( &Handle, &gEfiBlockIoProtocolGuid, &Private->BlockIo, &gEfiBlockIo2ProtocolGuid, &Private->BlockIo2, NULL ); Done: if (EFI_ERROR (Status)) { if (Private != NULL) { if (Private->ControllerNameTable != NULL) { FreeUnicodeStringTable (Private->ControllerNameTable); } gBS->FreePool (Private); } gBS->CloseProtocol ( Handle, &gEmuIoThunkProtocolGuid, This->DriverBindingHandle, Handle ); } return Status; }
这篇关于Starts a device controller or a bus controller的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-05-15PingCAP 黄东旭参与 CCF 秀湖会议,共探开源教育未来
- 2024-05-13PingCAP 戴涛:构建面向未来的金融核心系统
- 2024-05-09flutter3.x_macos桌面os实战
- 2024-05-09Rust中的并发性:Sync 和 Send Traits
- 2024-05-08使用Ollama和OpenWebUI在CPU上玩转Meta Llama3-8B
- 2024-05-08完工标准(DoD)与验收条件(AC)究竟有什么不同?
- 2024-05-084万 star 的 NocoDB 在 sealos 上一键起,轻松把数据库编程智能表格
- 2024-05-08Mac 版Stable Diffusion WebUI的安装
- 2024-05-08解锁CodeGeeX智能问答中3项独有的隐藏技能
- 2024-05-08RAG算法优化+新增代码仓库支持,CodeGeeX的@repo功能效果提升