#include <linux/blkdev.h>
#include <linux/kthread.h>
#include <linux/sched.h>
#include <linux/vmalloc.h>
#include "rtsx.h"
#include "sd.h"
#include "ms.h"
#include "spi.h"
void scsi_show_command(struct rtsx_chip *chip)
{ … }
void set_sense_type(struct rtsx_chip *chip, unsigned int lun, int sense_type)
{ … }
void set_sense_data(struct rtsx_chip *chip, unsigned int lun, u8 err_code,
u8 sense_key, u32 info, u8 asc, u8 ascq, u8 sns_key_info0,
u16 sns_key_info1)
{ … }
static int test_unit_ready(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static unsigned char formatter_inquiry_str[20] = …;
static int inquiry(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static int start_stop_unit(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static int allow_medium_removal(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static int request_sense(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static void ms_mode_sense(struct rtsx_chip *chip, u8 cmd,
int lun, u8 *buf, int buf_len)
{ … }
static int mode_sense(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static int read_write(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static int read_format_capacity(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static int read_capacity(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static int read_eeprom(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static int write_eeprom(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static int read_mem(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static int write_mem(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static int get_sd_csd(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static int toggle_gpio_cmd(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static int read_host_reg(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static int write_host_reg(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static int set_variable(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static int get_variable(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static int dma_access_ring_buffer(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static int get_dev_status(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static int set_chip_mode(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static int rw_mem_cmd_buf(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static int suit_cmd(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static int read_phy_register(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static int write_phy_register(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static int erase_eeprom2(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static int read_eeprom2(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static int write_eeprom2(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static int read_efuse(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static int write_efuse(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static int read_cfg_byte(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static int write_cfg_byte(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static int app_cmd(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static int read_status(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static int get_card_bus_width(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static int spi_vendor_cmd(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static int vendor_cmnd(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
#if !defined(LED_AUTO_BLINK) && !defined(REGULAR_BLINK)
void led_shine(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{
unsigned int lun = SCSI_LUN(srb);
u16 sec_cnt;
if (srb->cmnd[0] == READ_10 || srb->cmnd[0] == WRITE_10) {
sec_cnt = ((u16)(srb->cmnd[7]) << 8) | srb->cmnd[8];
} else if ((srb->cmnd[0] == READ_6) || (srb->cmnd[0] == WRITE_6)) {
sec_cnt = srb->cmnd[4];
if (sec_cnt == 0)
sec_cnt = 256;
} else {
return;
}
if (chip->rw_cap[lun] >= GPIO_TOGGLE_THRESHOLD) {
toggle_gpio(chip, LED_GPIO);
chip->rw_cap[lun] = 0;
} else {
chip->rw_cap[lun] += sec_cnt;
}
}
#endif
static int ms_format_cmnd(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
#ifdef SUPPORT_PCGL_1P18
static int get_ms_information(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
#endif
static int ms_sp_cmnd(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
#ifdef SUPPORT_CPRM
static int sd_extension_cmnd(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
#endif
#ifdef SUPPORT_MAGIC_GATE
static int mg_report_key(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
static int mg_send_key(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }
#endif
int rtsx_scsi_handler(struct scsi_cmnd *srb, struct rtsx_chip *chip)
{ … }