git: ddc0ad6b45d6 - main - sysutils/mmc-utils: Update to 20230209 version
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 15 Apr 2023 19:02:05 UTC
The branch main has been updated by marius: URL: https://cgit.FreeBSD.org/ports/commit/?id=ddc0ad6b45d697222d335985d7a44ecfc04532ca commit ddc0ad6b45d697222d335985d7a44ecfc04532ca Author: Marius Strobl <marius@FreeBSD.org> AuthorDate: 2023-04-14 20:54:46 +0000 Commit: Marius Strobl <marius@FreeBSD.org> CommitDate: 2023-04-15 19:01:47 +0000 sysutils/mmc-utils: Update to 20230209 version This loops back some local fixes and enhancements but also brings initial support for writing EXT_CSD values and GEN_CMD (CMD56) read support, both for vendor-specific bits. Also: - Use more up-to-date location for WWW and pkg-descr. - Take back port. Approved by: netchild --- sysutils/mmc-utils/Makefile | 8 ++-- sysutils/mmc-utils/distinfo | 6 +-- sysutils/mmc-utils/files/patch-man_mmc.1 | 33 ----------------- sysutils/mmc-utils/files/patch-mmc.c | 22 +++++++++-- sysutils/mmc-utils/files/patch-mmc.h | 12 ++---- sysutils/mmc-utils/files/patch-mmc__cmds.c | 59 +++++++++++++++++------------- sysutils/mmc-utils/pkg-descr | 2 +- 7 files changed, 65 insertions(+), 77 deletions(-) diff --git a/sysutils/mmc-utils/Makefile b/sysutils/mmc-utils/Makefile index bfb7a0290b5e..031e7befa88d 100644 --- a/sysutils/mmc-utils/Makefile +++ b/sysutils/mmc-utils/Makefile @@ -1,18 +1,18 @@ PORTNAME= mmc-utils -DISTVERSION= 20211202 +DISTVERSION= 20230209 DISTVERSIONSUFFIX= -${MMC_GITSHASH} CATEGORIES= sysutils MASTER_SITES= https://git.kernel.org/pub/scm/utils/mmc/mmc-utils.git/snapshot/${MMC_GITHASH}${EXTRACT_SUFX}?dummy=/ -MAINTAINER= ports@FreeBSD.org +MAINTAINER= marius@FreeBSD.org COMMENT= Userspace tools for MMC/SD devices -WWW= https://www.kernel.org/doc/Documentation/mmc/mmc-tools.txt +WWW= https://www.kernel.org/doc/html/latest/driver-api/mmc/mmc-tools.html LICENSE= BSD3CLAUSE GPLv2 LICENSE_COMB= multi IGNORE_DragonFly= only supported on FreeBSD -MMC_GITHASH= a1b233c2a31baa5b77cb67c0c3be4767be86f727 +MMC_GITHASH= d4c2910981ff99b983734426dfa99632fb81ac6b MMC_GITSHASH= ${MMC_GITHASH:C/^(........).*/\1/} PLIST_FILES= man/man1/mmc.1.gz sbin/mmc USES= gmake diff --git a/sysutils/mmc-utils/distinfo b/sysutils/mmc-utils/distinfo index 7278400b05f9..f98908a6048e 100644 --- a/sysutils/mmc-utils/distinfo +++ b/sysutils/mmc-utils/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1639924509 -SHA256 (mmc-utils-20211202-a1b233c2.tar.gz) = fb275b57353bb53ff97d9ba4716928ed159341a1e1539f6face40bc63b39e674 -SIZE (mmc-utils-20211202-a1b233c2.tar.gz) = 47220 +TIMESTAMP = 1676241599 +SHA256 (mmc-utils-20230209-d4c29109.tar.gz) = ba1414aaa31d87f0c37b6a8ddf6da67af4776a2e6b05c165d4d6d53294c7a628 +SIZE (mmc-utils-20230209-d4c29109.tar.gz) = 50506 diff --git a/sysutils/mmc-utils/files/patch-man_mmc.1 b/sysutils/mmc-utils/files/patch-man_mmc.1 deleted file mode 100644 index 284d221c1326..000000000000 --- a/sysutils/mmc-utils/files/patch-man_mmc.1 +++ /dev/null @@ -1,33 +0,0 @@ ---- man/mmc.1.orig 2021-12-18 19:59:21 UTC -+++ man/mmc.1 -@@ -30,21 +30,24 @@ This sets the eMMC to be write-protected until next bo - Set the eMMC data sector size to 4KB by disabling emulation on - <device>. - .TP --.BR "gp create <-y|-n> <length KiB> <partition> <enh_attr> <ext_attr> <device>" -+.BR "gp create <-y|-n|-c> <length KiB> <partition> <enh_attr> <ext_attr> <device>" - create general purpose partition for the <device>. --Dry-run only unless -y is passed. -+Dry-run only unless -y or -c is passed. -+Use -c if more partitioning settings are still to come. - To set enhanced attribute to general partition being created set <enh_attr> to 1 else set it to 0. - To set extended attribute to general partition set <ext_attr> to 1,2 else set it to 0. - NOTE! This is a one-time programmable (unreversible) change. - .TP --.BR "enh_area set <-y|-n> <start KiB> <length KiB> <device>" -+.BR "enh_area set <-y|-n|-c> <start KiB> <length KiB> <device>" - Enable the enhanced user area for the <device>. --Dry-run only unless -y is passed. -+Dry-run only unless -y or -c is passed. -+Use -c if more partitioning settings are still to come. - NOTE! This is a one-time programmable (unreversible) change. - .TP --.BR "write_reliability set <-y|-n> <partition> <device>" -+.BR "write_reliability set <-y|-n|-c> <partition> <device>" - Enable write reliability per partition for the <device>. --Dry-run only unless -y is passed. -+Dry-run only unless -y or -c is passed. -+Use -c if more partitioning settings are still to come. - NOTE! This is a one-time programmable (unreversible) change. - .TP - .BR "status get <device>" diff --git a/sysutils/mmc-utils/files/patch-mmc.c b/sysutils/mmc-utils/files/patch-mmc.c index cf88845d082c..0255a194a82d 100644 --- a/sysutils/mmc-utils/files/patch-mmc.c +++ b/sysutils/mmc-utils/files/patch-mmc.c @@ -1,6 +1,6 @@ ---- mmc.c.orig 2021-12-18 19:59:21 UTC +--- mmc.c.orig 2023-02-09 14:16:51 UTC +++ mmc.c -@@ -229,6 +229,7 @@ static struct Command commands[] = { +@@ -234,6 +234,7 @@ static struct Command commands[] = { "Run Field Firmware Update with <image name> on <device>.\n", NULL }, @@ -8,10 +8,26 @@ { do_erase, -4, "erase", "<type> " "<start address> " "<end address> " "<device>\n" "Send Erase CMD38 with specific argument to the <device>\n\n" -@@ -237,6 +238,7 @@ static struct Command commands[] = { +@@ -242,6 +243,7 @@ static struct Command commands[] = { "secure-trim1 | secure-trim2 | trim \n", NULL }, ++#endif + { do_general_cmd_read, -1, + "gen_cmd read", "<device> [arg]\n" + "Send GEN_CMD (CMD56) to read vendor-specific format/meaning data from <device>\n\n" +@@ -260,6 +262,7 @@ static struct Command commands[] = { + "Issues a CMD0 GO_PRE_IDLE", + NULL + }, ++#if defined(__linux__) + { do_alt_boot_op, -1, + "boot_operation", "<boot_data_file> <device>\n" + "Does the alternative boot operation and writes the specified starting blocks of boot data into the requested file.\n\n" +@@ -272,6 +275,7 @@ static struct Command commands[] = { + "4. The MMC will perform a soft reset, if your system cannot handle that do not use the boot operation from mmc-utils.\n", + NULL + }, +#endif { 0, 0, 0, 0 } }; diff --git a/sysutils/mmc-utils/files/patch-mmc.h b/sysutils/mmc-utils/files/patch-mmc.h index b1b5eab3cb51..9db6d8ec4374 100644 --- a/sysutils/mmc-utils/files/patch-mmc.h +++ b/sysutils/mmc-utils/files/patch-mmc.h @@ -1,10 +1,11 @@ ---- mmc.h.orig 2021-12-18 19:59:21 UTC +--- mmc.h.orig 2023-02-09 14:16:51 UTC +++ mmc.h -@@ -17,10 +17,26 @@ +@@ -17,8 +17,22 @@ * those modifications are Copyright (c) 2016 SanDisk Corp. */ +#if defined(__linux__) + #include <linux/major.h> #include <linux/mmc/ioctl.h> +#elif defined(__FreeBSD__) +#include <dev/mmc/mmc_ioctl.h> @@ -20,10 +21,5 @@ +typedef uint64_t __u64; +#endif -+#if 0 - /* From kernel linux/major.h */ - #define MMC_BLOCK_MAJOR 179 -+#endif - /* From kernel linux/mmc/mmc.h */ - #define MMC_SWITCH 6 /* ac [31:0] See below R1b */ + #define MMC_GO_IDLE_STATE 0 /* bc */ diff --git a/sysutils/mmc-utils/files/patch-mmc__cmds.c b/sysutils/mmc-utils/files/patch-mmc__cmds.c index fdac6beabd56..305e2ec7461f 100644 --- a/sysutils/mmc-utils/files/patch-mmc__cmds.c +++ b/sysutils/mmc-utils/files/patch-mmc__cmds.c @@ -1,4 +1,4 @@ ---- mmc_cmds.c.orig 2021-12-18 19:59:21 UTC +--- mmc_cmds.c.orig 2023-02-09 14:16:51 UTC +++ mmc_cmds.c @@ -28,7 +28,12 @@ #include <errno.h> @@ -13,7 +13,23 @@ #include "mmc.h" #include "mmc_cmds.h" -@@ -120,8 +125,19 @@ static __u32 get_size_in_blks(int fd) +@@ -88,8 +93,15 @@ int write_extcsd_value(int fd, __u8 index, __u8 value, + (value << 8) | + EXT_CSD_CMD_SET_NORMAL; + idata.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC; ++#if defined(__FreeBSD__) ++ if (timeout_ms != 0) { ++ fprintf(stderr, "Command timeout not supported\n"); ++ 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) +@@ -121,8 +133,19 @@ static __u32 get_size_in_blks(int fd) { int res; int size; @@ -33,27 +49,7 @@ if (res) { fprintf(stderr, "Error getting device size, errno: %d\n", errno); -@@ -1605,13 +1621,18 @@ int do_read_extcsd(int nargs, char **argv) - /* A441/A43: reserved [197] [195] [193] [190] [188] - * [186] [184] [182] [180] [176] */ - -- if (ext_csd_rev >= 6) -+ if (ext_csd_rev >= 6) { - printf("I/O Driver Strength [DRIVER_STRENGTH: 0x%02x]\n", - ext_csd[197]); -+ printf("Enhanced Strobe mode [STROBE_SUPPORT: 0x%02x]\n", -+ ext_csd[184]); -+ } - - /* DEVICE_TYPE in A45, CARD_TYPE in A441 */ - reg = ext_csd[196]; - printf("Card Type [CARD_TYPE: 0x%02x]\n", reg); -+ if (reg & 0x80) printf(" HS400 Dual Data Rate eMMC @200MHz 1.2VI/O\n"); -+ if (reg & 0x40) printf(" HS400 Dual Data Rate eMMC @200MHz 1.8VI/O\n"); - if (reg & 0x20) printf(" HS200 Single Data Rate eMMC @200MHz 1.2VI/O\n"); - if (reg & 0x10) printf(" HS200 Single Data Rate eMMC @200MHz 1.8VI/O\n"); - if (reg & 0x08) printf(" HS Dual Data Rate eMMC @52MHz 1.2VI/O\n"); -@@ -1881,8 +1902,10 @@ int do_read_extcsd(int nargs, char **argv) +@@ -1974,8 +1997,10 @@ int do_read_extcsd(int nargs, char **argv) (ext_csd[EXT_CSD_CMDQ_DEPTH] & 0x1f) + 1); printf("Command Enabled [CMDQ_MODE_EN]: 0x%02x\n", ext_csd[EXT_CSD_CMDQ_MODE_EN]); @@ -64,7 +60,7 @@ } out_free: return ret; -@@ -2515,6 +2538,7 @@ int do_cache_dis(int nargs, char **argv) +@@ -2646,6 +2671,7 @@ int do_cache_dis(int nargs, char **argv) return do_cache_ctrl(0, nargs, argv); } @@ -72,7 +68,7 @@ static int erase(int dev_fd, __u32 argin, __u32 start, __u32 end) { int ret = 0; -@@ -2657,6 +2681,7 @@ out: +@@ -2800,6 +2826,7 @@ out: close(dev_fd); return ret; } @@ -80,3 +76,16 @@ int do_ffu(int nargs, char **argv) +@@ -3145,6 +3172,7 @@ int do_preidle(int nargs, char **argv) + return 0; + } + ++#if defined(__linux__) + int do_alt_boot_op(int nargs, char **argv) + { + int fd, ret, boot_data_fd; +@@ -3247,3 +3275,4 @@ dev_fd_close: + exit(1); + return 0; + } ++#endif diff --git a/sysutils/mmc-utils/pkg-descr b/sysutils/mmc-utils/pkg-descr index 78c85514c224..d55ec10587e9 100644 --- a/sysutils/mmc-utils/pkg-descr +++ b/sysutils/mmc-utils/pkg-descr @@ -2,7 +2,7 @@ MMC tools introduction ====================== There is one MMC test tools called mmc-utils, which is maintained by -Chris Ball, you can find it at the below public git repository: +Ulf Hansson, you can find it at the below public git repository: https://git.kernel.org/pub/scm/utils/mmc/mmc-utils.git Functions