mxsboot.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673
  1. /*
  2. * Freescale i.MX28 image generator
  3. *
  4. * Copyright (C) 2011 Marek Vasut <marek.vasut@gmail.com>
  5. * on behalf of DENX Software Engineering GmbH
  6. *
  7. * SPDX-License-Identifier: GPL-2.0+
  8. */
  9. #include <fcntl.h>
  10. #include <sys/stat.h>
  11. #include <sys/types.h>
  12. #include <unistd.h>
  13. #include "compiler.h"
  14. /*
  15. * Default BCB layout.
  16. *
  17. * TWEAK this if you have blown any OCOTP fuses.
  18. */
  19. #define STRIDE_PAGES 64
  20. #define STRIDE_COUNT 4
  21. /*
  22. * Layout for 256Mb big NAND with 2048b page size, 64b OOB size and
  23. * 128kb erase size.
  24. *
  25. * TWEAK this if you have different kind of NAND chip.
  26. */
  27. static uint32_t nand_writesize = 2048;
  28. static uint32_t nand_oobsize = 64;
  29. static uint32_t nand_erasesize = 128 * 1024;
  30. /*
  31. * Sector on which the SigmaTel boot partition (0x53) starts.
  32. */
  33. static uint32_t sd_sector = 2048;
  34. /*
  35. * Each of the U-Boot bootstreams is at maximum 1MB big.
  36. *
  37. * TWEAK this if, for some wild reason, you need to boot bigger image.
  38. */
  39. #define MAX_BOOTSTREAM_SIZE (1 * 1024 * 1024)
  40. /* i.MX28 NAND controller-specific constants. DO NOT TWEAK! */
  41. #define MXS_NAND_DMA_DESCRIPTOR_COUNT 4
  42. #define MXS_NAND_CHUNK_DATA_CHUNK_SIZE 512
  43. #define MXS_NAND_METADATA_SIZE 10
  44. #define MXS_NAND_COMMAND_BUFFER_SIZE 32
  45. struct mx28_nand_fcb {
  46. uint32_t checksum;
  47. uint32_t fingerprint;
  48. uint32_t version;
  49. struct {
  50. uint8_t data_setup;
  51. uint8_t data_hold;
  52. uint8_t address_setup;
  53. uint8_t dsample_time;
  54. uint8_t nand_timing_state;
  55. uint8_t rea;
  56. uint8_t rloh;
  57. uint8_t rhoh;
  58. } timing;
  59. uint32_t page_data_size;
  60. uint32_t total_page_size;
  61. uint32_t sectors_per_block;
  62. uint32_t number_of_nands; /* Ignored */
  63. uint32_t total_internal_die; /* Ignored */
  64. uint32_t cell_type; /* Ignored */
  65. uint32_t ecc_block_n_ecc_type;
  66. uint32_t ecc_block_0_size;
  67. uint32_t ecc_block_n_size;
  68. uint32_t ecc_block_0_ecc_type;
  69. uint32_t metadata_bytes;
  70. uint32_t num_ecc_blocks_per_page;
  71. uint32_t ecc_block_n_ecc_level_sdk; /* Ignored */
  72. uint32_t ecc_block_0_size_sdk; /* Ignored */
  73. uint32_t ecc_block_n_size_sdk; /* Ignored */
  74. uint32_t ecc_block_0_ecc_level_sdk; /* Ignored */
  75. uint32_t num_ecc_blocks_per_page_sdk; /* Ignored */
  76. uint32_t metadata_bytes_sdk; /* Ignored */
  77. uint32_t erase_threshold;
  78. uint32_t boot_patch;
  79. uint32_t patch_sectors;
  80. uint32_t firmware1_starting_sector;
  81. uint32_t firmware2_starting_sector;
  82. uint32_t sectors_in_firmware1;
  83. uint32_t sectors_in_firmware2;
  84. uint32_t dbbt_search_area_start_address;
  85. uint32_t badblock_marker_byte;
  86. uint32_t badblock_marker_start_bit;
  87. uint32_t bb_marker_physical_offset;
  88. };
  89. struct mx28_nand_dbbt {
  90. uint32_t checksum;
  91. uint32_t fingerprint;
  92. uint32_t version;
  93. uint32_t number_bb;
  94. uint32_t number_2k_pages_bb;
  95. };
  96. struct mx28_nand_bbt {
  97. uint32_t nand;
  98. uint32_t number_bb;
  99. uint32_t badblock[510];
  100. };
  101. struct mx28_sd_drive_info {
  102. uint32_t chip_num;
  103. uint32_t drive_type;
  104. uint32_t tag;
  105. uint32_t first_sector_number;
  106. uint32_t sector_count;
  107. };
  108. struct mx28_sd_config_block {
  109. uint32_t signature;
  110. uint32_t primary_boot_tag;
  111. uint32_t secondary_boot_tag;
  112. uint32_t num_copies;
  113. struct mx28_sd_drive_info drv_info[1];
  114. };
  115. static inline uint32_t mx28_nand_ecc_size_in_bits(uint32_t ecc_strength)
  116. {
  117. return ecc_strength * 13;
  118. }
  119. static inline uint32_t mx28_nand_get_ecc_strength(uint32_t page_data_size,
  120. uint32_t page_oob_size)
  121. {
  122. if (page_data_size == 2048)
  123. return 8;
  124. if (page_data_size == 4096) {
  125. if (page_oob_size == 128)
  126. return 8;
  127. if (page_oob_size == 218)
  128. return 16;
  129. }
  130. return 0;
  131. }
  132. static inline uint32_t mx28_nand_get_mark_offset(uint32_t page_data_size,
  133. uint32_t ecc_strength)
  134. {
  135. uint32_t chunk_data_size_in_bits;
  136. uint32_t chunk_ecc_size_in_bits;
  137. uint32_t chunk_total_size_in_bits;
  138. uint32_t block_mark_chunk_number;
  139. uint32_t block_mark_chunk_bit_offset;
  140. uint32_t block_mark_bit_offset;
  141. chunk_data_size_in_bits = MXS_NAND_CHUNK_DATA_CHUNK_SIZE * 8;
  142. chunk_ecc_size_in_bits = mx28_nand_ecc_size_in_bits(ecc_strength);
  143. chunk_total_size_in_bits =
  144. chunk_data_size_in_bits + chunk_ecc_size_in_bits;
  145. /* Compute the bit offset of the block mark within the physical page. */
  146. block_mark_bit_offset = page_data_size * 8;
  147. /* Subtract the metadata bits. */
  148. block_mark_bit_offset -= MXS_NAND_METADATA_SIZE * 8;
  149. /*
  150. * Compute the chunk number (starting at zero) in which the block mark
  151. * appears.
  152. */
  153. block_mark_chunk_number =
  154. block_mark_bit_offset / chunk_total_size_in_bits;
  155. /*
  156. * Compute the bit offset of the block mark within its chunk, and
  157. * validate it.
  158. */
  159. block_mark_chunk_bit_offset = block_mark_bit_offset -
  160. (block_mark_chunk_number * chunk_total_size_in_bits);
  161. if (block_mark_chunk_bit_offset > chunk_data_size_in_bits)
  162. return 1;
  163. /*
  164. * Now that we know the chunk number in which the block mark appears,
  165. * we can subtract all the ECC bits that appear before it.
  166. */
  167. block_mark_bit_offset -=
  168. block_mark_chunk_number * chunk_ecc_size_in_bits;
  169. return block_mark_bit_offset;
  170. }
  171. static inline uint32_t mx28_nand_mark_byte_offset(void)
  172. {
  173. uint32_t ecc_strength;
  174. ecc_strength = mx28_nand_get_ecc_strength(nand_writesize, nand_oobsize);
  175. return mx28_nand_get_mark_offset(nand_writesize, ecc_strength) >> 3;
  176. }
  177. static inline uint32_t mx28_nand_mark_bit_offset(void)
  178. {
  179. uint32_t ecc_strength;
  180. ecc_strength = mx28_nand_get_ecc_strength(nand_writesize, nand_oobsize);
  181. return mx28_nand_get_mark_offset(nand_writesize, ecc_strength) & 0x7;
  182. }
  183. static uint32_t mx28_nand_block_csum(uint8_t *block, uint32_t size)
  184. {
  185. uint32_t csum = 0;
  186. int i;
  187. for (i = 0; i < size; i++)
  188. csum += block[i];
  189. return csum ^ 0xffffffff;
  190. }
  191. static struct mx28_nand_fcb *mx28_nand_get_fcb(uint32_t size)
  192. {
  193. struct mx28_nand_fcb *fcb;
  194. uint32_t bcb_size_bytes;
  195. uint32_t stride_size_bytes;
  196. uint32_t bootstream_size_pages;
  197. uint32_t fw1_start_page;
  198. uint32_t fw2_start_page;
  199. fcb = malloc(nand_writesize);
  200. if (!fcb) {
  201. printf("MX28 NAND: Unable to allocate FCB\n");
  202. return NULL;
  203. }
  204. memset(fcb, 0, nand_writesize);
  205. fcb->fingerprint = 0x20424346;
  206. fcb->version = 0x01000000;
  207. /*
  208. * FIXME: These here are default values as found in kobs-ng. We should
  209. * probably retrieve the data from NAND or something.
  210. */
  211. fcb->timing.data_setup = 80;
  212. fcb->timing.data_hold = 60;
  213. fcb->timing.address_setup = 25;
  214. fcb->timing.dsample_time = 6;
  215. fcb->page_data_size = nand_writesize;
  216. fcb->total_page_size = nand_writesize + nand_oobsize;
  217. fcb->sectors_per_block = nand_erasesize / nand_writesize;
  218. fcb->num_ecc_blocks_per_page = (nand_writesize / 512) - 1;
  219. fcb->ecc_block_0_size = 512;
  220. fcb->ecc_block_n_size = 512;
  221. fcb->metadata_bytes = 10;
  222. if (nand_writesize == 2048) {
  223. fcb->ecc_block_n_ecc_type = 4;
  224. fcb->ecc_block_0_ecc_type = 4;
  225. } else if (nand_writesize == 4096) {
  226. if (nand_oobsize == 128) {
  227. fcb->ecc_block_n_ecc_type = 4;
  228. fcb->ecc_block_0_ecc_type = 4;
  229. } else if (nand_oobsize == 218) {
  230. fcb->ecc_block_n_ecc_type = 8;
  231. fcb->ecc_block_0_ecc_type = 8;
  232. }
  233. }
  234. if (fcb->ecc_block_n_ecc_type == 0) {
  235. printf("MX28 NAND: Unsupported NAND geometry\n");
  236. goto err;
  237. }
  238. fcb->boot_patch = 0;
  239. fcb->patch_sectors = 0;
  240. fcb->badblock_marker_byte = mx28_nand_mark_byte_offset();
  241. fcb->badblock_marker_start_bit = mx28_nand_mark_bit_offset();
  242. fcb->bb_marker_physical_offset = nand_writesize;
  243. stride_size_bytes = STRIDE_PAGES * nand_writesize;
  244. bcb_size_bytes = stride_size_bytes * STRIDE_COUNT;
  245. bootstream_size_pages = (size + (nand_writesize - 1)) /
  246. nand_writesize;
  247. fw1_start_page = 2 * bcb_size_bytes / nand_writesize;
  248. fw2_start_page = (2 * bcb_size_bytes + MAX_BOOTSTREAM_SIZE) /
  249. nand_writesize;
  250. fcb->firmware1_starting_sector = fw1_start_page;
  251. fcb->firmware2_starting_sector = fw2_start_page;
  252. fcb->sectors_in_firmware1 = bootstream_size_pages;
  253. fcb->sectors_in_firmware2 = bootstream_size_pages;
  254. fcb->dbbt_search_area_start_address = STRIDE_PAGES * STRIDE_COUNT;
  255. return fcb;
  256. err:
  257. free(fcb);
  258. return NULL;
  259. }
  260. static struct mx28_nand_dbbt *mx28_nand_get_dbbt(void)
  261. {
  262. struct mx28_nand_dbbt *dbbt;
  263. dbbt = malloc(nand_writesize);
  264. if (!dbbt) {
  265. printf("MX28 NAND: Unable to allocate DBBT\n");
  266. return NULL;
  267. }
  268. memset(dbbt, 0, nand_writesize);
  269. dbbt->fingerprint = 0x54424244;
  270. dbbt->version = 0x1;
  271. return dbbt;
  272. }
  273. static inline uint8_t mx28_nand_parity_13_8(const uint8_t b)
  274. {
  275. uint32_t parity = 0, tmp;
  276. tmp = ((b >> 6) ^ (b >> 5) ^ (b >> 3) ^ (b >> 2)) & 1;
  277. parity |= tmp << 0;
  278. tmp = ((b >> 7) ^ (b >> 5) ^ (b >> 4) ^ (b >> 2) ^ (b >> 1)) & 1;
  279. parity |= tmp << 1;
  280. tmp = ((b >> 7) ^ (b >> 6) ^ (b >> 5) ^ (b >> 1) ^ (b >> 0)) & 1;
  281. parity |= tmp << 2;
  282. tmp = ((b >> 7) ^ (b >> 4) ^ (b >> 3) ^ (b >> 0)) & 1;
  283. parity |= tmp << 3;
  284. tmp = ((b >> 6) ^ (b >> 4) ^ (b >> 3) ^
  285. (b >> 2) ^ (b >> 1) ^ (b >> 0)) & 1;
  286. parity |= tmp << 4;
  287. return parity;
  288. }
  289. static uint8_t *mx28_nand_fcb_block(struct mx28_nand_fcb *fcb)
  290. {
  291. uint8_t *block;
  292. uint8_t *ecc;
  293. int i;
  294. block = malloc(nand_writesize + nand_oobsize);
  295. if (!block) {
  296. printf("MX28 NAND: Unable to allocate FCB block\n");
  297. return NULL;
  298. }
  299. memset(block, 0, nand_writesize + nand_oobsize);
  300. /* Update the FCB checksum */
  301. fcb->checksum = mx28_nand_block_csum(((uint8_t *)fcb) + 4, 508);
  302. /* Figure 12-11. in iMX28RM, rev. 1, says FCB is at offset 12 */
  303. memcpy(block + 12, fcb, sizeof(struct mx28_nand_fcb));
  304. /* ECC is at offset 12 + 512 */
  305. ecc = block + 12 + 512;
  306. /* Compute the ECC parity */
  307. for (i = 0; i < sizeof(struct mx28_nand_fcb); i++)
  308. ecc[i] = mx28_nand_parity_13_8(block[i + 12]);
  309. return block;
  310. }
  311. static int mx28_nand_write_fcb(struct mx28_nand_fcb *fcb, uint8_t *buf)
  312. {
  313. uint32_t offset;
  314. uint8_t *fcbblock;
  315. int ret = 0;
  316. int i;
  317. fcbblock = mx28_nand_fcb_block(fcb);
  318. if (!fcbblock)
  319. return -1;
  320. for (i = 0; i < STRIDE_PAGES * STRIDE_COUNT; i += STRIDE_PAGES) {
  321. offset = i * nand_writesize;
  322. memcpy(buf + offset, fcbblock, nand_writesize + nand_oobsize);
  323. /* Mark the NAND page is OK. */
  324. buf[offset + nand_writesize] = 0xff;
  325. }
  326. free(fcbblock);
  327. return ret;
  328. }
  329. static int mx28_nand_write_dbbt(struct mx28_nand_dbbt *dbbt, uint8_t *buf)
  330. {
  331. uint32_t offset;
  332. int i = STRIDE_PAGES * STRIDE_COUNT;
  333. for (; i < 2 * STRIDE_PAGES * STRIDE_COUNT; i += STRIDE_PAGES) {
  334. offset = i * nand_writesize;
  335. memcpy(buf + offset, dbbt, sizeof(struct mx28_nand_dbbt));
  336. }
  337. return 0;
  338. }
  339. static int mx28_nand_write_firmware(struct mx28_nand_fcb *fcb, int infd,
  340. uint8_t *buf)
  341. {
  342. int ret;
  343. off_t size;
  344. uint32_t offset1, offset2;
  345. size = lseek(infd, 0, SEEK_END);
  346. lseek(infd, 0, SEEK_SET);
  347. offset1 = fcb->firmware1_starting_sector * nand_writesize;
  348. offset2 = fcb->firmware2_starting_sector * nand_writesize;
  349. ret = read(infd, buf + offset1, size);
  350. if (ret != size)
  351. return -1;
  352. memcpy(buf + offset2, buf + offset1, size);
  353. return 0;
  354. }
  355. static void usage(void)
  356. {
  357. printf(
  358. "Usage: mxsboot [ops] <type> <infile> <outfile>\n"
  359. "Augment BootStream file with a proper header for i.MX28 boot\n"
  360. "\n"
  361. " <type> type of image:\n"
  362. " \"nand\" for NAND image\n"
  363. " \"sd\" for SD image\n"
  364. " <infile> input file, the u-boot.sb bootstream\n"
  365. " <outfile> output file, the bootable image\n"
  366. "\n");
  367. printf(
  368. "For NAND boot, these options are accepted:\n"
  369. " -w <size> NAND page size\n"
  370. " -o <size> NAND OOB size\n"
  371. " -e <size> NAND erase size\n"
  372. "\n"
  373. "For SD boot, these options are accepted:\n"
  374. " -p <sector> Sector where the SGTL partition starts\n"
  375. );
  376. }
  377. static int mx28_create_nand_image(int infd, int outfd)
  378. {
  379. struct mx28_nand_fcb *fcb;
  380. struct mx28_nand_dbbt *dbbt;
  381. int ret = -1;
  382. uint8_t *buf;
  383. int size;
  384. ssize_t wr_size;
  385. size = nand_writesize * 512 + 2 * MAX_BOOTSTREAM_SIZE;
  386. buf = malloc(size);
  387. if (!buf) {
  388. printf("Can not allocate output buffer of %d bytes\n", size);
  389. goto err0;
  390. }
  391. memset(buf, 0, size);
  392. fcb = mx28_nand_get_fcb(MAX_BOOTSTREAM_SIZE);
  393. if (!fcb) {
  394. printf("Unable to compile FCB\n");
  395. goto err1;
  396. }
  397. dbbt = mx28_nand_get_dbbt();
  398. if (!dbbt) {
  399. printf("Unable to compile DBBT\n");
  400. goto err2;
  401. }
  402. ret = mx28_nand_write_fcb(fcb, buf);
  403. if (ret) {
  404. printf("Unable to write FCB to buffer\n");
  405. goto err3;
  406. }
  407. ret = mx28_nand_write_dbbt(dbbt, buf);
  408. if (ret) {
  409. printf("Unable to write DBBT to buffer\n");
  410. goto err3;
  411. }
  412. ret = mx28_nand_write_firmware(fcb, infd, buf);
  413. if (ret) {
  414. printf("Unable to write firmware to buffer\n");
  415. goto err3;
  416. }
  417. wr_size = write(outfd, buf, size);
  418. if (wr_size != size) {
  419. ret = -1;
  420. goto err3;
  421. }
  422. ret = 0;
  423. err3:
  424. free(dbbt);
  425. err2:
  426. free(fcb);
  427. err1:
  428. free(buf);
  429. err0:
  430. return ret;
  431. }
  432. static int mx28_create_sd_image(int infd, int outfd)
  433. {
  434. int ret = -1;
  435. uint32_t *buf;
  436. int size;
  437. off_t fsize;
  438. ssize_t wr_size;
  439. struct mx28_sd_config_block *cb;
  440. fsize = lseek(infd, 0, SEEK_END);
  441. lseek(infd, 0, SEEK_SET);
  442. size = fsize + 4 * 512;
  443. buf = malloc(size);
  444. if (!buf) {
  445. printf("Can not allocate output buffer of %d bytes\n", size);
  446. goto err0;
  447. }
  448. ret = read(infd, (uint8_t *)buf + 4 * 512, fsize);
  449. if (ret != fsize) {
  450. ret = -1;
  451. goto err1;
  452. }
  453. cb = (struct mx28_sd_config_block *)buf;
  454. cb->signature = 0x00112233;
  455. cb->primary_boot_tag = 0x1;
  456. cb->secondary_boot_tag = 0x1;
  457. cb->num_copies = 1;
  458. cb->drv_info[0].chip_num = 0x0;
  459. cb->drv_info[0].drive_type = 0x0;
  460. cb->drv_info[0].tag = 0x1;
  461. cb->drv_info[0].first_sector_number = sd_sector + 4;
  462. cb->drv_info[0].sector_count = (size - 4) / 512;
  463. wr_size = write(outfd, buf, size);
  464. if (wr_size != size) {
  465. ret = -1;
  466. goto err1;
  467. }
  468. ret = 0;
  469. err1:
  470. free(buf);
  471. err0:
  472. return ret;
  473. }
  474. static int parse_ops(int argc, char **argv)
  475. {
  476. int i;
  477. int tmp;
  478. char *end;
  479. enum param {
  480. PARAM_WRITE,
  481. PARAM_OOB,
  482. PARAM_ERASE,
  483. PARAM_PART,
  484. PARAM_SD,
  485. PARAM_NAND
  486. };
  487. int type;
  488. if (argc < 4)
  489. return -1;
  490. for (i = 1; i < argc; i++) {
  491. if (!strncmp(argv[i], "-w", 2))
  492. type = PARAM_WRITE;
  493. else if (!strncmp(argv[i], "-o", 2))
  494. type = PARAM_OOB;
  495. else if (!strncmp(argv[i], "-e", 2))
  496. type = PARAM_ERASE;
  497. else if (!strncmp(argv[i], "-p", 2))
  498. type = PARAM_PART;
  499. else /* SD/MMC */
  500. break;
  501. tmp = strtol(argv[++i], &end, 10);
  502. if (tmp % 2)
  503. return -1;
  504. if (tmp <= 0)
  505. return -1;
  506. if (type == PARAM_WRITE)
  507. nand_writesize = tmp;
  508. if (type == PARAM_OOB)
  509. nand_oobsize = tmp;
  510. if (type == PARAM_ERASE)
  511. nand_erasesize = tmp;
  512. if (type == PARAM_PART)
  513. sd_sector = tmp;
  514. }
  515. if (strcmp(argv[i], "sd") && strcmp(argv[i], "nand"))
  516. return -1;
  517. if (i + 3 != argc)
  518. return -1;
  519. return i;
  520. }
  521. int main(int argc, char **argv)
  522. {
  523. int infd, outfd;
  524. int ret = 0;
  525. int offset;
  526. offset = parse_ops(argc, argv);
  527. if (offset < 0) {
  528. usage();
  529. ret = 1;
  530. goto err1;
  531. }
  532. infd = open(argv[offset + 1], O_RDONLY);
  533. if (infd < 0) {
  534. printf("Input BootStream file can not be opened\n");
  535. ret = 2;
  536. goto err1;
  537. }
  538. outfd = open(argv[offset + 2], O_CREAT | O_TRUNC | O_WRONLY,
  539. S_IRUSR | S_IWUSR);
  540. if (outfd < 0) {
  541. printf("Output file can not be created\n");
  542. ret = 3;
  543. goto err2;
  544. }
  545. if (!strcmp(argv[offset], "sd"))
  546. ret = mx28_create_sd_image(infd, outfd);
  547. else if (!strcmp(argv[offset], "nand"))
  548. ret = mx28_create_nand_image(infd, outfd);
  549. close(outfd);
  550. err2:
  551. close(infd);
  552. err1:
  553. return ret;
  554. }