--- Gnu-Mach/linux/src/drivers/block/ide-cd.c 2020/09/02 04:41:40 1.1 +++ Gnu-Mach/linux/src/drivers/block/ide-cd.c 2020/09/02 04:46:34 1.1.1.2 @@ -153,6 +153,10 @@ /***************************************************************************/ +#ifdef MACH +#include +#endif + #include #include #include @@ -626,7 +630,7 @@ static void cdrom_queue_request_sense (i pc->c[0] = REQUEST_SENSE; pc->c[4] = len; - pc->buffer = (char *)reqbuf; + pc->buffer = (unsigned char *)reqbuf; pc->buflen = len; pc->sense_data = (struct atapi_request_sense *)failed_command; @@ -844,7 +848,7 @@ static int cdrom_start_packet_command (i HANDLER is the interrupt handler to call when the command completes or there's data ready. */ static int cdrom_transfer_packet_command (ide_drive_t *drive, - char *cmd_buf, int cmd_len, + unsigned char *cmd_buf, int cmd_len, ide_handler_t *handler) { if (CDROM_CONFIG_FLAGS (drive)->drq_interrupt) { @@ -1379,9 +1383,19 @@ static void cdrom_do_packet_command (ide cdrom_start_packet_command (drive, len, cdrom_do_pc_continuation); } - /* Sleep for TIME jiffies. Not to be called from an interrupt handler. */ +#ifdef MACH +static +void cdrom_sleep (int time) +{ + int xxx; + + assert_wait ((event_t) &xxx, TRUE); + thread_set_timeout (time); + schedule (); +} +#else static void cdrom_sleep (int time) { @@ -1389,6 +1403,7 @@ void cdrom_sleep (int time) current->timeout = jiffies + time; schedule (); } +#endif static int cdrom_queue_packet_command (ide_drive_t *drive, struct packet_command *pc) @@ -1658,7 +1673,7 @@ cdrom_read_capacity (ide_drive_t *drive, pc.sense_data = reqbuf; pc.c[0] = READ_CAPACITY; - pc.buffer = (char *)&capbuf; + pc.buffer = (unsigned char *)&capbuf; pc.buflen = sizeof (capbuf); stat = cdrom_queue_packet_command (drive, &pc); @@ -1679,7 +1694,7 @@ cdrom_read_tocentry (ide_drive_t *drive, memset (&pc, 0, sizeof (pc)); pc.sense_data = reqbuf; - pc.buffer = buf; + pc.buffer = (unsigned char *)buf; pc.buflen = buflen; pc.c[0] = SCMD_READ_TOC; pc.c[6] = trackno; @@ -1811,7 +1826,7 @@ cdrom_read_subchannel (ide_drive_t *driv memset (&pc, 0, sizeof (pc)); pc.sense_data = reqbuf; - pc.buffer = buf; + pc.buffer = (unsigned char *) buf; pc.buflen = buflen; pc.c[0] = SCMD_READ_SUBCHANNEL; pc.c[1] = 2; /* MSF addressing */ @@ -1834,7 +1849,7 @@ cdrom_mode_sense (ide_drive_t *drive, in memset (&pc, 0, sizeof (pc)); pc.sense_data = reqbuf; - pc.buffer = buf; + pc.buffer = (unsigned char *)buf; pc.buflen = buflen; pc.c[0] = MODE_SENSE_10; pc.c[2] = pageno | (modeflag << 6); @@ -1853,7 +1868,7 @@ cdrom_mode_select (ide_drive_t *drive, i memset (&pc, 0, sizeof (pc)); pc.sense_data = reqbuf; - pc.buffer = buf; + pc.buffer = (unsigned char *)buf; pc.buflen = - buflen; pc.c[0] = MODE_SELECT_10; pc.c[1] = 0x10; @@ -1969,7 +1984,7 @@ cdrom_read_block (ide_drive_t *drive, in memset (&pc, 0, sizeof (pc)); pc.sense_data = reqbuf; - pc.buffer = buf; + pc.buffer = (unsigned char *)buf; pc.buflen = buflen; #if ! STANDARD_ATAPI @@ -2696,9 +2711,12 @@ void ide_cdrom_setup (ide_drive_t *drive CDROM_CONFIG_FLAGS (drive)->subchan_as_bcd = 0; if (drive->id != NULL) { - if (strcmp (drive->id->model, "V003S0DS") == 0 && - drive->id->fw_rev[4] == '1' && - drive->id->fw_rev[6] <= '2') { + const char *model = (const char *)drive->id->model; + const char *fw_rev = (const char *)drive->id->fw_rev; + + if (strcmp (model, "V003S0DS") == 0 && + fw_rev[4] == '1' && + fw_rev[6] <= '2') { /* Vertos 300. Some versions of this drive like to talk BCD. */ CDROM_CONFIG_FLAGS (drive)->toctracks_as_bcd = 1; @@ -2707,27 +2725,27 @@ void ide_cdrom_setup (ide_drive_t *drive CDROM_CONFIG_FLAGS (drive)->subchan_as_bcd = 1; } - else if (strcmp (drive->id->model, "V006E0DS") == 0 && - drive->id->fw_rev[4] == '1' && - drive->id->fw_rev[6] <= '2') { + else if (strcmp (model, "V006E0DS") == 0 && + fw_rev[4] == '1' && + fw_rev[6] <= '2') { /* Vertos 600 ESD. */ CDROM_CONFIG_FLAGS (drive)->toctracks_as_bcd = 1; } - else if (strcmp (drive->id->model, "GCD-R580B") == 0) + else if (strcmp (model, "GCD-R580B") == 0) drive->cdrom_info.max_sectors = 124; - else if (strcmp (drive->id->model, + else if (strcmp (model, "NEC CD-ROM DRIVE:260") == 0 && - strcmp (drive->id->fw_rev, "1.01") == 0) { + strcmp (fw_rev, "1.01") == 0) { /* Old NEC260 (not R). */ CDROM_CONFIG_FLAGS (drive)->tocaddr_as_bcd = 1; CDROM_CONFIG_FLAGS (drive)->playmsf_as_bcd = 1; CDROM_CONFIG_FLAGS (drive)->subchan_as_bcd = 1; } - else if (strcmp (drive->id->model, "WEARNES CDD-120") == 0 && - strcmp (drive->id->fw_rev, "A1.1") == 0) { + else if (strcmp (model, "WEARNES CDD-120") == 0 && + strcmp (fw_rev, "A1.1") == 0) { /* Wearnes */ CDROM_CONFIG_FLAGS (drive)->playmsf_as_bcd = 1; CDROM_CONFIG_FLAGS (drive)->subchan_as_bcd = 1; @@ -2735,9 +2753,9 @@ void ide_cdrom_setup (ide_drive_t *drive /* Sanyo 3 CD changer uses a non-standard command for CD changing */ - else if ((strcmp(drive->id->model, "CD-ROM CDR-C3 G") == 0) || - (strcmp(drive->id->model, "CD-ROM CDR-C3G") == 0) || - (strcmp(drive->id->model, "CD-ROM CDR_C36") == 0)) { + else if ((strcmp(model, "CD-ROM CDR-C3 G") == 0) || + (strcmp(model, "CD-ROM CDR-C3G") == 0) || + (strcmp(model, "CD-ROM CDR_C36") == 0)) { /* uses CD in slot 0 when value is set to 3 */ CDROM_STATE_FLAGS (drive)->sanyo_slot = 3; }