tel69589584emailwangbox@163com内容摘要:
Preventing Alignment Faults VOID ScsiDeviceNodeInit ( IN OUT SCSI_DEVICE_PATH *ScsiDeviceNode, IN UINT16 Pun, IN UINT16 Lun ) { ScsiDeviceNode = MESSAGING_DEVICE_PATH。 ScsiDeviceNode = MSG_SCSI_DP。 SetDevicePathNodeLength (amp。 ScsiDeviceNode, sizeof(SCSI_DEVICE_PATH))。 ScsiDeviceNode = Pun。 ScsiDeviceNode = Lun。 } BAD ScsiDeviceNode may not be aligned Driver Guidelines Preventing Alignment Faults VOID ScsiDeviceNodeInit ( IN OUT SCSI_DEVICE_PATH *ScsiDeviceNode, IN UINT16 Pun, IN UINT16 Lun ) { SCSI_DEVICE_PATH MyDeviceNode。 = MESSAGING_DEVICE_PATH。 = MSG_SCSI_DP。 SetDevicePathNodeLength (amp。 , sizeof(SCSI_DEVICE_PATH))。 = Pun。 = Lun。 gBSCopyMem (ScsiDeviceNode, amp。 MyDeviceNode, sizeof(SCSI_DEVICE_PATH))。 } GOOD gBSCopyMem() handles all alignments MyDeviceNode is aligned Driver Guidelines Use EFI Driver Library Functions CHILD_DEVICE Child。 Child = EfiLibAllocateZeroPool (sizeof (CHILD_DEVICE))。 if (Child == NULL) { return EFI_OUT_OF_RESOURCES。 } Library Functions Simplify Source Code Library Functions May Reduce Size CHILD_DEVICE Child。 Status = gBSAllocatePool ( EfiBootServicesData, sizeof (CHILD_DEVICE), amp。 Child )。 if (EFI_ERROR (Status)) { return Status。 } gBSSetMem (Child, sizeof (CHILD_DEVICE), 0)。 OK GOOD Driver Guidelines EFI Device Paths () ChildDevicePath = EfiAppendDevicePathNode ( ControllerDevicePath, ChildDevicePathNode )。 if (ChildDevicePath == NULL) { return(EFI_OUT_OF_RESOURCES)。 } gBSFreePool (ChildDevicePath)。 () Parent Device Path is Opaque Not Parsed by Bus Drivers Driver Guidelines Bus Walk Tips Use LocateHandleBuffer(Bus I/O Protocol) Do not scan PCI configuration space Implement support for RemainingDevicePath Highly remended for all bus drivers (. SCSI, Fibre Channel, etc.) Allows bus driver to bypass full enumeration. Reduces boot time Driver Guidelines Component Name Protocol Limit Lengths of Names to 40 Unicode Characters Include Driver Name and Version Number UNDI Driver (Network Interface Controller) Typically the Name of the PCI Controller MAC Node Produced by an UNDI Driver Identify Location of Physical Connector on NIC PCI Slots Identify Physical Location of PCI Slots in the System SCSI / SCSI RAID / Fiber Channel Controller Typically name of the PCI Controller Channel Identify Physical Location of the SCSI Channel Disk Use Results from INQUIRY Command Driver Guidelines Option ROM Size Reduction Use EFI Compression Compile with EFI Byte Code Compiler Single Binary for x86, x64 and Itanium Smaller than Itanium Binaries Comparable to x86 Binaries Compresses Well ~ 50% Driver Guidelines How To Improve Portability Do Not Assume Max Number of Children Do Not Use Fixed Memory Addresses Do Not Use Assembly Do Not Use Floating Point Arithmetic Some Minor EBC Porting Considerations Bus Drivers Should Support Producing 1 Child at a time if possible (improves boot performance) D。tel69589584emailwangbox@163com
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。
用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。