Message ID | 45BEF419-969C-495B-9802-C6DE0BBBDF0A@siemens.com |
---|---|
State | Accepted |
Headers | show |
Series | FreeBSD: Fix eMMC handler and infrastructure | expand |
On 03.06.24 20:48, 'Storm, Christian' via swupdate wrote: > With the eMMC internal register handler and the > unconditional build of emmc_utils.o introduced, > the FreeBSD build was broken. > > Fix it along the lines of the FreeBSD patches in > https://cgit.freebsd.org/ports/tree/sysutils/mmc-utils/files > > Signed-off-by: Christian Storm <christian.storm@siemens.com> > --- > corelib/emmc_utils.c | 13 +++++++++++++ > handlers/emmc_csd_handler.c | 6 ++++++ > 2 files changed, 19 insertions(+) > > diff --git a/corelib/emmc_utils.c b/corelib/emmc_utils.c > index f12c7867..cabcdf8e 100644 > --- a/corelib/emmc_utils.c > +++ b/corelib/emmc_utils.c > @@ -12,10 +12,16 @@ > #include <stddef.h> > #include <stdint.h> > #include <errno.h> > +#if defined(__linux__) > #include <linux/version.h> > +#endif > #include <sys/ioctl.h> > +#if defined(__linux__) > #include <linux/major.h> > #include <linux/mmc/ioctl.h> > +#elif defined(__FreeBSD__) > +#include <dev/mmc/mmc_ioctl.h> > +#endif > #include "emmc.h" > #include "util.h" > > @@ -59,8 +65,15 @@ static int emmc_write_extcsd_value(int fd, __u8 index, __u8 value, unsigned int > > fill_switch_cmd(&idata, index, value); > > +#if defined(__FreeBSD__) > + if (timeout_ms != 0) { > + ERROR("Command timeout not supported"); > + return -EOPNOTSUPP; > + } > +#else > /* Kernel will set cmd_timeout_ms if 0 is set */ > idata.cmd_timeout_ms = timeout_ms; > +#endif > > ret = ioctl(fd, MMC_IOC_CMD, &idata); > if (ret) > diff --git a/handlers/emmc_csd_handler.c b/handlers/emmc_csd_handler.c > index 27bd0257..0f9519f5 100644 > --- a/handlers/emmc_csd_handler.c > +++ b/handlers/emmc_csd_handler.c > @@ -18,9 +18,15 @@ > #include <stdbool.h> > #include <stddef.h> > #include <errno.h> > +#if defined(__linux__) > #include <linux/version.h> > +#endif > #include <sys/ioctl.h> > +#if defined(__linux__) > #include <linux/mmc/ioctl.h> > +#elif defined(__FreeBSD__) > +#include <dev/mmc/mmc_ioctl.h> > +#endif > #include "swupdate_image.h" > #include "handler.h" > #include "util.h" Applied to -master, thanks ! Best regards, Stefano Babic
diff --git a/corelib/emmc_utils.c b/corelib/emmc_utils.c index f12c7867..cabcdf8e 100644 --- a/corelib/emmc_utils.c +++ b/corelib/emmc_utils.c @@ -12,10 +12,16 @@ #include <stddef.h> #include <stdint.h> #include <errno.h> +#if defined(__linux__) #include <linux/version.h> +#endif #include <sys/ioctl.h> +#if defined(__linux__) #include <linux/major.h> #include <linux/mmc/ioctl.h> +#elif defined(__FreeBSD__) +#include <dev/mmc/mmc_ioctl.h> +#endif #include "emmc.h" #include "util.h" @@ -59,8 +65,15 @@ static int emmc_write_extcsd_value(int fd, __u8 index, __u8 value, unsigned int fill_switch_cmd(&idata, index, value); +#if defined(__FreeBSD__) + if (timeout_ms != 0) { + ERROR("Command timeout not supported"); + return -EOPNOTSUPP; + } +#else /* Kernel will set cmd_timeout_ms if 0 is set */ idata.cmd_timeout_ms = timeout_ms; +#endif ret = ioctl(fd, MMC_IOC_CMD, &idata); if (ret) diff --git a/handlers/emmc_csd_handler.c b/handlers/emmc_csd_handler.c index 27bd0257..0f9519f5 100644 --- a/handlers/emmc_csd_handler.c +++ b/handlers/emmc_csd_handler.c @@ -18,9 +18,15 @@ #include <stdbool.h> #include <stddef.h> #include <errno.h> +#if defined(__linux__) #include <linux/version.h> +#endif #include <sys/ioctl.h> +#if defined(__linux__) #include <linux/mmc/ioctl.h> +#elif defined(__FreeBSD__) +#include <dev/mmc/mmc_ioctl.h> +#endif #include "swupdate_image.h" #include "handler.h" #include "util.h"
With the eMMC internal register handler and the unconditional build of emmc_utils.o introduced, the FreeBSD build was broken. Fix it along the lines of the FreeBSD patches in https://cgit.freebsd.org/ports/tree/sysutils/mmc-utils/files Signed-off-by: Christian Storm <christian.storm@siemens.com> --- corelib/emmc_utils.c | 13 +++++++++++++ handlers/emmc_csd_handler.c | 6 ++++++ 2 files changed, 19 insertions(+)