[PATCH 5/8] nvme: Add shutdown function

Simon Glass sjg at chromium.org
Sat Jan 22 02:40:21 CET 2022


Hi Mark,

On Fri, 14 Jan 2022 at 04:05, Mark Kettenis <kettenis at openbsd.org> wrote:
>
> Add a function to disable the NVMe controller. This will be used
> to let the driver for the NVMe storage integrated on Apple SoCs
> shutdown the NVMe controller such we can shutdown the NVMe
> IOP controller in a clean way afterwards before handing control
> to the OS.
>
> Signed-off-by: Mark Kettenis <kettenis at openbsd.org>
> ---
>  drivers/nvme/nvme.c | 7 +++++++
>  drivers/nvme/nvme.h | 1 +
>  2 files changed, 8 insertions(+)

Reviewed-by: Simon Glass <sjg at chromium.org>
Tested on: Macbook Air M1
Tested-by: Simon Glass <sjg at chromium.org>

with change below

>
> diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c
> index e2d0f9c668..3b1a5c718f 100644
> --- a/drivers/nvme/nvme.c
> +++ b/drivers/nvme/nvme.c
> @@ -896,3 +896,10 @@ free_queue:
>  free_nvme:
>         return ret;
>  }
> +
> +int nvme_shutdown(struct udevice *udev)
> +{
> +       struct nvme_dev *ndev = dev_get_priv(udev);
> +
> +       return nvme_disable_ctrl(ndev);
> +}
> diff --git a/drivers/nvme/nvme.h b/drivers/nvme/nvme.h
> index 57803b43fd..6e39af8831 100644
> --- a/drivers/nvme/nvme.h
> +++ b/drivers/nvme/nvme.h
> @@ -670,5 +670,6 @@ struct nvme_ops {
>  };
>
>  int nvme_init(struct udevice *udev);
> +int nvme_shutdown(struct udevice *udev);

Please add a comment


>
>  #endif /* __DRIVER_NVME_H__ */
> --
> 2.34.1
>


More information about the U-Boot mailing list