ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / drivers / scsi / pc980155.h
1 /*
2  *
3  *  drivers/scsi/pc980155.h
4  *
5  *  PC-9801-55 SCSI host adapter driver
6  *
7  *  Copyright (C) 1997-2003  Kyoto University Microcomputer Club
8  *                           (Linux/98 project)
9  *                           Tomoharu Ugawa <ohirune@kmc.gr.jp>
10  *
11  */
12
13 #ifndef __PC980155_H
14 #define __PC980155_H
15
16 #include "wd33c93.h"
17
18 #define REG_ADDRST (base_io)
19 #define REG_CONTRL (base_io + 2)
20 #define REG_CWRITE (base_io + 4)
21 #define REG_STATRD (base_io + 4)
22
23 #define WD_MEMORYBANK   0x30
24 #define WD_RESETINT     0x33
25
26 static inline uchar read_pc980155(const wd33c93_regs regs, uchar reg_num)
27 {
28         outb(reg_num, regs.SASR);
29         return (uchar)inb(regs.SCMD);
30 }
31
32 static inline void write_memorybank(const wd33c93_regs regs, uchar value)
33 {
34       outb(WD_MEMORYBANK, regs.SASR);
35       outb(value, regs.SCMD);
36 }
37
38 #define read_pc980155_resetint(regs) \
39         read_pc980155((regs), WD_RESETINT)
40 #define pc980155_int_enable(regs) \
41         write_memorybank((regs), read_pc980155((regs), WD_MEMORYBANK) | 0x04)
42
43 #define pc980155_int_disable(regs) \
44         write_memorybank((regs), read_pc980155((regs), WD_MEMORYBANK) & ~0x04)
45
46 #define pc980155_assert_bus_reset(regs) \
47         write_memorybank((regs), read_pc980155((regs), WD_MEMORYBANK) | 0x02)
48
49 #define pc980155_negate_bus_reset(regs) \
50         write_memorybank((regs), read_pc980155((regs), WD_MEMORYBANK) & ~0x02)
51
52 #endif /* __PC980155_H */