/* Check if media is changed according to sense data. */
BOOLEAN IsMediaChange(IN ATAPI_REQUEST_SENSE_DATA *SenseData, IN UINTN SenseCounts)
/* Check if media is changed according to sense data. */
BOOLEAN IsMediaChange(IN ATAPI_REQUEST_SENSE_DATA *SenseData, IN UINTN SenseCounts)
{
  ATAPI_REQUEST_SENSE_DATA  *SensePtr;
  UINTN                     Index;
  BOOLEAN                   MediaChange;
  MediaChange = FALSE;
  SensePtr = SenseData;
  for (Index = 0; Index < SenseCounts; Index++) {
    switch (SensePtr->sense_key) {
      case ATA_SK_UNIT_ATTENTION:
        switch (SensePtr->addnl_sense_code) {
          case ATA_ASC_MEDIA_CHANGE:
            MediaChange = TRUE;
            break;
          default:
            break;
        }
        break;
      default:
        break;
    }
    SensePtr++;
  }
  return MediaChange;
}