/*
* This file contains the device dependent part of an experimental disk
* and tape driver for the Adaptec 154x SCSI Host Adapter family, written
* by James da Silva (jds@cs.umd.edu).
*
* I wrote this driver using the technical documentation for the AHA available
* from the Adaptec BBS at 1-408-945-7727, and from the SCSI standard drafts
* available on NCR's SCSI BBS at 1-316-636-8700. I suggest you get both
* these documents if you want to understand and hack this code.
*
* This code has been extensively modified by Kees J. Bot (kjb@cs.vu.nl) to
* a point that James will barely recognize it as his. It is completely
* remodeled and doubled in both size and functionality. It is no longer
* considered experimental either.
*
* The supported device numbers are as follows:
* # Name Device
* 0 sd0 disk 0, entire disk
* 1 sd1 disk 0, partition 1
* 2 sd2 disk 0, partition 2
* 3 sd3 disk 0, partition 3
* 4 sd4 disk 0, partition 4
* 5 sd5 disk 1, entire disk
* 6 sd6 disk 1, partition 1
* .. .... ....
* 39 sd39 disk 7, partition 4
*
* 64 nrst0 tape 0, no rewind
* 65 rst0 tape 0, rewind
* 66 nrst1 tape 1, no rewind
* .. .... ....
* 79 rst7 tape 7, rewind
*
* 128 sd1a disk 0, partition 1, subpartition 1
* 129 sd1b disk 0, partition 1, subpartition 2
* ... .... ....
* 255 sd39d disk 7, partition 4, subpartition 4
*
* The translation of device numbers to targets and logical units is very
* simple: The target is the same as the disk or tape number, the logical
* unit is always zero. Devices with logical unit numbers other then zero
* are virtually extinct. If you happen to have such a dinosaur device,
* then you can reprogram (e.g.) sd35 and st7 to target 0, lun 1 from the
* Boot Monitor with 'sd35=0,1'.
*
*
* The file contains one entry point:
*
* aha_scsi_task: main entry when system is brought up
*
*
* Changes:
* 5 May 1992 by Kees J. Bot: device dependent/independent split.
* 7 Jul 1992 by Kees J. Bot: speedup & features.
* 28 Dec 1992 by Kees J. Bot: completely remodeled & virtual memory.
* 18 Sep 1994 by Kees J. Bot: removed "send 2 commands at once" junk.
*/
#include "kernel.h"
#include "driver.h"
#include "drvlib.h"
#if ENABLE_ADAPTEC_SCSI
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/mtio.h>
#include "assert.h"
INIT_ASSERT
#ifndef AHA_DEBUG
#define AHA_DEBUG 0 /* 1=print all SCSI errors | 2=dump ccb
* 4=show request | 8=dump scsi cmd
*/
#endif
/* AHA-154x port addresses */
#define AHA_BASEREG 0x330 /* default base port address of AHA registers */
#define AHA_CNTLREG aha_basereg+0 /* Control Register - write only */
#define AHA_STATREG aha_basereg+0 /* Status Register - read only */
#define AHA_DATAREG aha_basereg+1 /* Data Register - read/write */
#define AHA_INTRREG aha_basereg+2 /* Interrupt Flags - read only */
/* control register bits */
#define AHA_HRST 0x80 /* bit 7 - Hard Reset */
#define AHA_SRST 0x40 /* bit 6 - Soft Reset */
#define AHA_IRST 0x20 /* bit 5 - Interrupt Reset */
#define AHA_SCRST 0x10 /* bit 4 - SCSI Bus Reset */
/* 0x08 * bit 3 - Reserved (set to 0) */
/* 0x04 * bit 2 - Reserved (set to 0) */
/* 0x02 * bit 1 - Reserved (set to 0) */
/* 0x01 * bit 0 - Reserved (set to 0) */
/* status register bits */
#define AHA_STST 0x80 /* bit 7 - Self Test in Progress */
#define AHA_DIAGF 0x40 /* bit 6 - Internal Diagnostic Failure */
#define AHA_INIT 0x20 /* bit 5 - Mailbox Initialization Required */
#define AHA_IDLE 0x10 /* bit 4 - SCSI Host Adapter Idle */
#define AHA_CDF 0x08 /* bit 3 - Command/Data Out Port Full */
#define AHA_DF 0x04 /* bit 2 - Data In Port Full */
/* 0x02 * bit 1 - Reserved */
#define AHA_INVDCMD 0x01 /* bit 0 - Invalid Host Adapter Command */
/* interrupt flags register bits */
#define AHA_ANYINT 0x80 /* bit 7 - Any Interrupt */
/* 0x40 * bit 6 - Reserved */
/* 0x20 * bit 5 - Reserved */
/* 0x10 * bit 4 - Reserved */
#define AHA_SCRD 0x08 /* bit 3 - SCSI Reset Detected */
#define AHA_HACC 0x04 /* bit 2 - Host Adapter Command Complete */
#define AHA_MBOE 0x02 /* bit 1 - Mailbox Out Empty */
#define AHA_MBIF 0x01 /* bit 0 - Mailbox In Full */
/* AHA board models */
#define AHA1540 0x30
#define AHA1540A 0x41
#define AHA1640 0x42
#define AHA1740 0x43
#define AHA1540C 0x44
#define AHA1540CF 0x45
#define BT545 0x20 /* BusLogic */
/* AHA Command Codes */
#define AHACOM_INITBOX 0x01 /* Mailbox Initialization */
#define AHACOM_STARTSCSI 0x02 /* Start SCSI Command */
#define AHACOM_HAINQUIRY 0x04 /* Host Adapter Inquiry */
#define AHACOM_SETIMEOUT 0x06 /* Set SCSI selection time out value */
#define AHACOM_BUSON 0x07 /* Set DMA bus on time */
#define AHACOM_BUSOFF 0x08 /* Set DMA bus off time */
#define AHACOM_SPEED 0x09 /* Set DMA transfer speed */
#define AHACOM_INSTALLED 0x0A /* Return Installed Devices */
#define AHACOM_GETCONFIG 0x0B /* Return Configuration Data */
#define AHACOM_GETSETUP 0x0D /* Return Setup Data */
#define AHACOM_EXTBIOS 0x28 /* Return Extended BIOS Info */
#define AHACOM_MBOX_ENABLE 0x29 /* Enable Mailbox Interface */
/* AHA Mailbox Out Codes */
#define AHA_MBOXFREE 0x00 /* Mailbox is Free */
#define AHA_MBOXSTART 0x01 /* Start Command */
#define AHA_MBOXABORT 0x02 /* Abort Command */
/* AHA Mailbox In Codes */
#define AHA_MBOXOK 0x01 /* Command Completed Successfully */
#define AHA_MBOXERR 0x04 /* Command Completed with Error */
/* Basic types */
typedef unsigned char byte;
typedef byte big16[2]; /* 16 bit big-endian values */
typedef byte big24[3]; /* AHA uses 24 bit, big-endian values! */
typedef byte big32[4]; /* Group 1 SCSI commands use 32 bit big-endian values */
/* AHA Mailbox structure */
typedef struct {
byte status; /* Command or Status byte */
big24 ccbptr; /* pointer to Command Control Block */
} mailbox_t;
/* SCSI Group 0 Command Descriptor Block structure */
typedef union {
struct { /* Disk i/o commands */
byte d_scsi_op; /* SCSI Operation Code */
# define SCSI_UNITRDY 0x00 /* Test Unit Ready */
# define SCSI_REWIND 0x01 /* Rewind */
# define SCSI_REQSENSE 0x03 /* Request sense */
# define SCSI_RDLIMITS 0x05 /* Read Block Limits Opcode */
# define SCSI_READ 0x08 /* Group 0 Read Opcode */
# define SCSI_WRITE 0x0A /* Group 0 Write Opcode */
# define SCSI_WREOF 0x10 /* Write File Marks */
# define SCSI_SPACE 0x11 /* Space over filemarks/blocks */
# define SCSI_INQUIRY 0x12 /* Group 0 Inquiry Opcode */
# define SCSI_MDSELECT 0x15 /* Group 0 Mode Select Opcode */
# define SCSI_ERASE 0x19 /* Erase Tape */
# define SCSI_MDSENSE 0x1A /* Group 0 Mode Sense Opcode */
# define SCSI_STRTSTP 0x1B /* Start/Stop */
# define SCSI_LOADUNLD 0x1B /* Load/Unload */
big24 d_lba; /* LUN and logical block address */
byte d_nblocks; /* Transfer size in blocks */
byte d_control; /* Reserved and link bit fields, set to 0 */
} d;
struct { /* Tape i/o commands */
byte t_scsi_op; /* SCSI Operation Code */
byte t_fixed; /* Fixed length? */
big24 t_trlength; /* Transfer length */
byte t_control; /* reserved and link bit fields, set to 0 */
} t;
} cdb0_t;
#define scsi_op d.d_scsi_op
#define lba d.d_lba
#define nblocks d.d_nblocks
#define fixed t.t_fixed
#define trlength t.t_trlength
#define control d.d_control
/* SCSI Group 1 Command Descriptor Block structure */
typedef union {
struct { /* Disk i/o commands */
byte d_scsi_op; /* SCSI Operation Code */
# define SCSI_CAPACITY 0x25 /* Read Capacity */
# define SCSI_READ1 0x28 /* Group 1 Read Opcode */
# define SCSI_WRITE1 0x2A /* Group 1 Write Opcode */
byte d_lunra; /* LUN etc. */
big32 d_lba; /* Logical Block Address */
byte reserved;
big16 d_nblocks; /* transf
没有合适的资源?快使用搜索试试~ 我知道了~
minix2源代码.zip
共999个文件
c:550个
s:293个
h:82个
5星 · 超过95%的资源 需积分: 3 53 下载量 93 浏览量
2007-05-12
23:18:30
上传
评论
收藏 1.07MB ZIP 举报
温馨提示
minix2源代码.zip
资源详情
资源评论
资源推荐
收起资源包目录
minix2源代码.zip (999个子文件)
.ashrc 357B
.ellepro.b1 300B
aha_scsi.c 65KB
tty.c 51KB
tcp.c 48KB
dp8390.c 47KB
floppy.c 44KB
system.c 40KB
mcd.c 40KB
tcp_recv.c 37KB
boot.c 36KB
udp.c 35KB
test18.c 34KB
test17.c 32KB
tcp_send.c 30KB
console.c 29KB
rs232.c 29KB
xt_wini.c 29KB
regexp.c 29KB
at_wini.c 27KB
arp.c 27KB
ip_write.c 27KB
test8.c 27KB
editline.c 24KB
test15.c 24KB
test25.c 24KB
esdi_wini.c 24KB
edparams.c 23KB
signal.c 22KB
installboot.c 22KB
clock.c 22KB
test29.c 21KB
eth.c 21KB
exec.c 21KB
res_send.c 21KB
proc.c 20KB
test21.c 20KB
test20.c 20KB
test7.c 19KB
icmp.c 19KB
test33.c 19KB
sb16_dsp.c 19KB
ip_read.c 19KB
sr.c 19KB
buf.c 18KB
test34.c 18KB
ps.c 18KB
read.c 18KB
bootimage.c 17KB
open.c 16KB
ext_comp.c 16KB
keyboard.c 16KB
link.c 15KB
bios_wini.c 15KB
test19.c 15KB
cache.c 14KB
inode.c 14KB
test28.c 14KB
rcmd.c 13KB
printer.c 13KB
misc.c 13KB
pty.c 13KB
test23.c 13KB
path.c 13KB
tcp_lib.c 12KB
mnx_eth.c 12KB
device.c 12KB
sb16_mixer.c 12KB
test24.c 12KB
main.c 12KB
test39.c 11KB
forkexit.c 11KB
init.c 11KB
ip.c 11KB
test26.c 11KB
misc.c 11KB
protect.c 11KB
doscan.c 10KB
test32.c 10KB
test27.c 10KB
pipe.c 10KB
test35.c 10KB
driver.c 10KB
wdeth.c 10KB
ip_ioctl.c 9KB
test30.c 9KB
super.c 9KB
ipr.c 9KB
alloc.c 9KB
write.c 8KB
res_query.c 8KB
gethnmadr.c 8KB
res_comp.c 8KB
test2.c 8KB
rawfs.c 8KB
test5.c 8KB
memory.c 7KB
ne2000.c 7KB
test40.c 7KB
fslib.c 7KB
共 999 条
- 1
- 2
- 3
- 4
- 5
- 6
- 10
andylin02
- 粉丝: 792
- 资源: 68
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 笔记实验六,spark,大数据分析
- ####蓝桥杯python的详细的信息介绍
- 电子万年历软件仿真(经过多次修改,保证正确性)
- Unity XR 手势射击控制脚本(适用于任何可手势识别的设备)
- 机械设计全自动电表(NB和IC卡表)控制和上壳装配线sw16可编辑非常好的设计图纸100%好用.zip
- 基于matlab的EAN-13条形码识别系统GUI界面.zip代码53
- matlab基于bp神经网络交通信号标志识别GUI界面13个标志.zip代码54
- 电子万年历答辩实物展示视频mp4格式
- 基于python实现的程序,包括哈希感知算法cvHash,图像切割cvsplit,固定目标检测cvRec(附文档ppt)等
- 计算0-10000之间所有偶数的和
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1