2 NvmExpressDxe driver is used to manage non-volatile memory subsystem which follows
3 NVM Express specification.
5 (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
6 Copyright (c) 2013 - 2016, Intel Corporation. All rights reserved.<BR>
7 This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php.
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 #ifndef _EFI_NVM_EXPRESS_H_
18 #define _EFI_NVM_EXPRESS_H_
22 #include <IndustryStandard/Pci.h>
23 #include <IndustryStandard/Nvme.h>
25 #include <Protocol/ComponentName.h>
26 #include <Protocol/ComponentName2.h>
27 #include <Protocol/DriverBinding.h>
28 #include <Protocol/LoadedImage.h>
29 #include <Protocol/DevicePath.h>
30 #include <Protocol/PciIo.h>
31 #include <Protocol/NvmExpressPassthru.h>
32 #include <Protocol/BlockIo.h>
33 #include <Protocol/BlockIo2.h>
34 #include <Protocol/DiskInfo.h>
35 #include <Protocol/DriverSupportedEfiVersion.h>
36 #include <Protocol/StorageSecurityCommand.h>
38 #include <Library/BaseLib.h>
39 #include <Library/BaseMemoryLib.h>
40 #include <Library/DebugLib.h>
41 #include <Library/PrintLib.h>
42 #include <Library/UefiLib.h>
43 #include <Library/DevicePathLib.h>
44 #include <Library/MemoryAllocationLib.h>
45 #include <Library/UefiBootServicesTableLib.h>
46 #include <Library/UefiDriverEntryPoint.h>
48 typedef struct _NVME_CONTROLLER_PRIVATE_DATA NVME_CONTROLLER_PRIVATE_DATA
;
49 typedef struct _NVME_DEVICE_PRIVATE_DATA NVME_DEVICE_PRIVATE_DATA
;
51 #include "NvmExpressBlockIo.h"
52 #include "NvmExpressDiskInfo.h"
53 #include "NvmExpressHci.h"
55 extern EFI_DRIVER_BINDING_PROTOCOL gNvmExpressDriverBinding
;
56 extern EFI_COMPONENT_NAME_PROTOCOL gNvmExpressComponentName
;
57 extern EFI_COMPONENT_NAME2_PROTOCOL gNvmExpressComponentName2
;
58 extern EFI_DRIVER_SUPPORTED_EFI_VERSION_PROTOCOL gNvmExpressDriverSupportedEfiVersion
;
60 #define PCI_CLASS_MASS_STORAGE_NVM 0x08 // mass storage sub-class non-volatile memory.
61 #define PCI_IF_NVMHCI 0x02 // mass storage programming interface NVMHCI.
63 #define NVME_ASQ_SIZE 1 // Number of admin submission queue entries, which is 0-based
64 #define NVME_ACQ_SIZE 1 // Number of admin completion queue entries, which is 0-based
66 #define NVME_CSQ_SIZE 1 // Number of I/O submission queue entries, which is 0-based
67 #define NVME_CCQ_SIZE 1 // Number of I/O completion queue entries, which is 0-based
70 // Number of asynchronous I/O submission queue entries, which is 0-based.
71 // The asynchronous I/O submission queue size is 4kB in total.
73 #define NVME_ASYNC_CSQ_SIZE 63
75 // Number of asynchronous I/O completion queue entries, which is 0-based.
76 // The asynchronous I/O completion queue size is 4kB in total.
78 #define NVME_ASYNC_CCQ_SIZE 255
80 #define NVME_MAX_QUEUES 3 // Number of queues supported by the driver
82 #define NVME_CONTROLLER_ID 0
85 // Time out value for Nvme transaction execution
87 #define NVME_GENERIC_TIMEOUT EFI_TIMER_PERIOD_SECONDS (5)
90 // Nvme async transfer timer interval, set by experience.
92 #define NVME_HC_ASYNC_TIMER EFI_TIMER_PERIOD_MILLISECONDS (1)
95 // Unique signature for private data structure.
97 #define NVME_CONTROLLER_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('N','V','M','E')
100 // Nvme private data structure.
102 struct _NVME_CONTROLLER_PRIVATE_DATA
{
105 EFI_HANDLE ControllerHandle
;
106 EFI_HANDLE ImageHandle
;
107 EFI_HANDLE DriverBindingHandle
;
109 EFI_PCI_IO_PROTOCOL
*PciIo
;
110 UINT64 PciAttributes
;
112 EFI_DEVICE_PATH_PROTOCOL
*ParentDevicePath
;
114 EFI_NVM_EXPRESS_PASS_THRU_MODE PassThruMode
;
115 EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL Passthru
;
118 // pointer to identify controller data
120 NVME_ADMIN_CONTROLLER_DATA
*ControllerData
;
123 // 6 x 4kB aligned buffers will be carved out of this buffer.
124 // 1st 4kB boundary is the start of the admin submission queue.
125 // 2nd 4kB boundary is the start of the admin completion queue.
126 // 3rd 4kB boundary is the start of I/O submission queue #1.
127 // 4th 4kB boundary is the start of I/O completion queue #1.
128 // 5th 4kB boundary is the start of I/O submission queue #2.
129 // 6th 4kB boundary is the start of I/O completion queue #2.
132 UINT8
*BufferPciAddr
;
135 // Pointers to 4kB aligned submission & completion queues.
137 NVME_SQ
*SqBuffer
[NVME_MAX_QUEUES
];
138 NVME_CQ
*CqBuffer
[NVME_MAX_QUEUES
];
139 NVME_SQ
*SqBufferPciAddr
[NVME_MAX_QUEUES
];
140 NVME_CQ
*CqBufferPciAddr
[NVME_MAX_QUEUES
];
143 // Submission and completion queue indices.
145 NVME_SQTDBL SqTdbl
[NVME_MAX_QUEUES
];
146 NVME_CQHDBL CqHdbl
[NVME_MAX_QUEUES
];
149 UINT8 Pt
[NVME_MAX_QUEUES
];
150 UINT16 Cid
[NVME_MAX_QUEUES
];
153 // Nvme controller capabilities
160 // For Non-blocking operations.
162 EFI_EVENT TimerEvent
;
163 LIST_ENTRY AsyncPassThruQueue
;
164 LIST_ENTRY UnsubmittedSubtasks
;
167 #define NVME_CONTROLLER_PRIVATE_DATA_FROM_PASS_THRU(a) \
169 NVME_CONTROLLER_PRIVATE_DATA, \
171 NVME_CONTROLLER_PRIVATE_DATA_SIGNATURE \
175 // Unique signature for private data structure.
177 #define NVME_DEVICE_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('X','S','S','D')
180 // Nvme device private data structure
182 struct _NVME_DEVICE_PRIVATE_DATA
{
185 EFI_HANDLE DeviceHandle
;
186 EFI_HANDLE ControllerHandle
;
187 EFI_HANDLE DriverBindingHandle
;
189 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
191 EFI_UNICODE_STRING_TABLE
*ControllerNameTable
;
194 UINT64 NamespaceUuid
;
196 EFI_BLOCK_IO_MEDIA Media
;
197 EFI_BLOCK_IO_PROTOCOL BlockIo
;
198 EFI_BLOCK_IO2_PROTOCOL BlockIo2
;
199 EFI_DISK_INFO_PROTOCOL DiskInfo
;
200 EFI_STORAGE_SECURITY_COMMAND_PROTOCOL StorageSecurity
;
202 LIST_ENTRY AsyncQueue
;
206 CHAR16 ModelName
[80];
207 NVME_ADMIN_NAMESPACE_DATA NamespaceData
;
209 NVME_CONTROLLER_PRIVATE_DATA
*Controller
;
214 // Statments to retrieve the private data from produced protocols.
216 #define NVME_DEVICE_PRIVATE_DATA_FROM_BLOCK_IO(a) \
218 NVME_DEVICE_PRIVATE_DATA, \
220 NVME_DEVICE_PRIVATE_DATA_SIGNATURE \
223 #define NVME_DEVICE_PRIVATE_DATA_FROM_BLOCK_IO2(a) \
225 NVME_DEVICE_PRIVATE_DATA, \
227 NVME_DEVICE_PRIVATE_DATA_SIGNATURE \
230 #define NVME_DEVICE_PRIVATE_DATA_FROM_DISK_INFO(a) \
232 NVME_DEVICE_PRIVATE_DATA, \
234 NVME_DEVICE_PRIVATE_DATA_SIGNATURE \
237 #define NVME_DEVICE_PRIVATE_DATA_FROM_STORAGE_SECURITY(a)\
239 NVME_DEVICE_PRIVATE_DATA, \
241 NVME_DEVICE_PRIVATE_DATA_SIGNATURE \
245 // Nvme block I/O 2 request.
247 #define NVME_BLKIO2_REQUEST_SIGNATURE SIGNATURE_32 ('N', 'B', '2', 'R')
253 EFI_BLOCK_IO2_TOKEN
*Token
;
254 UINTN UnsubmittedSubtaskNum
;
255 BOOLEAN LastSubtaskSubmitted
;
257 // The queue for Nvme read/write sub-tasks of a BlockIo2 request.
259 LIST_ENTRY SubtasksQueue
;
260 } NVME_BLKIO2_REQUEST
;
262 #define NVME_BLKIO2_REQUEST_FROM_LINK(a) \
263 CR (a, NVME_BLKIO2_REQUEST, Link, NVME_BLKIO2_REQUEST_SIGNATURE)
265 #define NVME_BLKIO2_SUBTASK_SIGNATURE SIGNATURE_32 ('N', 'B', '2', 'S')
274 EFI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET
*CommandPacket
;
276 // The BlockIo2 request this subtask belongs to
278 NVME_BLKIO2_REQUEST
*BlockIo2Request
;
279 } NVME_BLKIO2_SUBTASK
;
281 #define NVME_BLKIO2_SUBTASK_FROM_LINK(a) \
282 CR (a, NVME_BLKIO2_SUBTASK, Link, NVME_BLKIO2_SUBTASK_SIGNATURE)
285 // Nvme asynchronous passthru request.
287 #define NVME_PASS_THRU_ASYNC_REQ_SIG SIGNATURE_32 ('N', 'P', 'A', 'R')
293 EFI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET
*Packet
;
300 EFI_EVENT CallerEvent
;
301 } NVME_PASS_THRU_ASYNC_REQ
;
303 #define NVME_PASS_THRU_ASYNC_REQ_FROM_THIS(a) \
305 NVME_PASS_THRU_ASYNC_REQ, \
307 NVME_PASS_THRU_ASYNC_REQ_SIG \
311 Retrieves a Unicode string that is the user readable name of the driver.
313 This function retrieves the user readable name of a driver in the form of a
314 Unicode string. If the driver specified by This has a user readable name in
315 the language specified by Language, then a pointer to the driver name is
316 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
317 by This does not support the language specified by Language,
318 then EFI_UNSUPPORTED is returned.
320 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
321 EFI_COMPONENT_NAME_PROTOCOL instance.
323 @param Language[in] A pointer to a Null-terminated ASCII string
324 array indicating the language. This is the
325 language of the driver name that the caller is
326 requesting, and it must match one of the
327 languages specified in SupportedLanguages. The
328 number of languages supported by a driver is up
329 to the driver writer. Language is specified
330 in RFC 4646 or ISO 639-2 language code format.
332 @param DriverName[out] A pointer to the Unicode string to return.
333 This Unicode string is the name of the
334 driver specified by This in the language
335 specified by Language.
337 @retval EFI_SUCCESS The Unicode string for the Driver specified by
338 This and the language specified by Language was
339 returned in DriverName.
341 @retval EFI_INVALID_PARAMETER Language is NULL.
343 @retval EFI_INVALID_PARAMETER DriverName is NULL.
345 @retval EFI_UNSUPPORTED The driver specified by This does not support
346 the language specified by Language.
351 NvmExpressComponentNameGetDriverName (
352 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
354 OUT CHAR16
**DriverName
358 Retrieves a Unicode string that is the user readable name of the controller
359 that is being managed by a driver.
361 This function retrieves the user readable name of the controller specified by
362 ControllerHandle and ChildHandle in the form of a Unicode string. If the
363 driver specified by This has a user readable name in the language specified by
364 Language, then a pointer to the controller name is returned in ControllerName,
365 and EFI_SUCCESS is returned. If the driver specified by This is not currently
366 managing the controller specified by ControllerHandle and ChildHandle,
367 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
368 support the language specified by Language, then EFI_UNSUPPORTED is returned.
370 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
371 EFI_COMPONENT_NAME_PROTOCOL instance.
373 @param ControllerHandle[in] The handle of a controller that the driver
374 specified by This is managing. This handle
375 specifies the controller whose name is to be
378 @param ChildHandle[in] The handle of the child controller to retrieve
379 the name of. This is an optional parameter that
380 may be NULL. It will be NULL for device
381 drivers. It will also be NULL for a bus drivers
382 that wish to retrieve the name of the bus
383 controller. It will not be NULL for a bus
384 driver that wishes to retrieve the name of a
387 @param Language[in] A pointer to a Null-terminated ASCII string
388 array indicating the language. This is the
389 language of the driver name that the caller is
390 requesting, and it must match one of the
391 languages specified in SupportedLanguages. The
392 number of languages supported by a driver is up
393 to the driver writer. Language is specified in
394 RFC 4646 or ISO 639-2 language code format.
396 @param ControllerName[out] A pointer to the Unicode string to return.
397 This Unicode string is the name of the
398 controller specified by ControllerHandle and
399 ChildHandle in the language specified by
400 Language from the point of view of the driver
403 @retval EFI_SUCCESS The Unicode string for the user readable name in
404 the language specified by Language for the
405 driver specified by This was returned in
408 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
410 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
413 @retval EFI_INVALID_PARAMETER Language is NULL.
415 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
417 @retval EFI_UNSUPPORTED The driver specified by This is not currently
418 managing the controller specified by
419 ControllerHandle and ChildHandle.
421 @retval EFI_UNSUPPORTED The driver specified by This does not support
422 the language specified by Language.
427 NvmExpressComponentNameGetControllerName (
428 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
429 IN EFI_HANDLE ControllerHandle
,
430 IN EFI_HANDLE ChildHandle OPTIONAL
,
432 OUT CHAR16
**ControllerName
436 Tests to see if this driver supports a given controller. If a child device is provided,
437 it further tests to see if this driver supports creating a handle for the specified child device.
439 This function checks to see if the driver specified by This supports the device specified by
440 ControllerHandle. Drivers will typically use the device path attached to
441 ControllerHandle and/or the services from the bus I/O abstraction attached to
442 ControllerHandle to determine if the driver supports ControllerHandle. This function
443 may be called many times during platform initialization. In order to reduce boot times, the tests
444 performed by this function must be very small, and take as little time as possible to execute. This
445 function must not change the state of any hardware devices, and this function must be aware that the
446 device specified by ControllerHandle may already be managed by the same driver or a
447 different driver. This function must match its calls to AllocatePages() with FreePages(),
448 AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().
449 Since ControllerHandle may have been previously started by the same driver, if a protocol is
450 already in the opened state, then it must not be closed with CloseProtocol(). This is required
451 to guarantee the state of ControllerHandle is not modified by this function.
453 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
454 @param[in] ControllerHandle The handle of the controller to test. This handle
455 must support a protocol interface that supplies
456 an I/O abstraction to the driver.
457 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
458 parameter is ignored by device drivers, and is optional for bus
459 drivers. For bus drivers, if this parameter is not NULL, then
460 the bus driver must determine if the bus controller specified
461 by ControllerHandle and the child controller specified
462 by RemainingDevicePath are both supported by this
465 @retval EFI_SUCCESS The device specified by ControllerHandle and
466 RemainingDevicePath is supported by the driver specified by This.
467 @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and
468 RemainingDevicePath is already being managed by the driver
470 @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and
471 RemainingDevicePath is already being managed by a different
472 driver or an application that requires exclusive access.
473 Currently not implemented.
474 @retval EFI_UNSUPPORTED The device specified by ControllerHandle and
475 RemainingDevicePath is not supported by the driver specified by This.
479 NvmExpressDriverBindingSupported (
480 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
481 IN EFI_HANDLE Controller
,
482 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
486 Starts a device controller or a bus controller.
488 The Start() function is designed to be invoked from the EFI boot service ConnectController().
489 As a result, much of the error checking on the parameters to Start() has been moved into this
490 common boot service. It is legal to call Start() from other locations,
491 but the following calling restrictions must be followed or the system behavior will not be deterministic.
492 1. ControllerHandle must be a valid EFI_HANDLE.
493 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned
494 EFI_DEVICE_PATH_PROTOCOL.
495 3. Prior to calling Start(), the Supported() function for the driver specified by This must
496 have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.
498 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
499 @param[in] ControllerHandle The handle of the controller to start. This handle
500 must support a protocol interface that supplies
501 an I/O abstraction to the driver.
502 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
503 parameter is ignored by device drivers, and is optional for bus
504 drivers. For a bus driver, if this parameter is NULL, then handles
505 for all the children of Controller are created by this driver.
506 If this parameter is not NULL and the first Device Path Node is
507 not the End of Device Path Node, then only the handle for the
508 child device specified by the first Device Path Node of
509 RemainingDevicePath is created by this driver.
510 If the first Device Path Node of RemainingDevicePath is
511 the End of Device Path Node, no child handle is created by this
514 @retval EFI_SUCCESS The device was started.
515 @retval EFI_DEVICE_ERROR The device could not be started due to a device error.Currently not implemented.
516 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
517 @retval Others The driver failded to start the device.
522 NvmExpressDriverBindingStart (
523 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
524 IN EFI_HANDLE Controller
,
525 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
529 Stops a device controller or a bus controller.
531 The Stop() function is designed to be invoked from the EFI boot service DisconnectController().
532 As a result, much of the error checking on the parameters to Stop() has been moved
533 into this common boot service. It is legal to call Stop() from other locations,
534 but the following calling restrictions must be followed or the system behavior will not be deterministic.
535 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
536 same driver's Start() function.
537 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid
538 EFI_HANDLE. In addition, all of these handles must have been created in this driver's
539 Start() function, and the Start() function must have called OpenProtocol() on
540 ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
542 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
543 @param[in] ControllerHandle A handle to the device being stopped. The handle must
544 support a bus specific I/O protocol for the driver
545 to use to stop the device.
546 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.
547 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
548 if NumberOfChildren is 0.
550 @retval EFI_SUCCESS The device was stopped.
551 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
556 NvmExpressDriverBindingStop (
557 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
558 IN EFI_HANDLE Controller
,
559 IN UINTN NumberOfChildren
,
560 IN EFI_HANDLE
*ChildHandleBuffer
564 Sends an NVM Express Command Packet to an NVM Express controller or namespace. This function supports
565 both blocking I/O and nonblocking I/O. The blocking I/O functionality is required, and the nonblocking
566 I/O functionality is optional.
568 @param[in] This A pointer to the EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL instance.
569 @param[in] NamespaceId Is a 32 bit Namespace ID to which the Express HCI command packet will be sent.
570 A value of 0 denotes the NVM Express controller, a value of all 0FFh in the namespace
571 ID specifies that the command packet should be sent to all valid namespaces.
572 @param[in,out] Packet A pointer to the NVM Express HCI Command Packet to send to the NVMe namespace specified
574 @param[in] Event If nonblocking I/O is not supported then Event is ignored, and blocking I/O is performed.
575 If Event is NULL, then blocking I/O is performed. If Event is not NULL and non blocking I/O
576 is supported, then nonblocking I/O is performed, and Event will be signaled when the NVM
577 Express Command Packet completes.
579 @retval EFI_SUCCESS The NVM Express Command Packet was sent by the host. TransferLength bytes were transferred
580 to, or from DataBuffer.
581 @retval EFI_BAD_BUFFER_SIZE The NVM Express Command Packet was not executed. The number of bytes that could be transferred
582 is returned in TransferLength.
583 @retval EFI_NOT_READY The NVM Express Command Packet could not be sent because the controller is not ready. The caller
584 may retry again later.
585 @retval EFI_DEVICE_ERROR A device error occurred while attempting to send the NVM Express Command Packet.
586 @retval EFI_INVALID_PARAMETER Namespace, or the contents of EFI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET are invalid. The NVM
587 Express Command Packet was not sent, so no additional status information is available.
588 @retval EFI_UNSUPPORTED The command described by the NVM Express Command Packet is not supported by the host adapter.
589 The NVM Express Command Packet was not sent, so no additional status information is available.
590 @retval EFI_TIMEOUT A timeout occurred while waiting for the NVM Express Command Packet to execute.
596 IN EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL
*This
,
597 IN UINT32 NamespaceId
,
598 IN OUT EFI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET
*Packet
,
599 IN EFI_EVENT Event OPTIONAL
603 Used to retrieve the next namespace ID for this NVM Express controller.
605 The EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL.GetNextNamespace() function retrieves the next valid
606 namespace ID on this NVM Express controller.
608 If on input the value pointed to by NamespaceId is 0xFFFFFFFF, then the first valid namespace
609 ID defined on the NVM Express controller is returned in the location pointed to by NamespaceId
610 and a status of EFI_SUCCESS is returned.
612 If on input the value pointed to by NamespaceId is an invalid namespace ID other than 0xFFFFFFFF,
613 then EFI_INVALID_PARAMETER is returned.
615 If on input the value pointed to by NamespaceId is a valid namespace ID, then the next valid
616 namespace ID on the NVM Express controller is returned in the location pointed to by NamespaceId,
617 and EFI_SUCCESS is returned.
619 If the value pointed to by NamespaceId is the namespace ID of the last namespace on the NVM
620 Express controller, then EFI_NOT_FOUND is returned.
622 @param[in] This A pointer to the EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL instance.
623 @param[in,out] NamespaceId On input, a pointer to a legal NamespaceId for an NVM Express
624 namespace present on the NVM Express controller. On output, a
625 pointer to the next NamespaceId of an NVM Express namespace on
626 an NVM Express controller. An input value of 0xFFFFFFFF retrieves
627 the first NamespaceId for an NVM Express namespace present on an
628 NVM Express controller.
630 @retval EFI_SUCCESS The Namespace ID of the next Namespace was returned.
631 @retval EFI_NOT_FOUND There are no more namespaces defined on this controller.
632 @retval EFI_INVALID_PARAMETER NamespaceId is an invalid value other than 0xFFFFFFFF.
637 NvmExpressGetNextNamespace (
638 IN EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL
*This
,
639 IN OUT UINT32
*NamespaceId
643 Used to translate a device path node to a namespace ID.
645 The EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL.GetNamespace() function determines the namespace ID associated with the
646 namespace described by DevicePath.
648 If DevicePath is a device path node type that the NVM Express Pass Thru driver supports, then the NVM Express
649 Pass Thru driver will attempt to translate the contents DevicePath into a namespace ID.
651 If this translation is successful, then that namespace ID is returned in NamespaceId, and EFI_SUCCESS is returned
653 @param[in] This A pointer to the EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL instance.
654 @param[in] DevicePath A pointer to the device path node that describes an NVM Express namespace on
655 the NVM Express controller.
656 @param[out] NamespaceId The NVM Express namespace ID contained in the device path node.
658 @retval EFI_SUCCESS DevicePath was successfully translated to NamespaceId.
659 @retval EFI_INVALID_PARAMETER If DevicePath or NamespaceId are NULL, then EFI_INVALID_PARAMETER is returned.
660 @retval EFI_UNSUPPORTED If DevicePath is not a device path node type that the NVM Express Pass Thru driver
661 supports, then EFI_UNSUPPORTED is returned.
662 @retval EFI_NOT_FOUND If DevicePath is a device path node type that the NVM Express Pass Thru driver
663 supports, but there is not a valid translation from DevicePath to a namespace ID,
664 then EFI_NOT_FOUND is returned.
668 NvmExpressGetNamespace (
669 IN EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL
*This
,
670 IN EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
671 OUT UINT32
*NamespaceId
675 Used to allocate and build a device path node for an NVM Express namespace on an NVM Express controller.
677 The EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL.BuildDevicePath() function allocates and builds a single device
678 path node for the NVM Express namespace specified by NamespaceId.
680 If the NamespaceId is not valid, then EFI_NOT_FOUND is returned.
682 If DevicePath is NULL, then EFI_INVALID_PARAMETER is returned.
684 If there are not enough resources to allocate the device path node, then EFI_OUT_OF_RESOURCES is returned.
686 Otherwise, DevicePath is allocated with the boot service AllocatePool(), the contents of DevicePath are
687 initialized to describe the NVM Express namespace specified by NamespaceId, and EFI_SUCCESS is returned.
689 @param[in] This A pointer to the EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL instance.
690 @param[in] NamespaceId The NVM Express namespace ID for which a device path node is to be
691 allocated and built. Caller must set the NamespaceId to zero if the
692 device path node will contain a valid UUID.
693 @param[in,out] DevicePath A pointer to a single device path node that describes the NVM Express
694 namespace specified by NamespaceId. This function is responsible for
695 allocating the buffer DevicePath with the boot service AllocatePool().
696 It is the caller's responsibility to free DevicePath when the caller
697 is finished with DevicePath.
698 @retval EFI_SUCCESS The device path node that describes the NVM Express namespace specified
699 by NamespaceId was allocated and returned in DevicePath.
700 @retval EFI_NOT_FOUND The NamespaceId is not valid.
701 @retval EFI_INVALID_PARAMETER DevicePath is NULL.
702 @retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate the DevicePath node.
707 NvmExpressBuildDevicePath (
708 IN EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL
*This
,
709 IN UINT32 NamespaceId
,
710 IN OUT EFI_DEVICE_PATH_PROTOCOL
**DevicePath
714 Dump the execution status from a given completion queue entry.
716 @param[in] Cq A pointer to the NVME_CQ item.