Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Commit 93fc20d

Browse files
zhouji3xbuildslave
authored andcommitted
[efiwrapper] generate same emmc serialno with abl
This patch change generation algorithm of emmc serialno to generate same serialno with abl Change-Id: I28b78e82a1124ff26cc154ab1c1270610089e7eb Tracked-On: https://jira01.devtools.intel.com/browse/OAM-70029 Signed-off-by: zhouji3x <[email protected]> Reviewed-on: https://android.intel.com:443/648213
1 parent 30846e8 commit 93fc20d

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

drivers/mmc_serial/mmc_serial.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,21 +60,24 @@ extern int mmc_cid(uint8_t cid[16]);
6060
static char *build_serial(void)
6161
{
6262
static char serial[15];
63-
struct cid cid;
64-
size_t i;
65-
uint32_t *tmp = (uint32_t *)&cid;
63+
struct cid m_cid;
64+
uint8_t *cid = (uint8_t *) &m_cid;
65+
uint32_t sn;
6666
int ret;
6767

68-
ret = mmc_cid((uint8_t *)&cid);
68+
ret = mmc_cid((uint8_t *)&m_cid);
6969
if (ret)
7070
return NULL;
7171

72-
for (i = 0; i < sizeof(cid) / sizeof(*tmp); i++)
73-
tmp[i] = __builtin_bswap32(tmp[i]);
74-
75-
memcpy(&serial[0], cid.pnm, sizeof(cid.pnm));
76-
snprintf(&serial[6], 9, "%08x", cid.psn);
72+
sn = (cid[9]<<24) | (cid[8]<<16) | (cid[15]<<8) | (cid[14]);
73+
serial[0] = cid[0];
74+
serial[1] = cid[7];
75+
serial[2] = cid[6];
76+
serial[3] = cid[5];
77+
serial[4] = cid[4];
78+
serial[5] = cid[11];
7779

80+
snprintf(&serial[6], 9, "%08x", sn);
7881
return serial;
7982
}
8083

0 commit comments

Comments
 (0)