blob: 403fd5351d7738f1175dd5da2bc82829fb4d86dc [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Lukasz Majewskicb383cd2012-08-06 14:41:08 +02002/*
3 * dfu.c -- DFU back-end routines
4 *
5 * Copyright (C) 2012 Samsung Electronics
6 * author: Lukasz Majewski <l.majewski@samsung.com>
Lukasz Majewskicb383cd2012-08-06 14:41:08 +02007 */
8
9#include <common.h>
10#include <malloc.h>
Pantelis Antoniou1b6ca182012-11-30 08:01:11 +000011#include <errno.h>
Pantelis Antoniouea2453d2013-03-14 05:32:48 +000012#include <div64.h>
Lukasz Majewskicb383cd2012-08-06 14:41:08 +020013#include <dfu.h>
Stephen Warren0e285b52014-06-11 12:47:27 -060014#include <ext4fs.h>
15#include <fat.h>
Łukasz Majewski7d0b6052014-02-21 08:23:00 +010016#include <mmc.h>
Lukasz Majewskicb383cd2012-08-06 14:41:08 +020017
Przemyslaw Marczak41ac2332015-03-04 14:01:23 +010018static unsigned char *dfu_file_buf;
Patrick Delaunay15970d82017-07-19 16:39:23 +020019static u64 dfu_file_buf_len;
Stephen Warren411c5e52015-09-04 22:03:47 -060020static long dfu_file_buf_filled;
Pantelis Antoniouea2453d2013-03-14 05:32:48 +000021
Afzal Mohammed5a127c82013-09-18 01:14:50 +053022static int mmc_block_op(enum dfu_op op, struct dfu_entity *dfu,
Pantelis Antoniouea2453d2013-03-14 05:32:48 +000023 u64 offset, void *buf, long *len)
Lukasz Majewskicb383cd2012-08-06 14:41:08 +020024{
Przemyslaw Marczak7da6fa22014-12-15 10:34:09 +010025 struct mmc *mmc;
Łukasz Majewski7d0b6052014-02-21 08:23:00 +010026 u32 blk_start, blk_count, n = 0;
Lukasz Majewskic8151b42014-05-09 16:58:15 +020027 int ret, part_num_bkp = 0;
Lukasz Majewskicb383cd2012-08-06 14:41:08 +020028
Przemyslaw Marczak7da6fa22014-12-15 10:34:09 +010029 mmc = find_mmc_device(dfu->data.mmc.dev_num);
30 if (!mmc) {
Masahiro Yamada9b643e32017-09-16 14:10:41 +090031 pr_err("Device MMC %d - not found!", dfu->data.mmc.dev_num);
Przemyslaw Marczak7da6fa22014-12-15 10:34:09 +010032 return -ENODEV;
33 }
34
Pantelis Antoniouea2453d2013-03-14 05:32:48 +000035 /*
36 * We must ensure that we work in lba_blk_size chunks, so ALIGN
37 * this value.
38 */
39 *len = ALIGN(*len, dfu->data.mmc.lba_blk_size);
40
41 blk_start = dfu->data.mmc.lba_start +
42 (u32)lldiv(offset, dfu->data.mmc.lba_blk_size);
43 blk_count = *len / dfu->data.mmc.lba_blk_size;
44 if (blk_start + blk_count >
45 dfu->data.mmc.lba_start + dfu->data.mmc.lba_size) {
46 puts("Request would exceed designated area!\n");
47 return -EINVAL;
48 }
49
Lukasz Majewskic8151b42014-05-09 16:58:15 +020050 if (dfu->data.mmc.hw_partition >= 0) {
Simon Glass797d1b92016-06-12 23:30:33 -060051 part_num_bkp = mmc_get_blk_desc(mmc)->hwpart;
Simon Glass69f45cd2016-05-01 13:52:29 -060052 ret = blk_select_hwpart_devnum(IF_TYPE_MMC,
53 dfu->data.mmc.dev_num,
54 dfu->data.mmc.hw_partition);
Lukasz Majewskic8151b42014-05-09 16:58:15 +020055 if (ret)
56 return ret;
57 }
58
Łukasz Majewski7d0b6052014-02-21 08:23:00 +010059 debug("%s: %s dev: %d start: %d cnt: %d buf: 0x%p\n", __func__,
Stephen Warrendd648272014-06-11 16:03:33 -060060 op == DFU_OP_READ ? "MMC READ" : "MMC WRITE",
61 dfu->data.mmc.dev_num, blk_start, blk_count, buf);
Łukasz Majewski7d0b6052014-02-21 08:23:00 +010062 switch (op) {
63 case DFU_OP_READ:
Simon Glass797d1b92016-06-12 23:30:33 -060064 n = blk_dread(mmc_get_blk_desc(mmc), blk_start, blk_count, buf);
Łukasz Majewski7d0b6052014-02-21 08:23:00 +010065 break;
66 case DFU_OP_WRITE:
Simon Glass797d1b92016-06-12 23:30:33 -060067 n = blk_dwrite(mmc_get_blk_desc(mmc), blk_start, blk_count,
68 buf);
Łukasz Majewski7d0b6052014-02-21 08:23:00 +010069 break;
70 default:
Masahiro Yamada9b643e32017-09-16 14:10:41 +090071 pr_err("Operation not supported\n");
Łukasz Majewski7d0b6052014-02-21 08:23:00 +010072 }
Lukasz Majewskicb383cd2012-08-06 14:41:08 +020073
Łukasz Majewski7d0b6052014-02-21 08:23:00 +010074 if (n != blk_count) {
Masahiro Yamada9b643e32017-09-16 14:10:41 +090075 pr_err("MMC operation failed");
Lukasz Majewskic8151b42014-05-09 16:58:15 +020076 if (dfu->data.mmc.hw_partition >= 0)
Simon Glass69f45cd2016-05-01 13:52:29 -060077 blk_select_hwpart_devnum(IF_TYPE_MMC,
78 dfu->data.mmc.dev_num,
79 part_num_bkp);
Łukasz Majewski7d0b6052014-02-21 08:23:00 +010080 return -EIO;
81 }
82
Lukasz Majewskic8151b42014-05-09 16:58:15 +020083 if (dfu->data.mmc.hw_partition >= 0) {
Simon Glass69f45cd2016-05-01 13:52:29 -060084 ret = blk_select_hwpart_devnum(IF_TYPE_MMC,
85 dfu->data.mmc.dev_num,
86 part_num_bkp);
Lukasz Majewskic8151b42014-05-09 16:58:15 +020087 if (ret)
88 return ret;
89 }
90
Łukasz Majewski7d0b6052014-02-21 08:23:00 +010091 return 0;
Lukasz Majewskicb383cd2012-08-06 14:41:08 +020092}
93
Pantelis Antoniouea2453d2013-03-14 05:32:48 +000094static int mmc_file_buffer(struct dfu_entity *dfu, void *buf, long *len)
Lukasz Majewskicb383cd2012-08-06 14:41:08 +020095{
Pantelis Antoniouea2453d2013-03-14 05:32:48 +000096 if (dfu_file_buf_len + *len > CONFIG_SYS_DFU_MAX_FILE_SIZE) {
97 dfu_file_buf_len = 0;
98 return -EINVAL;
99 }
Lukasz Majewskicb383cd2012-08-06 14:41:08 +0200100
Pantelis Antoniouea2453d2013-03-14 05:32:48 +0000101 /* Add to the current buffer. */
102 memcpy(dfu_file_buf + dfu_file_buf_len, buf, *len);
103 dfu_file_buf_len += *len;
104
105 return 0;
Lukasz Majewskicb383cd2012-08-06 14:41:08 +0200106}
107
Afzal Mohammed5a127c82013-09-18 01:14:50 +0530108static int mmc_file_op(enum dfu_op op, struct dfu_entity *dfu,
Patrick Delaunay15970d82017-07-19 16:39:23 +0200109 void *buf, u64 *len)
Lukasz Majewskicb383cd2012-08-06 14:41:08 +0200110{
Simon Goldschmidt1f92c072019-01-25 19:58:01 +0100111 char dev_part_str[8];
Lukasz Majewskicb383cd2012-08-06 14:41:08 +0200112 int ret;
Simon Goldschmidt1f92c072019-01-25 19:58:01 +0100113 int fstype;
114 loff_t size = 0;
Lukasz Majewskicb383cd2012-08-06 14:41:08 +0200115
Łukasz Majewski43e66272012-08-23 23:33:55 +0000116 switch (dfu->layout) {
117 case DFU_FS_FAT:
Simon Goldschmidt1f92c072019-01-25 19:58:01 +0100118 fstype = FS_TYPE_FAT;
Łukasz Majewski43e66272012-08-23 23:33:55 +0000119 break;
120 case DFU_FS_EXT4:
Simon Goldschmidt1f92c072019-01-25 19:58:01 +0100121 fstype = FS_TYPE_EXT;
Łukasz Majewski43e66272012-08-23 23:33:55 +0000122 break;
123 default:
124 printf("%s: Layout (%s) not (yet) supported!\n", __func__,
125 dfu_get_layout(dfu->layout));
Pantelis Antoniouea2453d2013-03-14 05:32:48 +0000126 return -1;
Łukasz Majewski43e66272012-08-23 23:33:55 +0000127 }
Lukasz Majewskicb383cd2012-08-06 14:41:08 +0200128
Simon Goldschmidt1f92c072019-01-25 19:58:01 +0100129 snprintf(dev_part_str, sizeof(dev_part_str), "%d:%d",
130 dfu->data.mmc.dev, dfu->data.mmc.part);
Stephen Warren0e285b52014-06-11 12:47:27 -0600131
Simon Goldschmidt1f92c072019-01-25 19:58:01 +0100132 ret = fs_set_blk_dev("mmc", dev_part_str, fstype);
Lukasz Majewskicb383cd2012-08-06 14:41:08 +0200133 if (ret) {
Simon Goldschmidt1f92c072019-01-25 19:58:01 +0100134 puts("dfu: fs_set_blk_dev error!\n");
Lukasz Majewskicb383cd2012-08-06 14:41:08 +0200135 return ret;
136 }
137
Simon Goldschmidt1f92c072019-01-25 19:58:01 +0100138 switch (op) {
139 case DFU_OP_READ:
140 ret = fs_read(dfu->name, (size_t)buf, 0, 0, &size);
141 if (ret) {
142 puts("dfu: fs_read error!\n");
143 return ret;
Lukasz Majewskicb383cd2012-08-06 14:41:08 +0200144 }
Simon Goldschmidt1f92c072019-01-25 19:58:01 +0100145 *len = size;
146 break;
147 case DFU_OP_WRITE:
148 ret = fs_write(dfu->name, (size_t)buf, 0, *len, &size);
149 if (ret) {
150 puts("dfu: fs_write error!\n");
151 return ret;
152 }
153 break;
154 case DFU_OP_SIZE:
155 ret = fs_size(dfu->name, &size);
156 if (ret) {
157 puts("dfu: fs_size error!\n");
158 return ret;
159 }
160 *len = size;
161 break;
162 default:
163 return -1;
Lukasz Majewskicb383cd2012-08-06 14:41:08 +0200164 }
165
166 return ret;
167}
168
Pantelis Antoniouea2453d2013-03-14 05:32:48 +0000169int dfu_write_medium_mmc(struct dfu_entity *dfu,
170 u64 offset, void *buf, long *len)
Lukasz Majewskicb383cd2012-08-06 14:41:08 +0200171{
172 int ret = -1;
173
174 switch (dfu->layout) {
175 case DFU_RAW_ADDR:
Pantelis Antoniouea2453d2013-03-14 05:32:48 +0000176 ret = mmc_block_op(DFU_OP_WRITE, dfu, offset, buf, len);
Lukasz Majewskicb383cd2012-08-06 14:41:08 +0200177 break;
178 case DFU_FS_FAT:
Łukasz Majewski43e66272012-08-23 23:33:55 +0000179 case DFU_FS_EXT4:
Pantelis Antoniouea2453d2013-03-14 05:32:48 +0000180 ret = mmc_file_buffer(dfu, buf, len);
Lukasz Majewskicb383cd2012-08-06 14:41:08 +0200181 break;
182 default:
183 printf("%s: Layout (%s) not (yet) supported!\n", __func__,
184 dfu_get_layout(dfu->layout));
185 }
186
187 return ret;
188}
189
Pantelis Antoniouea2453d2013-03-14 05:32:48 +0000190int dfu_flush_medium_mmc(struct dfu_entity *dfu)
191{
192 int ret = 0;
193
194 if (dfu->layout != DFU_RAW_ADDR) {
195 /* Do stuff here. */
Przemyslaw Marczak41ac2332015-03-04 14:01:23 +0100196 ret = mmc_file_op(DFU_OP_WRITE, dfu, dfu_file_buf,
Pantelis Antoniouea2453d2013-03-14 05:32:48 +0000197 &dfu_file_buf_len);
198
199 /* Now that we're done */
200 dfu_file_buf_len = 0;
201 }
202
203 return ret;
204}
205
Patrick Delaunay15970d82017-07-19 16:39:23 +0200206int dfu_get_medium_size_mmc(struct dfu_entity *dfu, u64 *size)
Stephen Warren0e285b52014-06-11 12:47:27 -0600207{
208 int ret;
Stephen Warren0e285b52014-06-11 12:47:27 -0600209
210 switch (dfu->layout) {
211 case DFU_RAW_ADDR:
Patrick Delaunay4de51202017-07-19 16:39:22 +0200212 *size = dfu->data.mmc.lba_size * dfu->data.mmc.lba_blk_size;
213 return 0;
Stephen Warren0e285b52014-06-11 12:47:27 -0600214 case DFU_FS_FAT:
215 case DFU_FS_EXT4:
Stephen Warren411c5e52015-09-04 22:03:47 -0600216 dfu_file_buf_filled = -1;
Patrick Delaunay4de51202017-07-19 16:39:22 +0200217 ret = mmc_file_op(DFU_OP_SIZE, dfu, NULL, size);
Stephen Warren0e285b52014-06-11 12:47:27 -0600218 if (ret < 0)
219 return ret;
Patrick Delaunay4de51202017-07-19 16:39:22 +0200220 if (*size > CONFIG_SYS_DFU_MAX_FILE_SIZE)
Stephen Warren411c5e52015-09-04 22:03:47 -0600221 return -1;
Patrick Delaunay4de51202017-07-19 16:39:22 +0200222 return 0;
Stephen Warren0e285b52014-06-11 12:47:27 -0600223 default:
224 printf("%s: Layout (%s) not (yet) supported!\n", __func__,
225 dfu_get_layout(dfu->layout));
226 return -1;
227 }
228}
229
Stephen Warren411c5e52015-09-04 22:03:47 -0600230static int mmc_file_unbuffer(struct dfu_entity *dfu, u64 offset, void *buf,
231 long *len)
232{
233 int ret;
Patrick Delaunay15970d82017-07-19 16:39:23 +0200234 u64 file_len;
Stephen Warren411c5e52015-09-04 22:03:47 -0600235
236 if (dfu_file_buf_filled == -1) {
237 ret = mmc_file_op(DFU_OP_READ, dfu, dfu_file_buf, &file_len);
238 if (ret < 0)
239 return ret;
240 dfu_file_buf_filled = file_len;
241 }
242 if (offset + *len > dfu_file_buf_filled)
243 return -EINVAL;
244
245 /* Add to the current buffer. */
246 memcpy(buf, dfu_file_buf + offset, *len);
247
248 return 0;
249}
250
Pantelis Antoniouea2453d2013-03-14 05:32:48 +0000251int dfu_read_medium_mmc(struct dfu_entity *dfu, u64 offset, void *buf,
252 long *len)
Lukasz Majewskicb383cd2012-08-06 14:41:08 +0200253{
254 int ret = -1;
255
256 switch (dfu->layout) {
257 case DFU_RAW_ADDR:
Pantelis Antoniouea2453d2013-03-14 05:32:48 +0000258 ret = mmc_block_op(DFU_OP_READ, dfu, offset, buf, len);
Lukasz Majewskicb383cd2012-08-06 14:41:08 +0200259 break;
260 case DFU_FS_FAT:
Łukasz Majewski43e66272012-08-23 23:33:55 +0000261 case DFU_FS_EXT4:
Stephen Warren411c5e52015-09-04 22:03:47 -0600262 ret = mmc_file_unbuffer(dfu, offset, buf, len);
Lukasz Majewskicb383cd2012-08-06 14:41:08 +0200263 break;
264 default:
265 printf("%s: Layout (%s) not (yet) supported!\n", __func__,
266 dfu_get_layout(dfu->layout));
267 }
268
269 return ret;
270}
271
Przemyslaw Marczak41ac2332015-03-04 14:01:23 +0100272void dfu_free_entity_mmc(struct dfu_entity *dfu)
273{
274 if (dfu_file_buf) {
275 free(dfu_file_buf);
276 dfu_file_buf = NULL;
277 }
278}
279
Mateusz Zalega711b9312014-04-28 21:13:24 +0200280/*
281 * @param s Parameter string containing space-separated arguments:
282 * 1st:
283 * raw (raw read/write)
284 * fat (files)
285 * ext4 (^)
286 * part (partition image)
287 * 2nd and 3rd:
288 * lba_start and lba_size, for raw write
289 * mmc_dev and mmc_part, for filesystems and part
Lukasz Majewskic8151b42014-05-09 16:58:15 +0200290 * 4th (optional):
291 * mmcpart <num> (access to HW eMMC partitions)
Mateusz Zalega711b9312014-04-28 21:13:24 +0200292 */
Stephen Warrendd648272014-06-11 16:03:33 -0600293int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *devstr, char *s)
Lukasz Majewskicb383cd2012-08-06 14:41:08 +0200294{
Mateusz Zalega711b9312014-04-28 21:13:24 +0200295 const char *entity_type;
296 size_t second_arg;
297 size_t third_arg;
298
Pantelis Antoniou1b6ca182012-11-30 08:01:11 +0000299 struct mmc *mmc;
Lukasz Majewskicb383cd2012-08-06 14:41:08 +0200300
Mateusz Zalega711b9312014-04-28 21:13:24 +0200301 const char *argv[3];
302 const char **parg = argv;
Pantelis Antoniou1b6ca182012-11-30 08:01:11 +0000303
Stephen Warrendd648272014-06-11 16:03:33 -0600304 dfu->data.mmc.dev_num = simple_strtoul(devstr, NULL, 10);
305
Mateusz Zalega711b9312014-04-28 21:13:24 +0200306 for (; parg < argv + sizeof(argv) / sizeof(*argv); ++parg) {
307 *parg = strsep(&s, " ");
308 if (*parg == NULL) {
Masahiro Yamada9b643e32017-09-16 14:10:41 +0900309 pr_err("Invalid number of arguments.\n");
Pantelis Antoniou1b6ca182012-11-30 08:01:11 +0000310 return -ENODEV;
311 }
Mateusz Zalega711b9312014-04-28 21:13:24 +0200312 }
Pantelis Antoniou1b6ca182012-11-30 08:01:11 +0000313
Mateusz Zalega711b9312014-04-28 21:13:24 +0200314 entity_type = argv[0];
Mateusz Zalegab7d42592014-04-28 21:13:25 +0200315 /*
316 * Base 0 means we'll accept (prefixed with 0x or 0) base 16, 8,
317 * with default 10.
318 */
319 second_arg = simple_strtoul(argv[1], NULL, 0);
320 third_arg = simple_strtoul(argv[2], NULL, 0);
Pantelis Antoniou1b6ca182012-11-30 08:01:11 +0000321
Stephen Warrendd648272014-06-11 16:03:33 -0600322 mmc = find_mmc_device(dfu->data.mmc.dev_num);
Mateusz Zalega711b9312014-04-28 21:13:24 +0200323 if (mmc == NULL) {
Masahiro Yamada9b643e32017-09-16 14:10:41 +0900324 pr_err("Couldn't find MMC device no. %d.\n",
Stephen Warrendd648272014-06-11 16:03:33 -0600325 dfu->data.mmc.dev_num);
Pantelis Antoniou1b6ca182012-11-30 08:01:11 +0000326 return -ENODEV;
Lukasz Majewskicb383cd2012-08-06 14:41:08 +0200327 }
328
Mateusz Zalega711b9312014-04-28 21:13:24 +0200329 if (mmc_init(mmc)) {
Masahiro Yamada9b643e32017-09-16 14:10:41 +0900330 pr_err("Couldn't init MMC device.\n");
Mateusz Zalega711b9312014-04-28 21:13:24 +0200331 return -ENODEV;
Łukasz Majewski43e66272012-08-23 23:33:55 +0000332 }
333
Lukasz Majewskic8151b42014-05-09 16:58:15 +0200334 dfu->data.mmc.hw_partition = -EINVAL;
Mateusz Zalega711b9312014-04-28 21:13:24 +0200335 if (!strcmp(entity_type, "raw")) {
336 dfu->layout = DFU_RAW_ADDR;
337 dfu->data.mmc.lba_start = second_arg;
338 dfu->data.mmc.lba_size = third_arg;
339 dfu->data.mmc.lba_blk_size = mmc->read_bl_len;
Lukasz Majewskic8151b42014-05-09 16:58:15 +0200340
341 /*
342 * Check for an extra entry at dfu_alt_info env variable
343 * specifying the mmc HW defined partition number
344 */
345 if (s)
346 if (!strcmp(strsep(&s, " "), "mmcpart"))
347 dfu->data.mmc.hw_partition =
348 simple_strtoul(s, NULL, 0);
349
Mateusz Zalega711b9312014-04-28 21:13:24 +0200350 } else if (!strcmp(entity_type, "part")) {
351 disk_partition_t partinfo;
Simon Glass797d1b92016-06-12 23:30:33 -0600352 struct blk_desc *blk_dev = mmc_get_blk_desc(mmc);
Mateusz Zalega711b9312014-04-28 21:13:24 +0200353 int mmcdev = second_arg;
354 int mmcpart = third_arg;
355
Simon Glass3e8bd462016-02-29 15:25:48 -0700356 if (part_get_info(blk_dev, mmcpart, &partinfo) != 0) {
Masahiro Yamada9b643e32017-09-16 14:10:41 +0900357 pr_err("Couldn't find part #%d on mmc device #%d\n",
Mateusz Zalega711b9312014-04-28 21:13:24 +0200358 mmcpart, mmcdev);
359 return -ENODEV;
360 }
361
362 dfu->layout = DFU_RAW_ADDR;
363 dfu->data.mmc.lba_start = partinfo.start;
364 dfu->data.mmc.lba_size = partinfo.size;
365 dfu->data.mmc.lba_blk_size = partinfo.blksz;
366 } else if (!strcmp(entity_type, "fat")) {
367 dfu->layout = DFU_FS_FAT;
368 } else if (!strcmp(entity_type, "ext4")) {
369 dfu->layout = DFU_FS_EXT4;
370 } else {
Masahiro Yamada9b643e32017-09-16 14:10:41 +0900371 pr_err("Memory layout (%s) not supported!\n", entity_type);
Mateusz Zalega711b9312014-04-28 21:13:24 +0200372 return -ENODEV;
373 }
374
375 /* if it's NOT a raw write */
376 if (strcmp(entity_type, "raw")) {
377 dfu->data.mmc.dev = second_arg;
378 dfu->data.mmc.part = third_arg;
379 }
380
381 dfu->dev_type = DFU_DEV_MMC;
Stephen Warren0e285b52014-06-11 12:47:27 -0600382 dfu->get_medium_size = dfu_get_medium_size_mmc;
Lukasz Majewskicb383cd2012-08-06 14:41:08 +0200383 dfu->read_medium = dfu_read_medium_mmc;
384 dfu->write_medium = dfu_write_medium_mmc;
Pantelis Antoniouea2453d2013-03-14 05:32:48 +0000385 dfu->flush_medium = dfu_flush_medium_mmc;
Pantelis Antoniouea2453d2013-03-14 05:32:48 +0000386 dfu->inited = 0;
Przemyslaw Marczak41ac2332015-03-04 14:01:23 +0100387 dfu->free_entity = dfu_free_entity_mmc;
388
389 /* Check if file buffer is ready */
390 if (!dfu_file_buf) {
391 dfu_file_buf = memalign(CONFIG_SYS_CACHELINE_SIZE,
392 CONFIG_SYS_DFU_MAX_FILE_SIZE);
393 if (!dfu_file_buf) {
Masahiro Yamada9b643e32017-09-16 14:10:41 +0900394 pr_err("Could not memalign 0x%x bytes",
Przemyslaw Marczak41ac2332015-03-04 14:01:23 +0100395 CONFIG_SYS_DFU_MAX_FILE_SIZE);
396 return -ENOMEM;
397 }
398 }
Lukasz Majewskicb383cd2012-08-06 14:41:08 +0200399
400 return 0;
401}