mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-08-28 18:11:42 +02:00
Merge branch '2022-08-26-assorted-fixes'
- PCIe, NVMe and 2 UBIFS related fixes
This commit is contained in:
commit
cd3872ce7e
16
cmd/pci.c
16
cmd/pci.c
@ -358,6 +358,9 @@ static int pci_cfg_display(struct udevice *dev, ulong addr,
|
|||||||
if (length == 0)
|
if (length == 0)
|
||||||
length = 0x40 / byte_size; /* Standard PCI config space */
|
length = 0x40 / byte_size; /* Standard PCI config space */
|
||||||
|
|
||||||
|
if (addr >= 4096)
|
||||||
|
return 1;
|
||||||
|
|
||||||
/* Print the lines.
|
/* Print the lines.
|
||||||
* once, and all accesses are with the specified bus width.
|
* once, and all accesses are with the specified bus width.
|
||||||
*/
|
*/
|
||||||
@ -378,7 +381,10 @@ static int pci_cfg_display(struct udevice *dev, ulong addr,
|
|||||||
rc = 1;
|
rc = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while (nbytes > 0);
|
} while (nbytes > 0 && addr < 4096);
|
||||||
|
|
||||||
|
if (rc == 0 && nbytes > 0)
|
||||||
|
return 1;
|
||||||
|
|
||||||
return (rc);
|
return (rc);
|
||||||
}
|
}
|
||||||
@ -390,6 +396,9 @@ static int pci_cfg_modify(struct udevice *dev, ulong addr, ulong size,
|
|||||||
int nbytes;
|
int nbytes;
|
||||||
ulong val;
|
ulong val;
|
||||||
|
|
||||||
|
if (addr >= 4096)
|
||||||
|
return 1;
|
||||||
|
|
||||||
/* Print the address, followed by value. Then accept input for
|
/* Print the address, followed by value. Then accept input for
|
||||||
* the next value. A non-converted value exits.
|
* the next value. A non-converted value exits.
|
||||||
*/
|
*/
|
||||||
@ -427,7 +436,10 @@ static int pci_cfg_modify(struct udevice *dev, ulong addr, ulong size,
|
|||||||
addr += size;
|
addr += size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (nbytes);
|
} while (nbytes && addr < 4096);
|
||||||
|
|
||||||
|
if (nbytes)
|
||||||
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -479,7 +479,7 @@ int blk_get_device_part_str(const char *ifname, const char *dev_part_str,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_CMD_UBIFS
|
#if IS_ENABLED(CONFIG_CMD_UBIFS) && !IS_ENABLED(CONFIG_SPL_BUILD)
|
||||||
/*
|
/*
|
||||||
* Special-case ubi, ubi goes through a mtd, rather than through
|
* Special-case ubi, ubi goes through a mtd, rather than through
|
||||||
* a regular block device.
|
* a regular block device.
|
||||||
|
@ -27,9 +27,8 @@
|
|||||||
#define IO_TIMEOUT 30
|
#define IO_TIMEOUT 30
|
||||||
#define MAX_PRP_POOL 512
|
#define MAX_PRP_POOL 512
|
||||||
|
|
||||||
static int nvme_wait_ready(struct nvme_dev *dev, bool enabled)
|
static int nvme_wait_csts(struct nvme_dev *dev, u32 mask, u32 val)
|
||||||
{
|
{
|
||||||
u32 bit = enabled ? NVME_CSTS_RDY : 0;
|
|
||||||
int timeout;
|
int timeout;
|
||||||
ulong start;
|
ulong start;
|
||||||
|
|
||||||
@ -38,7 +37,7 @@ static int nvme_wait_ready(struct nvme_dev *dev, bool enabled)
|
|||||||
|
|
||||||
start = get_timer(0);
|
start = get_timer(0);
|
||||||
while (get_timer(start) < timeout) {
|
while (get_timer(start) < timeout) {
|
||||||
if ((readl(&dev->bar->csts) & NVME_CSTS_RDY) == bit)
|
if ((readl(&dev->bar->csts) & mask) == val)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,7 +294,7 @@ static int nvme_enable_ctrl(struct nvme_dev *dev)
|
|||||||
dev->ctrl_config |= NVME_CC_ENABLE;
|
dev->ctrl_config |= NVME_CC_ENABLE;
|
||||||
writel(dev->ctrl_config, &dev->bar->cc);
|
writel(dev->ctrl_config, &dev->bar->cc);
|
||||||
|
|
||||||
return nvme_wait_ready(dev, true);
|
return nvme_wait_csts(dev, NVME_CSTS_RDY, NVME_CSTS_RDY);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int nvme_disable_ctrl(struct nvme_dev *dev)
|
static int nvme_disable_ctrl(struct nvme_dev *dev)
|
||||||
@ -304,7 +303,16 @@ static int nvme_disable_ctrl(struct nvme_dev *dev)
|
|||||||
dev->ctrl_config &= ~NVME_CC_ENABLE;
|
dev->ctrl_config &= ~NVME_CC_ENABLE;
|
||||||
writel(dev->ctrl_config, &dev->bar->cc);
|
writel(dev->ctrl_config, &dev->bar->cc);
|
||||||
|
|
||||||
return nvme_wait_ready(dev, false);
|
return nvme_wait_csts(dev, NVME_CSTS_RDY, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int nvme_shutdown_ctrl(struct nvme_dev *dev)
|
||||||
|
{
|
||||||
|
dev->ctrl_config &= ~NVME_CC_SHN_MASK;
|
||||||
|
dev->ctrl_config |= NVME_CC_SHN_NORMAL;
|
||||||
|
writel(dev->ctrl_config, &dev->bar->cc);
|
||||||
|
|
||||||
|
return nvme_wait_csts(dev, NVME_CSTS_SHST_MASK, NVME_CSTS_SHST_CMPLT);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nvme_free_queue(struct nvme_queue *nvmeq)
|
static void nvme_free_queue(struct nvme_queue *nvmeq)
|
||||||
@ -904,6 +912,13 @@ free_nvme:
|
|||||||
int nvme_shutdown(struct udevice *udev)
|
int nvme_shutdown(struct udevice *udev)
|
||||||
{
|
{
|
||||||
struct nvme_dev *ndev = dev_get_priv(udev);
|
struct nvme_dev *ndev = dev_get_priv(udev);
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = nvme_shutdown_ctrl(ndev);
|
||||||
|
if (ret < 0) {
|
||||||
|
printf("Error: %s: Shutdown timed out!\n", udev->name);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
return nvme_disable_ctrl(ndev);
|
return nvme_disable_ctrl(ndev);
|
||||||
}
|
}
|
||||||
|
@ -286,6 +286,8 @@ int pci_bus_write_config(struct udevice *bus, pci_dev_t bdf, int offset,
|
|||||||
ops = pci_get_ops(bus);
|
ops = pci_get_ops(bus);
|
||||||
if (!ops->write_config)
|
if (!ops->write_config)
|
||||||
return -ENOSYS;
|
return -ENOSYS;
|
||||||
|
if (offset < 0 || offset >= 4096)
|
||||||
|
return -EINVAL;
|
||||||
return ops->write_config(bus, bdf, offset, value, size);
|
return ops->write_config(bus, bdf, offset, value, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -364,8 +366,14 @@ int pci_bus_read_config(const struct udevice *bus, pci_dev_t bdf, int offset,
|
|||||||
struct dm_pci_ops *ops;
|
struct dm_pci_ops *ops;
|
||||||
|
|
||||||
ops = pci_get_ops(bus);
|
ops = pci_get_ops(bus);
|
||||||
if (!ops->read_config)
|
if (!ops->read_config) {
|
||||||
|
*valuep = pci_conv_32_to_size(~0, offset, size);
|
||||||
return -ENOSYS;
|
return -ENOSYS;
|
||||||
|
}
|
||||||
|
if (offset < 0 || offset >= 4096) {
|
||||||
|
*valuep = pci_conv_32_to_size(0, offset, size);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
return ops->read_config(bus, bdf, offset, valuep, size);
|
return ops->read_config(bus, bdf, offset, valuep, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@
|
|||||||
#ifdef CONFIG_CMD_UBIFS
|
#ifdef CONFIG_CMD_UBIFS
|
||||||
#define BOOTENV_SHARED_UBIFS \
|
#define BOOTENV_SHARED_UBIFS \
|
||||||
"ubifs_boot=" \
|
"ubifs_boot=" \
|
||||||
"if ubi part ${bootubipart} && " \
|
"if ubi part ${bootubipart} ${bootubioff} && " \
|
||||||
"ubifsmount ubi0:${bootubivol}; " \
|
"ubifsmount ubi0:${bootubivol}; " \
|
||||||
"then " \
|
"then " \
|
||||||
"devtype=ubi; " \
|
"devtype=ubi; " \
|
||||||
@ -80,12 +80,14 @@
|
|||||||
"run scan_dev_for_boot; " \
|
"run scan_dev_for_boot; " \
|
||||||
"ubifsumount; " \
|
"ubifsumount; " \
|
||||||
"fi\0"
|
"fi\0"
|
||||||
#define BOOTENV_DEV_UBIFS(devtypeu, devtypel, instance, bootubipart, bootubivol) \
|
#define BOOTENV_DEV_UBIFS_BOOTUBIOFF(off) #off /* type check, throw error when called with more args */
|
||||||
|
#define BOOTENV_DEV_UBIFS(devtypeu, devtypel, instance, bootubipart, bootubivol, ...) \
|
||||||
"bootcmd_ubifs" #instance "=" \
|
"bootcmd_ubifs" #instance "=" \
|
||||||
"bootubipart=" #bootubipart "; " \
|
"bootubipart=" #bootubipart "; " \
|
||||||
"bootubivol=" #bootubivol "; " \
|
"bootubivol=" #bootubivol "; " \
|
||||||
|
"bootubioff=" BOOTENV_DEV_UBIFS_BOOTUBIOFF(__VA_ARGS__) "; " \
|
||||||
"run ubifs_boot\0"
|
"run ubifs_boot\0"
|
||||||
#define BOOTENV_DEV_NAME_UBIFS(devtypeu, devtypel, instance, bootubipart, bootubivol) \
|
#define BOOTENV_DEV_NAME_UBIFS(devtypeu, devtypel, instance, ...) \
|
||||||
#devtypel #instance " "
|
#devtypel #instance " "
|
||||||
#else
|
#else
|
||||||
#define BOOTENV_SHARED_UBIFS
|
#define BOOTENV_SHARED_UBIFS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user