imx233: document some more stmp vendor scsi command

Change-Id: Ie03c0c8288b4bd9c0b4beedae363cff6caf3c5cd
This commit is contained in:
Amaury Pouly 2013-07-03 01:05:00 +02:00
parent 20ee453edc
commit 00faabef5e
2 changed files with 92 additions and 19 deletions

View file

@ -344,6 +344,46 @@ static int stmp_get_logical_drive_info(uint8_t drive, uint8_t info, void *data,
return do_sense_analysis(ret, sense, sense_size);
}
static const char *stmp_get_logical_media_type_string(uint32_t type)
{
switch(type)
{
case SCSI_STMP_MEDIA_TYPE_NAND: return "NAND";
case SCSI_STMP_MEDIA_TYPE_SDMMC: return "SD/MMC";
case SCSI_STMP_MEDIA_TYPE_HDD: return "HDD";
case SCSI_STMP_MEDIA_TYPE_RAM: return "RAM";
case SCSI_STMP_MEDIA_TYPE_iNAND: return "iNAND";
default: return "?";
}
}
static const char *stmp_get_logical_media_vendor_string(uint32_t type)
{
switch(type)
{
case SCSI_STMP_MEDIA_VENDOR_SAMSUNG: return "Samsung";
case SCSI_STMP_MEDIA_VENDOR_STMICRO: return "ST Micro";
case SCSI_STMP_MEDIA_VENDOR_HYNIX: return "Hynix";
case SCSI_STMP_MEDIA_VENDOR_MICRON: return "Micron";
case SCSI_STMP_MEDIA_VENDOR_TOSHIBA: return "Toshiba";
case SCSI_STMP_MEDIA_VENDOR_RENESAS: return "Renesas";
case SCSI_STMP_MEDIA_VENDOR_INTEL: return "Intel";
case SCSI_STMP_MEDIA_VENDOR_SANDISK: return "Sandisk";
default: return "?";
}
}
static const char *stmp_get_logical_drive_type_string(uint32_t type)
{
switch(type)
{
case SCSI_STMP_DRIVE_TYPE_USER: return "User";
case SCSI_STMP_DRIVE_TYPE_SYSTEM: return "System";
case SCSI_STMP_DRIVE_TYPE_DRM: return "DRM";
default: return "?";
}
}
static int do_work(void)
{
cprintf(BLUE, "Information\n");
@ -389,11 +429,12 @@ static int do_work(void)
}
len = 4;
ret = stmp_get_logical_media_info(6, &u.u32, &len);
ret = stmp_get_logical_media_info(SCSI_STMP_MEDIA_INFO_TYPE, &u.u32, &len);
if(!ret && len == 4)
{
u.u32 = fix_endian32be(u.u32);
cprintf_field(" Logical Media Info (6): ", "%#x\n", u.u32);
cprintf_field(" Media Type: ", "%#x", u.u32);
cprintf(RED, " (%s)\n", stmp_get_logical_media_type_string(u.u32));
}
len = 1;
@ -406,7 +447,7 @@ static int do_work(void)
if(!ret && len == 8)
{
u.u64 = fix_endian64be(u.u64);
cprintf_field(" Logical Media Info (1): ", "%#llx\n", u.u64);
cprintf_field(" Logical Media Info (1): ", "%#llx\n", (unsigned long long)u.u64);
}
len = 4;
@ -436,11 +477,12 @@ static int do_work(void)
cprintf_field(" Logical Media Info (9): ", "%#x\n", u.u8);
len = 4;
ret = stmp_get_logical_media_info(12, &u.u32, &len);
ret = stmp_get_logical_media_info(SCSI_STMP_MEDIA_INFO_VENDOR, &u.u32, &len);
if(!ret && len == 4)
{
u.u32 = fix_endian32be(u.u32);
cprintf_field(" Logical Media Info (12): ", "%#x\n", u.u32);
cprintf_field(" Media Vendor: ", "%#x", u.u32);
cprintf(RED, " (%s)\n", stmp_get_logical_media_vendor_string(u.u32));
}
len = 8;
@ -448,7 +490,7 @@ static int do_work(void)
if(!ret && len == 8)
{
u.u64 = fix_endian64be(u.u64);
cprintf_field(" Logical Media Info (13): ", "%#llx\n", u.u64);
cprintf_field(" Logical Media Info (13): ", "%#llx\n", (unsigned long long)u.u64);
}
len = 4;
@ -525,11 +567,11 @@ static int do_work(void)
cprintf_field(" Drive ", "%02x\n", drive);
int len = 4;
ret = stmp_get_logical_drive_info(drive, 0, &u.u32, &len);
ret = stmp_get_logical_drive_info(drive, SCSI_STMP_DRIVE_INFO_SECTOR, &u.u32, &len);
if(!ret && len == 4)
{
u.u32 = fix_endian32be(u.u32);
cprintf_field(" Info 0: ", "%#x\n", u.u32);
cprintf_field(" Sector Size: ", "%#x\n", u.u32);
}
len = 4;
@ -541,11 +583,11 @@ static int do_work(void)
}
len = 8;
ret = stmp_get_logical_drive_info(drive, 2, &u.u64, &len);
ret = stmp_get_logical_drive_info(drive, SCSI_STMP_DRIVE_INFO_SIZE, &u.u64, &len);
if(!ret && len == 8)
{
u.u64 = fix_endian64be(u.u64);
cprintf_field(" Info 2: ", "%#llx\n", u.u64);
cprintf_field(" Total Size: ", "%#llx\n", (unsigned long long)u.u64);
}
len = 4;
@ -557,19 +599,20 @@ static int do_work(void)
}
len = 8;
ret = stmp_get_logical_drive_info(drive, 4, &u.u64, &len);
ret = stmp_get_logical_drive_info(drive, SCSI_STMP_DRIVE_INFO_COUNT, &u.u64, &len);
if(!ret && len == 8)
{
u.u64 = fix_endian64be(u.u64);
cprintf_field(" Info 4: ", "%#llx\n", u.u64);
cprintf_field(" Sector Count: ", "%#llx\n", (unsigned long long)u.u64);
}
len = 4;
ret = stmp_get_logical_drive_info(drive, 5, &u.u32, &len);
ret = stmp_get_logical_drive_info(drive,SCSI_STMP_DRIVE_INFO_TYPE, &u.u32, &len);
if(!ret && len == 4)
{
u.u32 = fix_endian32be(u.u32);
cprintf_field(" Info 5: ", "%#x\n", u.u32);
cprintf_field(" Type: ", "%#x", u.u32);
cprintf(RED, " (%s)\n", stmp_get_logical_drive_type_string(u.u32));
}
len = 1;

View file

@ -26,12 +26,26 @@
#define SCSI_STMP_READ 0xc0
#define SCSI_STMP_WRITE 0xc1
/** STMP: Command */
#define SCSI_STMP_CMD_GET_PROTOCOL_VERSION 0
#define SCSI_STMP_CMD_GET_LOGICAL_MEDIA_INFO 2
#define SCSI_STMP_CMD_GET_LOGICAL_TABLE 5
#define SCSI_STMP_CMD_GET_PROTOCOL_VERSION 0x0
#define SCSI_STMP_CMD_GET_LOGICAL_MEDIA_INFO 0x2
#define SCSI_STMP_CMD_GET_LOGICAL_TABLE 0x5
#define SCSI_STMP_CMD_ALLOCATE_LOGICAL_MEDIA 0x6
#define SCSI_STMP_CMD_ERASE LOGICAL MEDIA 0x7
#define SCSI_STMP_CMD_GET_LOGICAL_DRIVE_INFO 0x12
#define SCSI_STMP_CMD_READ_LOGICAL_DRIVE_SECTOR 0x13
#define SCSI_STMP_CMD_SET_LOGICAL_DRIVE_INFO 0x20
#define SCSI_STMP_CMD_WRITE_LOGICAL_DRIVE_SECTOR 0x23
#define SCSI_STMP_CMD_ERASE_LOGICAL_DRIVE 0x2f
#define SCSI_STMP_CMD_GET_CHIP_MAJOR_REV_ID 0x30
#define SCSI_STMP_CMD_CHIP_RESET 0x31
#define SCSI_STMP_CMD_GET_CHIP_SERIAL_NUMBER 0x32
#define SCSI_STMP_CMD_GET_ROM_REV_ID 0x37
#define SCSI_STMP_CMD_GET_JANUS_STATUS 0x40
#define SCSI_STMP_CMD_INITIALIZE_STATUS 0x41
#define SCSI_STMP_CMD_RESET_TO_RECOVERY 0x42
#define SCSI_STMP_CMD_INITIALIZE_DATA_STORE 0x43
#define SCSI_STMP_CMD_RESET_TO_UPDATER 0x44
#define SCSI_STMP_CMD_GET_DEVICE_INFO 0x45
struct scsi_stmp_protocol_version_t
{
@ -90,8 +104,24 @@ struct scsi_stmp_logical_media_info_manufacturer_t
uint32_t type; /* big-endian */
} __attribute__((packed));
#define SCSI_STMP_DRIVE_INFO_SIZE 2
#define SCSI_STMP_DRIVE_INFO_TYPE 5
#define SCSI_STMP_DRIVE_INFO_SECTOR 0 /** Sector Size (bytes) */
#define SCSI_STMP_DRIVE_INFO_SIZE 2 /** Total Size (bytes) */
#define SCSI_STMP_DRIVE_INFO_COUNT 4 /** Sector Count */
#define SCSI_STMP_DRIVE_INFO_TYPE 5 /** Drive Type */
#define SCSI_STMP_DRIVE_TYPE_USER 0
#define SCSI_STMP_DRIVE_TYPE_SYSTEM 1
#define SCSI_STMP_DRIVE_TYPE_DRM 2
struct scsi_stmp_logical_drive_info_sector_t
{
uint32_t size; /* big-endian */
} __attribute__((packed));
struct scsi_stmp_logical_drive_info_count_t
{
uint64_t count; /* big-endian */
} __attribute__((packed));
struct scsi_stmp_logical_drive_info_size_t
{