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 - 2018, 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>
37 #include <Protocol/ResetNotification.h>
39 #include <Library/BaseLib.h>
40 #include <Library/BaseMemoryLib.h>
41 #include <Library/DebugLib.h>
42 #include <Library/PrintLib.h>
43 #include <Library/UefiLib.h>
44 #include <Library/DevicePathLib.h>
45 #include <Library/MemoryAllocationLib.h>
46 #include <Library/UefiBootServicesTableLib.h>
47 #include <Library/UefiDriverEntryPoint.h>
49 typedef struct _NVME_CONTROLLER_PRIVATE_DATA NVME_CONTROLLER_PRIVATE_DATA
;
50 typedef struct _NVME_DEVICE_PRIVATE_DATA NVME_DEVICE_PRIVATE_DATA
;
52 #include "NvmExpressBlockIo.h"
53 #include "NvmExpressDiskInfo.h"
54 #include "NvmExpressHci.h"
56 extern EFI_DRIVER_BINDING_PROTOCOL gNvmExpressDriverBinding
;
57 extern EFI_COMPONENT_NAME_PROTOCOL gNvmExpressComponentName
;
58 extern EFI_COMPONENT_NAME2_PROTOCOL gNvmExpressComponentName2
;
59 extern EFI_DRIVER_SUPPORTED_EFI_VERSION_PROTOCOL gNvmExpressDriverSupportedEfiVersion
;
61 #define PCI_CLASS_MASS_STORAGE_NVM 0x08 // mass storage sub-class non-volatile memory.
62 #define PCI_IF_NVMHCI 0x02 // mass storage programming interface NVMHCI.
64 #define NVME_ASQ_SIZE 1 // Number of admin submission queue entries, which is 0-based
65 #define NVME_ACQ_SIZE 1 // Number of admin completion queue entries, which is 0-based
67 #define NVME_CSQ_SIZE 1 // Number of I/O submission queue entries, which is 0-based
68 #define NVME_CCQ_SIZE 1 // Number of I/O completion queue entries, which is 0-based
71 // Number of asynchronous I/O submission queue entries, which is 0-based.
72 // The asynchronous I/O submission queue size is 4kB in total.
74 #define NVME_ASYNC_CSQ_SIZE 63
76 // Number of asynchronous I/O completion queue entries, which is 0-based.
77 // The asynchronous I/O completion queue size is 4kB in total.
79 #define NVME_ASYNC_CCQ_SIZE 255
81 #define NVME_MAX_QUEUES 3 // Number of queues supported by the driver
83 #define NVME_CONTROLLER_ID 0
86 // Time out value for Nvme transaction execution
88 #define NVME_GENERIC_TIMEOUT EFI_TIMER_PERIOD_SECONDS (5)
91 // Nvme async transfer timer interval, set by experience.
93 #define NVME_HC_ASYNC_TIMER EFI_TIMER_PERIOD_MILLISECONDS (1)
96 // Unique signature for private data structure.
98 #define NVME_CONTROLLER_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('N','V','M','E')
101 // Nvme private data structure.
103 struct _NVME_CONTROLLER_PRIVATE_DATA
{
106 EFI_HANDLE ControllerHandle
;
107 EFI_HANDLE ImageHandle
;
108 EFI_HANDLE DriverBindingHandle
;
110 EFI_PCI_IO_PROTOCOL
*PciIo
;
111 UINT64 PciAttributes
;
113 EFI_DEVICE_PATH_PROTOCOL
*ParentDevicePath
;
115 EFI_NVM_EXPRESS_PASS_THRU_MODE PassThruMode
;
116 EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL Passthru
;
119 // pointer to identify controller data
121 NVME_ADMIN_CONTROLLER_DATA
*ControllerData
;
124 // 6 x 4kB aligned buffers will be carved out of this buffer.
125 // 1st 4kB boundary is the start of the admin submission queue.
126 // 2nd 4kB boundary is the start of the admin completion queue.
127 // 3rd 4kB boundary is the start of I/O submission queue #1.
128 // 4th 4kB boundary is the start of I/O completion queue #1.
129 // 5th 4kB boundary is the start of I/O submission queue #2.
130 // 6th 4kB boundary is the start of I/O completion queue #2.
133 UINT8
*BufferPciAddr
;
136 // Pointers to 4kB aligned submission & completion queues.
138 NVME_SQ
*SqBuffer
[NVME_MAX_QUEUES
];
139 NVME_CQ
*CqBuffer
[NVME_MAX_QUEUES
];
140 NVME_SQ
*SqBufferPciAddr
[NVME_MAX_QUEUES
];
141 NVME_CQ
*CqBufferPciAddr
[NVME_MAX_QUEUES
];
144 // Submission and completion queue indices.
146 NVME_SQTDBL SqTdbl
[NVME_MAX_QUEUES
];
147 NVME_CQHDBL CqHdbl
[NVME_MAX_QUEUES
];
151 // Flag to indicate internal IO queue creation.
153 BOOLEAN CreateIoQueue
;
155 UINT8 Pt
[NVME_MAX_QUEUES
];
156 UINT16 Cid
[NVME_MAX_QUEUES
];
159 // Nvme controller capabilities
166 // For Non-blocking operations.
168 EFI_EVENT TimerEvent
;
169 LIST_ENTRY AsyncPassThruQueue
;
170 LIST_ENTRY UnsubmittedSubtasks
;
173 #define NVME_CONTROLLER_PRIVATE_DATA_FROM_PASS_THRU(a) \
175 NVME_CONTROLLER_PRIVATE_DATA, \
177 NVME_CONTROLLER_PRIVATE_DATA_SIGNATURE \
181 // Unique signature for private data structure.
183 #define NVME_DEVICE_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('X','S','S','D')
186 // Nvme device private data structure
188 struct _NVME_DEVICE_PRIVATE_DATA
{
191 EFI_HANDLE DeviceHandle
;
192 EFI_HANDLE ControllerHandle
;
193 EFI_HANDLE DriverBindingHandle
;
195 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
197 EFI_UNICODE_STRING_TABLE
*ControllerNameTable
;
200 UINT64 NamespaceUuid
;
202 EFI_BLOCK_IO_MEDIA Media
;
203 EFI_BLOCK_IO_PROTOCOL BlockIo
;
204 EFI_BLOCK_IO2_PROTOCOL BlockIo2
;
205 EFI_DISK_INFO_PROTOCOL DiskInfo
;
206 EFI_STORAGE_SECURITY_COMMAND_PROTOCOL StorageSecurity
;
208 LIST_ENTRY AsyncQueue
;
212 CHAR16 ModelName
[80];
213 NVME_ADMIN_NAMESPACE_DATA NamespaceData
;
215 NVME_CONTROLLER_PRIVATE_DATA
*Controller
;
220 // Statments to retrieve the private data from produced protocols.
222 #define NVME_DEVICE_PRIVATE_DATA_FROM_BLOCK_IO(a) \
224 NVME_DEVICE_PRIVATE_DATA, \
226 NVME_DEVICE_PRIVATE_DATA_SIGNATURE \
229 #define NVME_DEVICE_PRIVATE_DATA_FROM_BLOCK_IO2(a) \
231 NVME_DEVICE_PRIVATE_DATA, \
233 NVME_DEVICE_PRIVATE_DATA_SIGNATURE \
236 #define NVME_DEVICE_PRIVATE_DATA_FROM_DISK_INFO(a) \
238 NVME_DEVICE_PRIVATE_DATA, \
240 NVME_DEVICE_PRIVATE_DATA_SIGNATURE \
243 #define NVME_DEVICE_PRIVATE_DATA_FROM_STORAGE_SECURITY(a)\
245 NVME_DEVICE_PRIVATE_DATA, \
247 NVME_DEVICE_PRIVATE_DATA_SIGNATURE \
251 // Nvme block I/O 2 request.
253 #define NVME_BLKIO2_REQUEST_SIGNATURE SIGNATURE_32 ('N', 'B', '2', 'R')
259 EFI_BLOCK_IO2_TOKEN
*Token
;
260 UINTN UnsubmittedSubtaskNum
;
261 BOOLEAN LastSubtaskSubmitted
;
263 // The queue for Nvme read/write sub-tasks of a BlockIo2 request.
265 LIST_ENTRY SubtasksQueue
;
266 } NVME_BLKIO2_REQUEST
;
268 #define NVME_BLKIO2_REQUEST_FROM_LINK(a) \
269 CR (a, NVME_BLKIO2_REQUEST, Link, NVME_BLKIO2_REQUEST_SIGNATURE)
271 #define NVME_BLKIO2_SUBTASK_SIGNATURE SIGNATURE_32 ('N', 'B', '2', 'S')
280 EFI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET
*CommandPacket
;
282 // The BlockIo2 request this subtask belongs to
284 NVME_BLKIO2_REQUEST
*BlockIo2Request
;
285 } NVME_BLKIO2_SUBTASK
;
287 #define NVME_BLKIO2_SUBTASK_FROM_LINK(a) \
288 CR (a, NVME_BLKIO2_SUBTASK, Link, NVME_BLKIO2_SUBTASK_SIGNATURE)
291 // Nvme asynchronous passthru request.
293 #define NVME_PASS_THRU_ASYNC_REQ_SIG SIGNATURE_32 ('N', 'P', 'A', 'R')
299 EFI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET
*Packet
;
306 EFI_EVENT CallerEvent
;
307 } NVME_PASS_THRU_ASYNC_REQ
;
309 #define NVME_PASS_THRU_ASYNC_REQ_FROM_THIS(a) \
311 NVME_PASS_THRU_ASYNC_REQ, \
313 NVME_PASS_THRU_ASYNC_REQ_SIG \
317 Retrieves a Unicode string that is the user readable name of the driver.
319 This function retrieves the user readable name of a driver in the form of a
320 Unicode string. If the driver specified by This has a user readable name in
321 the language specified by Language, then a pointer to the driver name is
322 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
323 by This does not support the language specified by Language,
324 then EFI_UNSUPPORTED is returned.
326 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
327 EFI_COMPONENT_NAME_PROTOCOL instance.
329 @param Language[in] A pointer to a Null-terminated ASCII string
330 array indicating the language. This is the
331 language of the driver name that the caller is
332 requesting, and it must match one of the
333 languages specified in SupportedLanguages. The
334 number of languages supported by a driver is up
335 to the driver writer. Language is specified
336 in RFC 4646 or ISO 639-2 language code format.
338 @param DriverName[out] A pointer to the Unicode string to return.
339 This Unicode string is the name of the
340 driver specified by This in the language
341 specified by Language.
343 @retval EFI_SUCCESS The Unicode string for the Driver specified by
344 This and the language specified by Language was
345 returned in DriverName.
347 @retval EFI_INVALID_PARAMETER Language is NULL.
349 @retval EFI_INVALID_PARAMETER DriverName is NULL.
351 @retval EFI_UNSUPPORTED The driver specified by This does not support
352 the language specified by Language.
357 NvmExpressComponentNameGetDriverName (
358 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
360 OUT CHAR16
**DriverName
364 Retrieves a Unicode string that is the user readable name of the controller
365 that is being managed by a driver.
367 This function retrieves the user readable name of the controller specified by
368 ControllerHandle and ChildHandle in the form of a Unicode string. If the
369 driver specified by This has a user readable name in the language specified by
370 Language, then a pointer to the controller name is returned in ControllerName,
371 and EFI_SUCCESS is returned. If the driver specified by This is not currently
372 managing the controller specified by ControllerHandle and ChildHandle,
373 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
374 support the language specified by Language, then EFI_UNSUPPORTED is returned.
376 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
377 EFI_COMPONENT_NAME_PROTOCOL instance.
379 @param ControllerHandle[in] The handle of a controller that the driver
380 specified by This is managing. This handle
381 specifies the controller whose name is to be
384 @param ChildHandle[in] The handle of the child controller to retrieve
385 the name of. This is an optional parameter that
386 may be NULL. It will be NULL for device
387 drivers. It will also be NULL for a bus drivers
388 that wish to retrieve the name of the bus
389 controller. It will not be NULL for a bus
390 driver that wishes to retrieve the name of a
393 @param Language[in] A pointer to a Null-terminated ASCII string
394 array indicating the language. This is the
395 language of the driver name that the caller is
396 requesting, and it must match one of the
397 languages specified in SupportedLanguages. The
398 number of languages supported by a driver is up
399 to the driver writer. Language is specified in
400 RFC 4646 or ISO 639-2 language code format.
402 @param ControllerName[out] A pointer to the Unicode string to return.
403 This Unicode string is the name of the
404 controller specified by ControllerHandle and
405 ChildHandle in the language specified by
406 Language from the point of view of the driver
409 @retval EFI_SUCCESS The Unicode string for the user readable name in
410 the language specified by Language for the
411 driver specified by This was returned in
414 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
416 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
419 @retval EFI_INVALID_PARAMETER Language is NULL.
421 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
423 @retval EFI_UNSUPPORTED The driver specified by This is not currently
424 managing the controller specified by
425 ControllerHandle and ChildHandle.
427 @retval EFI_UNSUPPORTED The driver specified by This does not support
428 the language specified by Language.
433 NvmExpressComponentNameGetControllerName (
434 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
435 IN EFI_HANDLE ControllerHandle
,
436 IN EFI_HANDLE ChildHandle OPTIONAL
,
438 OUT CHAR16
**ControllerName
442 Tests to see if this driver supports a given controller. If a child device is provided,
443 it further tests to see if this driver supports creating a handle for the specified child device.
445 This function checks to see if the driver specified by This supports the device specified by
446 ControllerHandle. Drivers will typically use the device path attached to
447 ControllerHandle and/or the services from the bus I/O abstraction attached to
448 ControllerHandle to determine if the driver supports ControllerHandle. This function
449 may be called many times during platform initialization. In order to reduce boot times, the tests
450 performed by this function must be very small, and take as little time as possible to execute. This
451 function must not change the state of any hardware devices, and this function must be aware that the
452 device specified by ControllerHandle may already be managed by the same driver or a
453 different driver. This function must match its calls to AllocatePages() with FreePages(),
454 AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().
455 Since ControllerHandle may have been previously started by the same driver, if a protocol is
456 already in the opened state, then it must not be closed with CloseProtocol(). This is required
457 to guarantee the state of ControllerHandle is not modified by this function.
459 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
460 @param[in] ControllerHandle The handle of the controller to test. This handle
461 must support a protocol interface that supplies
462 an I/O abstraction to the driver.
463 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
464 parameter is ignored by device drivers, and is optional for bus
465 drivers. For bus drivers, if this parameter is not NULL, then
466 the bus driver must determine if the bus controller specified
467 by ControllerHandle and the child controller specified
468 by RemainingDevicePath are both supported by this
471 @retval EFI_SUCCESS The device specified by ControllerHandle and
472 RemainingDevicePath is supported by the driver specified by This.
473 @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and
474 RemainingDevicePath is already being managed by the driver
476 @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and
477 RemainingDevicePath is already being managed by a different
478 driver or an application that requires exclusive access.
479 Currently not implemented.
480 @retval EFI_UNSUPPORTED The device specified by ControllerHandle and
481 RemainingDevicePath is not supported by the driver specified by This.
485 NvmExpressDriverBindingSupported (
486 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
487 IN EFI_HANDLE Controller
,
488 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
492 Starts a device controller or a bus controller.
494 The Start() function is designed to be invoked from the EFI boot service ConnectController().
495 As a result, much of the error checking on the parameters to Start() has been moved into this
496 common boot service. It is legal to call Start() from other locations,
497 but the following calling restrictions must be followed or the system behavior will not be deterministic.
498 1. ControllerHandle must be a valid EFI_HANDLE.
499 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned
500 EFI_DEVICE_PATH_PROTOCOL.
501 3. Prior to calling Start(), the Supported() function for the driver specified by This must
502 have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.
504 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
505 @param[in] ControllerHandle The handle of the controller to start. This handle
506 must support a protocol interface that supplies
507 an I/O abstraction to the driver.
508 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
509 parameter is ignored by device drivers, and is optional for bus
510 drivers. For a bus driver, if this parameter is NULL, then handles
511 for all the children of Controller are created by this driver.
512 If this parameter is not NULL and the first Device Path Node is
513 not the End of Device Path Node, then only the handle for the
514 child device specified by the first Device Path Node of
515 RemainingDevicePath is created by this driver.
516 If the first Device Path Node of RemainingDevicePath is
517 the End of Device Path Node, no child handle is created by this
520 @retval EFI_SUCCESS The device was started.
521 @retval EFI_DEVICE_ERROR The device could not be started due to a device error.Currently not implemented.
522 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
523 @retval Others The driver failded to start the device.
528 NvmExpressDriverBindingStart (
529 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
530 IN EFI_HANDLE Controller
,
531 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
535 Stops a device controller or a bus controller.
537 The Stop() function is designed to be invoked from the EFI boot service DisconnectController().
538 As a result, much of the error checking on the parameters to Stop() has been moved
539 into this common boot service. It is legal to call Stop() from other locations,
540 but the following calling restrictions must be followed or the system behavior will not be deterministic.
541 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
542 same driver's Start() function.
543 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid
544 EFI_HANDLE. In addition, all of these handles must have been created in this driver's
545 Start() function, and the Start() function must have called OpenProtocol() on
546 ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
548 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
549 @param[in] ControllerHandle A handle to the device being stopped. The handle must
550 support a bus specific I/O protocol for the driver
551 to use to stop the device.
552 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.
553 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
554 if NumberOfChildren is 0.
556 @retval EFI_SUCCESS The device was stopped.
557 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
562 NvmExpressDriverBindingStop (
563 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
564 IN EFI_HANDLE Controller
,
565 IN UINTN NumberOfChildren
,
566 IN EFI_HANDLE
*ChildHandleBuffer
570 Sends an NVM Express Command Packet to an NVM Express controller or namespace. This function supports
571 both blocking I/O and nonblocking I/O. The blocking I/O functionality is required, and the nonblocking
572 I/O functionality is optional.
574 @param[in] This A pointer to the EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL instance.
575 @param[in] NamespaceId Is a 32 bit Namespace ID to which the Express HCI command packet will be sent.
576 A value of 0 denotes the NVM Express controller, a value of all 0FFh in the namespace
577 ID specifies that the command packet should be sent to all valid namespaces.
578 @param[in,out] Packet A pointer to the NVM Express HCI Command Packet to send to the NVMe namespace specified
580 @param[in] Event If nonblocking I/O is not supported then Event is ignored, and blocking I/O is performed.
581 If Event is NULL, then blocking I/O is performed. If Event is not NULL and non blocking I/O
582 is supported, then nonblocking I/O is performed, and Event will be signaled when the NVM
583 Express Command Packet completes.
585 @retval EFI_SUCCESS The NVM Express Command Packet was sent by the host. TransferLength bytes were transferred
586 to, or from DataBuffer.
587 @retval EFI_BAD_BUFFER_SIZE The NVM Express Command Packet was not executed. The number of bytes that could be transferred
588 is returned in TransferLength.
589 @retval EFI_NOT_READY The NVM Express Command Packet could not be sent because the controller is not ready. The caller
590 may retry again later.
591 @retval EFI_DEVICE_ERROR A device error occurred while attempting to send the NVM Express Command Packet.
592 @retval EFI_INVALID_PARAMETER Namespace, or the contents of EFI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET are invalid. The NVM
593 Express Command Packet was not sent, so no additional status information is available.
594 @retval EFI_UNSUPPORTED The command described by the NVM Express Command Packet is not supported by the host adapter.
595 The NVM Express Command Packet was not sent, so no additional status information is available.
596 @retval EFI_TIMEOUT A timeout occurred while waiting for the NVM Express Command Packet to execute.
602 IN EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL
*This
,
603 IN UINT32 NamespaceId
,
604 IN OUT EFI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET
*Packet
,
605 IN EFI_EVENT Event OPTIONAL
609 Used to retrieve the next namespace ID for this NVM Express controller.
611 The EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL.GetNextNamespace() function retrieves the next valid
612 namespace ID on this NVM Express controller.
614 If on input the value pointed to by NamespaceId is 0xFFFFFFFF, then the first valid namespace
615 ID defined on the NVM Express controller is returned in the location pointed to by NamespaceId
616 and a status of EFI_SUCCESS is returned.
618 If on input the value pointed to by NamespaceId is an invalid namespace ID other than 0xFFFFFFFF,
619 then EFI_INVALID_PARAMETER is returned.
621 If on input the value pointed to by NamespaceId is a valid namespace ID, then the next valid
622 namespace ID on the NVM Express controller is returned in the location pointed to by NamespaceId,
623 and EFI_SUCCESS is returned.
625 If the value pointed to by NamespaceId is the namespace ID of the last namespace on the NVM
626 Express controller, then EFI_NOT_FOUND is returned.
628 @param[in] This A pointer to the EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL instance.
629 @param[in,out] NamespaceId On input, a pointer to a legal NamespaceId for an NVM Express
630 namespace present on the NVM Express controller. On output, a
631 pointer to the next NamespaceId of an NVM Express namespace on
632 an NVM Express controller. An input value of 0xFFFFFFFF retrieves
633 the first NamespaceId for an NVM Express namespace present on an
634 NVM Express controller.
636 @retval EFI_SUCCESS The Namespace ID of the next Namespace was returned.
637 @retval EFI_NOT_FOUND There are no more namespaces defined on this controller.
638 @retval EFI_INVALID_PARAMETER NamespaceId is an invalid value other than 0xFFFFFFFF.
643 NvmExpressGetNextNamespace (
644 IN EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL
*This
,
645 IN OUT UINT32
*NamespaceId
649 Used to translate a device path node to a namespace ID.
651 The EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL.GetNamespace() function determines the namespace ID associated with the
652 namespace described by DevicePath.
654 If DevicePath is a device path node type that the NVM Express Pass Thru driver supports, then the NVM Express
655 Pass Thru driver will attempt to translate the contents DevicePath into a namespace ID.
657 If this translation is successful, then that namespace ID is returned in NamespaceId, and EFI_SUCCESS is returned
659 @param[in] This A pointer to the EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL instance.
660 @param[in] DevicePath A pointer to the device path node that describes an NVM Express namespace on
661 the NVM Express controller.
662 @param[out] NamespaceId The NVM Express namespace ID contained in the device path node.
664 @retval EFI_SUCCESS DevicePath was successfully translated to NamespaceId.
665 @retval EFI_INVALID_PARAMETER If DevicePath or NamespaceId are NULL, then EFI_INVALID_PARAMETER is returned.
666 @retval EFI_UNSUPPORTED If DevicePath is not a device path node type that the NVM Express Pass Thru driver
667 supports, then EFI_UNSUPPORTED is returned.
668 @retval EFI_NOT_FOUND If DevicePath is a device path node type that the NVM Express Pass Thru driver
669 supports, but there is not a valid translation from DevicePath to a namespace ID,
670 then EFI_NOT_FOUND is returned.
674 NvmExpressGetNamespace (
675 IN EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL
*This
,
676 IN EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
677 OUT UINT32
*NamespaceId
681 Used to allocate and build a device path node for an NVM Express namespace on an NVM Express controller.
683 The EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL.BuildDevicePath() function allocates and builds a single device
684 path node for the NVM Express namespace specified by NamespaceId.
686 If the NamespaceId is not valid, then EFI_NOT_FOUND is returned.
688 If DevicePath is NULL, then EFI_INVALID_PARAMETER is returned.
690 If there are not enough resources to allocate the device path node, then EFI_OUT_OF_RESOURCES is returned.
692 Otherwise, DevicePath is allocated with the boot service AllocatePool(), the contents of DevicePath are
693 initialized to describe the NVM Express namespace specified by NamespaceId, and EFI_SUCCESS is returned.
695 @param[in] This A pointer to the EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL instance.
696 @param[in] NamespaceId The NVM Express namespace ID for which a device path node is to be
697 allocated and built. Caller must set the NamespaceId to zero if the
698 device path node will contain a valid UUID.
699 @param[in,out] DevicePath A pointer to a single device path node that describes the NVM Express
700 namespace specified by NamespaceId. This function is responsible for
701 allocating the buffer DevicePath with the boot service AllocatePool().
702 It is the caller's responsibility to free DevicePath when the caller
703 is finished with DevicePath.
704 @retval EFI_SUCCESS The device path node that describes the NVM Express namespace specified
705 by NamespaceId was allocated and returned in DevicePath.
706 @retval EFI_NOT_FOUND The NamespaceId is not valid.
707 @retval EFI_INVALID_PARAMETER DevicePath is NULL.
708 @retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate the DevicePath node.
713 NvmExpressBuildDevicePath (
714 IN EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL
*This
,
715 IN UINT32 NamespaceId
,
716 IN OUT EFI_DEVICE_PATH_PROTOCOL
**DevicePath
720 Dump the execution status from a given completion queue entry.
722 @param[in] Cq A pointer to the NVME_CQ item.
731 Register the shutdown notification through the ResetNotification protocol.
733 Register the shutdown notification when mNvmeControllerNumber increased from 0 to 1.
736 NvmeRegisterShutdownNotification (
741 Unregister the shutdown notification through the ResetNotification protocol.
743 Unregister the shutdown notification when mNvmeControllerNumber decreased from 1 to 0.
746 NvmeUnregisterShutdownNotification (