More linting in src/scsi
This commit is contained in:
@@ -143,7 +143,7 @@ scsi_card_has_config(int card)
|
||||
return (device_has_config(scsi_cards[card].device) ? 1 : 0);
|
||||
}
|
||||
|
||||
char *
|
||||
const char *
|
||||
scsi_card_get_internal_name(int card)
|
||||
{
|
||||
return device_get_internal_name(scsi_cards[card].device);
|
||||
@@ -155,7 +155,7 @@ scsi_card_get_from_internal_name(char *s)
|
||||
int c = 0;
|
||||
|
||||
while (scsi_cards[c].device != NULL) {
|
||||
if (!strcmp((char *) scsi_cards[c].device->internal_name, s))
|
||||
if (!strcmp(scsi_cards[c].device->internal_name, s))
|
||||
return c;
|
||||
c++;
|
||||
}
|
||||
|
@@ -152,13 +152,13 @@ aha154x_shram(x54x_t *dev, uint8_t cmd)
|
||||
static void
|
||||
aha_eeprom_save(x54x_t *dev)
|
||||
{
|
||||
FILE *f;
|
||||
FILE *fp;
|
||||
|
||||
f = nvr_fopen(dev->nvr_path, "wb");
|
||||
if (f) {
|
||||
fwrite(dev->nvr, 1, NVR_SIZE, f);
|
||||
fclose(f);
|
||||
f = NULL;
|
||||
fp = nvr_fopen(dev->nvr_path, "wb");
|
||||
if (fp) {
|
||||
fwrite(dev->nvr, 1, NVR_SIZE, fp);
|
||||
fclose(fp);
|
||||
fp = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,15 +282,12 @@ aha_param_len(void *priv)
|
||||
case CMD_BIOS_MBINIT:
|
||||
/* Same as 0x01 for AHA. */
|
||||
return sizeof(MailboxInit_t);
|
||||
break;
|
||||
|
||||
case CMD_SHADOW_RAM:
|
||||
return 1;
|
||||
break;
|
||||
|
||||
case CMD_WRITE_EEPROM:
|
||||
return 35;
|
||||
break;
|
||||
|
||||
case CMD_READ_EEPROM:
|
||||
return 3;
|
||||
@@ -716,7 +713,7 @@ aha_setbios(x54x_t *dev)
|
||||
uint32_t size;
|
||||
uint32_t mask;
|
||||
uint32_t temp;
|
||||
FILE *f;
|
||||
FILE *fp;
|
||||
int i;
|
||||
|
||||
/* Only if this device has a BIOS ROM. */
|
||||
@@ -725,7 +722,7 @@ aha_setbios(x54x_t *dev)
|
||||
|
||||
/* Open the BIOS image file and make sure it exists. */
|
||||
aha_log("%s: loading BIOS from '%s'\n", dev->name, dev->bios_path);
|
||||
if ((f = rom_fopen(dev->bios_path, "rb")) == NULL) {
|
||||
if ((fp = rom_fopen(dev->bios_path, "rb")) == NULL) {
|
||||
aha_log("%s: BIOS ROM not found!\n", dev->name);
|
||||
return;
|
||||
}
|
||||
@@ -737,17 +734,17 @@ aha_setbios(x54x_t *dev)
|
||||
* this special case, we can't: we may need WRITE access to the
|
||||
* memory later on.
|
||||
*/
|
||||
(void) fseek(f, 0L, SEEK_END);
|
||||
temp = ftell(f);
|
||||
(void) fseek(f, 0L, SEEK_SET);
|
||||
(void) fseek(fp, 0L, SEEK_END);
|
||||
temp = ftell(fp);
|
||||
(void) fseek(fp, 0L, SEEK_SET);
|
||||
|
||||
/* Load first chunk of BIOS (which is the main BIOS, aka ROM1.) */
|
||||
dev->rom1 = malloc(ROM_SIZE);
|
||||
(void) !fread(dev->rom1, ROM_SIZE, 1, f);
|
||||
(void) !fread(dev->rom1, ROM_SIZE, 1, fp);
|
||||
temp -= ROM_SIZE;
|
||||
if (temp > 0) {
|
||||
dev->rom2 = malloc(ROM_SIZE);
|
||||
(void) !fread(dev->rom2, ROM_SIZE, 1, f);
|
||||
(void) !fread(dev->rom2, ROM_SIZE, 1, fp);
|
||||
temp -= ROM_SIZE;
|
||||
} else {
|
||||
dev->rom2 = NULL;
|
||||
@@ -757,13 +754,13 @@ aha_setbios(x54x_t *dev)
|
||||
free(dev->rom1);
|
||||
if (dev->rom2 != NULL)
|
||||
free(dev->rom2);
|
||||
(void) fclose(f);
|
||||
(void) fclose(fp);
|
||||
return;
|
||||
}
|
||||
temp = ftell(f);
|
||||
temp = ftell(fp);
|
||||
if (temp > ROM_SIZE)
|
||||
temp = ROM_SIZE;
|
||||
(void) fclose(f);
|
||||
(void) fclose(fp);
|
||||
|
||||
/* Adjust BIOS size in chunks of 2K, as per BIOS spec. */
|
||||
size = 0x10000;
|
||||
@@ -824,7 +821,7 @@ static void
|
||||
aha_setmcode(x54x_t *dev)
|
||||
{
|
||||
uint32_t temp;
|
||||
FILE *f;
|
||||
FILE *fp;
|
||||
|
||||
/* Only if this device has a BIOS ROM. */
|
||||
if (dev->mcode_path == NULL)
|
||||
@@ -832,7 +829,7 @@ aha_setmcode(x54x_t *dev)
|
||||
|
||||
/* Open the microcode image file and make sure it exists. */
|
||||
aha_log("%s: loading microcode from '%ls'\n", dev->name, dev->bios_path);
|
||||
if ((f = rom_fopen(dev->mcode_path, "rb")) == NULL) {
|
||||
if ((fp = rom_fopen(dev->mcode_path, "rb")) == NULL) {
|
||||
aha_log("%s: microcode ROM not found!\n", dev->name);
|
||||
return;
|
||||
}
|
||||
@@ -844,13 +841,13 @@ aha_setmcode(x54x_t *dev)
|
||||
* this special case, we can't: we may need WRITE access to the
|
||||
* memory later on.
|
||||
*/
|
||||
(void) fseek(f, 0L, SEEK_END);
|
||||
temp = ftell(f);
|
||||
(void) fseek(f, 0L, SEEK_SET);
|
||||
(void) fseek(fp, 0L, SEEK_END);
|
||||
temp = ftell(fp);
|
||||
(void) fseek(fp, 0L, SEEK_SET);
|
||||
|
||||
if (temp < (dev->cmd_33_offset + dev->cmd_33_len - 1)) {
|
||||
aha_log("%s: microcode ROM size invalid!\n", dev->name);
|
||||
(void) fclose(f);
|
||||
(void) fclose(fp);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -860,11 +857,11 @@ aha_setmcode(x54x_t *dev)
|
||||
aha1542cp_pnp_rom = NULL;
|
||||
}
|
||||
aha1542cp_pnp_rom = (uint8_t *) malloc(dev->pnp_len + 7);
|
||||
fseek(f, dev->pnp_offset, SEEK_SET);
|
||||
(void) !fread(aha1542cp_pnp_rom, dev->pnp_len, 1, f);
|
||||
fseek(fp, dev->pnp_offset, SEEK_SET);
|
||||
(void) !fread(aha1542cp_pnp_rom, dev->pnp_len, 1, fp);
|
||||
memset(&(aha1542cp_pnp_rom[4]), 0x00, 5);
|
||||
fseek(f, dev->pnp_offset + 4, SEEK_SET);
|
||||
(void) !fread(&(aha1542cp_pnp_rom[9]), dev->pnp_len - 4, 1, f);
|
||||
fseek(fp, dev->pnp_offset + 4, SEEK_SET);
|
||||
(void) !fread(&(aha1542cp_pnp_rom[9]), dev->pnp_len - 4, 1, fp);
|
||||
/* Even the real AHA-1542CP microcode seem to be flipping bit
|
||||
4 to not erroneously indicate there is a range length. */
|
||||
aha1542cp_pnp_rom[0x87] |= 0x04;
|
||||
@@ -874,10 +871,10 @@ aha_setmcode(x54x_t *dev)
|
||||
aha1542cp_pnp_rom[dev->pnp_len + 6] = 0x00;
|
||||
|
||||
/* Load the SCSISelect decompression code. */
|
||||
fseek(f, dev->cmd_33_offset, SEEK_SET);
|
||||
(void) !fread(dev->cmd_33_buf, dev->cmd_33_len, 1, f);
|
||||
fseek(fp, dev->cmd_33_offset, SEEK_SET);
|
||||
(void) !fread(dev->cmd_33_buf, dev->cmd_33_len, 1, fp);
|
||||
|
||||
(void) fclose(f);
|
||||
(void) fclose(fp);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -902,7 +899,7 @@ aha_initnvr(x54x_t *dev)
|
||||
static void
|
||||
aha_setnvr(x54x_t *dev)
|
||||
{
|
||||
FILE *f;
|
||||
FILE *fp;
|
||||
|
||||
/* Only if this device has an EEPROM. */
|
||||
if (dev->nvr_path == NULL)
|
||||
@@ -912,12 +909,12 @@ aha_setnvr(x54x_t *dev)
|
||||
dev->nvr = (uint8_t *) malloc(NVR_SIZE);
|
||||
memset(dev->nvr, 0x00, NVR_SIZE);
|
||||
|
||||
f = nvr_fopen(dev->nvr_path, "rb");
|
||||
if (f) {
|
||||
if (fread(dev->nvr, 1, NVR_SIZE, f) != NVR_SIZE)
|
||||
fp = nvr_fopen(dev->nvr_path, "rb");
|
||||
if (fp) {
|
||||
if (fread(dev->nvr, 1, NVR_SIZE, fp) != NVR_SIZE)
|
||||
fatal("aha_setnvr(): Error reading data\n");
|
||||
fclose(f);
|
||||
f = NULL;
|
||||
fclose(fp);
|
||||
fp = NULL;
|
||||
} else
|
||||
aha_initnvr(dev);
|
||||
|
||||
|
@@ -675,7 +675,7 @@ buslogic_cmds(void *priv)
|
||||
|
||||
const HALocalRAM *HALR = &bl->LocalRAM;
|
||||
|
||||
FILE *f;
|
||||
FILE *fp;
|
||||
uint16_t TargetsPresentMask = 0;
|
||||
uint32_t Offset;
|
||||
int i = 0;
|
||||
@@ -890,11 +890,11 @@ buslogic_cmds(void *priv)
|
||||
BuslogicAutoSCSIRamSetDefaults(dev, 3);
|
||||
break;
|
||||
case 1:
|
||||
f = nvr_fopen(BuslogicGetNVRFileName(bl), "wb");
|
||||
if (f) {
|
||||
fwrite(&(bl->LocalRAM.structured.autoSCSIData), 1, 64, f);
|
||||
fclose(f);
|
||||
f = NULL;
|
||||
fp = nvr_fopen(BuslogicGetNVRFileName(bl), "wb");
|
||||
if (fp) {
|
||||
fwrite(&(bl->LocalRAM.structured.autoSCSIData), 1, 64, fp);
|
||||
fclose(fp);
|
||||
fp = NULL;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -1528,16 +1528,16 @@ static void *
|
||||
buslogic_init(const device_t *info)
|
||||
{
|
||||
x54x_t *dev;
|
||||
char *bios_rom_name;
|
||||
const char *bios_rom_name;
|
||||
uint16_t bios_rom_size = 0;
|
||||
uint16_t bios_rom_mask = 0;
|
||||
uint8_t has_autoscsi_rom;
|
||||
char *autoscsi_rom_name = NULL;
|
||||
const char *autoscsi_rom_name = NULL;
|
||||
uint16_t autoscsi_rom_size = 0;
|
||||
uint8_t has_scam_rom;
|
||||
char *scam_rom_name = NULL;
|
||||
const char *scam_rom_name = NULL;
|
||||
uint16_t scam_rom_size = 0;
|
||||
FILE *f;
|
||||
FILE *fp;
|
||||
buslogic_data_t *bl;
|
||||
uint32_t bios_rom_addr;
|
||||
|
||||
@@ -1721,20 +1721,20 @@ buslogic_init(const device_t *info)
|
||||
rom_init(&bl->bios, bios_rom_name, bios_rom_addr, bios_rom_size, bios_rom_mask, 0, MEM_MAPPING_EXTERNAL);
|
||||
|
||||
if (has_autoscsi_rom) {
|
||||
f = rom_fopen(autoscsi_rom_name, "rb");
|
||||
if (f) {
|
||||
(void) !fread(bl->AutoSCSIROM, 1, autoscsi_rom_size, f);
|
||||
fclose(f);
|
||||
f = NULL;
|
||||
fp = rom_fopen(autoscsi_rom_name, "rb");
|
||||
if (fp) {
|
||||
(void) !fread(bl->AutoSCSIROM, 1, autoscsi_rom_size, fp);
|
||||
fclose(fp);
|
||||
fp = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (has_scam_rom) {
|
||||
f = rom_fopen(scam_rom_name, "rb");
|
||||
if (f) {
|
||||
(void) !fread(bl->SCAMData, 1, scam_rom_size, f);
|
||||
fclose(f);
|
||||
f = NULL;
|
||||
fp = rom_fopen(scam_rom_name, "rb");
|
||||
if (fp) {
|
||||
(void) !fread(bl->SCAMData, 1, scam_rom_size, fp);
|
||||
fclose(fp);
|
||||
fp = NULL;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@@ -608,7 +608,7 @@ scsi_cdrom_get_volume(void *priv, int channel)
|
||||
static void
|
||||
scsi_cdrom_mode_sense_load(scsi_cdrom_t *dev)
|
||||
{
|
||||
FILE *f;
|
||||
FILE *fp;
|
||||
char file_name[512];
|
||||
|
||||
if (!strcmp(cdrom_drive_types[dev->drv->type].internal_name, "SONY_CD-ROM_CDU-541_1.0i") ||
|
||||
@@ -618,11 +618,11 @@ scsi_cdrom_mode_sense_load(scsi_cdrom_t *dev)
|
||||
|
||||
memset(file_name, 0, 512);
|
||||
sprintf(file_name, "scsi_cdrom_%02i_mode_sense_sony_bin", dev->id);
|
||||
f = plat_fopen(nvr_path(file_name), "rb");
|
||||
if (f) {
|
||||
if (fread(dev->ms_pages_saved_sony.pages[GPMODE_CDROM_AUDIO_PAGE_SONY], 1, 0x10, f) != 0x10)
|
||||
fp = plat_fopen(nvr_path(file_name), "rb");
|
||||
if (fp) {
|
||||
if (fread(dev->ms_pages_saved_sony.pages[GPMODE_CDROM_AUDIO_PAGE_SONY], 1, 0x10, fp) != 0x10)
|
||||
fatal("scsi_cdrom_mode_sense_load(): Error reading data\n");
|
||||
fclose(f);
|
||||
fclose(fp);
|
||||
}
|
||||
} else {
|
||||
memset(&dev->ms_pages_saved, 0, sizeof(mode_sense_pages_t));
|
||||
@@ -636,11 +636,11 @@ scsi_cdrom_mode_sense_load(scsi_cdrom_t *dev)
|
||||
sprintf(file_name, "scsi_cdrom_%02i_mode_sense_bin", dev->id);
|
||||
else
|
||||
sprintf(file_name, "cdrom_%02i_mode_sense_bin", dev->id);
|
||||
f = plat_fopen(nvr_path(file_name), "rb");
|
||||
if (f) {
|
||||
if (fread(dev->ms_pages_saved.pages[GPMODE_CDROM_AUDIO_PAGE], 1, 0x10, f) != 0x10)
|
||||
fp = plat_fopen(nvr_path(file_name), "rb");
|
||||
if (fp) {
|
||||
if (fread(dev->ms_pages_saved.pages[GPMODE_CDROM_AUDIO_PAGE], 1, 0x10, fp) != 0x10)
|
||||
fatal("scsi_cdrom_mode_sense_load(): Error reading data\n");
|
||||
fclose(f);
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -648,7 +648,7 @@ scsi_cdrom_mode_sense_load(scsi_cdrom_t *dev)
|
||||
static void
|
||||
scsi_cdrom_mode_sense_save(scsi_cdrom_t *dev)
|
||||
{
|
||||
FILE *f;
|
||||
FILE *fp;
|
||||
char file_name[512];
|
||||
|
||||
memset(file_name, 0, 512);
|
||||
@@ -656,20 +656,20 @@ scsi_cdrom_mode_sense_save(scsi_cdrom_t *dev)
|
||||
if (!strcmp(cdrom_drive_types[dev->drv->type].internal_name, "SONY_CD-ROM_CDU-541_1.0i") ||
|
||||
!strcmp(cdrom_drive_types[dev->drv->type].internal_name, "SONY_CD-ROM_CDU-76S_1.00")) {
|
||||
sprintf(file_name, "scsi_cdrom_%02i_mode_sense_sony_bin", dev->id);
|
||||
f = plat_fopen(nvr_path(file_name), "wb");
|
||||
if (f) {
|
||||
fwrite(dev->ms_pages_saved_sony.pages[GPMODE_CDROM_AUDIO_PAGE_SONY], 1, 0x10, f);
|
||||
fclose(f);
|
||||
fp = plat_fopen(nvr_path(file_name), "wb");
|
||||
if (fp) {
|
||||
fwrite(dev->ms_pages_saved_sony.pages[GPMODE_CDROM_AUDIO_PAGE_SONY], 1, 0x10, fp);
|
||||
fclose(fp);
|
||||
}
|
||||
} else {
|
||||
if (dev->drv->bus_type == CDROM_BUS_SCSI)
|
||||
sprintf(file_name, "scsi_cdrom_%02i_mode_sense_bin", dev->id);
|
||||
else
|
||||
sprintf(file_name, "cdrom_%02i_mode_sense_bin", dev->id);
|
||||
f = plat_fopen(nvr_path(file_name), "wb");
|
||||
if (f) {
|
||||
fwrite(dev->ms_pages_saved.pages[GPMODE_CDROM_AUDIO_PAGE], 1, 0x10, f);
|
||||
fclose(f);
|
||||
fp = plat_fopen(nvr_path(file_name), "wb");
|
||||
if (fp) {
|
||||
fwrite(dev->ms_pages_saved.pages[GPMODE_CDROM_AUDIO_PAGE], 1, 0x10, fp);
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1902,14 +1902,12 @@ begin:
|
||||
cdb[0] = GPCMD_PLAY_AUDIO_MSF;
|
||||
dev->current_cdb[0] = cdb[0];
|
||||
goto begin;
|
||||
break;
|
||||
} else if (!strcmp(cdrom_drive_types[dev->drv->type].internal_name, "SONY_CD-ROM_CDU-541_1.0i") ||
|
||||
!strcmp(cdrom_drive_types[dev->drv->type].internal_name, "SONY_CD-ROM_CDU-76S_1.00")) { /*GPCMD_PLAY_MSF_SONY*/
|
||||
cdb[0] = GPCMD_PLAY_AUDIO_MSF;
|
||||
dev->current_cdb[0] = cdb[0];
|
||||
dev->sony_vendor = 1;
|
||||
goto begin;
|
||||
break;
|
||||
} /*GPCMD_READ_DISC_INFORMATION_TOSHIBA*/
|
||||
case 0xDE: /*GPCMD_READ_DISC_INFORMATION_NEC*/
|
||||
scsi_cdrom_set_phase(dev, SCSI_PHASE_DATA_IN);
|
||||
@@ -2788,7 +2786,6 @@ begin:
|
||||
cdb[0] = GPCMD_READ_HEADER;
|
||||
dev->current_cdb[0] = cdb[0];
|
||||
goto begin;
|
||||
break;
|
||||
} else if (!strcmp(cdrom_drive_types[dev->drv->type].internal_name, "SONY_CD-ROM_CDU-541_1.0i") ||
|
||||
!strcmp(cdrom_drive_types[dev->drv->type].internal_name, "SONY_CD-ROM_CDU-76S_1.00")) { /*GPCMD_PLAYBACK_STATUS_SONY*/
|
||||
scsi_cdrom_set_phase(dev, SCSI_PHASE_DATA_IN);
|
||||
@@ -3029,7 +3026,6 @@ atapi_out:
|
||||
cdb[0] = GPCMD_READ_TOC_PMA_ATIP;
|
||||
dev->current_cdb[0] = cdb[0];
|
||||
goto begin;
|
||||
break;
|
||||
} else if (!strcmp(cdrom_drive_types[dev->drv->type].internal_name, "SONY_CD-ROM_CDU-541_1.0i") ||
|
||||
!strcmp(cdrom_drive_types[dev->drv->type].internal_name, "SONY_CD-ROM_CDU-76S_1.00")) { /*GPCMD_READ_HEADER_SONY*/
|
||||
scsi_cdrom_set_phase(dev, SCSI_PHASE_DATA_IN);
|
||||
@@ -3064,7 +3060,6 @@ atapi_out:
|
||||
cdb[0] = GPCMD_READ_SUBCHANNEL;
|
||||
dev->current_cdb[0] = cdb[0];
|
||||
goto begin;
|
||||
break;
|
||||
} else if (!strcmp(cdrom_drive_types[dev->drv->type].internal_name, "SONY_CD-ROM_CDU-541_1.0i") ||
|
||||
!strcmp(cdrom_drive_types[dev->drv->type].internal_name, "SONY_CD-ROM_CDU-76S_1.00") ||
|
||||
!strcmp(cdrom_drive_types[dev->drv->type].internal_name, "PIONEER_CD-ROM_DRM-604X_2403")) { /*GPCMD_READ_SUBCHANNEL_SONY*/
|
||||
@@ -3172,7 +3167,6 @@ atapi_out:
|
||||
cdb[0] = GPCMD_PLAY_AUDIO_10;
|
||||
dev->current_cdb[0] = cdb[0];
|
||||
goto begin;
|
||||
break;
|
||||
} else if (!strcmp(cdrom_drive_types[dev->drv->type].internal_name, "SONY_CD-ROM_CDU-541_1.0i") ||
|
||||
!strcmp(cdrom_drive_types[dev->drv->type].internal_name, "SONY_CD-ROM_CDU-76S_1.00")) { /*GPCMD_PAUSE_SONY*/
|
||||
scsi_cdrom_set_phase(dev, SCSI_PHASE_STATUS);
|
||||
@@ -3186,21 +3180,18 @@ atapi_out:
|
||||
cdb[0] = GPCMD_PLAY_AUDIO_TRACK_INDEX;
|
||||
dev->current_cdb[0] = cdb[0];
|
||||
goto begin;
|
||||
break;
|
||||
} else if (!strcmp(cdrom_drive_types[dev->drv->type].internal_name, "SONY_CD-ROM_CDU-541_1.0i") ||
|
||||
!strcmp(cdrom_drive_types[dev->drv->type].internal_name, "SONY_CD-ROM_CDU-76S_1.00")) { /*GPCMD_PLAY_AUDIO_SONY*/
|
||||
cdb[0] = GPCMD_PLAY_AUDIO_10;
|
||||
dev->current_cdb[0] = cdb[0];
|
||||
dev->sony_vendor = 1;
|
||||
goto begin;
|
||||
break;
|
||||
}
|
||||
case 0xC9:
|
||||
if (!strcmp(cdrom_drive_types[dev->drv->type].internal_name, "MATSHITA_CD-ROM_CR-501_1.0b")) { /*GPCMD_PLAY_AUDIO_TRACK_RELATIVE_10_MATSUSHITA*/
|
||||
cdb[0] = GPCMD_PLAY_AUDIO_TRACK_RELATIVE_10;
|
||||
dev->current_cdb[0] = cdb[0];
|
||||
goto begin;
|
||||
break;
|
||||
} else if (!strcmp(cdrom_drive_types[dev->drv->type].internal_name, "SONY_CD-ROM_CDU-541_1.0i") ||
|
||||
!strcmp(cdrom_drive_types[dev->drv->type].internal_name, "SONY_CD-ROM_CDU-76S_1.00")) { /*GPCMD_PLAYBACK_CONTROL_SONY*/
|
||||
scsi_cdrom_set_phase(dev, SCSI_PHASE_DATA_OUT);
|
||||
@@ -3225,7 +3216,6 @@ atapi_out:
|
||||
cdb[0] = GPCMD_PAUSE_RESUME;
|
||||
dev->current_cdb[0] = cdb[0];
|
||||
goto begin;
|
||||
break;
|
||||
}
|
||||
case 0xCC:
|
||||
if (!strcmp(cdrom_drive_types[dev->drv->type].internal_name, "PIONEER_CD-ROM_DRM-604X_2403")) {
|
||||
@@ -3295,15 +3285,14 @@ atapi_out:
|
||||
cdb[0] = GPCMD_PLAY_AUDIO_12;
|
||||
dev->current_cdb[0] = cdb[0];
|
||||
goto begin;
|
||||
break;
|
||||
}
|
||||
case 0xE9:
|
||||
if (!strcmp(cdrom_drive_types[dev->drv->type].internal_name, "MATSHITA_CD-ROM_CR-501_1.0b")) { /*GPCMD_PLAY_AUDIO_TRACK_RELATIVE_12_MATSUSHITA*/
|
||||
cdb[0] = GPCMD_PLAY_AUDIO_TRACK_RELATIVE_12;
|
||||
dev->current_cdb[0] = cdb[0];
|
||||
goto begin;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
scsi_cdrom_illegal_opcode(dev);
|
||||
break;
|
||||
|
@@ -137,7 +137,7 @@ scsi_disk_log(const char *fmt, ...)
|
||||
void
|
||||
scsi_disk_mode_sense_load(scsi_disk_t *dev)
|
||||
{
|
||||
FILE *f;
|
||||
FILE *fp;
|
||||
char file_name[512];
|
||||
|
||||
memset(&dev->ms_pages_saved, 0, sizeof(mode_sense_pages_t));
|
||||
@@ -145,26 +145,26 @@ scsi_disk_mode_sense_load(scsi_disk_t *dev)
|
||||
|
||||
memset(file_name, 0, 512);
|
||||
sprintf(file_name, "scsi_disk_%02i_mode_sense.bin", dev->id);
|
||||
f = plat_fopen(nvr_path(file_name), "rb");
|
||||
if (f) {
|
||||
if (fread(dev->ms_pages_saved.pages[0x30], 1, 0x18, f) != 0x18)
|
||||
fp = plat_fopen(nvr_path(file_name), "rb");
|
||||
if (fp) {
|
||||
if (fread(dev->ms_pages_saved.pages[0x30], 1, 0x18, fp) != 0x18)
|
||||
fatal("scsi_disk_mode_sense_load(): Error reading data\n");
|
||||
fclose(f);
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
scsi_disk_mode_sense_save(scsi_disk_t *dev)
|
||||
{
|
||||
FILE *f;
|
||||
FILE *fp;
|
||||
char file_name[512];
|
||||
|
||||
memset(file_name, 0, 512);
|
||||
sprintf(file_name, "scsi_disk_%02i_mode_sense.bin", dev->id);
|
||||
f = plat_fopen(nvr_path(file_name), "wb");
|
||||
if (f) {
|
||||
fwrite(dev->ms_pages_saved.pages[0x30], 1, 0x18, f);
|
||||
fclose(f);
|
||||
fp = plat_fopen(nvr_path(file_name), "wb");
|
||||
if (fp) {
|
||||
fwrite(dev->ms_pages_saved.pages[0x30], 1, 0x18, fp);
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1445,15 +1445,15 @@ ncr53c8xx_callback(void *priv)
|
||||
static void
|
||||
ncr53c8xx_eeprom(ncr53c8xx_t *dev, uint8_t save)
|
||||
{
|
||||
FILE *f;
|
||||
FILE *fp;
|
||||
|
||||
f = nvr_fopen(dev->nvr_path, save ? "wb" : "rb");
|
||||
if (f) {
|
||||
fp = nvr_fopen(dev->nvr_path, save ? "wb" : "rb");
|
||||
if (fp) {
|
||||
if (save)
|
||||
fwrite(&dev->nvram, sizeof(dev->nvram), 1, f);
|
||||
fwrite(&dev->nvram, sizeof(dev->nvram), 1, fp);
|
||||
else
|
||||
(void) !fread(&dev->nvram, sizeof(dev->nvram), 1, f);
|
||||
fclose(f);
|
||||
(void) !fread(&dev->nvram, sizeof(dev->nvram), 1, fp);
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1463,11 +1463,11 @@ esp_bios_disable(esp_t *dev)
|
||||
static void
|
||||
dc390_save_eeprom(esp_t *dev)
|
||||
{
|
||||
FILE *f = nvr_fopen(dev->nvr_path, "wb");
|
||||
if (!f)
|
||||
FILE *fp = nvr_fopen(dev->nvr_path, "wb");
|
||||
if (!fp)
|
||||
return;
|
||||
fwrite(dev->eeprom.data, 1, 128, f);
|
||||
fclose(f);
|
||||
fwrite(dev->eeprom.data, 1, 128, fp);
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1599,16 +1599,16 @@ dc390_load_eeprom(esp_t *dev)
|
||||
uint8_t *nvr = (uint8_t *) eeprom->data;
|
||||
int i;
|
||||
uint16_t checksum = 0;
|
||||
FILE *f;
|
||||
FILE *fp;
|
||||
|
||||
eeprom->out = 1;
|
||||
|
||||
f = nvr_fopen(dev->nvr_path, "rb");
|
||||
if (f) {
|
||||
fp = nvr_fopen(dev->nvr_path, "rb");
|
||||
if (fp) {
|
||||
esp_log("EEPROM Load\n");
|
||||
if (fread(nvr, 1, 128, f) != 128)
|
||||
if (fread(nvr, 1, 128, fp) != 128)
|
||||
fatal("dc390_eeprom_load(): Error reading data\n");
|
||||
fclose(f);
|
||||
fclose(fp);
|
||||
} else {
|
||||
for (i = 0; i < 16; i++) {
|
||||
nvr[i * 2] = 0x57;
|
||||
@@ -1656,7 +1656,6 @@ esp_pci_read(UNUSED(int func), int addr, void *priv)
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 0x01:
|
||||
return 0x10;
|
||||
case 0x02:
|
||||
|
@@ -466,7 +466,6 @@ x54x_bios_command(x54x_t *x54x, uint8_t max_id, BIOSCMD *cmd, int8_t islba)
|
||||
}
|
||||
|
||||
return 0;
|
||||
break;
|
||||
|
||||
case 0x02: /* Read Desired Sectors to Memory */
|
||||
case 0x03: /* Write Desired Sectors from Memory */
|
||||
@@ -1467,7 +1466,7 @@ x54x_out(uint16_t port, uint8_t val, void *priv)
|
||||
{
|
||||
ReplyInquireSetupInformation *ReplyISI;
|
||||
x54x_t *dev = (x54x_t *) priv;
|
||||
MailboxInit_t *mbi;
|
||||
const MailboxInit_t *mbi;
|
||||
int i = 0;
|
||||
BIOSCMD *cmd;
|
||||
uint16_t cyl = 0;
|
||||
@@ -1774,6 +1773,9 @@ x54x_out(uint16_t port, uint8_t val, void *priv)
|
||||
if (dev->flags & X54X_INT_GEOM_WRITABLE)
|
||||
dev->Geometry = val;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user