mi/util.c
// this function sends an IDENTIFY command to a drive
this function sends an IDENTIFY command to a drive
this function sends an IDENTIFY command to a drive
int32_t ata_ident(struct ATA *ata, uint32_t ata_chan, uint32_t ata_dev, struct ata_ident * identity)
{
	int32_t rc = 0;
	unsigned char * buf  = NULL;
	ata_setataparams(ata, 0, 0);
	ata_setdataout_params(ata, (char**) &buf, 512);
	rc = ata_cmd(ata, ata_chan, ata_dev, ATA__IDENTIFY, 0);
	if(rc) {
		ata_setataparams(ata, 0, 0);
		ata_setdataout_params(ata, (char**) &buf, 512);
		rc = ata_cmd(ata, ata_chan, ata_dev, ATA__ATAPI_IDENTIFY, 0);
	}
	byteswap((char*)buf, 20, 39); 
	byteswap((char*)buf, 46, 52); 
	byteswap((char*)buf, 54, 92); 
	strpack((char*)buf, 20, 39);
	if(!rc)
		memcpy(identity, buf, sizeof(struct ata_ident));
	return rc;
}
int32_t ata_ident ( struct ATA * ata , uint32_t ata_chan , uint32_t ata_dev , struct ata_ident * identity ) { int32_t rc = 0 ; unsigned char * buf = NULL ; ata_setataparams ( ata , 0 , 0 ) ; ata_setdataout_params ( ata , ( char * * ) & buf , 512 ) ; rc = ata_cmd ( ata , ata_chan , ata_dev , ATA__IDENTIFY , 0 ) ; if ( rc ) { ata_setataparams ( ata , 0 , 0 ) ; ata_setdataout_params ( ata , ( char * * ) & buf , 512 ) ; rc = ata_cmd ( ata , ata_chan , ata_dev , ATA__ATAPI_IDENTIFY , 0 ) ; } byteswap ( ( char * ) buf , 20 , 39 ) ; byteswap ( ( char * ) buf , 46 , 52 ) ; byteswap ( ( char * ) buf , 54 , 92 ) ; strpack ( ( char * ) buf , 20 , 39 ) ; if ( ! rc ) memcpy ( identity , buf , sizeof ( struct ata_ident ) ) ; return rc ; }
this function sends an IDENTIFY command to a drive
this function sends an IDENTIFY command to a drive
// then try an ATAPI IDENTIFY, maybe it didn't like an ATA_IDENTIFY // serial	 // firmware // model