]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
Revert "nvme: Fix error in nvme_setup_prps"
authorTom Rini <trini@konsulko.com>
Fri, 19 Nov 2021 01:18:22 +0000 (20:18 -0500)
committerTom Rini <trini@konsulko.com>
Fri, 19 Nov 2021 01:18:22 +0000 (20:18 -0500)
Dependent commit has unaddressed review comments.

This reverts commit c4eef59faab6ae4ecb1beae6d4391b0889bc3ff3.

Signed-off-by: Tom Rini <trini@konsulko.com>
drivers/nvme/nvme.c

index 22ded626a529924dd5d7f22095e5351cf094a0d4..9623c896a15d20c337fe3764d11ccffae34f7f6e 100644 (file)
@@ -100,7 +100,7 @@ static int nvme_setup_prps(struct nvme_dev *dev, u64 *prp2,
        }
 
        nprps = DIV_ROUND_UP(length, page_size);
-       num_pages = DIV_ROUND_UP(nprps + 1, prps_per_page);
+       num_pages = DIV_ROUND_UP(nprps, prps_per_page);
 
        if (nprps > dev->prp_entry_num) {
                free(dev->prp_pool);
@@ -119,11 +119,10 @@ static int nvme_setup_prps(struct nvme_dev *dev, u64 *prp2,
        prp_pool = dev->prp_pool;
        i = 0;
        while (nprps) {
-               if (i == prps_per_page) {
-                       *(prp_pool + i) = *(prp_pool + i - 1);
-                       *(prp_pool + i - 1) = cpu_to_le64((ulong)prp_pool +
+               if (i == ((page_size >> 3) - 1)) {
+                       *(prp_pool + i) = cpu_to_le64((ulong)prp_pool +
                                        page_size);
-                       i = 1;
+                       i = 0;
                        prp_pool += page_size;
                }
                *(prp_pool + i++) = cpu_to_le64(dma_addr);