require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&SCSI_SCSICONF_H)) {
    eval 'sub SCSI_SCSICONF_H () {1;}' unless defined(&SCSI_SCSICONF_H);
    require 'sys/queue.ph';
    require 'sys/timeout.ph';
    require 'machine/cpu.ph';
    require 'scsi/scsi_debug.ph';
    eval 'sub SUCCESSFULLY_QUEUED () {0;}' unless defined(&SUCCESSFULLY_QUEUED);
    eval 'sub TRY_AGAIN_LATER () {1;}' unless defined(&TRY_AGAIN_LATER);
    eval 'sub COMPLETE () {2;}' unless defined(&COMPLETE);
    eval 'sub ESCAPE_NOT_SUPPORTED () {3;}' unless defined(&ESCAPE_NOT_SUPPORTED);
    eval 'sub NO_CCB () {4;}' unless defined(&NO_CCB);
    eval 'sub SDEV_REMOVABLE () {0x1;}' unless defined(&SDEV_REMOVABLE);
    eval 'sub SDEV_MEDIA_LOADED () {0x2;}' unless defined(&SDEV_MEDIA_LOADED);
    eval 'sub SDEV_WAITING () {0x4;}' unless defined(&SDEV_WAITING);
    eval 'sub SDEV_OPEN () {0x8;}' unless defined(&SDEV_OPEN);
    eval 'sub SDEV_DBX () {0xf0;}' unless defined(&SDEV_DBX);
    eval 'sub SDEV_EJECTING () {0x100;}' unless defined(&SDEV_EJECTING);
    eval 'sub SDEV_ATAPI () {0x200;}' unless defined(&SDEV_ATAPI);
    eval 'sub SDEV_2NDBUS () {0x400;}' unless defined(&SDEV_2NDBUS);
    eval 'sub SDEV_UMASS () {0x800;}' unless defined(&SDEV_UMASS);
    eval 'sub SDEV_VIRTUAL () {0x1000;}' unless defined(&SDEV_VIRTUAL);
    eval 'sub SDEV_AUTOSAVE () {0x1;}' unless defined(&SDEV_AUTOSAVE);
    eval 'sub SDEV_NOSYNC () {0x2;}' unless defined(&SDEV_NOSYNC);
    eval 'sub SDEV_NOWIDE () {0x4;}' unless defined(&SDEV_NOWIDE);
    eval 'sub SDEV_NOTAGS () {0x8;}' unless defined(&SDEV_NOTAGS);
    eval 'sub SDEV_NOSYNCCACHE () {0x100;}' unless defined(&SDEV_NOSYNCCACHE);
    eval 'sub ADEV_NOSENSE () {0x200;}' unless defined(&ADEV_NOSENSE);
    eval 'sub ADEV_LITTLETOC () {0x400;}' unless defined(&ADEV_LITTLETOC);
    eval 'sub ADEV_NOCAPACITY () {0x800;}' unless defined(&ADEV_NOCAPACITY);
    eval 'sub ADEV_NOTUR () {0x1000;}' unless defined(&ADEV_NOTUR);
    eval 'sub ADEV_NODOORLOCK () {0x2000;}' unless defined(&ADEV_NODOORLOCK);
    eval 'sub SDEV_ONLYBIG () {0x4000;}' unless defined(&SDEV_ONLYBIG);
    eval 'sub SCSI_NOSLEEP () {0x1;}' unless defined(&SCSI_NOSLEEP);
    eval 'sub SCSI_POLL () {0x2;}' unless defined(&SCSI_POLL);
    eval 'sub SCSI_AUTOCONF () {0x3;}' unless defined(&SCSI_AUTOCONF);
    eval 'sub SCSI_USER () {0x4;}' unless defined(&SCSI_USER);
    eval 'sub ITSDONE () {0x8;}' unless defined(&ITSDONE);
    eval 'sub SCSI_SILENT () {0x20;}' unless defined(&SCSI_SILENT);
    eval 'sub SCSI_IGNORE_NOT_READY () {0x40;}' unless defined(&SCSI_IGNORE_NOT_READY);
    eval 'sub SCSI_IGNORE_MEDIA_CHANGE () {0x80;}' unless defined(&SCSI_IGNORE_MEDIA_CHANGE);
    eval 'sub SCSI_IGNORE_ILLEGAL_REQUEST () {0x100;}' unless defined(&SCSI_IGNORE_ILLEGAL_REQUEST);
    eval 'sub SCSI_RESET () {0x200;}' unless defined(&SCSI_RESET);
    eval 'sub SCSI_DATA_UIO () {0x400;}' unless defined(&SCSI_DATA_UIO);
    eval 'sub SCSI_DATA_IN () {0x800;}' unless defined(&SCSI_DATA_IN);
    eval 'sub SCSI_DATA_OUT () {0x1000;}' unless defined(&SCSI_DATA_OUT);
    eval 'sub SCSI_TARGET () {0x2000;}' unless defined(&SCSI_TARGET);
    eval 'sub SCSI_ESCAPE () {0x4000;}' unless defined(&SCSI_ESCAPE);
    eval 'sub SCSI_URGENT () {0x8000;}' unless defined(&SCSI_URGENT);
    eval 'sub SCSI_PRIVATE () {0xf0000;}' unless defined(&SCSI_PRIVATE);
    eval 'sub SCSI_OP_TARGET () {0x1;}' unless defined(&SCSI_OP_TARGET);
    eval 'sub SCSI_OP_RESET () {0x2;}' unless defined(&SCSI_OP_RESET);
    eval 'sub SCSI_OP_BDINFO () {0x3;}' unless defined(&SCSI_OP_BDINFO);
    eval 'sub XS_NOERROR () {0;}' unless defined(&XS_NOERROR);
    eval 'sub XS_SENSE () {1;}' unless defined(&XS_SENSE);
    eval 'sub XS_DRIVER_STUFFUP () {2;}' unless defined(&XS_DRIVER_STUFFUP);
    eval 'sub XS_SELTIMEOUT () {3;}' unless defined(&XS_SELTIMEOUT);
    eval 'sub XS_TIMEOUT () {4;}' unless defined(&XS_TIMEOUT);
    eval 'sub XS_BUSY () {5;}' unless defined(&XS_BUSY);
    eval 'sub XS_SHORTSENSE () {6;}' unless defined(&XS_SHORTSENSE);
    eval 'sub XS_RESET () {8;}' unless defined(&XS_RESET);
    eval 'sub TEST_READY_RETRIES () {5;}' unless defined(&TEST_READY_RETRIES);
    eval 'sub _lto2b {
        my($val,$bytes) = @_;
	    eval q(;  &u_int8_t *$bytes; { $bytes->[0] = ($val >> 8) & 0xff; $bytes->[1] = $val & 0xff; });
    }' unless defined(&_lto2b);
    eval 'sub _lto3b {
        my($val,$bytes) = @_;
	    eval q(;  &u_int8_t *$bytes; { $bytes->[0] = ($val >> 16) & 0xff; $bytes->[1] = ($val >> 8) & 0xff; $bytes->[2] = $val & 0xff; });
    }' unless defined(&_lto3b);
    eval 'sub _lto4b {
        my($val,$bytes) = @_;
	    eval q(;  &u_int8_t *$bytes; { $bytes->[0] = ($val >> 24) & 0xff; $bytes->[1] = ($val >> 16) & 0xff; $bytes->[2] = ($val >> 8) & 0xff; $bytes->[3] = $val & 0xff; });
    }' unless defined(&_lto4b);
    eval 'sub _lto8b {
        my($val,$bytes) = @_;
	    eval q(;  &u_int8_t *$bytes; { $bytes->[0] = ($val >> 56) & 0xff; $bytes->[1] = ($val >> 48) & 0xff; $bytes->[2] = ($val >> 40) & 0xff; $bytes->[3] = ($val >> 32) & 0xff; $bytes->[4] = ($val >> 24) & 0xff; $bytes->[5] = ($val >> 16) & 0xff; $bytes->[6] = ($val >> 8) & 0xff; $bytes->[7] = $val & 0xff; });
    }' unless defined(&_lto8b);
    eval 'sub _2btol {
        my($bytes) = @_;
	    eval q(*$bytes; {  &u_int32_t  &rv;  &rv = ($bytes->[0] << 8) | $bytes->[1]; ( &rv); });
    }' unless defined(&_2btol);
    eval 'sub _3btol {
        my($bytes) = @_;
	    eval q(*$bytes; {  &u_int32_t  &rv;  &rv = ($bytes->[0] << 16) | ($bytes->[1] << 8) | $bytes->[2]; ( &rv); });
    }' unless defined(&_3btol);
    eval 'sub _4btol {
        my($bytes) = @_;
	    eval q(*$bytes; {  &u_int32_t  &rv;  &rv = ($bytes->[0] << 24) | ($bytes->[1] << 16) | ($bytes->[2] << 8) | $bytes->[3]; ( &rv); });
    }' unless defined(&_4btol);
    eval 'sub _5btol {
        my($bytes) = @_;
	    eval q(*$bytes; {  &u_int64_t  &rv;  &rv = (( &u_int64_t)$bytes->[0] << 32) | (( &u_int64_t)$bytes->[1] << 24) | (( &u_int64_t)$bytes->[2] << 16) | (( &u_int64_t)$bytes->[3] << 8) | ( &u_int64_t)$bytes->[4]; ( &rv); });
    }' unless defined(&_5btol);
    eval 'sub _8btol {
        my($bytes) = @_;
	    eval q(*$bytes; {  &u_int64_t  &rv;  &rv = ((( &u_int64_t)$bytes->[0]) << 56) | ((( &u_int64_t)$bytes->[1]) << 48) | ((( &u_int64_t)$bytes->[2]) << 40) | ((( &u_int64_t)$bytes->[3]) << 32) | ((( &u_int64_t)$bytes->[4]) << 24) | ((( &u_int64_t)$bytes->[5]) << 16) | ((( &u_int64_t)$bytes->[6]) << 8) | (( &u_int64_t)$bytes->[7]); ( &rv); });
    }' unless defined(&_8btol);
    eval 'sub _lto2l {
        my($val,$bytes) = @_;
	    eval q(;  &u_int8_t *$bytes; { $bytes->[0] = $val & 0xff; $bytes->[1] = ($val >> 8) & 0xff; });
    }' unless defined(&_lto2l);
    eval 'sub _lto3l {
        my($val,$bytes) = @_;
	    eval q(;  &u_int8_t *$bytes; { $bytes->[0] = $val & 0xff; $bytes->[1] = ($val >> 8) & 0xff; $bytes->[2] = ($val >> 16) & 0xff; });
    }' unless defined(&_lto3l);
    eval 'sub _lto4l {
        my($val,$bytes) = @_;
	    eval q(;  &u_int8_t *$bytes; { $bytes->[0] = $val & 0xff; $bytes->[1] = ($val >> 8) & 0xff; $bytes->[2] = ($val >> 16) & 0xff; $bytes->[3] = ($val >> 24) & 0xff; });
    }' unless defined(&_lto4l);
    eval 'sub _2ltol {
        my($bytes) = @_;
	    eval q(*$bytes; {  &u_int32_t  &rv;  &rv = $bytes->[0] | ($bytes->[1] << 8); ( &rv); });
    }' unless defined(&_2ltol);
    eval 'sub _3ltol {
        my($bytes) = @_;
	    eval q(*$bytes; {  &u_int32_t  &rv;  &rv = $bytes->[0] | ($bytes->[1] << 8) | ($bytes->[2] << 16); ( &rv); });
    }' unless defined(&_3ltol);
    eval 'sub _4ltol {
        my($bytes) = @_;
	    eval q(*$bytes; {  &u_int32_t  &rv;  &rv = $bytes->[0] | ($bytes->[1] << 8) | ($bytes->[2] << 16) | ($bytes->[3] << 24); ( &rv); });
    }' unless defined(&_4ltol);
    eval 'sub SCSISPC {
        my($x) = @_;
	    eval q(( $version_to_spc[($x) &  &SID_ANSII]));
    }' unless defined(&SCSISPC);
}
1;
