Commit 90e153d7709634eec903fc9c1a60878379915e33
Committed by
Wolfgang Denk
1 parent
8ade950638
Exists in
master
and in
54 other branches
bootstage: Convert IDE progress numbers to enums
This changes over the IDE progress numbers to use enums from bootstage.h. Signed-off-by: Simon Glass <sjg@chromium.org>
Showing 2 changed files with 39 additions and 23 deletions Side-by-side Diff
common/cmd_ide.c
... | ... | @@ -345,7 +345,7 @@ |
345 | 345 | const void *fit_hdr = NULL; |
346 | 346 | #endif |
347 | 347 | |
348 | - show_boot_progress(41); | |
348 | + show_boot_progress(BOOTSTAGE_ID_IDE_START); | |
349 | 349 | switch (argc) { |
350 | 350 | case 1: |
351 | 351 | addr = CONFIG_SYS_LOAD_ADDR; |
352 | 352 | |
353 | 353 | |
354 | 354 | |
355 | 355 | |
356 | 356 | |
357 | 357 | |
358 | 358 | |
359 | 359 | |
360 | 360 | |
... | ... | @@ -360,41 +360,43 @@ |
360 | 360 | boot_device = argv[2]; |
361 | 361 | break; |
362 | 362 | default: |
363 | - show_boot_error(42); | |
363 | + show_boot_error(BOOTSTAGE_ID_IDE_ADDR); | |
364 | 364 | return CMD_RET_USAGE; |
365 | 365 | } |
366 | - show_boot_progress(42); | |
366 | + show_boot_progress(BOOTSTAGE_ID_IDE_ADDR); | |
367 | 367 | |
368 | 368 | if (!boot_device) { |
369 | 369 | puts("\n** No boot device **\n"); |
370 | - show_boot_error(43); | |
370 | + show_boot_error(BOOTSTAGE_ID_IDE_BOOT_DEVICE); | |
371 | 371 | return 1; |
372 | 372 | } |
373 | - show_boot_progress(43); | |
373 | + show_boot_progress(BOOTSTAGE_ID_IDE_BOOT_DEVICE); | |
374 | 374 | |
375 | 375 | dev = simple_strtoul(boot_device, &ep, 16); |
376 | 376 | |
377 | 377 | if (ide_dev_desc[dev].type == DEV_TYPE_UNKNOWN) { |
378 | 378 | printf("\n** Device %d not available\n", dev); |
379 | - show_boot_error(44); | |
379 | + show_boot_error(BOOTSTAGE_ID_IDE_TYPE); | |
380 | 380 | return 1; |
381 | 381 | } |
382 | - show_boot_progress(44); | |
382 | + show_boot_progress(BOOTSTAGE_ID_IDE_TYPE); | |
383 | 383 | |
384 | 384 | if (*ep) { |
385 | 385 | if (*ep != ':') { |
386 | 386 | puts("\n** Invalid boot device, use `dev[:part]' **\n"); |
387 | - show_boot_error(45); | |
387 | + show_boot_error(BOOTSTAGE_ID_IDE_PART); | |
388 | 388 | return 1; |
389 | 389 | } |
390 | 390 | part = simple_strtoul(++ep, NULL, 16); |
391 | 391 | } |
392 | - show_boot_progress(45); | |
392 | + show_boot_progress(BOOTSTAGE_ID_IDE_PART); | |
393 | + | |
393 | 394 | if (get_partition_info(&ide_dev_desc[dev], part, &info)) { |
394 | - show_boot_error(46); | |
395 | + show_boot_error(BOOTSTAGE_ID_IDE_PART_INFO); | |
395 | 396 | return 1; |
396 | 397 | } |
397 | - show_boot_progress(46); | |
398 | + show_boot_progress(BOOTSTAGE_ID_IDE_PART_INFO); | |
399 | + | |
398 | 400 | if ((strncmp((char *)info.type, BOOT_PART_TYPE, sizeof(info.type)) != 0) |
399 | 401 | && |
400 | 402 | (strncmp((char *)info.type, BOOT_PART_COMP, sizeof(info.type)) != 0) |
401 | 403 | |
... | ... | @@ -402,10 +404,10 @@ |
402 | 404 | printf("\n** Invalid partition type \"%.32s\"" " (expect \"" |
403 | 405 | BOOT_PART_TYPE "\")\n", |
404 | 406 | info.type); |
405 | - show_boot_error(47); | |
407 | + show_boot_error(BOOTSTAGE_ID_IDE_PART_TYPE); | |
406 | 408 | return 1; |
407 | 409 | } |
408 | - show_boot_progress(47); | |
410 | + show_boot_progress(BOOTSTAGE_ID_IDE_PART_TYPE); | |
409 | 411 | |
410 | 412 | printf("\nLoading from IDE device %d, partition %d: " |
411 | 413 | "Name: %.32s Type: %.32s\n", dev, part, info.name, info.type); |
412 | 414 | |
413 | 415 | |
414 | 416 | |
415 | 417 | |
... | ... | @@ -416,23 +418,23 @@ |
416 | 418 | if (ide_dev_desc[dev]. |
417 | 419 | block_read(dev, info.start, 1, (ulong *) addr) != 1) { |
418 | 420 | printf("** Read error on %d:%d\n", dev, part); |
419 | - show_boot_error(48); | |
421 | + show_boot_error(BOOTSTAGE_ID_IDE_PART_READ); | |
420 | 422 | return 1; |
421 | 423 | } |
422 | - show_boot_progress(48); | |
424 | + show_boot_progress(BOOTSTAGE_ID_IDE_PART_READ); | |
423 | 425 | |
424 | 426 | switch (genimg_get_format((void *) addr)) { |
425 | 427 | case IMAGE_FORMAT_LEGACY: |
426 | 428 | hdr = (image_header_t *) addr; |
427 | 429 | |
428 | - show_boot_progress(49); | |
430 | + show_boot_progress(BOOTSTAGE_ID_IDE_FORMAT); | |
429 | 431 | |
430 | 432 | if (!image_check_hcrc(hdr)) { |
431 | 433 | puts("\n** Bad Header Checksum **\n"); |
432 | - show_boot_error(50); | |
434 | + show_boot_error(BOOTSTAGE_ID_IDE_CHECKSUM); | |
433 | 435 | return 1; |
434 | 436 | } |
435 | - show_boot_progress(50); | |
437 | + show_boot_progress(BOOTSTAGE_ID_IDE_CHECKSUM); | |
436 | 438 | |
437 | 439 | image_print_contents(hdr); |
438 | 440 | |
... | ... | @@ -447,7 +449,7 @@ |
447 | 449 | break; |
448 | 450 | #endif |
449 | 451 | default: |
450 | - show_boot_error(49); | |
452 | + show_boot_error(BOOTSTAGE_ID_IDE_FORMAT); | |
451 | 453 | puts("** Unknown image type\n"); |
452 | 454 | return 1; |
453 | 455 | } |
454 | 456 | |
455 | 457 | |
456 | 458 | |
... | ... | @@ -459,20 +461,20 @@ |
459 | 461 | if (ide_dev_desc[dev].block_read(dev, info.start + 1, cnt, |
460 | 462 | (ulong *)(addr + info.blksz)) != cnt) { |
461 | 463 | printf("** Read error on %d:%d\n", dev, part); |
462 | - show_boot_error(51); | |
464 | + show_boot_error(BOOTSTAGE_ID_IDE_READ); | |
463 | 465 | return 1; |
464 | 466 | } |
465 | - show_boot_progress(51); | |
467 | + show_boot_progress(BOOTSTAGE_ID_IDE_READ); | |
466 | 468 | |
467 | 469 | #if defined(CONFIG_FIT) |
468 | 470 | /* This cannot be done earlier, we need complete FIT image in RAM first */ |
469 | 471 | if (genimg_get_format((void *) addr) == IMAGE_FORMAT_FIT) { |
470 | 472 | if (!fit_check_format(fit_hdr)) { |
471 | - show_boot_error(140); | |
473 | + show_boot_error(BOOTSTAGE_ID_IDE_FIT_READ); | |
472 | 474 | puts("** Bad FIT image format\n"); |
473 | 475 | return 1; |
474 | 476 | } |
475 | - show_boot_progress(141); | |
477 | + show_boot_progress(BOOTSTAGE_ID_IDE_FIT_READ_OK); | |
476 | 478 | fit_print_contents(fit_hdr); |
477 | 479 | } |
478 | 480 | #endif |
include/bootstage.h
... | ... | @@ -91,6 +91,20 @@ |
91 | 91 | BOOTSTAGE_ID_BOARD_DONE, /* Board init done, off to main loop */ |
92 | 92 | /* ^^^ here ends the x86 sequence */ |
93 | 93 | |
94 | + /* Boot stages related to loading a kernel from an IDE device */ | |
95 | + BOOTSTAGE_ID_IDE_START = 41, | |
96 | + BOOTSTAGE_ID_IDE_ADDR, | |
97 | + BOOTSTAGE_ID_IDE_BOOT_DEVICE, | |
98 | + BOOTSTAGE_ID_IDE_TYPE, | |
99 | + | |
100 | + BOOTSTAGE_ID_IDE_PART, | |
101 | + BOOTSTAGE_ID_IDE_PART_INFO, | |
102 | + BOOTSTAGE_ID_IDE_PART_TYPE, | |
103 | + BOOTSTAGE_ID_IDE_PART_READ, | |
104 | + BOOTSTAGE_ID_IDE_FORMAT, | |
105 | + | |
106 | + BOOTSTAGE_ID_IDE_CHECKSUM, /* 50 */ | |
107 | + BOOTSTAGE_ID_IDE_READ, | |
94 | 108 | }; |
95 | 109 | |
96 | 110 | /* |