summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2013-07-03 01:05:00 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2013-07-03 01:05:00 +0200
commit00faabef5e902008172e08d3bcd77683cbafef51 (patch)
treebf70a609d2d8c9b4e87262fbea8f649179ea85ee
parent20ee453edce207a4285638f0399926b0b9f506df (diff)
downloadrockbox-00faabef5e902008172e08d3bcd77683cbafef51.tar.gz
rockbox-00faabef5e902008172e08d3bcd77683cbafef51.zip
imx233: document some more stmp vendor scsi command
Change-Id: Ie03c0c8288b4bd9c0b4beedae363cff6caf3c5cd
-rw-r--r--utils/imxtools/scsitools/scsitool.c71
-rw-r--r--utils/imxtools/scsitools/stmp_scsi.h40
2 files changed, 92 insertions, 19 deletions
diff --git a/utils/imxtools/scsitools/scsitool.c b/utils/imxtools/scsitools/scsitool.c
index 8ef2774f32..8c124ee9f3 100644
--- a/utils/imxtools/scsitools/scsitool.c
+++ b/utils/imxtools/scsitools/scsitool.c
@@ -344,6 +344,46 @@ static int stmp_get_logical_drive_info(uint8_t drive, uint8_t info, void *data,
344 return do_sense_analysis(ret, sense, sense_size); 344 return do_sense_analysis(ret, sense, sense_size);
345} 345}
346 346
347static const char *stmp_get_logical_media_type_string(uint32_t type)
348{
349 switch(type)
350 {
351 case SCSI_STMP_MEDIA_TYPE_NAND: return "NAND";
352 case SCSI_STMP_MEDIA_TYPE_SDMMC: return "SD/MMC";
353 case SCSI_STMP_MEDIA_TYPE_HDD: return "HDD";
354 case SCSI_STMP_MEDIA_TYPE_RAM: return "RAM";
355 case SCSI_STMP_MEDIA_TYPE_iNAND: return "iNAND";
356 default: return "?";
357 }
358}
359
360static const char *stmp_get_logical_media_vendor_string(uint32_t type)
361{
362 switch(type)
363 {
364 case SCSI_STMP_MEDIA_VENDOR_SAMSUNG: return "Samsung";
365 case SCSI_STMP_MEDIA_VENDOR_STMICRO: return "ST Micro";
366 case SCSI_STMP_MEDIA_VENDOR_HYNIX: return "Hynix";
367 case SCSI_STMP_MEDIA_VENDOR_MICRON: return "Micron";
368 case SCSI_STMP_MEDIA_VENDOR_TOSHIBA: return "Toshiba";
369 case SCSI_STMP_MEDIA_VENDOR_RENESAS: return "Renesas";
370 case SCSI_STMP_MEDIA_VENDOR_INTEL: return "Intel";
371 case SCSI_STMP_MEDIA_VENDOR_SANDISK: return "Sandisk";
372 default: return "?";
373 }
374}
375
376static const char *stmp_get_logical_drive_type_string(uint32_t type)
377{
378 switch(type)
379 {
380 case SCSI_STMP_DRIVE_TYPE_USER: return "User";
381 case SCSI_STMP_DRIVE_TYPE_SYSTEM: return "System";
382 case SCSI_STMP_DRIVE_TYPE_DRM: return "DRM";
383 default: return "?";
384 }
385}
386
347static int do_work(void) 387static int do_work(void)
348{ 388{
349 cprintf(BLUE, "Information\n"); 389 cprintf(BLUE, "Information\n");
@@ -389,11 +429,12 @@ static int do_work(void)
389 } 429 }
390 430
391 len = 4; 431 len = 4;
392 ret = stmp_get_logical_media_info(6, &u.u32, &len); 432 ret = stmp_get_logical_media_info(SCSI_STMP_MEDIA_INFO_TYPE, &u.u32, &len);
393 if(!ret && len == 4) 433 if(!ret && len == 4)
394 { 434 {
395 u.u32 = fix_endian32be(u.u32); 435 u.u32 = fix_endian32be(u.u32);
396 cprintf_field(" Logical Media Info (6): ", "%#x\n", u.u32); 436 cprintf_field(" Media Type: ", "%#x", u.u32);
437 cprintf(RED, " (%s)\n", stmp_get_logical_media_type_string(u.u32));
397 } 438 }
398 439
399 len = 1; 440 len = 1;
@@ -406,7 +447,7 @@ static int do_work(void)
406 if(!ret && len == 8) 447 if(!ret && len == 8)
407 { 448 {
408 u.u64 = fix_endian64be(u.u64); 449 u.u64 = fix_endian64be(u.u64);
409 cprintf_field(" Logical Media Info (1): ", "%#llx\n", u.u64); 450 cprintf_field(" Logical Media Info (1): ", "%#llx\n", (unsigned long long)u.u64);
410 } 451 }
411 452
412 len = 4; 453 len = 4;
@@ -436,11 +477,12 @@ static int do_work(void)
436 cprintf_field(" Logical Media Info (9): ", "%#x\n", u.u8); 477 cprintf_field(" Logical Media Info (9): ", "%#x\n", u.u8);
437 478
438 len = 4; 479 len = 4;
439 ret = stmp_get_logical_media_info(12, &u.u32, &len); 480 ret = stmp_get_logical_media_info(SCSI_STMP_MEDIA_INFO_VENDOR, &u.u32, &len);
440 if(!ret && len == 4) 481 if(!ret && len == 4)
441 { 482 {
442 u.u32 = fix_endian32be(u.u32); 483 u.u32 = fix_endian32be(u.u32);
443 cprintf_field(" Logical Media Info (12): ", "%#x\n", u.u32); 484 cprintf_field(" Media Vendor: ", "%#x", u.u32);
485 cprintf(RED, " (%s)\n", stmp_get_logical_media_vendor_string(u.u32));
444 } 486 }
445 487
446 len = 8; 488 len = 8;
@@ -448,7 +490,7 @@ static int do_work(void)
448 if(!ret && len == 8) 490 if(!ret && len == 8)
449 { 491 {
450 u.u64 = fix_endian64be(u.u64); 492 u.u64 = fix_endian64be(u.u64);
451 cprintf_field(" Logical Media Info (13): ", "%#llx\n", u.u64); 493 cprintf_field(" Logical Media Info (13): ", "%#llx\n", (unsigned long long)u.u64);
452 } 494 }
453 495
454 len = 4; 496 len = 4;
@@ -525,11 +567,11 @@ static int do_work(void)
525 cprintf_field(" Drive ", "%02x\n", drive); 567 cprintf_field(" Drive ", "%02x\n", drive);
526 568
527 int len = 4; 569 int len = 4;
528 ret = stmp_get_logical_drive_info(drive, 0, &u.u32, &len); 570 ret = stmp_get_logical_drive_info(drive, SCSI_STMP_DRIVE_INFO_SECTOR, &u.u32, &len);
529 if(!ret && len == 4) 571 if(!ret && len == 4)
530 { 572 {
531 u.u32 = fix_endian32be(u.u32); 573 u.u32 = fix_endian32be(u.u32);
532 cprintf_field(" Info 0: ", "%#x\n", u.u32); 574 cprintf_field(" Sector Size: ", "%#x\n", u.u32);
533 } 575 }
534 576
535 len = 4; 577 len = 4;
@@ -541,11 +583,11 @@ static int do_work(void)
541 } 583 }
542 584
543 len = 8; 585 len = 8;
544 ret = stmp_get_logical_drive_info(drive, 2, &u.u64, &len); 586 ret = stmp_get_logical_drive_info(drive, SCSI_STMP_DRIVE_INFO_SIZE, &u.u64, &len);
545 if(!ret && len == 8) 587 if(!ret && len == 8)
546 { 588 {
547 u.u64 = fix_endian64be(u.u64); 589 u.u64 = fix_endian64be(u.u64);
548 cprintf_field(" Info 2: ", "%#llx\n", u.u64); 590 cprintf_field(" Total Size: ", "%#llx\n", (unsigned long long)u.u64);
549 } 591 }
550 592
551 len = 4; 593 len = 4;
@@ -557,19 +599,20 @@ static int do_work(void)
557 } 599 }
558 600
559 len = 8; 601 len = 8;
560 ret = stmp_get_logical_drive_info(drive, 4, &u.u64, &len); 602 ret = stmp_get_logical_drive_info(drive, SCSI_STMP_DRIVE_INFO_COUNT, &u.u64, &len);
561 if(!ret && len == 8) 603 if(!ret && len == 8)
562 { 604 {
563 u.u64 = fix_endian64be(u.u64); 605 u.u64 = fix_endian64be(u.u64);
564 cprintf_field(" Info 4: ", "%#llx\n", u.u64); 606 cprintf_field(" Sector Count: ", "%#llx\n", (unsigned long long)u.u64);
565 } 607 }
566 608
567 len = 4; 609 len = 4;
568 ret = stmp_get_logical_drive_info(drive, 5, &u.u32, &len); 610 ret = stmp_get_logical_drive_info(drive,SCSI_STMP_DRIVE_INFO_TYPE, &u.u32, &len);
569 if(!ret && len == 4) 611 if(!ret && len == 4)
570 { 612 {
571 u.u32 = fix_endian32be(u.u32); 613 u.u32 = fix_endian32be(u.u32);
572 cprintf_field(" Info 5: ", "%#x\n", u.u32); 614 cprintf_field(" Type: ", "%#x", u.u32);
615 cprintf(RED, " (%s)\n", stmp_get_logical_drive_type_string(u.u32));
573 } 616 }
574 617
575 len = 1; 618 len = 1;
diff --git a/utils/imxtools/scsitools/stmp_scsi.h b/utils/imxtools/scsitools/stmp_scsi.h
index 0b7453e70b..2da17baf47 100644
--- a/utils/imxtools/scsitools/stmp_scsi.h
+++ b/utils/imxtools/scsitools/stmp_scsi.h
@@ -26,12 +26,26 @@
26#define SCSI_STMP_READ 0xc0 26#define SCSI_STMP_READ 0xc0
27#define SCSI_STMP_WRITE 0xc1 27#define SCSI_STMP_WRITE 0xc1
28/** STMP: Command */ 28/** STMP: Command */
29#define SCSI_STMP_CMD_GET_PROTOCOL_VERSION 0 29#define SCSI_STMP_CMD_GET_PROTOCOL_VERSION 0x0
30#define SCSI_STMP_CMD_GET_LOGICAL_MEDIA_INFO 2 30#define SCSI_STMP_CMD_GET_LOGICAL_MEDIA_INFO 0x2
31#define SCSI_STMP_CMD_GET_LOGICAL_TABLE 5 31#define SCSI_STMP_CMD_GET_LOGICAL_TABLE 0x5
32#define SCSI_STMP_CMD_ALLOCATE_LOGICAL_MEDIA 0x6
33#define SCSI_STMP_CMD_ERASE LOGICAL MEDIA 0x7
32#define SCSI_STMP_CMD_GET_LOGICAL_DRIVE_INFO 0x12 34#define SCSI_STMP_CMD_GET_LOGICAL_DRIVE_INFO 0x12
35#define SCSI_STMP_CMD_READ_LOGICAL_DRIVE_SECTOR 0x13
36#define SCSI_STMP_CMD_SET_LOGICAL_DRIVE_INFO 0x20
37#define SCSI_STMP_CMD_WRITE_LOGICAL_DRIVE_SECTOR 0x23
38#define SCSI_STMP_CMD_ERASE_LOGICAL_DRIVE 0x2f
33#define SCSI_STMP_CMD_GET_CHIP_MAJOR_REV_ID 0x30 39#define SCSI_STMP_CMD_GET_CHIP_MAJOR_REV_ID 0x30
40#define SCSI_STMP_CMD_CHIP_RESET 0x31
41#define SCSI_STMP_CMD_GET_CHIP_SERIAL_NUMBER 0x32
34#define SCSI_STMP_CMD_GET_ROM_REV_ID 0x37 42#define SCSI_STMP_CMD_GET_ROM_REV_ID 0x37
43#define SCSI_STMP_CMD_GET_JANUS_STATUS 0x40
44#define SCSI_STMP_CMD_INITIALIZE_STATUS 0x41
45#define SCSI_STMP_CMD_RESET_TO_RECOVERY 0x42
46#define SCSI_STMP_CMD_INITIALIZE_DATA_STORE 0x43
47#define SCSI_STMP_CMD_RESET_TO_UPDATER 0x44
48#define SCSI_STMP_CMD_GET_DEVICE_INFO 0x45
35 49
36struct scsi_stmp_protocol_version_t 50struct scsi_stmp_protocol_version_t
37{ 51{
@@ -90,8 +104,24 @@ struct scsi_stmp_logical_media_info_manufacturer_t
90 uint32_t type; /* big-endian */ 104 uint32_t type; /* big-endian */
91} __attribute__((packed)); 105} __attribute__((packed));
92 106
93#define SCSI_STMP_DRIVE_INFO_SIZE 2 107#define SCSI_STMP_DRIVE_INFO_SECTOR 0 /** Sector Size (bytes) */
94#define SCSI_STMP_DRIVE_INFO_TYPE 5 108#define SCSI_STMP_DRIVE_INFO_SIZE 2 /** Total Size (bytes) */
109#define SCSI_STMP_DRIVE_INFO_COUNT 4 /** Sector Count */
110#define SCSI_STMP_DRIVE_INFO_TYPE 5 /** Drive Type */
111
112#define SCSI_STMP_DRIVE_TYPE_USER 0
113#define SCSI_STMP_DRIVE_TYPE_SYSTEM 1
114#define SCSI_STMP_DRIVE_TYPE_DRM 2
115
116struct scsi_stmp_logical_drive_info_sector_t
117{
118 uint32_t size; /* big-endian */
119} __attribute__((packed));
120
121struct scsi_stmp_logical_drive_info_count_t
122{
123 uint64_t count; /* big-endian */
124} __attribute__((packed));
95 125
96struct scsi_stmp_logical_drive_info_size_t 126struct scsi_stmp_logical_drive_info_size_t
97{ 127{