2018-01-26 22:17:09 +01:00
|
|
|
/*
|
|
|
|
|
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
|
|
|
|
* running old operating systems and software designed for IBM
|
|
|
|
|
* PC systems and compatibles from 1981 through fairly recent
|
|
|
|
|
* system designs based on the PCI bus.
|
|
|
|
|
*
|
|
|
|
|
* This file is part of the 86Box distribution.
|
|
|
|
|
*
|
|
|
|
|
* Implementation of the Iomega ZIP drive with SCSI(-like)
|
|
|
|
|
* commands, for both ATAPI and SCSI usage.
|
|
|
|
|
*
|
2020-03-25 00:46:02 +02:00
|
|
|
*
|
2018-01-26 22:17:09 +01:00
|
|
|
*
|
|
|
|
|
* Author: Miran Grca, <mgrca8@gmail.com>
|
|
|
|
|
*
|
2019-11-19 04:35:54 +01:00
|
|
|
* Copyright 2018,2019 Miran Grca.
|
2018-01-26 22:17:09 +01:00
|
|
|
*/
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
#include <wchar.h>
|
|
|
|
|
#define HAVE_STDARG_H
|
2020-03-29 14:24:42 +02:00
|
|
|
#include <86box/86box.h>
|
|
|
|
|
#include <86box/timer.h>
|
|
|
|
|
#include <86box/config.h>
|
|
|
|
|
#include <86box/timer.h>
|
|
|
|
|
#include <86box/device.h>
|
2022-08-02 20:11:23 -04:00
|
|
|
#include <86box/scsi.h>
|
2020-03-29 14:24:42 +02:00
|
|
|
#include <86box/scsi_device.h>
|
|
|
|
|
#include <86box/nvr.h>
|
|
|
|
|
#include <86box/plat.h>
|
|
|
|
|
#include <86box/ui.h>
|
|
|
|
|
#include <86box/hdc.h>
|
|
|
|
|
#include <86box/hdc_ide.h>
|
|
|
|
|
#include <86box/zip.h>
|
2018-01-26 22:17:09 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
zip_drive_t zip_drives[ZIP_NUM];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Table of all SCSI commands and their flags, needed for the new disc change / not ready handler. */
|
2018-03-19 01:02:04 +01:00
|
|
|
const uint8_t zip_command_flags[0x100] =
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
|
|
|
|
IMPLEMENTED | CHECK_READY | NONDATA, /* 0x00 */
|
|
|
|
|
IMPLEMENTED | ALLOW_UA | NONDATA | SCSI_ONLY, /* 0x01 */
|
|
|
|
|
0,
|
|
|
|
|
IMPLEMENTED | ALLOW_UA, /* 0x03 */
|
|
|
|
|
IMPLEMENTED | CHECK_READY | ALLOW_UA | NONDATA | SCSI_ONLY, /* 0x04 */
|
|
|
|
|
0,
|
|
|
|
|
IMPLEMENTED, /* 0x06 */
|
|
|
|
|
0,
|
|
|
|
|
IMPLEMENTED | CHECK_READY, /* 0x08 */
|
|
|
|
|
0,
|
|
|
|
|
IMPLEMENTED | CHECK_READY, /* 0x0A */
|
2018-07-15 01:41:53 +02:00
|
|
|
IMPLEMENTED | CHECK_READY | NONDATA, /* 0x0B */
|
2018-01-26 22:17:09 +01:00
|
|
|
IMPLEMENTED, /* 0x0C */
|
|
|
|
|
IMPLEMENTED | ATAPI_ONLY, /* 0x0D */
|
|
|
|
|
0, 0, 0, 0,
|
|
|
|
|
IMPLEMENTED | ALLOW_UA, /* 0x12 */
|
|
|
|
|
IMPLEMENTED | CHECK_READY | NONDATA | SCSI_ONLY, /* 0x13 */
|
|
|
|
|
0,
|
|
|
|
|
IMPLEMENTED, /* 0x15 */
|
|
|
|
|
IMPLEMENTED | SCSI_ONLY, /* 0x16 */
|
|
|
|
|
IMPLEMENTED | SCSI_ONLY, /* 0x17 */
|
|
|
|
|
0, 0,
|
2018-04-25 23:51:13 +02:00
|
|
|
IMPLEMENTED, /* 0x1A */
|
2018-01-26 22:17:09 +01:00
|
|
|
IMPLEMENTED | CHECK_READY, /* 0x1B */
|
|
|
|
|
0,
|
|
|
|
|
IMPLEMENTED, /* 0x1D */
|
|
|
|
|
IMPLEMENTED | CHECK_READY, /* 0x1E */
|
2018-03-21 15:16:25 +01:00
|
|
|
0, 0, 0, 0,
|
|
|
|
|
IMPLEMENTED | ATAPI_ONLY, /* 0x23 */
|
|
|
|
|
0,
|
2018-01-26 22:17:09 +01:00
|
|
|
IMPLEMENTED | CHECK_READY, /* 0x25 */
|
|
|
|
|
0, 0,
|
|
|
|
|
IMPLEMENTED | CHECK_READY, /* 0x28 */
|
|
|
|
|
0,
|
|
|
|
|
IMPLEMENTED | CHECK_READY, /* 0x2A */
|
2018-07-15 01:41:53 +02:00
|
|
|
IMPLEMENTED | CHECK_READY | NONDATA, /* 0x2B */
|
|
|
|
|
0, 0,
|
2018-01-26 22:17:09 +01:00
|
|
|
IMPLEMENTED | CHECK_READY, /* 0x2E */
|
|
|
|
|
IMPLEMENTED | CHECK_READY | NONDATA | SCSI_ONLY, /* 0x2F */
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
|
0,
|
|
|
|
|
IMPLEMENTED | CHECK_READY, /* 0x41 */
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
|
0, 0, 0, 0, 0,
|
|
|
|
|
IMPLEMENTED, /* 0x55 */
|
|
|
|
|
0, 0, 0, 0,
|
|
|
|
|
IMPLEMENTED, /* 0x5A */
|
|
|
|
|
0, 0, 0, 0, 0,
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
|
IMPLEMENTED | CHECK_READY, /* 0xA8 */
|
|
|
|
|
0,
|
|
|
|
|
IMPLEMENTED | CHECK_READY, /* 0xAA */
|
|
|
|
|
0, 0, 0,
|
|
|
|
|
IMPLEMENTED | CHECK_READY, /* 0xAE */
|
|
|
|
|
IMPLEMENTED | CHECK_READY | NONDATA | SCSI_ONLY, /* 0xAF */
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
|
IMPLEMENTED, /* 0xBD */
|
|
|
|
|
0, 0,
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
|
|
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
|
|
|
|
};
|
|
|
|
|
|
2018-09-12 19:46:26 +02:00
|
|
|
static uint64_t zip_mode_sense_page_flags = (GPMODEP_R_W_ERROR_PAGE |
|
2018-10-07 00:35:37 +02:00
|
|
|
GPMODEP_DISCONNECT_PAGE |
|
|
|
|
|
GPMODEP_IOMEGA_PAGE |
|
2018-09-12 19:46:26 +02:00
|
|
|
GPMODEP_ALL_PAGES);
|
|
|
|
|
static uint64_t zip_250_mode_sense_page_flags = (GPMODEP_R_W_ERROR_PAGE |
|
2018-10-07 00:35:37 +02:00
|
|
|
GPMODEP_FLEXIBLE_DISK_PAGE |
|
|
|
|
|
GPMODEP_CACHING_PAGE |
|
|
|
|
|
GPMODEP_IOMEGA_PAGE |
|
2018-09-12 19:46:26 +02:00
|
|
|
GPMODEP_ALL_PAGES);
|
2018-01-26 22:17:09 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
static const mode_sense_pages_t zip_mode_sense_pages_default =
|
2018-04-25 23:51:13 +02:00
|
|
|
{ {
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ GPMODE_R_W_ERROR_PAGE, 0x0a, 0xc8, 22, 0, 0, 0, 0, 90, 0, 0x50, 0x20 },
|
2018-10-07 00:35:37 +02:00
|
|
|
{ GPMODE_DISCONNECT_PAGE, 0x0e, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
2018-04-25 23:51:13 +02:00
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
2018-10-07 00:35:37 +02:00
|
|
|
{ GPMODE_IOMEGA_PAGE, 0x04, 0x5c, 0x0f, 0xff, 0x0f }
|
2018-04-25 23:51:13 +02:00
|
|
|
} };
|
2018-01-26 22:17:09 +01:00
|
|
|
|
|
|
|
|
static const mode_sense_pages_t zip_250_mode_sense_pages_default =
|
2018-04-25 23:51:13 +02:00
|
|
|
{ {
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ GPMODE_R_W_ERROR_PAGE, 0x06, 0xc8, 0x64, 0, 0, 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
2018-10-07 00:35:37 +02:00
|
|
|
{GPMODE_FLEXIBLE_DISK_PAGE, 0x1e, 0x80, 0, 0x40, 0x20, 2, 0, 0, 0xef, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0b, 0x7d, 0, 0 },
|
2018-04-25 23:51:13 +02:00
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
2018-10-07 00:35:37 +02:00
|
|
|
{ GPMODE_CACHING_PAGE, 0x0a, 4, 0, 0xff, 0xff, 0, 0, 0xff, 0xff, 0xff, 0xff },
|
2018-04-25 23:51:13 +02:00
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 }, { 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
2018-10-07 00:35:37 +02:00
|
|
|
{ GPMODE_IOMEGA_PAGE, 0x04, 0x5c, 0x0f, 0x3c, 0x0f }
|
2018-04-25 23:51:13 +02:00
|
|
|
} };
|
2018-01-26 22:17:09 +01:00
|
|
|
|
|
|
|
|
static const mode_sense_pages_t zip_mode_sense_pages_default_scsi =
|
2018-04-25 23:51:13 +02:00
|
|
|
{ {
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ GPMODE_R_W_ERROR_PAGE, 0x0a, 0xc8, 22, 0, 0, 0, 0, 90, 0, 0x50, 0x20 },
|
2018-10-07 00:35:37 +02:00
|
|
|
{ GPMODE_DISCONNECT_PAGE, 0x0e, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
2018-04-25 23:51:13 +02:00
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
2018-10-07 00:35:37 +02:00
|
|
|
{ GPMODE_IOMEGA_PAGE, 0x04, 0x5c, 0x0f, 0xff, 0x0f }
|
2018-04-25 23:51:13 +02:00
|
|
|
} };
|
2018-01-26 22:17:09 +01:00
|
|
|
|
|
|
|
|
static const mode_sense_pages_t zip_250_mode_sense_pages_default_scsi =
|
2018-04-25 23:51:13 +02:00
|
|
|
{ {
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ GPMODE_R_W_ERROR_PAGE, 0x06, 0xc8, 0x64, 0, 0, 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
2018-10-07 00:35:37 +02:00
|
|
|
{GPMODE_FLEXIBLE_DISK_PAGE, 0x1e, 0x80, 0, 0x40, 0x20, 2, 0, 0, 0xef, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0b, 0x7d, 0, 0 },
|
2018-04-25 23:51:13 +02:00
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
2018-10-07 00:35:37 +02:00
|
|
|
{ GPMODE_CACHING_PAGE, 0x0a, 4, 0, 0xff, 0xff, 0, 0, 0xff, 0xff, 0xff, 0xff },
|
2018-04-25 23:51:13 +02:00
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
2018-10-07 00:35:37 +02:00
|
|
|
{ GPMODE_IOMEGA_PAGE, 0x04, 0x5c, 0x0f, 0x3c, 0x0f }
|
2018-04-25 23:51:13 +02:00
|
|
|
} };
|
2018-01-26 22:17:09 +01:00
|
|
|
|
|
|
|
|
static const mode_sense_pages_t zip_mode_sense_pages_changeable =
|
2018-04-25 23:51:13 +02:00
|
|
|
{ {
|
|
|
|
|
{ 0, 0 },
|
2018-10-07 00:35:37 +02:00
|
|
|
|
|
|
|
|
{ GPMODE_R_W_ERROR_PAGE, 0x0a, 0xFF, 0xFF, 0, 0, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF },
|
|
|
|
|
{ GPMODE_DISCONNECT_PAGE, 0x0e, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
2018-04-25 23:51:13 +02:00
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
2018-10-07 00:35:37 +02:00
|
|
|
{ GPMODE_IOMEGA_PAGE, 0x04, 0xff, 0xff, 0xff, 0xff }
|
2018-04-25 23:51:13 +02:00
|
|
|
} };
|
2018-01-26 22:17:09 +01:00
|
|
|
|
|
|
|
|
static const mode_sense_pages_t zip_250_mode_sense_pages_changeable =
|
2018-04-25 23:51:13 +02:00
|
|
|
{ {
|
|
|
|
|
{ 0, 0 },
|
2018-10-07 00:35:37 +02:00
|
|
|
{ GPMODE_R_W_ERROR_PAGE, 0x06, 0xFF, 0xFF, 0, 0, 0, 0 },
|
2018-04-25 23:51:13 +02:00
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
2018-10-07 00:35:37 +02:00
|
|
|
{GPMODE_FLEXIBLE_DISK_PAGE, 0x1e, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0, 0 },
|
2018-04-25 23:51:13 +02:00
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
2018-10-07 00:35:37 +02:00
|
|
|
{ GPMODE_CACHING_PAGE, 0x0a, 4, 0, 0xff, 0xff, 0, 0, 0xff, 0xff, 0xff, 0xff },
|
2018-04-25 23:51:13 +02:00
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
|
|
|
|
{ 0, 0 },
|
2018-10-07 00:35:37 +02:00
|
|
|
{ GPMODE_IOMEGA_PAGE, 0x04, 0xff, 0xff, 0xff, 0xff }
|
2018-04-25 23:51:13 +02:00
|
|
|
} };
|
2018-01-26 22:17:09 +01:00
|
|
|
|
|
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
static void zip_command_complete(zip_t *dev);
|
|
|
|
|
static void zip_init(zip_t *dev);
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
|
2018-01-26 22:17:09 +01:00
|
|
|
#ifdef ENABLE_ZIP_LOG
|
|
|
|
|
int zip_do_log = ENABLE_ZIP_LOG;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2018-10-19 00:39:32 +02:00
|
|
|
zip_log(const char *fmt, ...)
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
2018-04-25 23:51:13 +02:00
|
|
|
va_list ap;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
if (zip_do_log) {
|
2018-10-19 00:39:32 +02:00
|
|
|
va_start(ap, fmt);
|
|
|
|
|
pclog_ex(fmt, ap);
|
2018-04-25 23:51:13 +02:00
|
|
|
va_end(ap);
|
|
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
2018-10-19 00:39:32 +02:00
|
|
|
#else
|
|
|
|
|
#define zip_log(fmt, ...)
|
|
|
|
|
#endif
|
2018-01-26 22:17:09 +01:00
|
|
|
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
int
|
|
|
|
|
find_zip_for_channel(uint8_t channel)
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
2018-04-25 23:51:13 +02:00
|
|
|
uint8_t i = 0;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
for (i = 0; i < ZIP_NUM; i++) {
|
|
|
|
|
if ((zip_drives[i].bus_type == ZIP_BUS_ATAPI) && (zip_drives[i].ide_channel == channel))
|
|
|
|
|
return i;
|
|
|
|
|
}
|
|
|
|
|
return 0xff;
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-10-30 13:32:25 +01:00
|
|
|
static int
|
|
|
|
|
zip_load_abort(zip_t *dev)
|
|
|
|
|
{
|
|
|
|
|
if (dev->drv->f)
|
|
|
|
|
fclose(dev->drv->f);
|
|
|
|
|
dev->drv->f = NULL;
|
|
|
|
|
dev->drv->medium_size = 0;
|
|
|
|
|
zip_eject(dev->id); /* Make sure the host OS knows we've rejected (and ejected) the image. */
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
int
|
2021-03-14 20:35:01 +01:00
|
|
|
zip_load(zip_t *dev, char *fn)
|
2018-04-25 23:51:13 +02:00
|
|
|
{
|
|
|
|
|
int size = 0;
|
|
|
|
|
|
2021-03-14 20:35:01 +01:00
|
|
|
dev->drv->f = plat_fopen(fn, dev->drv->read_only ? "rb" : "rb+");
|
2018-10-30 13:32:25 +01:00
|
|
|
if (!dev->drv->f) {
|
|
|
|
|
if (!dev->drv->read_only) {
|
2021-03-14 20:35:01 +01:00
|
|
|
dev->drv->f = plat_fopen(fn, "rb");
|
2018-10-30 13:32:25 +01:00
|
|
|
if (dev->drv->f)
|
|
|
|
|
dev->drv->read_only = 1;
|
|
|
|
|
else
|
|
|
|
|
return zip_load_abort(dev);
|
|
|
|
|
} else
|
|
|
|
|
return zip_load_abort(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
}
|
|
|
|
|
|
2018-10-30 13:32:25 +01:00
|
|
|
fseek(dev->drv->f, 0, SEEK_END);
|
|
|
|
|
size = ftell(dev->drv->f);
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-10-30 13:32:25 +01:00
|
|
|
if ((size == ((ZIP_250_SECTORS << 9) + 0x1000)) || (size == ((ZIP_SECTORS << 9) + 0x1000))) {
|
|
|
|
|
/* This is a ZDI image. */
|
|
|
|
|
size -= 0x1000;
|
|
|
|
|
dev->drv->base = 0x1000;
|
|
|
|
|
} else
|
|
|
|
|
dev->drv->base = 0;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-10-30 13:32:25 +01:00
|
|
|
if (dev->drv->is_250) {
|
|
|
|
|
if ((size != (ZIP_250_SECTORS << 9)) && (size != (ZIP_SECTORS << 9))) {
|
|
|
|
|
zip_log("File is incorrect size for a ZIP image\nMust be exactly %i or %i bytes\n",
|
|
|
|
|
ZIP_250_SECTORS << 9, ZIP_SECTORS << 9);
|
|
|
|
|
return zip_load_abort(dev);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (size != (ZIP_SECTORS << 9)) {
|
|
|
|
|
zip_log("File is incorrect size for a ZIP image\nMust be exactly %i bytes\n",
|
|
|
|
|
ZIP_SECTORS << 9);
|
|
|
|
|
return zip_load_abort(dev);
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-10-30 13:32:25 +01:00
|
|
|
dev->drv->medium_size = size >> 9;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2020-01-15 03:48:33 +01:00
|
|
|
if (fseek(dev->drv->f, dev->drv->base, SEEK_SET) == -1)
|
|
|
|
|
fatal("zip_load(): Error seeking to the beginning of the file\n");
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2021-03-14 20:35:01 +01:00
|
|
|
strncpy(dev->drv->image_path, fn, sizeof(dev->drv->image_path) - 1);
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-10-30 13:32:25 +01:00
|
|
|
return 1;
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
|
|
|
|
|
void
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_disk_reload(zip_t *dev)
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
2018-04-25 23:51:13 +02:00
|
|
|
int ret = 0;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2021-03-14 20:35:01 +01:00
|
|
|
if (strlen(dev->drv->prev_image_path) == 0)
|
2018-04-25 23:51:13 +02:00
|
|
|
return;
|
|
|
|
|
else
|
2018-07-15 01:41:53 +02:00
|
|
|
ret = zip_load(dev, dev->drv->prev_image_path);
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
if (ret)
|
|
|
|
|
dev->unit_attention = 1;
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
|
|
|
|
|
void
|
2018-10-27 22:19:39 +02:00
|
|
|
zip_disk_unload(zip_t *dev)
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
2018-07-15 01:41:53 +02:00
|
|
|
if (dev->drv->f) {
|
|
|
|
|
fclose(dev->drv->f);
|
|
|
|
|
dev->drv->f = NULL;
|
2018-10-27 22:19:39 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
zip_disk_close(zip_t *dev)
|
|
|
|
|
{
|
|
|
|
|
if (dev->drv->f) {
|
|
|
|
|
zip_disk_unload(dev);
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
memcpy(dev->drv->prev_image_path, dev->drv->image_path, sizeof(dev->drv->prev_image_path));
|
|
|
|
|
memset(dev->drv->image_path, 0, sizeof(dev->drv->image_path));
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
dev->drv->medium_size = 0;
|
2018-04-25 23:51:13 +02:00
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
|
|
|
|
|
static void
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_set_callback(zip_t *dev)
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
2018-07-15 01:41:53 +02:00
|
|
|
if (dev->drv->bus_type != ZIP_BUS_SCSI)
|
2020-06-19 12:02:17 +02:00
|
|
|
ide_set_callback(ide_drives[dev->drv->ide_channel], dev->callback);
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
static void
|
|
|
|
|
zip_init(zip_t *dev)
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
2018-07-15 01:41:53 +02:00
|
|
|
if (dev->id >= ZIP_NUM)
|
2018-04-25 23:51:13 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
dev->requested_blocks = 1;
|
|
|
|
|
dev->sense[0] = 0xf0;
|
|
|
|
|
dev->sense[7] = 10;
|
2018-07-15 01:41:53 +02:00
|
|
|
dev->drv->bus_mode = 0;
|
|
|
|
|
if (dev->drv->bus_type >= ZIP_BUS_ATAPI)
|
|
|
|
|
dev->drv->bus_mode |= 2;
|
|
|
|
|
if (dev->drv->bus_type < ZIP_BUS_SCSI)
|
|
|
|
|
dev->drv->bus_mode |= 1;
|
|
|
|
|
zip_log("ZIP %i: Bus type %i, bus mode %i\n", dev->id, dev->drv->bus_type, dev->drv->bus_mode);
|
2018-10-30 13:32:25 +01:00
|
|
|
if (dev->drv->bus_type < ZIP_BUS_SCSI) {
|
|
|
|
|
dev->phase = 1;
|
|
|
|
|
dev->request_length = 0xEB14;
|
|
|
|
|
}
|
2018-04-25 23:51:13 +02:00
|
|
|
dev->status = READY_STAT | DSC_STAT;
|
|
|
|
|
dev->pos = 0;
|
2018-10-31 12:23:49 +01:00
|
|
|
dev->packet_status = PHASE_NONE;
|
2018-04-25 23:51:13 +02:00
|
|
|
zip_sense_key = zip_asc = zip_ascq = dev->unit_attention = 0;
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
|
|
|
|
|
static int
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_supports_pio(zip_t *dev)
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
2018-07-15 01:41:53 +02:00
|
|
|
return (dev->drv->bus_mode & 1);
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
|
|
|
|
|
static int
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_supports_dma(zip_t *dev)
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
2018-07-15 01:41:53 +02:00
|
|
|
return (dev->drv->bus_mode & 2);
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
|
2018-01-26 22:17:09 +01:00
|
|
|
/* Returns: 0 for none, 1 for PIO, 2 for DMA. */
|
2018-04-25 23:51:13 +02:00
|
|
|
static int
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_current_mode(zip_t *dev)
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
2018-07-15 01:41:53 +02:00
|
|
|
if (!zip_supports_pio(dev) && !zip_supports_dma(dev))
|
2018-01-26 22:17:09 +01:00
|
|
|
return 0;
|
2018-07-15 01:41:53 +02:00
|
|
|
if (zip_supports_pio(dev) && !zip_supports_dma(dev)) {
|
|
|
|
|
zip_log("ZIP %i: Drive does not support DMA, setting to PIO\n", dev->id);
|
2018-04-25 23:51:13 +02:00
|
|
|
return 1;
|
|
|
|
|
}
|
2018-07-15 01:41:53 +02:00
|
|
|
if (!zip_supports_pio(dev) && zip_supports_dma(dev))
|
2018-04-25 23:51:13 +02:00
|
|
|
return 2;
|
2018-07-15 01:41:53 +02:00
|
|
|
if (zip_supports_pio(dev) && zip_supports_dma(dev)) {
|
|
|
|
|
zip_log("ZIP %i: Drive supports both, setting to %s\n", dev->id, (dev->features & 1) ? "DMA" : "PIO");
|
2018-04-25 23:51:13 +02:00
|
|
|
return (dev->features & 1) ? 2 : 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
|
2018-01-26 22:17:09 +01:00
|
|
|
/* Translates ATAPI phase (DRQ, I/O, C/D) to SCSI phase (MSG, C/D, I/O). */
|
2018-04-25 23:51:13 +02:00
|
|
|
int
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_atapi_phase_to_scsi(zip_t *dev)
|
2018-04-25 23:51:13 +02:00
|
|
|
{
|
|
|
|
|
if (dev->status & 8) {
|
|
|
|
|
switch (dev->phase & 3) {
|
|
|
|
|
case 0:
|
|
|
|
|
return 0;
|
|
|
|
|
case 1:
|
|
|
|
|
return 2;
|
|
|
|
|
case 2:
|
|
|
|
|
return 1;
|
|
|
|
|
case 3:
|
|
|
|
|
return 7;
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
2018-04-25 23:51:13 +02:00
|
|
|
} else {
|
|
|
|
|
if ((dev->phase & 3) == 3)
|
|
|
|
|
return 3;
|
|
|
|
|
else
|
|
|
|
|
return 4;
|
|
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
return 0;
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
static void
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_mode_sense_load(zip_t *dev)
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
2018-04-25 23:51:13 +02:00
|
|
|
FILE *f;
|
2021-03-14 20:35:01 +01:00
|
|
|
char file_name[512];
|
2018-04-25 23:51:13 +02:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
memset(&dev->ms_pages_saved, 0, sizeof(mode_sense_pages_t));
|
2018-10-27 22:19:39 +02:00
|
|
|
if (dev->drv->is_250) {
|
|
|
|
|
if (zip_drives[dev->id].bus_type == ZIP_BUS_SCSI)
|
|
|
|
|
memcpy(&dev->ms_pages_saved, &zip_250_mode_sense_pages_default_scsi, sizeof(mode_sense_pages_t));
|
|
|
|
|
else
|
|
|
|
|
memcpy(&dev->ms_pages_saved, &zip_250_mode_sense_pages_default, sizeof(mode_sense_pages_t));
|
|
|
|
|
} else {
|
|
|
|
|
if (zip_drives[dev->id].bus_type == ZIP_BUS_SCSI)
|
|
|
|
|
memcpy(&dev->ms_pages_saved, &zip_mode_sense_pages_default_scsi, sizeof(mode_sense_pages_t));
|
|
|
|
|
else
|
|
|
|
|
memcpy(&dev->ms_pages_saved, &zip_mode_sense_pages_default, sizeof(mode_sense_pages_t));
|
2018-04-25 23:51:13 +02:00
|
|
|
}
|
2018-10-27 22:19:39 +02:00
|
|
|
|
2021-03-14 20:35:01 +01:00
|
|
|
memset(file_name, 0, 512);
|
2018-07-15 01:41:53 +02:00
|
|
|
if (dev->drv->bus_type == ZIP_BUS_SCSI)
|
2021-03-14 20:35:01 +01:00
|
|
|
sprintf(file_name, "scsi_zip_%02i_mode_sense_bin", dev->id);
|
2018-04-25 23:51:13 +02:00
|
|
|
else
|
2021-03-14 20:35:01 +01:00
|
|
|
sprintf(file_name, "zip_%02i_mode_sense_bin", dev->id);
|
|
|
|
|
f = plat_fopen(nvr_path(file_name), "rb");
|
2018-10-27 03:43:25 +02:00
|
|
|
if (f) {
|
|
|
|
|
/* Nothing to read, not used by ZIP. */
|
2018-04-25 23:51:13 +02:00
|
|
|
fclose(f);
|
2018-10-27 03:43:25 +02:00
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
|
|
|
|
|
static void
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_mode_sense_save(zip_t *dev)
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
2018-04-25 23:51:13 +02:00
|
|
|
FILE *f;
|
2021-03-14 20:35:01 +01:00
|
|
|
char file_name[512];
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2021-03-14 20:35:01 +01:00
|
|
|
memset(file_name, 0, 512);
|
2018-07-15 01:41:53 +02:00
|
|
|
if (dev->drv->bus_type == ZIP_BUS_SCSI)
|
2021-03-14 20:35:01 +01:00
|
|
|
sprintf(file_name, "scsi_zip_%02i_mode_sense_bin", dev->id);
|
2018-04-25 23:51:13 +02:00
|
|
|
else
|
2021-03-14 20:35:01 +01:00
|
|
|
sprintf(file_name, "zip_%02i_mode_sense_bin", dev->id);
|
|
|
|
|
f = plat_fopen(nvr_path(file_name), "wb");
|
2018-10-27 03:43:25 +02:00
|
|
|
if (f) {
|
|
|
|
|
/* Nothing to write, not used by ZIP. */
|
2018-04-25 23:51:13 +02:00
|
|
|
fclose(f);
|
2018-10-27 03:43:25 +02:00
|
|
|
}
|
2018-04-25 23:51:13 +02:00
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/*SCSI Mode Sense 6/10*/
|
2018-04-25 23:51:13 +02:00
|
|
|
static uint8_t
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_mode_sense_read(zip_t *dev, uint8_t page_control, uint8_t page, uint8_t pos)
|
2018-04-25 23:51:13 +02:00
|
|
|
{
|
|
|
|
|
switch (page_control) {
|
|
|
|
|
case 0:
|
|
|
|
|
case 3:
|
2018-07-15 01:41:53 +02:00
|
|
|
if (dev->drv->is_250 && (page == 5) && (pos == 9) && (dev->drv->medium_size == ZIP_SECTORS))
|
2018-04-25 23:51:13 +02:00
|
|
|
return 0x60;
|
2018-07-15 01:41:53 +02:00
|
|
|
return dev->ms_pages_saved.pages[page][pos];
|
2018-04-25 23:51:13 +02:00
|
|
|
break;
|
|
|
|
|
case 1:
|
2018-07-15 01:41:53 +02:00
|
|
|
if (dev->drv->is_250)
|
2018-04-25 23:51:13 +02:00
|
|
|
return zip_250_mode_sense_pages_changeable.pages[page][pos];
|
|
|
|
|
else
|
|
|
|
|
return zip_mode_sense_pages_changeable.pages[page][pos];
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
2018-07-15 01:41:53 +02:00
|
|
|
if (dev->drv->is_250) {
|
|
|
|
|
if ((page == 5) && (pos == 9) && (dev->drv->medium_size == ZIP_SECTORS))
|
2018-01-26 22:17:09 +01:00
|
|
|
return 0x60;
|
2018-07-15 01:41:53 +02:00
|
|
|
if (dev->drv->bus_type == ZIP_BUS_SCSI)
|
2018-04-25 23:51:13 +02:00
|
|
|
return zip_250_mode_sense_pages_default_scsi.pages[page][pos];
|
2018-01-26 22:17:09 +01:00
|
|
|
else
|
2018-04-25 23:51:13 +02:00
|
|
|
return zip_250_mode_sense_pages_default.pages[page][pos];
|
|
|
|
|
} else {
|
2018-07-15 01:41:53 +02:00
|
|
|
if (dev->drv->bus_type == ZIP_BUS_SCSI)
|
2018-04-25 23:51:13 +02:00
|
|
|
return zip_mode_sense_pages_default_scsi.pages[page][pos];
|
|
|
|
|
else
|
|
|
|
|
return zip_mode_sense_pages_default.pages[page][pos];
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
return 0;
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
|
|
|
|
|
static uint32_t
|
2018-10-10 22:33:24 +02:00
|
|
|
zip_mode_sense(zip_t *dev, uint8_t *buf, uint32_t pos, uint8_t page, uint8_t block_descriptor_len)
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
2018-09-12 19:46:26 +02:00
|
|
|
uint64_t pf;
|
2018-10-10 22:33:24 +02:00
|
|
|
uint8_t page_control = (page >> 6) & 3;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
if (dev->drv->is_250)
|
2018-09-12 19:46:26 +02:00
|
|
|
pf = zip_250_mode_sense_page_flags;
|
2018-04-25 23:51:13 +02:00
|
|
|
else
|
2018-09-12 19:46:26 +02:00
|
|
|
pf = zip_mode_sense_page_flags;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
int i = 0;
|
|
|
|
|
int j = 0;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
uint8_t msplen;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-10-10 22:33:24 +02:00
|
|
|
page &= 0x3f;
|
2018-04-25 23:51:13 +02:00
|
|
|
|
|
|
|
|
if (block_descriptor_len) {
|
2018-10-27 03:43:25 +02:00
|
|
|
buf[pos++] = ((dev->drv->medium_size >> 24) & 0xff);
|
|
|
|
|
buf[pos++] = ((dev->drv->medium_size >> 16) & 0xff);
|
|
|
|
|
buf[pos++] = ((dev->drv->medium_size >> 8) & 0xff);
|
|
|
|
|
buf[pos++] = ( dev->drv->medium_size & 0xff);
|
2018-04-25 23:51:13 +02:00
|
|
|
buf[pos++] = 0; /* Reserved. */
|
|
|
|
|
buf[pos++] = 0; /* Block length (0x200 = 512 bytes). */
|
|
|
|
|
buf[pos++] = 2;
|
|
|
|
|
buf[pos++] = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 0x40; i++) {
|
2018-10-10 22:33:24 +02:00
|
|
|
if ((page == GPMODE_ALL_PAGES) || (page == i)) {
|
|
|
|
|
if (pf & (1LL << ((uint64_t) page))) {
|
2018-07-15 01:41:53 +02:00
|
|
|
buf[pos++] = zip_mode_sense_read(dev, page_control, i, 0);
|
|
|
|
|
msplen = zip_mode_sense_read(dev, page_control, i, 1);
|
2018-04-25 23:51:13 +02:00
|
|
|
buf[pos++] = msplen;
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_log("ZIP %i: MODE SENSE: Page [%02X] length %i\n", dev->id, i, msplen);
|
2018-04-25 23:51:13 +02:00
|
|
|
for (j = 0; j < msplen; j++)
|
2018-07-15 01:41:53 +02:00
|
|
|
buf[pos++] = zip_mode_sense_read(dev, page_control, i, 2 + j);
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
}
|
2018-04-25 23:51:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return pos;
|
|
|
|
|
}
|
|
|
|
|
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
static void
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_update_request_length(zip_t *dev, int len, int block_len)
|
2018-04-25 23:51:13 +02:00
|
|
|
{
|
2018-09-12 19:46:26 +02:00
|
|
|
int bt, min_len = 0;
|
2018-04-25 23:51:13 +02:00
|
|
|
|
|
|
|
|
dev->max_transfer_len = dev->request_length;
|
|
|
|
|
|
|
|
|
|
/* For media access commands, make sure the requested DRQ length matches the block length. */
|
|
|
|
|
switch (dev->current_cdb[0]) {
|
|
|
|
|
case 0x08:
|
2020-03-22 23:12:02 +01:00
|
|
|
case 0x0a:
|
2018-04-25 23:51:13 +02:00
|
|
|
case 0x28:
|
2020-03-22 23:12:02 +01:00
|
|
|
case 0x2a:
|
2018-04-25 23:51:13 +02:00
|
|
|
case 0xa8:
|
2020-03-22 23:12:02 +01:00
|
|
|
case 0xaa:
|
|
|
|
|
/* Round it to the nearest 2048 bytes. */
|
|
|
|
|
dev->max_transfer_len = (dev->max_transfer_len >> 9) << 9;
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
/* Make sure total length is not bigger than sum of the lengths of
|
|
|
|
|
all the requested blocks. */
|
|
|
|
|
bt = (dev->requested_blocks * block_len);
|
|
|
|
|
if (len > bt)
|
|
|
|
|
len = bt;
|
|
|
|
|
|
|
|
|
|
min_len = block_len;
|
|
|
|
|
|
|
|
|
|
if (len <= block_len) {
|
|
|
|
|
/* Total length is less or equal to block length. */
|
|
|
|
|
if (dev->max_transfer_len < block_len) {
|
|
|
|
|
/* Transfer a minimum of (block size) bytes. */
|
|
|
|
|
dev->max_transfer_len = block_len;
|
|
|
|
|
dev->packet_len = block_len;
|
|
|
|
|
break;
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
}
|
2018-10-26 05:07:03 +02:00
|
|
|
/*FALLTHROUGH*/
|
2018-04-25 23:51:13 +02:00
|
|
|
default:
|
|
|
|
|
dev->packet_len = len;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
/* If the DRQ length is odd, and the total remaining length is bigger, make sure it's even. */
|
|
|
|
|
if ((dev->max_transfer_len & 1) && (dev->max_transfer_len < len))
|
|
|
|
|
dev->max_transfer_len &= 0xfffe;
|
|
|
|
|
/* If the DRQ length is smaller or equal in size to the total remaining length, set it to that. */
|
|
|
|
|
if (!dev->max_transfer_len)
|
|
|
|
|
dev->max_transfer_len = 65534;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
if ((len <= dev->max_transfer_len) && (len >= min_len))
|
|
|
|
|
dev->request_length = dev->max_transfer_len = len;
|
2018-07-15 01:41:53 +02:00
|
|
|
else if (len > dev->max_transfer_len)
|
|
|
|
|
dev->request_length = dev->max_transfer_len;
|
2018-04-25 23:51:13 +02:00
|
|
|
|
|
|
|
|
return;
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
|
2019-11-19 04:35:54 +01:00
|
|
|
static double
|
|
|
|
|
zip_bus_speed(zip_t *dev)
|
|
|
|
|
{
|
|
|
|
|
double ret = -1.0;
|
|
|
|
|
|
2020-01-14 20:08:23 +01:00
|
|
|
if (dev && dev->drv && (dev->drv->bus_type == ZIP_BUS_SCSI)) {
|
2019-11-19 04:35:54 +01:00
|
|
|
dev->callback = -1.0; /* Speed depends on SCSI controller */
|
|
|
|
|
return 0.0;
|
|
|
|
|
} else {
|
|
|
|
|
if (dev && dev->drv)
|
|
|
|
|
ret = ide_atapi_get_period(dev->drv->ide_channel);
|
|
|
|
|
if (ret == -1.0) {
|
2020-01-15 02:18:28 +01:00
|
|
|
if (dev)
|
|
|
|
|
dev->callback = -1.0;
|
2019-11-19 04:35:54 +01:00
|
|
|
return 0.0;
|
|
|
|
|
} else
|
|
|
|
|
return ret * 1000000.0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
static void
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_command_common(zip_t *dev)
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
2018-04-25 23:51:13 +02:00
|
|
|
double bytes_per_second, period;
|
2018-03-07 20:06:08 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
dev->status = BUSY_STAT;
|
|
|
|
|
dev->phase = 1;
|
|
|
|
|
dev->pos = 0;
|
2018-10-31 12:23:49 +01:00
|
|
|
if (dev->packet_status == PHASE_COMPLETE)
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
dev->callback = 0.0;
|
2018-10-31 12:23:49 +01:00
|
|
|
else {
|
2018-07-15 01:41:53 +02:00
|
|
|
if (dev->drv->bus_type == ZIP_BUS_SCSI) {
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
dev->callback = -1.0; /* Speed depends on SCSI controller */
|
2018-04-25 23:51:13 +02:00
|
|
|
return;
|
2019-11-19 04:35:54 +01:00
|
|
|
} else
|
|
|
|
|
bytes_per_second = zip_bus_speed(dev);
|
2018-03-07 20:06:08 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
period = 1000000.0 / bytes_per_second;
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
dev->callback = period * (double) (dev->packet_len);
|
2018-04-25 23:51:13 +02:00
|
|
|
}
|
|
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_set_callback(dev);
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
|
|
|
|
|
static void
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_command_complete(zip_t *dev)
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
2019-09-21 19:15:38 +02:00
|
|
|
ui_sb_update_icon(SB_ZIP | dev->id, 0);
|
2018-10-10 22:33:24 +02:00
|
|
|
dev->packet_status = PHASE_COMPLETE;
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_command_common(dev);
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
|
|
|
|
|
static void
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_command_read(zip_t *dev)
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
2018-10-10 22:33:24 +02:00
|
|
|
dev->packet_status = PHASE_DATA_IN;
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_command_common(dev);
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
|
|
|
|
|
static void
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_command_read_dma(zip_t *dev)
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
2018-10-10 22:33:24 +02:00
|
|
|
dev->packet_status = PHASE_DATA_IN_DMA;
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_command_common(dev);
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
static void
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_command_write(zip_t *dev)
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
2018-10-10 22:33:24 +02:00
|
|
|
dev->packet_status = PHASE_DATA_OUT;
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_command_common(dev);
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
|
|
|
|
|
static void
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_command_write_dma(zip_t *dev)
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
2018-10-10 22:33:24 +02:00
|
|
|
dev->packet_status = PHASE_DATA_OUT_DMA;
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_command_common(dev);
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
|
2018-01-26 22:17:09 +01:00
|
|
|
/* id = Current ZIP device ID;
|
|
|
|
|
len = Total transfer length;
|
|
|
|
|
block_len = Length of a single block (why does it matter?!);
|
|
|
|
|
alloc_len = Allocated transfer length;
|
|
|
|
|
direction = Transfer direction (0 = read from host, 1 = write to host). */
|
2018-04-25 23:51:13 +02:00
|
|
|
static void
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_data_command_finish(zip_t *dev, int len, int block_len, int alloc_len, int direction)
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_log("ZIP %i: Finishing command (%02X): %i, %i, %i, %i, %i\n",
|
|
|
|
|
dev->id, dev->current_cdb[0], len, block_len, alloc_len, direction, dev->request_length);
|
|
|
|
|
dev->pos = 0;
|
2018-04-25 23:51:13 +02:00
|
|
|
if (alloc_len >= 0) {
|
|
|
|
|
if (alloc_len < len)
|
|
|
|
|
len = alloc_len;
|
|
|
|
|
}
|
2018-07-15 01:41:53 +02:00
|
|
|
if ((len == 0) || (zip_current_mode(dev) == 0)) {
|
|
|
|
|
if (dev->drv->bus_type != ZIP_BUS_SCSI)
|
2018-04-25 23:51:13 +02:00
|
|
|
dev->packet_len = 0;
|
|
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_command_complete(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
} else {
|
2018-07-15 01:41:53 +02:00
|
|
|
if (zip_current_mode(dev) == 2) {
|
|
|
|
|
if (dev->drv->bus_type != ZIP_BUS_SCSI)
|
2018-04-25 23:51:13 +02:00
|
|
|
dev->packet_len = alloc_len;
|
|
|
|
|
|
|
|
|
|
if (direction == 0)
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_command_read_dma(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
else
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_command_write_dma(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
} else {
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_update_request_length(dev, len, block_len);
|
2018-04-25 23:51:13 +02:00
|
|
|
if (direction == 0)
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_command_read(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
else
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_command_write(dev);
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
2018-04-25 23:51:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
zip_log("ZIP %i: Status: %i, cylinder %i, packet length: %i, position: %i, phase: %i\n",
|
2018-07-15 01:41:53 +02:00
|
|
|
dev->id, dev->packet_status, dev->request_length, dev->packet_len, dev->pos, dev->phase);
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
|
|
|
|
|
static void
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_sense_clear(zip_t *dev, int command)
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
2018-04-25 23:51:13 +02:00
|
|
|
zip_sense_key = zip_asc = zip_ascq = 0;
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
|
|
|
|
|
static void
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_set_phase(zip_t *dev, uint8_t phase)
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
2021-07-22 20:13:44 +02:00
|
|
|
uint8_t scsi_bus = (dev->drv->scsi_device_id >> 4) & 0x0f;
|
|
|
|
|
uint8_t scsi_id = dev->drv->scsi_device_id & 0x0f;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
if (dev->drv->bus_type != ZIP_BUS_SCSI)
|
2018-04-25 23:51:13 +02:00
|
|
|
return;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2021-07-22 20:13:44 +02:00
|
|
|
scsi_devices[scsi_bus][scsi_id].phase = phase;
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
static void
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_cmd_error(zip_t *dev)
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_set_phase(dev, SCSI_PHASE_STATUS);
|
2018-04-25 23:51:13 +02:00
|
|
|
dev->error = ((zip_sense_key & 0xf) << 4) | ABRT_ERR;
|
|
|
|
|
if (dev->unit_attention)
|
|
|
|
|
dev->error |= MCR_ERR;
|
|
|
|
|
dev->status = READY_STAT | ERR_STAT;
|
|
|
|
|
dev->phase = 3;
|
|
|
|
|
dev->pos = 0;
|
2018-10-31 12:23:49 +01:00
|
|
|
dev->packet_status = PHASE_ERROR;
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
dev->callback = 50.0 * ZIP_TIME;
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_set_callback(dev);
|
2019-09-21 19:15:38 +02:00
|
|
|
ui_sb_update_icon(SB_ZIP | dev->id, 0);
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_log("ZIP %i: [%02X] ERROR: %02X/%02X/%02X\n", dev->id, dev->current_cdb[0], zip_sense_key, zip_asc, zip_ascq);
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
|
|
|
|
|
static void
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_unit_attention(zip_t *dev)
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_set_phase(dev, SCSI_PHASE_STATUS);
|
2018-04-25 23:51:13 +02:00
|
|
|
dev->error = (SENSE_UNIT_ATTENTION << 4) | ABRT_ERR;
|
|
|
|
|
if (dev->unit_attention)
|
|
|
|
|
dev->error |= MCR_ERR;
|
|
|
|
|
dev->status = READY_STAT | ERR_STAT;
|
|
|
|
|
dev->phase = 3;
|
|
|
|
|
dev->pos = 0;
|
2018-10-31 12:23:49 +01:00
|
|
|
dev->packet_status = PHASE_ERROR;
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
dev->callback = 50.0 * ZIP_TIME;
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_set_callback(dev);
|
2019-09-21 19:15:38 +02:00
|
|
|
ui_sb_update_icon(SB_ZIP | dev->id, 0);
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_log("ZIP %i: UNIT ATTENTION\n", dev->id);
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
|
|
|
|
|
static void
|
2018-10-31 12:23:49 +01:00
|
|
|
zip_buf_alloc(zip_t *dev, uint32_t len)
|
|
|
|
|
{
|
|
|
|
|
zip_log("ZIP %i: Allocated buffer length: %i\n", dev->id, len);
|
|
|
|
|
if (!dev->buffer)
|
|
|
|
|
dev->buffer = (uint8_t *) malloc(len);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
zip_buf_free(zip_t *dev)
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
2018-10-31 12:23:49 +01:00
|
|
|
if (dev->buffer) {
|
|
|
|
|
zip_log("ZIP %i: Freeing buffer...\n", dev->id);
|
|
|
|
|
free(dev->buffer);
|
|
|
|
|
dev->buffer = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
zip_bus_master_error(scsi_common_t *sc)
|
|
|
|
|
{
|
|
|
|
|
zip_t *dev = (zip_t *) sc;
|
|
|
|
|
|
|
|
|
|
zip_buf_free(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
zip_sense_key = zip_asc = zip_ascq = 0;
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_cmd_error(dev);
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
|
|
|
|
|
static void
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_not_ready(zip_t *dev)
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
2018-04-25 23:51:13 +02:00
|
|
|
zip_sense_key = SENSE_NOT_READY;
|
|
|
|
|
zip_asc = ASC_MEDIUM_NOT_PRESENT;
|
|
|
|
|
zip_ascq = 0;
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_cmd_error(dev);
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
|
|
|
|
|
static void
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_write_protected(zip_t *dev)
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
2018-04-25 23:51:13 +02:00
|
|
|
zip_sense_key = SENSE_UNIT_ATTENTION;
|
|
|
|
|
zip_asc = ASC_WRITE_PROTECTED;
|
|
|
|
|
zip_ascq = 0;
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_cmd_error(dev);
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
|
|
|
|
|
static void
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_invalid_lun(zip_t *dev)
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
2018-04-25 23:51:13 +02:00
|
|
|
zip_sense_key = SENSE_ILLEGAL_REQUEST;
|
|
|
|
|
zip_asc = ASC_INV_LUN;
|
|
|
|
|
zip_ascq = 0;
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_cmd_error(dev);
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
|
|
|
|
|
static void
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_illegal_opcode(zip_t *dev)
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
2018-04-25 23:51:13 +02:00
|
|
|
zip_sense_key = SENSE_ILLEGAL_REQUEST;
|
|
|
|
|
zip_asc = ASC_ILLEGAL_OPCODE;
|
|
|
|
|
zip_ascq = 0;
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_cmd_error(dev);
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
|
|
|
|
|
static void
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_lba_out_of_range(zip_t *dev)
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
2018-04-25 23:51:13 +02:00
|
|
|
zip_sense_key = SENSE_ILLEGAL_REQUEST;
|
|
|
|
|
zip_asc = ASC_LBA_OUT_OF_RANGE;
|
|
|
|
|
zip_ascq = 0;
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_cmd_error(dev);
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
static void
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_invalid_field(zip_t *dev)
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
2018-04-25 23:51:13 +02:00
|
|
|
zip_sense_key = SENSE_ILLEGAL_REQUEST;
|
|
|
|
|
zip_asc = ASC_INV_FIELD_IN_CMD_PACKET;
|
|
|
|
|
zip_ascq = 0;
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_cmd_error(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
dev->status = 0x53;
|
|
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
static void
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_invalid_field_pl(zip_t *dev)
|
2018-04-25 23:51:13 +02:00
|
|
|
{
|
|
|
|
|
zip_sense_key = SENSE_ILLEGAL_REQUEST;
|
|
|
|
|
zip_asc = ASC_INV_FIELD_IN_PARAMETER_LIST;
|
|
|
|
|
zip_ascq = 0;
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_cmd_error(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
dev->status = 0x53;
|
|
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-03-20 19:45:45 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
static void
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_data_phase_error(zip_t *dev)
|
2018-04-25 23:51:13 +02:00
|
|
|
{
|
|
|
|
|
zip_sense_key = SENSE_ILLEGAL_REQUEST;
|
|
|
|
|
zip_asc = ASC_DATA_PHASE_ERROR;
|
|
|
|
|
zip_ascq = 0;
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_cmd_error(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
}
|
|
|
|
|
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
static int
|
2018-09-12 19:46:26 +02:00
|
|
|
zip_blocks(zip_t *dev, int32_t *len, int first_batch, int out)
|
2018-04-25 23:51:13 +02:00
|
|
|
{
|
|
|
|
|
*len = 0;
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
int i;
|
2018-04-25 23:51:13 +02:00
|
|
|
|
|
|
|
|
if (!dev->sector_len) {
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_command_complete(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
zip_log("%sing %i blocks starting from %i...\n", out ? "Writ" : "Read", dev->requested_blocks, dev->sector_pos);
|
|
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
if (dev->sector_pos >= dev->drv->medium_size) {
|
|
|
|
|
zip_log("ZIP %i: Trying to %s beyond the end of disk\n", dev->id, out ? "write" : "read");
|
|
|
|
|
zip_lba_out_of_range(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*len = dev->requested_blocks << 9;
|
|
|
|
|
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
for (i = 0; i < dev->requested_blocks; i++) {
|
2020-01-14 21:05:15 +01:00
|
|
|
if (fseek(dev->drv->f, dev->drv->base + (dev->sector_pos << 9) + (i << 9), SEEK_SET) == 1)
|
|
|
|
|
break;
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
|
|
|
|
|
if (feof(dev->drv->f))
|
|
|
|
|
break;
|
|
|
|
|
|
2020-01-15 03:48:33 +01:00
|
|
|
if (out) {
|
|
|
|
|
if (fwrite(dev->buffer + (i << 9), 1, 512, dev->drv->f) != 512)
|
|
|
|
|
fatal("zip_blocks(): Error writing data\n");
|
|
|
|
|
} else {
|
|
|
|
|
if (fread(dev->buffer + (i << 9), 1, 512, dev->drv->f) != 512)
|
|
|
|
|
fatal("zip_blocks(): Error reading data\n");
|
|
|
|
|
}
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
}
|
2018-04-25 23:51:13 +02:00
|
|
|
|
|
|
|
|
zip_log("%s %i bytes of blocks...\n", out ? "Written" : "Read", *len);
|
|
|
|
|
|
|
|
|
|
dev->sector_pos += dev->requested_blocks;
|
|
|
|
|
dev->sector_len -= dev->requested_blocks;
|
|
|
|
|
|
|
|
|
|
return 1;
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
|
|
|
|
|
void
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_insert(zip_t *dev)
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
2018-04-25 23:51:13 +02:00
|
|
|
dev->unit_attention = 1;
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
|
2018-01-26 22:17:09 +01:00
|
|
|
/*SCSI Sense Initialization*/
|
2018-04-25 23:51:13 +02:00
|
|
|
void
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_sense_code_ok(zip_t *dev)
|
2022-02-20 02:26:27 -05:00
|
|
|
{
|
2018-04-25 23:51:13 +02:00
|
|
|
zip_sense_key = SENSE_NONE;
|
|
|
|
|
zip_asc = 0;
|
|
|
|
|
zip_ascq = 0;
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
static int
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_pre_execution_check(zip_t *dev, uint8_t *cdb)
|
2018-04-25 23:51:13 +02:00
|
|
|
{
|
|
|
|
|
int ready = 0;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
if (dev->drv->bus_type == ZIP_BUS_SCSI) {
|
2021-03-23 06:32:18 +01:00
|
|
|
if ((cdb[0] != GPCMD_REQUEST_SENSE) && (dev->cur_lun == SCSI_LUN_USE_CDB) && (cdb[1] & 0xe0)) {
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_log("ZIP %i: Attempting to execute a unknown command targeted at SCSI LUN %i\n", dev->id, ((dev->request_length >> 5) & 7));
|
|
|
|
|
zip_invalid_lun(dev);
|
2018-01-26 22:17:09 +01:00
|
|
|
return 0;
|
|
|
|
|
}
|
2018-04-25 23:51:13 +02:00
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
if (!(zip_command_flags[cdb[0]] & IMPLEMENTED)) {
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_log("ZIP %i: Attempting to execute unknown command %02X over %s\n", dev->id, cdb[0],
|
|
|
|
|
(dev->drv->bus_type == ZIP_BUS_SCSI) ? "SCSI" : "ATAPI");
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_illegal_opcode(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
if ((dev->drv->bus_type < ZIP_BUS_SCSI) && (zip_command_flags[cdb[0]] & SCSI_ONLY)) {
|
|
|
|
|
zip_log("ZIP %i: Attempting to execute SCSI-only command %02X over ATAPI\n", dev->id, cdb[0]);
|
|
|
|
|
zip_illegal_opcode(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
return 0;
|
|
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
if ((dev->drv->bus_type == ZIP_BUS_SCSI) && (zip_command_flags[cdb[0]] & ATAPI_ONLY)) {
|
|
|
|
|
zip_log("ZIP %i: Attempting to execute ATAPI-only command %02X over SCSI\n", dev->id, cdb[0]);
|
|
|
|
|
zip_illegal_opcode(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
return 0;
|
|
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
ready = (dev->drv->f != NULL);
|
2018-04-25 23:51:13 +02:00
|
|
|
|
|
|
|
|
/* If the drive is not ready, there is no reason to keep the
|
|
|
|
|
UNIT ATTENTION condition present, as we only use it to mark
|
|
|
|
|
disc changes. */
|
|
|
|
|
if (!ready && dev->unit_attention)
|
|
|
|
|
dev->unit_attention = 0;
|
|
|
|
|
|
|
|
|
|
/* If the UNIT ATTENTION condition is set and the command does not allow
|
|
|
|
|
execution under it, error out and report the condition. */
|
|
|
|
|
if (dev->unit_attention == 1) {
|
|
|
|
|
/* Only increment the unit attention phase if the command can not pass through it. */
|
|
|
|
|
if (!(zip_command_flags[cdb[0]] & ALLOW_UA)) {
|
2018-07-15 01:41:53 +02:00
|
|
|
/* zip_log("ZIP %i: Unit attention now 2\n", dev->id); */
|
2018-04-25 23:51:13 +02:00
|
|
|
dev->unit_attention = 2;
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_log("ZIP %i: UNIT ATTENTION: Command %02X not allowed to pass through\n", dev->id, cdb[0]);
|
|
|
|
|
zip_unit_attention(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
return 0;
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
2018-04-25 23:51:13 +02:00
|
|
|
} else if (dev->unit_attention == 2) {
|
|
|
|
|
if (cdb[0] != GPCMD_REQUEST_SENSE) {
|
2018-07-15 01:41:53 +02:00
|
|
|
/* zip_log("ZIP %i: Unit attention now 0\n", dev->id); */
|
2018-04-25 23:51:13 +02:00
|
|
|
dev->unit_attention = 0;
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
2018-04-25 23:51:13 +02:00
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
/* Unless the command is REQUEST SENSE, clear the sense. This will *NOT*
|
|
|
|
|
the UNIT ATTENTION condition if it's set. */
|
|
|
|
|
if (cdb[0] != GPCMD_REQUEST_SENSE)
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_sense_clear(dev, cdb[0]);
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
/* Next it's time for NOT READY. */
|
|
|
|
|
if ((zip_command_flags[cdb[0]] & CHECK_READY) && !ready) {
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_log("ZIP %i: Not ready (%02X)\n", dev->id, cdb[0]);
|
|
|
|
|
zip_not_ready(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
return 0;
|
|
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_log("ZIP %i: Continuing with command %02X\n", dev->id, cdb[0]);
|
2018-04-25 23:51:13 +02:00
|
|
|
|
|
|
|
|
return 1;
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
|
|
|
|
|
static void
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_seek(zip_t *dev, uint32_t pos)
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
2018-07-15 01:41:53 +02:00
|
|
|
/* zip_log("ZIP %i: Seek %08X\n", dev->id, pos); */
|
2018-04-25 23:51:13 +02:00
|
|
|
dev->sector_pos = pos;
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
static void
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_rezero(zip_t *dev)
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
2018-04-25 23:51:13 +02:00
|
|
|
dev->sector_pos = dev->sector_len = 0;
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_seek(dev, 0);
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
|
|
|
|
|
void
|
2018-10-30 13:32:25 +01:00
|
|
|
zip_reset(scsi_common_t *sc)
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
2018-10-30 13:32:25 +01:00
|
|
|
zip_t *dev = (zip_t *) sc;
|
2018-10-10 22:33:24 +02:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_rezero(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
dev->status = 0;
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
dev->callback = 0.0;
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_set_callback(dev);
|
2018-10-30 13:32:25 +01:00
|
|
|
dev->phase = 1;
|
|
|
|
|
dev->request_length = 0xEB14;
|
2018-10-31 12:23:49 +01:00
|
|
|
dev->packet_status = PHASE_NONE;
|
2018-04-25 23:51:13 +02:00
|
|
|
dev->unit_attention = 0;
|
2021-03-23 06:32:18 +01:00
|
|
|
dev->cur_lun = SCSI_LUN_USE_CDB;
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
|
|
|
|
|
static void
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_request_sense(zip_t *dev, uint8_t *buffer, uint8_t alloc_length, int desc)
|
2022-02-20 02:26:27 -05:00
|
|
|
{
|
2018-04-25 23:51:13 +02:00
|
|
|
/*Will return 18 bytes of 0*/
|
|
|
|
|
if (alloc_length != 0) {
|
|
|
|
|
memset(buffer, 0, alloc_length);
|
|
|
|
|
if (!desc)
|
|
|
|
|
memcpy(buffer, dev->sense, alloc_length);
|
|
|
|
|
else {
|
|
|
|
|
buffer[1] = zip_sense_key;
|
|
|
|
|
buffer[2] = zip_asc;
|
|
|
|
|
buffer[3] = zip_ascq;
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
2018-04-25 23:51:13 +02:00
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
buffer[0] = desc ? 0x72 : 0x70;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
if (dev->unit_attention && (zip_sense_key == 0)) {
|
2018-07-15 01:41:53 +02:00
|
|
|
buffer[desc ? 1 : 2] = SENSE_UNIT_ATTENTION;
|
|
|
|
|
buffer[desc ? 2 : 12] = ASC_MEDIUM_MAY_HAVE_CHANGED;
|
|
|
|
|
buffer[desc ? 3 : 13] = 0;
|
2018-04-25 23:51:13 +02:00
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_log("ZIP %i: Reporting sense: %02X %02X %02X\n", dev->id, buffer[2], buffer[12], buffer[13]);
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
if (buffer[desc ? 1 : 2] == SENSE_UNIT_ATTENTION) {
|
|
|
|
|
/* If the last remaining sense is unit attention, clear
|
|
|
|
|
that condition. */
|
|
|
|
|
dev->unit_attention = 0;
|
|
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
/* Clear the sense stuff as per the spec. */
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_sense_clear(dev, GPCMD_REQUEST_SENSE);
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
|
2018-10-10 22:33:24 +02:00
|
|
|
static void
|
2018-10-30 13:32:25 +01:00
|
|
|
zip_request_sense_for_scsi(scsi_common_t *sc, uint8_t *buffer, uint8_t alloc_length)
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
2018-10-30 13:32:25 +01:00
|
|
|
zip_t *dev = (zip_t *) sc;
|
2018-04-25 23:51:13 +02:00
|
|
|
int ready = 0;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
ready = (dev->drv->f != NULL);
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
if (!ready && dev->unit_attention) {
|
|
|
|
|
/* If the drive is not ready, there is no reason to keep the
|
|
|
|
|
UNIT ATTENTION condition present, as we only use it to mark
|
|
|
|
|
disc changes. */
|
|
|
|
|
dev->unit_attention = 0;
|
|
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
/* Do *NOT* advance the unit attention phase. */
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_request_sense(dev, buffer, alloc_length, 0);
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
|
|
|
|
|
static void
|
2018-09-12 19:46:26 +02:00
|
|
|
zip_set_buf_len(zip_t *dev, int32_t *BufLen, int32_t *src_len)
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
2018-07-15 01:41:53 +02:00
|
|
|
if (dev->drv->bus_type == ZIP_BUS_SCSI) {
|
2018-04-25 23:51:13 +02:00
|
|
|
if (*BufLen == -1)
|
|
|
|
|
*BufLen = *src_len;
|
|
|
|
|
else {
|
|
|
|
|
*BufLen = MIN(*src_len, *BufLen);
|
|
|
|
|
*src_len = *BufLen;
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_log("ZIP %i: Actual transfer length: %i\n", dev->id, *BufLen);
|
2018-04-25 23:51:13 +02:00
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
|
2018-10-10 22:33:24 +02:00
|
|
|
static void
|
2018-10-30 13:32:25 +01:00
|
|
|
zip_command(scsi_common_t *sc, uint8_t *cdb)
|
2018-04-25 23:51:13 +02:00
|
|
|
{
|
2018-10-30 13:32:25 +01:00
|
|
|
zip_t *dev = (zip_t *) sc;
|
2018-04-25 23:51:13 +02:00
|
|
|
int pos = 0, block_desc = 0;
|
|
|
|
|
int ret;
|
2018-09-12 19:46:26 +02:00
|
|
|
int32_t len, max_len;
|
|
|
|
|
int32_t alloc_length;
|
|
|
|
|
uint32_t i = 0;
|
|
|
|
|
int size_idx, idx = 0;
|
2018-04-25 23:51:13 +02:00
|
|
|
unsigned preamble_len;
|
|
|
|
|
int32_t blen = 0;
|
|
|
|
|
int32_t *BufLen;
|
2021-07-22 20:13:44 +02:00
|
|
|
uint8_t scsi_bus = (dev->drv->scsi_device_id >> 4) & 0x0f;
|
|
|
|
|
uint8_t scsi_id = dev->drv->scsi_device_id & 0x0f;
|
2018-04-25 23:51:13 +02:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
if (dev->drv->bus_type == ZIP_BUS_SCSI) {
|
2021-07-22 20:13:44 +02:00
|
|
|
BufLen = &scsi_devices[scsi_bus][scsi_id].buffer_length;
|
2018-04-25 23:51:13 +02:00
|
|
|
dev->status &= ~ERR_STAT;
|
|
|
|
|
} else {
|
|
|
|
|
BufLen = &blen;
|
|
|
|
|
dev->error = 0;
|
|
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
dev->packet_len = 0;
|
|
|
|
|
dev->request_pos = 0;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
memcpy(dev->current_cdb, cdb, 12);
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
if (cdb[0] != 0) {
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_log("ZIP %i: Command 0x%02X, Sense Key %02X, Asc %02X, Ascq %02X, Unit attention: %i\n",
|
|
|
|
|
dev->id, cdb[0], zip_sense_key, zip_asc, zip_ascq, dev->unit_attention);
|
|
|
|
|
zip_log("ZIP %i: Request length: %04X\n", dev->id, dev->request_length);
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_log("ZIP %i: CDB: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n", dev->id,
|
2018-04-25 23:51:13 +02:00
|
|
|
cdb[0], cdb[1], cdb[2], cdb[3], cdb[4], cdb[5], cdb[6], cdb[7],
|
|
|
|
|
cdb[8], cdb[9], cdb[10], cdb[11]);
|
|
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
dev->sector_len = 0;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_set_phase(dev, SCSI_PHASE_STATUS);
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
/* This handles the Not Ready/Unit Attention check if it has to be handled at this point. */
|
2018-07-15 01:41:53 +02:00
|
|
|
if (zip_pre_execution_check(dev, cdb) == 0)
|
2018-04-25 23:51:13 +02:00
|
|
|
return;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
switch (cdb[0]) {
|
|
|
|
|
case GPCMD_SEND_DIAGNOSTIC:
|
|
|
|
|
if (!(cdb[1] & (1 << 2))) {
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_invalid_field(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
return;
|
|
|
|
|
}
|
2020-01-15 03:48:33 +01:00
|
|
|
/*FALLTHROUGH*/
|
2018-04-25 23:51:13 +02:00
|
|
|
case GPCMD_SCSI_RESERVE:
|
|
|
|
|
case GPCMD_SCSI_RELEASE:
|
|
|
|
|
case GPCMD_TEST_UNIT_READY:
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_set_phase(dev, SCSI_PHASE_STATUS);
|
|
|
|
|
zip_command_complete(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
break;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
case GPCMD_FORMAT_UNIT:
|
2018-10-27 03:43:25 +02:00
|
|
|
if (dev->drv->read_only) {
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_write_protected(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
return;
|
|
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_set_phase(dev, SCSI_PHASE_STATUS);
|
|
|
|
|
zip_command_complete(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case GPCMD_IOMEGA_SENSE:
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_set_phase(dev, SCSI_PHASE_DATA_IN);
|
2018-04-25 23:51:13 +02:00
|
|
|
max_len = cdb[4];
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_buf_alloc(dev, 256);
|
|
|
|
|
zip_set_buf_len(dev, BufLen, &max_len);
|
2018-10-26 06:02:16 +02:00
|
|
|
memset(dev->buffer, 0, 256);
|
2018-04-25 23:51:13 +02:00
|
|
|
if (cdb[2] == 1) {
|
|
|
|
|
/* This page is related to disk health status - setting
|
|
|
|
|
this page to 0 makes disk health read as "marginal". */
|
2018-10-26 06:02:16 +02:00
|
|
|
dev->buffer[0] = 0x58;
|
|
|
|
|
dev->buffer[1] = 0x00;
|
2018-04-25 23:51:13 +02:00
|
|
|
for (i = 0x00; i < 0x58; i++)
|
2018-10-26 06:02:16 +02:00
|
|
|
dev->buffer[i + 0x02] = 0xff;
|
2018-04-25 23:51:13 +02:00
|
|
|
} else if (cdb[2] == 2) {
|
2018-10-26 06:02:16 +02:00
|
|
|
dev->buffer[0] = 0x3d;
|
|
|
|
|
dev->buffer[1] = 0x00;
|
2018-04-25 23:51:13 +02:00
|
|
|
for (i = 0x00; i < 0x13; i++)
|
2018-10-26 06:02:16 +02:00
|
|
|
dev->buffer[i + 0x02] = 0x00;
|
|
|
|
|
dev->buffer[0x15] = 0x00;
|
2018-07-15 01:41:53 +02:00
|
|
|
if (dev->drv->read_only)
|
2018-10-26 06:02:16 +02:00
|
|
|
dev->buffer[0x15] |= 0x02;
|
2018-04-25 23:51:13 +02:00
|
|
|
for (i = 0x00; i < 0x27; i++)
|
2018-10-26 06:02:16 +02:00
|
|
|
dev->buffer[i + 0x16] = 0x00;
|
2018-04-25 23:51:13 +02:00
|
|
|
} else {
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_invalid_field(dev);
|
|
|
|
|
zip_buf_free(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
return;
|
|
|
|
|
}
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_data_command_finish(dev, 18, 18, cdb[4], 0);
|
2018-04-25 23:51:13 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case GPCMD_REZERO_UNIT:
|
|
|
|
|
dev->sector_pos = dev->sector_len = 0;
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_seek(dev, 0);
|
|
|
|
|
zip_set_phase(dev, SCSI_PHASE_STATUS);
|
2018-04-25 23:51:13 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case GPCMD_REQUEST_SENSE:
|
|
|
|
|
/* If there's a unit attention condition and there's a buffered not ready, a standalone REQUEST SENSE
|
|
|
|
|
should forget about the not ready, and report unit attention straight away. */
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_set_phase(dev, SCSI_PHASE_DATA_IN);
|
2018-04-25 23:51:13 +02:00
|
|
|
max_len = cdb[4];
|
2018-10-09 16:30:19 +02:00
|
|
|
|
|
|
|
|
if (!max_len) {
|
|
|
|
|
zip_set_phase(dev, SCSI_PHASE_STATUS);
|
2018-10-10 22:33:24 +02:00
|
|
|
dev->packet_status = PHASE_COMPLETE;
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
dev->callback = 20.0 * ZIP_TIME;
|
2018-10-09 16:30:19 +02:00
|
|
|
zip_set_callback(dev);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_buf_alloc(dev, 256);
|
|
|
|
|
zip_set_buf_len(dev, BufLen, &max_len);
|
2018-04-25 23:51:13 +02:00
|
|
|
len = (cdb[1] & 1) ? 8 : 18;
|
2018-10-26 06:02:16 +02:00
|
|
|
zip_request_sense(dev, dev->buffer, max_len, cdb[1] & 1);
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_data_command_finish(dev, len, len, cdb[4], 0);
|
2018-04-25 23:51:13 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case GPCMD_MECHANISM_STATUS:
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_set_phase(dev, SCSI_PHASE_DATA_IN);
|
2018-10-30 13:32:25 +01:00
|
|
|
len = (cdb[8] << 8) | cdb[9];
|
2018-04-25 23:51:13 +02:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_buf_alloc(dev, 8);
|
|
|
|
|
zip_set_buf_len(dev, BufLen, &len);
|
2018-04-25 23:51:13 +02:00
|
|
|
|
2018-10-26 06:02:16 +02:00
|
|
|
memset(dev->buffer, 0, 8);
|
|
|
|
|
dev->buffer[5] = 1;
|
2018-04-25 23:51:13 +02:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_data_command_finish(dev, 8, 8, len, 0);
|
2018-04-25 23:51:13 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case GPCMD_READ_6:
|
|
|
|
|
case GPCMD_READ_10:
|
|
|
|
|
case GPCMD_READ_12:
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_set_phase(dev, SCSI_PHASE_DATA_IN);
|
2018-04-25 23:51:13 +02:00
|
|
|
alloc_length = 512;
|
|
|
|
|
|
|
|
|
|
switch(cdb[0]) {
|
|
|
|
|
case GPCMD_READ_6:
|
|
|
|
|
dev->sector_len = cdb[4];
|
|
|
|
|
dev->sector_pos = ((((uint32_t) cdb[1]) & 0x1f) << 16) | (((uint32_t) cdb[2]) << 8) | ((uint32_t) cdb[3]);
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_log("ZIP %i: Length: %i, LBA: %i\n", dev->id, dev->sector_len, dev->sector_pos);
|
2018-04-25 23:51:13 +02:00
|
|
|
break;
|
|
|
|
|
case GPCMD_READ_10:
|
|
|
|
|
dev->sector_len = (cdb[7] << 8) | cdb[8];
|
|
|
|
|
dev->sector_pos = (cdb[2] << 24) | (cdb[3] << 16) | (cdb[4] << 8) | cdb[5];
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_log("ZIP %i: Length: %i, LBA: %i\n", dev->id, dev->sector_len, dev->sector_pos);
|
2018-04-25 23:51:13 +02:00
|
|
|
break;
|
|
|
|
|
case GPCMD_READ_12:
|
|
|
|
|
dev->sector_len = (((uint32_t) cdb[6]) << 24) | (((uint32_t) cdb[7]) << 16) | (((uint32_t) cdb[8]) << 8) | ((uint32_t) cdb[9]);
|
|
|
|
|
dev->sector_pos = (((uint32_t) cdb[2]) << 24) | (((uint32_t) cdb[3]) << 16) | (((uint32_t) cdb[4]) << 8) | ((uint32_t) cdb[5]);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
if (!dev->sector_len) {
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_set_phase(dev, SCSI_PHASE_STATUS);
|
|
|
|
|
/* zip_log("ZIP %i: All done - callback set\n", dev->id); */
|
2018-10-10 22:33:24 +02:00
|
|
|
dev->packet_status = PHASE_COMPLETE;
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
dev->callback = 20.0 * ZIP_TIME;
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_set_callback(dev);
|
2018-01-26 22:17:09 +01:00
|
|
|
break;
|
2018-04-25 23:51:13 +02:00
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
max_len = dev->sector_len;
|
|
|
|
|
dev->requested_blocks = max_len; /* If we're reading all blocks in one go for DMA, why not also for PIO, it should NOT
|
|
|
|
|
matter anyway, this step should be identical and only the way the read dat is
|
|
|
|
|
transferred to the host should be different. */
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
dev->packet_len = max_len * alloc_length;
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_buf_alloc(dev, dev->packet_len);
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
ret = zip_blocks(dev, &alloc_length, 1, 0);
|
2018-04-25 23:51:13 +02:00
|
|
|
if (ret <= 0) {
|
2018-10-30 13:32:25 +01:00
|
|
|
zip_set_phase(dev, SCSI_PHASE_STATUS);
|
|
|
|
|
dev->packet_status = PHASE_COMPLETE;
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
dev->callback = 20.0 * ZIP_TIME;
|
2018-10-30 13:32:25 +01:00
|
|
|
zip_set_callback(dev);
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_buf_free(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
return;
|
|
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
dev->requested_blocks = max_len;
|
|
|
|
|
dev->packet_len = alloc_length;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-09-12 19:46:26 +02:00
|
|
|
zip_set_buf_len(dev, BufLen, (int32_t *) &dev->packet_len);
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_data_command_finish(dev, alloc_length, 512, alloc_length, 0);
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-10-10 22:33:24 +02:00
|
|
|
if (dev->packet_status != PHASE_COMPLETE)
|
2018-07-15 01:41:53 +02:00
|
|
|
ui_sb_update_icon(SB_ZIP | dev->id, 1);
|
2018-04-25 23:51:13 +02:00
|
|
|
else
|
2018-07-15 01:41:53 +02:00
|
|
|
ui_sb_update_icon(SB_ZIP | dev->id, 0);
|
2018-04-25 23:51:13 +02:00
|
|
|
return;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
case GPCMD_VERIFY_6:
|
|
|
|
|
case GPCMD_VERIFY_10:
|
|
|
|
|
case GPCMD_VERIFY_12:
|
|
|
|
|
if (!(cdb[1] & 2)) {
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_set_phase(dev, SCSI_PHASE_STATUS);
|
|
|
|
|
zip_command_complete(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case GPCMD_WRITE_6:
|
|
|
|
|
case GPCMD_WRITE_10:
|
|
|
|
|
case GPCMD_WRITE_AND_VERIFY_10:
|
|
|
|
|
case GPCMD_WRITE_12:
|
|
|
|
|
case GPCMD_WRITE_AND_VERIFY_12:
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_set_phase(dev, SCSI_PHASE_DATA_OUT);
|
2018-04-25 23:51:13 +02:00
|
|
|
alloc_length = 512;
|
|
|
|
|
|
2018-10-27 03:43:25 +02:00
|
|
|
if (dev->drv->read_only) {
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_write_protected(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
return;
|
|
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
switch(cdb[0]) {
|
|
|
|
|
case GPCMD_VERIFY_6:
|
|
|
|
|
case GPCMD_WRITE_6:
|
|
|
|
|
dev->sector_len = cdb[4];
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
if (dev->sector_len == 0)
|
|
|
|
|
dev->sector_len = 256; /* For READ (6) and WRITE (6), a length of 0 indicates a transfer of 256 sector. */
|
2018-04-25 23:51:13 +02:00
|
|
|
dev->sector_pos = ((((uint32_t) cdb[1]) & 0x1f) << 16) | (((uint32_t) cdb[2]) << 8) | ((uint32_t) cdb[3]);
|
|
|
|
|
break;
|
|
|
|
|
case GPCMD_VERIFY_10:
|
|
|
|
|
case GPCMD_WRITE_10:
|
|
|
|
|
case GPCMD_WRITE_AND_VERIFY_10:
|
|
|
|
|
dev->sector_len = (cdb[7] << 8) | cdb[8];
|
|
|
|
|
dev->sector_pos = (cdb[2] << 24) | (cdb[3] << 16) | (cdb[4] << 8) | cdb[5];
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_log("ZIP %i: Length: %i, LBA: %i\n", dev->id, dev->sector_len, dev->sector_pos);
|
2018-04-25 23:51:13 +02:00
|
|
|
break;
|
|
|
|
|
case GPCMD_VERIFY_12:
|
|
|
|
|
case GPCMD_WRITE_12:
|
|
|
|
|
case GPCMD_WRITE_AND_VERIFY_12:
|
|
|
|
|
dev->sector_len = (((uint32_t) cdb[6]) << 24) | (((uint32_t) cdb[7]) << 16) | (((uint32_t) cdb[8]) << 8) | ((uint32_t) cdb[9]);
|
|
|
|
|
dev->sector_pos = (((uint32_t) cdb[2]) << 24) | (((uint32_t) cdb[3]) << 16) | (((uint32_t) cdb[4]) << 8) | ((uint32_t) cdb[5]);
|
2018-01-26 22:17:09 +01:00
|
|
|
break;
|
2018-04-25 23:51:13 +02:00
|
|
|
}
|
|
|
|
|
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
if ((dev->sector_pos >= dev->drv->medium_size)/* ||
|
|
|
|
|
((dev->sector_pos + dev->sector_len - 1) >= dev->drv->medium_size)*/) {
|
2018-10-27 03:43:25 +02:00
|
|
|
zip_lba_out_of_range(dev);
|
|
|
|
|
return;
|
2018-04-25 23:51:13 +02:00
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
if (!dev->sector_len) {
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_set_phase(dev, SCSI_PHASE_STATUS);
|
|
|
|
|
/* zip_log("ZIP %i: All done - callback set\n", dev->id); */
|
2018-10-10 22:33:24 +02:00
|
|
|
dev->packet_status = PHASE_COMPLETE;
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
dev->callback = 20.0 * ZIP_TIME;
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_set_callback(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
break;
|
|
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
max_len = dev->sector_len;
|
|
|
|
|
dev->requested_blocks = max_len; /* If we're writing all blocks in one go for DMA, why not also for PIO, it should NOT
|
|
|
|
|
matter anyway, this step should be identical and only the way the read dat is
|
|
|
|
|
transferred to the host should be different. */
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
dev->packet_len = max_len * alloc_length;
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_buf_alloc(dev, dev->packet_len);
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
dev->requested_blocks = max_len;
|
|
|
|
|
dev->packet_len = max_len << 9;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-09-12 19:46:26 +02:00
|
|
|
zip_set_buf_len(dev, BufLen, (int32_t *) &dev->packet_len);
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_data_command_finish(dev, dev->packet_len, 512, dev->packet_len, 1);
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-10-10 22:33:24 +02:00
|
|
|
if (dev->packet_status != PHASE_COMPLETE)
|
2018-07-15 01:41:53 +02:00
|
|
|
ui_sb_update_icon(SB_ZIP | dev->id, 1);
|
2018-04-25 23:51:13 +02:00
|
|
|
else
|
2018-07-15 01:41:53 +02:00
|
|
|
ui_sb_update_icon(SB_ZIP | dev->id, 0);
|
2018-04-25 23:51:13 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
case GPCMD_WRITE_SAME_10:
|
|
|
|
|
alloc_length = 512;
|
|
|
|
|
|
|
|
|
|
if ((cdb[1] & 6) == 6) {
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_invalid_field(dev);
|
2018-01-26 22:17:09 +01:00
|
|
|
return;
|
2018-04-25 23:51:13 +02:00
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-10-27 03:43:25 +02:00
|
|
|
if (dev->drv->read_only) {
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_write_protected(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dev->sector_len = (cdb[7] << 8) | cdb[8];
|
|
|
|
|
dev->sector_pos = (cdb[2] << 24) | (cdb[3] << 16) | (cdb[4] << 8) | cdb[5];
|
|
|
|
|
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
if ((dev->sector_pos >= dev->drv->medium_size)/* ||
|
|
|
|
|
((dev->sector_pos + dev->sector_len - 1) >= dev->drv->medium_size)*/) {
|
2018-10-27 03:43:25 +02:00
|
|
|
zip_lba_out_of_range(dev);
|
|
|
|
|
return;
|
2018-04-25 23:51:13 +02:00
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
if (!dev->sector_len) {
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_set_phase(dev, SCSI_PHASE_STATUS);
|
|
|
|
|
/* zip_log("ZIP %i: All done - callback set\n", dev->id); */
|
2018-10-10 22:33:24 +02:00
|
|
|
dev->packet_status = PHASE_COMPLETE;
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
dev->callback = 20.0 * ZIP_TIME;
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_set_callback(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
break;
|
|
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-10-30 13:32:25 +01:00
|
|
|
zip_buf_alloc(dev, alloc_length);
|
|
|
|
|
zip_set_buf_len(dev, BufLen, (int32_t *) &dev->packet_len);
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-10-30 13:32:25 +01:00
|
|
|
max_len = 1;
|
|
|
|
|
dev->requested_blocks = 1;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
dev->packet_len = alloc_length;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-10-30 13:32:25 +01:00
|
|
|
zip_set_phase(dev, SCSI_PHASE_DATA_OUT);
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-10-30 13:32:25 +01:00
|
|
|
zip_data_command_finish(dev, 512, 512, alloc_length, 1);
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-10-10 22:33:24 +02:00
|
|
|
if (dev->packet_status != PHASE_COMPLETE)
|
2018-07-15 01:41:53 +02:00
|
|
|
ui_sb_update_icon(SB_ZIP | dev->id, 1);
|
2018-04-25 23:51:13 +02:00
|
|
|
else
|
2018-07-15 01:41:53 +02:00
|
|
|
ui_sb_update_icon(SB_ZIP | dev->id, 0);
|
2018-04-25 23:51:13 +02:00
|
|
|
return;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
case GPCMD_MODE_SENSE_6:
|
|
|
|
|
case GPCMD_MODE_SENSE_10:
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_set_phase(dev, SCSI_PHASE_DATA_IN);
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
if (dev->drv->bus_type == ZIP_BUS_SCSI)
|
2018-04-25 23:51:13 +02:00
|
|
|
block_desc = ((cdb[1] >> 3) & 1) ? 0 : 1;
|
|
|
|
|
else
|
|
|
|
|
block_desc = 0;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
if (cdb[0] == GPCMD_MODE_SENSE_6) {
|
|
|
|
|
len = cdb[4];
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_buf_alloc(dev, 256);
|
2018-04-25 23:51:13 +02:00
|
|
|
} else {
|
|
|
|
|
len = (cdb[8] | (cdb[7] << 8));
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_buf_alloc(dev, 65536);
|
2018-04-25 23:51:13 +02:00
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-10-10 22:33:24 +02:00
|
|
|
if (!(zip_mode_sense_page_flags & (1LL << (uint64_t) (cdb[2] & 0x3f)))) {
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_invalid_field(dev);
|
|
|
|
|
zip_buf_free(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
return;
|
|
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-10-26 06:02:16 +02:00
|
|
|
memset(dev->buffer, 0, len);
|
2018-04-25 23:51:13 +02:00
|
|
|
alloc_length = len;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
if (cdb[0] == GPCMD_MODE_SENSE_6) {
|
2018-10-26 06:02:16 +02:00
|
|
|
len = zip_mode_sense(dev, dev->buffer, 4, cdb[2], block_desc);
|
2018-04-25 23:51:13 +02:00
|
|
|
len = MIN(len, alloc_length);
|
2018-10-26 06:02:16 +02:00
|
|
|
dev->buffer[0] = len - 1;
|
|
|
|
|
dev->buffer[1] = 0;
|
2018-04-25 23:51:13 +02:00
|
|
|
if (block_desc)
|
2018-10-26 06:02:16 +02:00
|
|
|
dev->buffer[3] = 8;
|
2018-04-25 23:51:13 +02:00
|
|
|
} else {
|
2018-10-26 06:02:16 +02:00
|
|
|
len = zip_mode_sense(dev, dev->buffer, 8, cdb[2], block_desc);
|
2018-04-25 23:51:13 +02:00
|
|
|
len = MIN(len, alloc_length);
|
2018-10-26 06:02:16 +02:00
|
|
|
dev->buffer[0]=(len - 2) >> 8;
|
|
|
|
|
dev->buffer[1]=(len - 2) & 255;
|
|
|
|
|
dev->buffer[2] = 0;
|
2018-04-25 23:51:13 +02:00
|
|
|
if (block_desc) {
|
2018-10-26 06:02:16 +02:00
|
|
|
dev->buffer[6] = 0;
|
|
|
|
|
dev->buffer[7] = 8;
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
2018-04-25 23:51:13 +02:00
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_set_buf_len(dev, BufLen, &len);
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_log("ZIP %i: Reading mode page: %02X...\n", dev->id, cdb[2]);
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_data_command_finish(dev, len, len, alloc_length, 0);
|
2018-04-25 23:51:13 +02:00
|
|
|
return;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
case GPCMD_MODE_SELECT_6:
|
|
|
|
|
case GPCMD_MODE_SELECT_10:
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_set_phase(dev, SCSI_PHASE_DATA_OUT);
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
if (cdb[0] == GPCMD_MODE_SELECT_6) {
|
|
|
|
|
len = cdb[4];
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_buf_alloc(dev, 256);
|
2018-04-25 23:51:13 +02:00
|
|
|
} else {
|
|
|
|
|
len = (cdb[7] << 8) | cdb[8];
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_buf_alloc(dev, 65536);
|
2018-04-25 23:51:13 +02:00
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_set_buf_len(dev, BufLen, &len);
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
dev->total_length = len;
|
|
|
|
|
dev->do_page_save = cdb[1] & 1;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_data_command_finish(dev, len, len, len, 1);
|
2018-04-25 23:51:13 +02:00
|
|
|
return;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
case GPCMD_START_STOP_UNIT:
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_set_phase(dev, SCSI_PHASE_STATUS);
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
switch(cdb[4] & 3) {
|
|
|
|
|
case 0: /* Stop the disc. */
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_eject(dev->id); /* The Iomega Windows 9x drivers require this. */
|
2018-04-25 23:51:13 +02:00
|
|
|
break;
|
|
|
|
|
case 1: /* Start the disc and read the TOC. */
|
|
|
|
|
break;
|
|
|
|
|
case 2: /* Eject the disc if possible. */
|
2018-07-15 01:41:53 +02:00
|
|
|
/* zip_eject(dev->id); */
|
2018-04-25 23:51:13 +02:00
|
|
|
break;
|
|
|
|
|
case 3: /* Load the disc (close tray). */
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_reload(dev->id);
|
2018-04-25 23:51:13 +02:00
|
|
|
break;
|
|
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_command_complete(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
break;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
case GPCMD_INQUIRY:
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_set_phase(dev, SCSI_PHASE_DATA_IN);
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
max_len = cdb[3];
|
|
|
|
|
max_len <<= 8;
|
|
|
|
|
max_len |= cdb[4];
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_buf_alloc(dev, 65536);
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
if (cdb[1] & 1) {
|
|
|
|
|
preamble_len = 4;
|
|
|
|
|
size_idx = 3;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2020-03-29 06:42:26 +02:00
|
|
|
dev->buffer[idx++] = 0;
|
2018-10-26 06:02:16 +02:00
|
|
|
dev->buffer[idx++] = cdb[2];
|
|
|
|
|
dev->buffer[idx++] = 0;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
idx++;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
switch (cdb[2]) {
|
|
|
|
|
case 0x00:
|
2018-10-26 06:02:16 +02:00
|
|
|
dev->buffer[idx++] = 0x00;
|
|
|
|
|
dev->buffer[idx++] = 0x83;
|
2018-01-26 22:17:09 +01:00
|
|
|
break;
|
2018-04-25 23:51:13 +02:00
|
|
|
case 0x83:
|
|
|
|
|
if (idx + 24 > max_len) {
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_data_phase_error(dev);
|
|
|
|
|
zip_buf_free(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-26 06:02:16 +02:00
|
|
|
dev->buffer[idx++] = 0x02;
|
|
|
|
|
dev->buffer[idx++] = 0x00;
|
|
|
|
|
dev->buffer[idx++] = 0x00;
|
|
|
|
|
dev->buffer[idx++] = 20;
|
|
|
|
|
ide_padstr8(dev->buffer + idx, 20, "53R141"); /* Serial */
|
2018-04-25 23:51:13 +02:00
|
|
|
idx += 20;
|
|
|
|
|
|
|
|
|
|
if (idx + 72 > cdb[4])
|
|
|
|
|
goto atapi_out;
|
2018-10-26 06:02:16 +02:00
|
|
|
dev->buffer[idx++] = 0x02;
|
|
|
|
|
dev->buffer[idx++] = 0x01;
|
|
|
|
|
dev->buffer[idx++] = 0x00;
|
|
|
|
|
dev->buffer[idx++] = 68;
|
|
|
|
|
ide_padstr8(dev->buffer + idx, 8, "IOMEGA "); /* Vendor */
|
2018-04-25 23:51:13 +02:00
|
|
|
idx += 8;
|
2018-07-15 01:41:53 +02:00
|
|
|
if (dev->drv->is_250)
|
2018-10-26 06:02:16 +02:00
|
|
|
ide_padstr8(dev->buffer + idx, 40, "ZIP 250 "); /* Product */
|
2018-04-25 23:51:13 +02:00
|
|
|
else
|
2018-10-26 06:02:16 +02:00
|
|
|
ide_padstr8(dev->buffer + idx, 40, "ZIP 100 "); /* Product */
|
2018-04-25 23:51:13 +02:00
|
|
|
idx += 40;
|
2018-10-26 06:02:16 +02:00
|
|
|
ide_padstr8(dev->buffer + idx, 20, "53R141"); /* Product */
|
2018-04-25 23:51:13 +02:00
|
|
|
idx += 20;
|
2018-01-26 22:17:09 +01:00
|
|
|
break;
|
2018-04-25 23:51:13 +02:00
|
|
|
default:
|
|
|
|
|
zip_log("INQUIRY: Invalid page: %02X\n", cdb[2]);
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_invalid_field(dev);
|
|
|
|
|
zip_buf_free(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
return;
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
2018-04-25 23:51:13 +02:00
|
|
|
} else {
|
|
|
|
|
preamble_len = 5;
|
|
|
|
|
size_idx = 4;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-10-26 06:02:16 +02:00
|
|
|
memset(dev->buffer, 0, 8);
|
2018-04-25 23:51:13 +02:00
|
|
|
if (cdb[1] & 0xe0)
|
2018-10-26 06:02:16 +02:00
|
|
|
dev->buffer[0] = 0x60; /*No physical device on this LUN*/
|
2018-04-25 23:51:13 +02:00
|
|
|
else
|
2018-10-26 06:02:16 +02:00
|
|
|
dev->buffer[0] = 0x00; /*Hard disk*/
|
|
|
|
|
dev->buffer[1] = 0x80; /*Removable*/
|
|
|
|
|
dev->buffer[2] = (dev->drv->bus_type == ZIP_BUS_SCSI) ? 0x02 : 0x00; /*SCSI-2 compliant*/
|
|
|
|
|
dev->buffer[3] = (dev->drv->bus_type == ZIP_BUS_SCSI) ? 0x02 : 0x21;
|
2018-10-30 15:17:48 +01:00
|
|
|
// dev->buffer[4] = 31;
|
|
|
|
|
dev->buffer[4] = 0;
|
2018-07-15 01:41:53 +02:00
|
|
|
if (dev->drv->bus_type == ZIP_BUS_SCSI) {
|
2018-10-26 06:02:16 +02:00
|
|
|
dev->buffer[6] = 1; /* 16-bit transfers supported */
|
|
|
|
|
dev->buffer[7] = 0x20; /* Wide bus supported */
|
2018-04-25 23:51:13 +02:00
|
|
|
}
|
2018-10-30 15:17:48 +01:00
|
|
|
dev->buffer[7] |= 0x02;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-10-26 06:02:16 +02:00
|
|
|
ide_padstr8(dev->buffer + 8, 8, "IOMEGA "); /* Vendor */
|
2018-07-15 01:41:53 +02:00
|
|
|
if (dev->drv->is_250) {
|
2018-10-26 06:02:16 +02:00
|
|
|
ide_padstr8(dev->buffer + 16, 16, "ZIP 250 "); /* Product */
|
|
|
|
|
ide_padstr8(dev->buffer + 32, 4, "42.S"); /* Revision */
|
2018-04-25 23:51:13 +02:00
|
|
|
if (max_len >= 44)
|
2018-10-26 06:02:16 +02:00
|
|
|
ide_padstr8(dev->buffer + 36, 8, "08/08/01"); /* Date? */
|
2018-04-25 23:51:13 +02:00
|
|
|
if (max_len >= 122)
|
2018-10-26 06:02:16 +02:00
|
|
|
ide_padstr8(dev->buffer + 96, 26, "(c) Copyright IOMEGA 2000 "); /* Copyright string */
|
2018-04-25 23:51:13 +02:00
|
|
|
} else {
|
2018-10-26 06:02:16 +02:00
|
|
|
ide_padstr8(dev->buffer + 16, 16, "ZIP 100 "); /* Product */
|
|
|
|
|
ide_padstr8(dev->buffer + 32, 4, "E.08"); /* Revision */
|
2018-04-25 23:51:13 +02:00
|
|
|
}
|
|
|
|
|
idx = 36;
|
|
|
|
|
|
|
|
|
|
if (max_len == 96) {
|
2018-10-26 06:02:16 +02:00
|
|
|
dev->buffer[4] = 91;
|
2018-04-25 23:51:13 +02:00
|
|
|
idx = 96;
|
|
|
|
|
} else if (max_len == 128) {
|
2018-10-26 06:02:16 +02:00
|
|
|
dev->buffer[4] = 0x75;
|
2018-04-25 23:51:13 +02:00
|
|
|
idx = 128;
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
2018-04-25 23:51:13 +02:00
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
|
|
|
|
atapi_out:
|
2018-10-26 06:02:16 +02:00
|
|
|
dev->buffer[size_idx] = idx - preamble_len;
|
2018-04-25 23:51:13 +02:00
|
|
|
len=idx;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
len = MIN(len, max_len);
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_set_buf_len(dev, BufLen, &len);
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_data_command_finish(dev, len, len, max_len, 0);
|
2018-04-25 23:51:13 +02:00
|
|
|
break;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
case GPCMD_PREVENT_REMOVAL:
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_set_phase(dev, SCSI_PHASE_STATUS);
|
|
|
|
|
zip_command_complete(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
break;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
case GPCMD_SEEK_6:
|
|
|
|
|
case GPCMD_SEEK_10:
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_set_phase(dev, SCSI_PHASE_STATUS);
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
switch(cdb[0]) {
|
|
|
|
|
case GPCMD_SEEK_6:
|
|
|
|
|
pos = (cdb[2] << 8) | cdb[3];
|
|
|
|
|
break;
|
|
|
|
|
case GPCMD_SEEK_10:
|
2018-07-15 01:41:53 +02:00
|
|
|
pos = (cdb[2] << 24) | (cdb[3] << 16) | (cdb[4] << 8) | cdb[5];
|
2018-04-25 23:51:13 +02:00
|
|
|
break;
|
|
|
|
|
}
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_seek(dev, pos);
|
|
|
|
|
zip_command_complete(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
break;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
case GPCMD_READ_CDROM_CAPACITY:
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_set_phase(dev, SCSI_PHASE_DATA_IN);
|
2018-03-21 15:16:25 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_buf_alloc(dev, 8);
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-10-30 13:32:25 +01:00
|
|
|
max_len = dev->drv->medium_size - 1; /* IMPORTANT: What's returned is the last LBA block. */
|
|
|
|
|
memset(dev->buffer, 0, 8);
|
|
|
|
|
dev->buffer[0] = (max_len >> 24) & 0xff;
|
|
|
|
|
dev->buffer[1] = (max_len >> 16) & 0xff;
|
|
|
|
|
dev->buffer[2] = (max_len >> 8) & 0xff;
|
|
|
|
|
dev->buffer[3] = max_len & 0xff;
|
|
|
|
|
dev->buffer[6] = 2; /* 512 = 0x0200 */
|
|
|
|
|
len = 8;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_set_buf_len(dev, BufLen, &len);
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_data_command_finish(dev, len, len, len, 0);
|
2018-04-25 23:51:13 +02:00
|
|
|
break;
|
2018-03-21 15:16:25 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
case GPCMD_IOMEGA_EJECT:
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_set_phase(dev, SCSI_PHASE_STATUS);
|
|
|
|
|
zip_eject(dev->id);
|
|
|
|
|
zip_command_complete(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
break;
|
2018-03-21 15:16:25 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
case GPCMD_READ_FORMAT_CAPACITIES:
|
|
|
|
|
len = (cdb[7] << 8) | cdb[8];
|
2018-03-21 15:16:25 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_buf_alloc(dev, len);
|
2018-10-26 06:02:16 +02:00
|
|
|
memset(dev->buffer, 0, len);
|
2018-03-21 15:16:25 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
pos = 0;
|
2018-03-21 15:16:25 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
/* List header */
|
2018-10-26 06:02:16 +02:00
|
|
|
dev->buffer[pos++] = 0;
|
|
|
|
|
dev->buffer[pos++] = 0;
|
|
|
|
|
dev->buffer[pos++] = 0;
|
2018-07-15 01:41:53 +02:00
|
|
|
if (dev->drv->f != NULL)
|
2018-10-26 06:02:16 +02:00
|
|
|
dev->buffer[pos++] = 16;
|
2018-04-25 23:51:13 +02:00
|
|
|
else
|
2018-10-26 06:02:16 +02:00
|
|
|
dev->buffer[pos++] = 8;
|
2018-03-21 15:16:25 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
/* Current/Maximum capacity header */
|
2018-07-15 01:41:53 +02:00
|
|
|
if (dev->drv->is_250) {
|
2018-10-27 03:43:25 +02:00
|
|
|
/* ZIP 250 also supports ZIP 100 media, so if the medium is inserted,
|
|
|
|
|
we return the inserted medium's size, otherwise, the ZIP 250 size. */
|
2018-07-15 01:41:53 +02:00
|
|
|
if (dev->drv->f != NULL) {
|
2018-10-26 06:02:16 +02:00
|
|
|
dev->buffer[pos++] = (dev->drv->medium_size >> 24) & 0xff;
|
|
|
|
|
dev->buffer[pos++] = (dev->drv->medium_size >> 16) & 0xff;
|
|
|
|
|
dev->buffer[pos++] = (dev->drv->medium_size >> 8) & 0xff;
|
|
|
|
|
dev->buffer[pos++] = dev->drv->medium_size & 0xff;
|
|
|
|
|
dev->buffer[pos++] = 2; /* Current medium capacity */
|
2018-04-25 23:51:13 +02:00
|
|
|
} else {
|
2018-10-26 06:02:16 +02:00
|
|
|
dev->buffer[pos++] = (ZIP_250_SECTORS >> 24) & 0xff;
|
|
|
|
|
dev->buffer[pos++] = (ZIP_250_SECTORS >> 16) & 0xff;
|
|
|
|
|
dev->buffer[pos++] = (ZIP_250_SECTORS >> 8) & 0xff;
|
|
|
|
|
dev->buffer[pos++] = ZIP_250_SECTORS & 0xff;
|
|
|
|
|
dev->buffer[pos++] = 3; /* Maximum medium capacity */
|
2018-03-21 15:16:25 +01:00
|
|
|
}
|
2018-04-25 23:51:13 +02:00
|
|
|
} else {
|
2018-10-27 03:43:25 +02:00
|
|
|
/* ZIP 100 only supports ZIP 100 media as well, so we always return
|
|
|
|
|
the ZIP 100 size. */
|
2018-10-26 06:02:16 +02:00
|
|
|
dev->buffer[pos++] = (ZIP_SECTORS >> 24) & 0xff;
|
|
|
|
|
dev->buffer[pos++] = (ZIP_SECTORS >> 16) & 0xff;
|
|
|
|
|
dev->buffer[pos++] = (ZIP_SECTORS >> 8) & 0xff;
|
|
|
|
|
dev->buffer[pos++] = ZIP_SECTORS & 0xff;
|
2018-07-15 01:41:53 +02:00
|
|
|
if (dev->drv->f != NULL)
|
2018-10-26 06:02:16 +02:00
|
|
|
dev->buffer[pos++] = 2;
|
2018-04-25 23:51:13 +02:00
|
|
|
else
|
2018-10-26 06:02:16 +02:00
|
|
|
dev->buffer[pos++] = 3;
|
2018-04-25 23:51:13 +02:00
|
|
|
}
|
2018-03-21 15:16:25 +01:00
|
|
|
|
2018-10-26 06:02:16 +02:00
|
|
|
dev->buffer[pos++] = 512 >> 16;
|
|
|
|
|
dev->buffer[pos++] = 512 >> 8;
|
|
|
|
|
dev->buffer[pos++] = 512 & 0xff;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
if (dev->drv->f != NULL) {
|
2018-04-25 23:51:13 +02:00
|
|
|
/* Formattable capacity descriptor */
|
2018-10-26 06:02:16 +02:00
|
|
|
dev->buffer[pos++] = (dev->drv->medium_size >> 24) & 0xff;
|
|
|
|
|
dev->buffer[pos++] = (dev->drv->medium_size >> 16) & 0xff;
|
|
|
|
|
dev->buffer[pos++] = (dev->drv->medium_size >> 8) & 0xff;
|
|
|
|
|
dev->buffer[pos++] = dev->drv->medium_size & 0xff;
|
|
|
|
|
dev->buffer[pos++] = 0;
|
|
|
|
|
dev->buffer[pos++] = 512 >> 16;
|
|
|
|
|
dev->buffer[pos++] = 512 >> 8;
|
|
|
|
|
dev->buffer[pos++] = 512 & 0xff;
|
2018-04-25 23:51:13 +02:00
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_set_buf_len(dev, BufLen, &len);
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_data_command_finish(dev, len, len, len, 0);
|
2018-04-25 23:51:13 +02:00
|
|
|
break;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
default:
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_illegal_opcode(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
break;
|
|
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
/* zip_log("ZIP %i: Phase: %02X, request length: %i\n", dev->id, dev->phase, dev->request_length); */
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
if (zip_atapi_phase_to_scsi(dev) == SCSI_PHASE_STATUS)
|
|
|
|
|
zip_buf_free(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
|
|
|
|
|
2018-10-30 13:32:25 +01:00
|
|
|
static void
|
|
|
|
|
zip_command_stop(scsi_common_t *sc)
|
|
|
|
|
{
|
|
|
|
|
zip_t *dev = (zip_t *) sc;
|
|
|
|
|
|
|
|
|
|
zip_command_complete(dev);
|
|
|
|
|
zip_buf_free(dev);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
/* The command second phase function, needed for Mode Select. */
|
|
|
|
|
static uint8_t
|
2018-10-30 13:32:25 +01:00
|
|
|
zip_phase_data_out(scsi_common_t *sc)
|
2018-04-25 23:51:13 +02:00
|
|
|
{
|
2018-10-30 13:32:25 +01:00
|
|
|
zip_t *dev = (zip_t *) sc;
|
|
|
|
|
|
2020-12-26 02:26:45 +01:00
|
|
|
uint16_t block_desc_len, pos;
|
|
|
|
|
uint16_t param_list_len;
|
2018-04-25 23:51:13 +02:00
|
|
|
|
|
|
|
|
uint8_t error = 0;
|
|
|
|
|
uint8_t page, page_len;
|
|
|
|
|
|
2018-09-13 05:33:45 +02:00
|
|
|
uint32_t i = 0;
|
2018-04-25 23:51:13 +02:00
|
|
|
|
|
|
|
|
uint8_t hdr_len, val, old_val, ch;
|
|
|
|
|
|
2018-09-12 19:46:26 +02:00
|
|
|
uint32_t last_to_write = 0;
|
2018-04-25 23:51:13 +02:00
|
|
|
uint32_t c, h, s;
|
|
|
|
|
|
2018-09-12 19:46:26 +02:00
|
|
|
int len = 0;
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
switch(dev->current_cdb[0]) {
|
|
|
|
|
case GPCMD_VERIFY_6:
|
|
|
|
|
case GPCMD_VERIFY_10:
|
|
|
|
|
case GPCMD_VERIFY_12:
|
|
|
|
|
break;
|
|
|
|
|
case GPCMD_WRITE_6:
|
|
|
|
|
case GPCMD_WRITE_10:
|
|
|
|
|
case GPCMD_WRITE_AND_VERIFY_10:
|
|
|
|
|
case GPCMD_WRITE_12:
|
|
|
|
|
case GPCMD_WRITE_AND_VERIFY_12:
|
|
|
|
|
if (dev->requested_blocks > 0)
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_blocks(dev, &len, 1, 1);
|
2018-04-25 23:51:13 +02:00
|
|
|
break;
|
|
|
|
|
case GPCMD_WRITE_SAME_10:
|
|
|
|
|
if (!dev->current_cdb[7] && !dev->current_cdb[8]) {
|
2018-10-27 03:43:25 +02:00
|
|
|
last_to_write = (dev->drv->medium_size - 1);
|
2018-04-25 23:51:13 +02:00
|
|
|
} else
|
|
|
|
|
last_to_write = dev->sector_pos + dev->sector_len - 1;
|
|
|
|
|
|
|
|
|
|
for (i = dev->sector_pos; i <= last_to_write; i++) {
|
|
|
|
|
if (dev->current_cdb[1] & 2) {
|
2018-10-26 06:02:16 +02:00
|
|
|
dev->buffer[0] = (i >> 24) & 0xff;
|
|
|
|
|
dev->buffer[1] = (i >> 16) & 0xff;
|
|
|
|
|
dev->buffer[2] = (i >> 8) & 0xff;
|
|
|
|
|
dev->buffer[3] = i & 0xff;
|
2018-04-25 23:51:13 +02:00
|
|
|
} else if (dev->current_cdb[1] & 4) {
|
|
|
|
|
/* CHS are 96,1,2048 (ZIP 100) and 239,1,2048 (ZIP 250) */
|
|
|
|
|
s = (i % 2048);
|
|
|
|
|
h = ((i - s) / 2048) % 1;
|
|
|
|
|
c = ((i - s) / 2048) / 1;
|
2018-10-26 06:02:16 +02:00
|
|
|
dev->buffer[0] = (c >> 16) & 0xff;
|
|
|
|
|
dev->buffer[1] = (c >> 8) & 0xff;
|
|
|
|
|
dev->buffer[2] = c & 0xff;
|
|
|
|
|
dev->buffer[3] = h & 0xff;
|
|
|
|
|
dev->buffer[4] = (s >> 24) & 0xff;
|
|
|
|
|
dev->buffer[5] = (s >> 16) & 0xff;
|
|
|
|
|
dev->buffer[6] = (s >> 8) & 0xff;
|
|
|
|
|
dev->buffer[7] = s & 0xff;
|
2018-04-25 23:51:13 +02:00
|
|
|
}
|
2020-01-15 05:24:33 +01:00
|
|
|
if (fseek(dev->drv->f, dev->drv->base + (i << 9), SEEK_SET) == -1)
|
|
|
|
|
fatal("zip_phase_data_out(): Error seeking\n");
|
|
|
|
|
if (fwrite(dev->buffer, 1, 512, dev->drv->f) != 512)
|
|
|
|
|
fatal("zip_phase_data_out(): Error writing data\n");
|
2018-04-25 23:51:13 +02:00
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case GPCMD_MODE_SELECT_6:
|
|
|
|
|
case GPCMD_MODE_SELECT_10:
|
2020-12-26 02:26:45 +01:00
|
|
|
if (dev->current_cdb[0] == GPCMD_MODE_SELECT_10) {
|
2018-04-25 23:51:13 +02:00
|
|
|
hdr_len = 8;
|
2020-12-26 02:26:45 +01:00
|
|
|
param_list_len = dev->current_cdb[7];
|
|
|
|
|
param_list_len <<= 8;
|
|
|
|
|
param_list_len |= dev->current_cdb[8];
|
|
|
|
|
} else {
|
2018-04-25 23:51:13 +02:00
|
|
|
hdr_len = 4;
|
2020-12-26 02:26:45 +01:00
|
|
|
param_list_len = dev->current_cdb[4];
|
|
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
if (dev->drv->bus_type == ZIP_BUS_SCSI) {
|
2018-04-25 23:51:13 +02:00
|
|
|
if (dev->current_cdb[0] == GPCMD_MODE_SELECT_6) {
|
2018-10-26 06:02:16 +02:00
|
|
|
block_desc_len = dev->buffer[2];
|
2018-04-25 23:51:13 +02:00
|
|
|
block_desc_len <<= 8;
|
2018-10-26 06:02:16 +02:00
|
|
|
block_desc_len |= dev->buffer[3];
|
2018-04-25 23:51:13 +02:00
|
|
|
} else {
|
2018-10-26 06:02:16 +02:00
|
|
|
block_desc_len = dev->buffer[6];
|
2018-04-25 23:51:13 +02:00
|
|
|
block_desc_len <<= 8;
|
2018-10-26 06:02:16 +02:00
|
|
|
block_desc_len |= dev->buffer[7];
|
2018-04-25 23:51:13 +02:00
|
|
|
}
|
|
|
|
|
} else
|
|
|
|
|
block_desc_len = 0;
|
|
|
|
|
|
|
|
|
|
pos = hdr_len + block_desc_len;
|
|
|
|
|
|
|
|
|
|
while(1) {
|
2020-12-26 02:26:45 +01:00
|
|
|
if (pos >= param_list_len) {
|
2018-11-02 20:03:55 +01:00
|
|
|
zip_log("ZIP %i: Buffer has only block descriptor\n", dev->id);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-26 06:02:16 +02:00
|
|
|
page = dev->buffer[pos] & 0x3F;
|
|
|
|
|
page_len = dev->buffer[pos + 1];
|
2018-04-25 23:51:13 +02:00
|
|
|
|
|
|
|
|
pos += 2;
|
|
|
|
|
|
|
|
|
|
if (!(zip_mode_sense_page_flags & (1LL << ((uint64_t) page))))
|
|
|
|
|
error |= 1;
|
|
|
|
|
else {
|
|
|
|
|
for (i = 0; i < page_len; i++) {
|
|
|
|
|
ch = zip_mode_sense_pages_changeable.pages[page][i + 2];
|
2018-10-26 06:02:16 +02:00
|
|
|
val = dev->buffer[pos + i];
|
2018-07-15 01:41:53 +02:00
|
|
|
old_val = dev->ms_pages_saved.pages[page][i + 2];
|
2018-04-25 23:51:13 +02:00
|
|
|
if (val != old_val) {
|
|
|
|
|
if (ch)
|
2018-07-15 01:41:53 +02:00
|
|
|
dev->ms_pages_saved.pages[page][i + 2] = val;
|
2018-04-25 23:51:13 +02:00
|
|
|
else
|
|
|
|
|
error |= 1;
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
}
|
2018-04-25 23:51:13 +02:00
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
pos += page_len;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
if (dev->drv->bus_type == ZIP_BUS_SCSI)
|
2018-04-25 23:51:13 +02:00
|
|
|
val = zip_mode_sense_pages_default_scsi.pages[page][0] & 0x80;
|
|
|
|
|
else
|
|
|
|
|
val = zip_mode_sense_pages_default.pages[page][0] & 0x80;
|
|
|
|
|
if (dev->do_page_save && val)
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_mode_sense_save(dev);
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
if (pos >= dev->total_length)
|
|
|
|
|
break;
|
|
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
if (error) {
|
2018-10-30 13:32:25 +01:00
|
|
|
zip_buf_free(dev);
|
2018-07-15 01:41:53 +02:00
|
|
|
zip_invalid_field_pl(dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-10-30 13:32:25 +01:00
|
|
|
zip_command_stop((scsi_common_t *) dev);
|
2018-04-25 23:51:13 +02:00
|
|
|
return 1;
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
|
2018-04-25 23:51:13 +02:00
|
|
|
|
2018-01-26 22:17:09 +01:00
|
|
|
/* Peform a master init on the entire module. */
|
|
|
|
|
void
|
|
|
|
|
zip_global_init(void)
|
|
|
|
|
{
|
|
|
|
|
/* Clear the global data. */
|
|
|
|
|
memset(zip_drives, 0x00, sizeof(zip_drives));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-10-10 22:33:24 +02:00
|
|
|
static int
|
|
|
|
|
zip_get_max(int ide_has_dma, int type)
|
|
|
|
|
{
|
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
|
|
switch(type) {
|
|
|
|
|
case TYPE_PIO:
|
|
|
|
|
ret = ide_has_dma ? 3 : 0;
|
|
|
|
|
break;
|
|
|
|
|
case TYPE_SDMA:
|
|
|
|
|
default:
|
|
|
|
|
ret = -1;
|
|
|
|
|
break;
|
|
|
|
|
case TYPE_MDMA:
|
2018-10-30 13:32:25 +01:00
|
|
|
ret = ide_has_dma ? 1 : -1;
|
2018-10-10 22:33:24 +02:00
|
|
|
break;
|
|
|
|
|
case TYPE_UDMA:
|
2020-10-13 19:20:14 -03:00
|
|
|
ret = ide_has_dma ? 5 : -1;
|
2018-10-10 22:33:24 +02:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
zip_get_timings(int ide_has_dma, int type)
|
|
|
|
|
{
|
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
|
|
switch(type) {
|
|
|
|
|
case TIMINGS_DMA:
|
|
|
|
|
ret = ide_has_dma ? 0x96 : 0;
|
|
|
|
|
break;
|
|
|
|
|
case TIMINGS_PIO:
|
|
|
|
|
ret = ide_has_dma ? 0xb4 : 0;
|
|
|
|
|
break;
|
|
|
|
|
case TIMINGS_PIO_FC:
|
|
|
|
|
ret = ide_has_dma ? 0xb4 : 0;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
ret = 0;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2018-10-30 13:32:25 +01:00
|
|
|
zip_100_identify(ide_t *ide)
|
|
|
|
|
{
|
|
|
|
|
ide_padstr((char *) (ide->buffer + 23), "E.08", 8); /* Firmware */
|
|
|
|
|
ide_padstr((char *) (ide->buffer + 27), "IOMEGA ZIP 100 ATAPI", 40); /* Model */
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
zip_250_identify(ide_t *ide, int ide_has_dma)
|
|
|
|
|
{
|
|
|
|
|
ide_padstr((char *) (ide->buffer + 23), "42.S", 8); /* Firmware */
|
|
|
|
|
ide_padstr((char *) (ide->buffer + 27), "IOMEGA ZIP 250 ATAPI", 40); /* Model */
|
|
|
|
|
|
|
|
|
|
if (ide_has_dma) {
|
PIC rewrite, proper SMRAM API, complete SiS 471 rewrite and addition of 40x, 460, and 461, changes to mem.c/h, disabled Voodoo memory dumping on exit, bumped SDL Hardware scale quality to 2, bumped IDE/ATAPI drives to ATA-6, finally bumped emulator version to 3.0, redid the bus type ID's to allow for planned ATAPI hard disks, made SST flash set its high mappings to the correct address if the CPU is 16-bit, and added the SiS 401 AMI 486 Clone, AOpen Vi15G, and the Soyo 4SA2 (486 with SiS 496/497 that can boot from CD-ROM), assorted 286+ protected mode fixes (for slightly more accuracy), and fixes to 808x emulation (MS Word 1.0 and 1.10 for DOS now work correctly from floppy).
2020-10-14 23:15:01 +02:00
|
|
|
ide->buffer[80] = 0x70; /*Supported ATA versions : ATA/ATAPI-4 ATA/ATAPI-6*/
|
|
|
|
|
ide->buffer[81] = 0x19; /*Maximum ATA revision supported : ATA/ATAPI-6 T13 1410D revision 3a*/
|
2018-10-30 13:32:25 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
zip_identify(ide_t *ide, int ide_has_dma)
|
2018-10-10 22:33:24 +02:00
|
|
|
{
|
|
|
|
|
zip_t *zip;
|
|
|
|
|
|
2018-10-30 13:32:25 +01:00
|
|
|
zip = (zip_t *) ide->sc;
|
|
|
|
|
|
|
|
|
|
/* ATAPI device, direct-access device, removable media, interrupt DRQ:
|
2018-10-10 22:33:24 +02:00
|
|
|
|
2018-10-30 13:32:25 +01:00
|
|
|
Using (2 << 5) below makes the ASUS P/I-P54TP4XE misdentify the ZIP drive
|
2018-10-10 22:33:24 +02:00
|
|
|
as a LS-120. */
|
2018-10-30 13:32:25 +01:00
|
|
|
ide->buffer[0] = 0x8000 | (0 << 8) | 0x80 | (1 << 5);
|
2018-10-10 22:33:24 +02:00
|
|
|
ide_padstr((char *) (ide->buffer + 10), "", 20); /* Serial Number */
|
|
|
|
|
ide->buffer[49] = 0x200; /* LBA supported */
|
|
|
|
|
ide->buffer[126] = 0xfffe; /* Interpret zero byte count limit as maximum length */
|
|
|
|
|
|
|
|
|
|
if (zip_drives[zip->id].is_250)
|
|
|
|
|
zip_250_identify(ide, ide_has_dma);
|
|
|
|
|
else
|
|
|
|
|
zip_100_identify(ide);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-10-19 19:10:12 +02:00
|
|
|
static void
|
2018-10-10 22:33:24 +02:00
|
|
|
zip_drive_reset(int c)
|
|
|
|
|
{
|
2018-10-26 04:47:21 +02:00
|
|
|
zip_t *dev;
|
2018-10-10 22:33:24 +02:00
|
|
|
scsi_device_t *sd;
|
|
|
|
|
ide_t *id;
|
2021-07-22 20:13:44 +02:00
|
|
|
uint8_t scsi_bus = (zip_drives[c].scsi_device_id >> 4) & 0x0f;
|
|
|
|
|
uint8_t scsi_id = zip_drives[c].scsi_device_id & 0x0f;
|
2018-10-10 22:33:24 +02:00
|
|
|
|
2018-10-26 04:47:21 +02:00
|
|
|
if (!zip_drives[c].priv) {
|
|
|
|
|
zip_drives[c].priv = (zip_t *) malloc(sizeof(zip_t));
|
|
|
|
|
memset(zip_drives[c].priv, 0, sizeof(zip_t));
|
2018-10-10 22:33:24 +02:00
|
|
|
}
|
|
|
|
|
|
2018-10-26 04:47:21 +02:00
|
|
|
dev = (zip_t *) zip_drives[c].priv;
|
|
|
|
|
|
|
|
|
|
dev->id = c;
|
2021-03-23 06:32:18 +01:00
|
|
|
dev->cur_lun = SCSI_LUN_USE_CDB;
|
2018-10-10 22:33:24 +02:00
|
|
|
|
|
|
|
|
if (zip_drives[c].bus_type == ZIP_BUS_SCSI) {
|
|
|
|
|
/* SCSI ZIP, attach to the SCSI bus. */
|
2021-07-22 20:13:44 +02:00
|
|
|
sd = &scsi_devices[scsi_bus][scsi_id];
|
2018-10-10 22:33:24 +02:00
|
|
|
|
2018-10-30 13:32:25 +01:00
|
|
|
sd->sc = (scsi_common_t *) dev;
|
2018-10-10 22:33:24 +02:00
|
|
|
sd->command = zip_command;
|
|
|
|
|
sd->request_sense = zip_request_sense_for_scsi;
|
|
|
|
|
sd->reset = zip_reset;
|
2018-10-31 12:23:49 +01:00
|
|
|
sd->phase_data_out = zip_phase_data_out;
|
2018-10-30 13:32:25 +01:00
|
|
|
sd->command_stop = zip_command_stop;
|
2018-10-10 22:33:24 +02:00
|
|
|
sd->type = SCSI_REMOVABLE_DISK;
|
|
|
|
|
} else if (zip_drives[c].bus_type == ZIP_BUS_ATAPI) {
|
|
|
|
|
/* ATAPI CD-ROM, attach to the IDE bus. */
|
Added the IBM 5161 ISA expansion for PC and XT;
Cleaned up the parallel port emulation, added IRQ support, and made enabling/disabling per port;
Added the Award 430NX and the Intel Classic/PCI (Alfredo, 420TX);
Finished the 586MC1;
Added 8087 emulation;
Moved Cyrix 6x86'es to the Dev branch;
Sanitized/cleaned up memregs.c/h and intel.c/h;
Split the chipsets from machines and sanitized Port 92 emulation;
Added support for the 15bpp mode to the Compaq ATI 28800;
Moved the MR 386DX and 486 machines to the Dev branch;
Ported the new dynamic recompiler from PCem, but it remains in Dev branch until after v2.00;
Ported the new timer code from PCem;
Cleaned up the CPU table of unused stuff and better optimized its structure;
Ported the Open-XT and Open-AT from VARCem, the Open-AT is in the Dev branch;
Ported the XT MFM controller rewrite and adding of more controllers (incl. two RLL ones), from VARCem;
Added the AHA-1540A and the BusTek BT-542B;
Moved the Sumo SCSI-AT to the Dev branch;
Minor IDE, FDC, and floppy drive code clean-ups;
Made NCR 5380/53C400-based cards' BIOS address configurable;
Got rid of the legacy romset variable;
Unified (video) buffer and buffer32 into one and make the unified buffer 32-bit;
Added the Amstead PPC512 per PCem patch by John Elliott;
Switched memory mapping granularity from 16k to 4k (less than 1k not possible due to internal pages);
Rewrote the CL-GD 54xx blitter, fixes Win-OS/2 on the 54x6 among other thing;
Added the Image Manager 1024 and Professional Graphics Controller per PCem patch by John Elliott and work done on VARCem;
Added Headland HT-216, GC-205 and Video 7 VGA 1024i emulation based on PCem commit;
Implemented the fuction keys for the Toshiba T1000/T1200/T3100 enhancement;
Amstrad MegaPC does now works correctly with non-internal graphics card;
The SLiRP code no longer casts a packed struct type to a non-packed struct type;
The Xi8088 and PB410a no longer hang on 86Box when PS/2 mouse is not present;
The S3 Virge on BeOS is no longer broken (was broken by build #1591);
OS/2 2.0 build 6.167 now sees key presses again;
Xi8088 now work on CGA again;
86F images converted from either the old or new variants of the HxC MFM format now work correctly;
Hardware interrupts with a vector of 0xFF are now handled correctly;
OPTi 495SX boards no longer incorrectly have 64 MB maximum RAM when 32 MB is correct;
Fixed VNC keyboard input bugs;
Fixed AT RTC periodic interrupt - Chicago 58s / 73f / 73g / 81 MIDI play no longer hangs with the build's own VTD driver;
Fixed mouse polling with internal mice - Amstrad and Olivetti mice now work correctly;
Triones ATAPI DMA driver now correctly reads a file at the end of a CD image with a sectors number not divisible by 4;
Compaq Portable now works with all graphics cards;
Fixed various MDSI Genius bugs;
Added segment limit checks and improved page fault checks for several CPU instructions - Memphis 15xx WINSETUP and Chicago 58s WINDISK.CPL no longer issue a GPF, and some S3 drivers that used to have glitches, now work correctly;
Further improved the 808x emulation, also fixes the noticably choppy sound when using 808x CPU's, also fixes #355;
OS/2 installer no logner locks up on splash screen on PS/2 Model 70 and 80, fixes #400.
Fixed several Amstead bugs, GEM no longer crashes on the Amstrad 1640, fixes #391.
Ported John Elliott's Amstrad fixes and improvement from PCem, and fixed the default language so it's correctly Engliish, fixes #278, fixes #389.
Fixed a minor IDE timing bug, fixes #388.
Fixed Toshiba T1000 RAM issues, fixes #379.
Fixed EGA/(S)VGA overscan border handling, fixes #378;
Got rid of the now long useless IDE channel 2 auto-removal, fixes #370;
Fixed the BIOS files used by the AMSTRAD PC1512, fixes #366;
Ported the Unicode CD image file name fix from VARCem, fixes #365;
Fixed high density floppy disks on the Xi8088, fixes #359;
Fixed some bugs in the Hercules emulation, fixes #346, fixes #358;
Fixed the SCSI hard disk mode sense pages, fixes #356;
Removed the AMI Unknown 386SX because of impossibility to identify the chipset, closes #349;
Fixed bugs in the serial mouse emulation, fixes #344;
Compiled 86Box binaries now include all the required .DLL's, fixes #341;
Made some combo boxes in the Settings dialog slightly wider, fixes #276.
2019-09-20 14:02:30 +02:00
|
|
|
id = ide_get_drive(zip_drives[c].ide_channel);
|
2018-10-10 22:33:24 +02:00
|
|
|
/* If the IDE channel is initialized, we attach to it,
|
|
|
|
|
otherwise, we do nothing - it's going to be a drive
|
|
|
|
|
that's not attached to anything. */
|
|
|
|
|
if (id) {
|
2018-10-30 13:32:25 +01:00
|
|
|
id->sc = (scsi_common_t *) dev;
|
2018-10-10 22:33:24 +02:00
|
|
|
id->get_max = zip_get_max;
|
|
|
|
|
id->get_timings = zip_get_timings;
|
|
|
|
|
id->identify = zip_identify;
|
|
|
|
|
id->stop = NULL;
|
2018-10-31 12:23:49 +01:00
|
|
|
id->packet_command = zip_command;
|
2018-10-10 22:33:24 +02:00
|
|
|
id->device_reset = zip_reset;
|
2018-10-30 13:32:25 +01:00
|
|
|
id->phase_data_out = zip_phase_data_out;
|
|
|
|
|
id->command_stop = zip_command_stop;
|
2018-10-31 12:23:49 +01:00
|
|
|
id->bus_master_error = zip_bus_master_error;
|
2018-10-10 22:33:24 +02:00
|
|
|
id->interrupt_drq = 1;
|
|
|
|
|
|
|
|
|
|
ide_atapi_attach(id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2018-01-26 22:17:09 +01:00
|
|
|
void
|
2018-03-17 20:32:20 +01:00
|
|
|
zip_hard_reset(void)
|
2018-01-26 22:17:09 +01:00
|
|
|
{
|
2018-10-26 04:47:21 +02:00
|
|
|
zip_t *dev;
|
2018-01-26 22:17:09 +01:00
|
|
|
int c;
|
2021-07-22 20:13:44 +02:00
|
|
|
uint8_t scsi_id, scsi_bus;
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2018-07-15 01:41:53 +02:00
|
|
|
for (c = 0; c < ZIP_NUM; c++) {
|
2018-10-10 22:33:24 +02:00
|
|
|
if ((zip_drives[c].bus_type == ZIP_BUS_ATAPI) || (zip_drives[c].bus_type == ZIP_BUS_SCSI)) {
|
2018-04-25 23:51:13 +02:00
|
|
|
zip_log("ZIP hard_reset drive=%d\n", c);
|
|
|
|
|
|
2021-07-22 20:13:44 +02:00
|
|
|
if (zip_drives[c].bus_type == ZIP_BUS_SCSI) {
|
|
|
|
|
scsi_bus = (zip_drives[c].scsi_device_id >> 4) & 0x0f;
|
|
|
|
|
scsi_id = zip_drives[c].scsi_device_id & 0x0f;
|
|
|
|
|
|
|
|
|
|
/* Make sure to ignore any SCSI ZIP drive that has an out of range SCSI bus. */
|
|
|
|
|
if (scsi_bus >= SCSI_BUS_MAX)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
/* Make sure to ignore any SCSI ZIP drive that has an out of range ID. */
|
|
|
|
|
if (scsi_id >= SCSI_ID_MAX)
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2018-10-10 22:33:24 +02:00
|
|
|
|
|
|
|
|
/* Make sure to ignore any ATAPI ZIP drive that has an out of range IDE channel. */
|
|
|
|
|
if ((zip_drives[c].bus_type == ZIP_BUS_ATAPI) && (zip_drives[c].ide_channel > 7))
|
|
|
|
|
continue;
|
|
|
|
|
|
2018-10-19 19:10:12 +02:00
|
|
|
zip_drive_reset(c);
|
2018-04-25 23:51:13 +02:00
|
|
|
|
2018-10-26 04:47:21 +02:00
|
|
|
dev = (zip_t *) zip_drives[c].priv;
|
|
|
|
|
|
|
|
|
|
dev->id = c;
|
|
|
|
|
dev->drv = &zip_drives[c];
|
2018-07-15 01:41:53 +02:00
|
|
|
|
2018-10-26 04:47:21 +02:00
|
|
|
zip_init(dev);
|
2018-01-26 22:17:09 +01:00
|
|
|
|
2021-03-14 20:35:01 +01:00
|
|
|
if (strlen(zip_drives[c].image_path))
|
2018-10-26 04:47:21 +02:00
|
|
|
zip_load(dev, zip_drives[c].image_path);
|
2018-03-17 20:32:20 +01:00
|
|
|
|
2018-10-26 04:47:21 +02:00
|
|
|
zip_mode_sense_load(dev);
|
2018-10-10 22:33:24 +02:00
|
|
|
|
|
|
|
|
if (zip_drives[c].bus_type == ZIP_BUS_SCSI)
|
|
|
|
|
zip_log("SCSI ZIP drive %i attached to SCSI ID %i\n", c, zip_drives[c].scsi_device_id);
|
|
|
|
|
else if (zip_drives[c].bus_type == ZIP_BUS_ATAPI)
|
|
|
|
|
zip_log("ATAPI ZIP drive %i attached to IDE channel %i\n", c, zip_drives[c].ide_channel);
|
2018-04-25 23:51:13 +02:00
|
|
|
}
|
2018-01-26 22:17:09 +01:00
|
|
|
}
|
|
|
|
|
}
|
2018-07-15 01:41:53 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
zip_close(void)
|
|
|
|
|
{
|
|
|
|
|
zip_t *dev;
|
|
|
|
|
int c;
|
2021-07-22 20:13:44 +02:00
|
|
|
uint8_t scsi_bus, scsi_id;
|
2018-07-15 01:41:53 +02:00
|
|
|
|
|
|
|
|
for (c = 0; c < ZIP_NUM; c++) {
|
2021-07-22 20:13:44 +02:00
|
|
|
if (zip_drives[c].bus_type == ZIP_BUS_SCSI) {
|
|
|
|
|
scsi_bus = (zip_drives[c].scsi_device_id >> 4) & 0x0f;
|
|
|
|
|
scsi_id = zip_drives[c].scsi_device_id & 0x0f;
|
|
|
|
|
|
|
|
|
|
memset(&scsi_devices[scsi_bus][scsi_id], 0x00, sizeof(scsi_device_t));
|
|
|
|
|
}
|
2020-06-14 21:59:45 +02:00
|
|
|
|
2018-10-26 04:47:21 +02:00
|
|
|
dev = (zip_t *) zip_drives[c].priv;
|
2018-07-15 01:41:53 +02:00
|
|
|
|
|
|
|
|
if (dev) {
|
2018-10-27 22:19:39 +02:00
|
|
|
zip_disk_unload(dev);
|
2018-07-15 01:41:53 +02:00
|
|
|
|
2018-10-26 04:47:21 +02:00
|
|
|
free(dev);
|
|
|
|
|
zip_drives[c].priv = NULL;
|
2018-07-15 01:41:53 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|