JFS: Initialize dentry->d_op for negative dentries too
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / scsi / sata_promise.h
blob6e7e96b9ee137d621370c40d9b139eab84f4b355
1 /*
2 * sata_promise.h - Promise SATA common definitions and inline funcs
4 * Copyright 2003-2004 Red Hat, Inc.
6 * The contents of this file are subject to the Open
7 * Software License version 1.1 that can be found at
8 * http://www.opensource.org/licenses/osl-1.1.txt and is included herein
9 * by reference.
11 * Alternatively, the contents of this file may be used under the terms
12 * of the GNU General Public License version 2 (the "GPL") as distributed
13 * in the kernel source COPYING file, in which case the provisions of
14 * the GPL are applicable instead of the above. If you wish to allow
15 * the use of your version of this file only under the terms of the
16 * GPL and not to allow others to use your version of this file under
17 * the OSL, indicate your decision by deleting the provisions above and
18 * replace them with the notice and other provisions required by the GPL.
19 * If you do not delete the provisions above, a recipient may use your
20 * version of this file under either the OSL or the GPL.
24 #ifndef __SATA_PROMISE_H__
25 #define __SATA_PROMISE_H__
27 #include <linux/ata.h>
29 enum pdc_packet_bits {
30 PDC_PKT_READ = (1 << 2),
31 PDC_PKT_NODATA = (1 << 3),
33 PDC_PKT_SIZEMASK = (1 << 7) | (1 << 6) | (1 << 5),
34 PDC_PKT_CLEAR_BSY = (1 << 4),
35 PDC_PKT_WAIT_DRDY = (1 << 3) | (1 << 4),
36 PDC_LAST_REG = (1 << 3),
38 PDC_REG_DEVCTL = (1 << 3) | (1 << 2) | (1 << 1),
41 static inline unsigned int pdc_pkt_header(struct ata_taskfile *tf,
42 dma_addr_t sg_table,
43 unsigned int devno, u8 *buf)
45 u8 dev_reg;
46 u32 *buf32 = (u32 *) buf;
48 /* set control bits (byte 0), zero delay seq id (byte 3),
49 * and seq id (byte 2)
51 switch (tf->protocol) {
52 case ATA_PROT_DMA:
53 if (!(tf->flags & ATA_TFLAG_WRITE))
54 buf32[0] = cpu_to_le32(PDC_PKT_READ);
55 else
56 buf32[0] = 0;
57 break;
59 case ATA_PROT_NODATA:
60 buf32[0] = cpu_to_le32(PDC_PKT_NODATA);
61 break;
63 default:
64 BUG();
65 break;
68 buf32[1] = cpu_to_le32(sg_table); /* S/G table addr */
69 buf32[2] = 0; /* no next-packet */
71 if (devno == 0)
72 dev_reg = ATA_DEVICE_OBS;
73 else
74 dev_reg = ATA_DEVICE_OBS | ATA_DEV1;
76 /* select device */
77 buf[12] = (1 << 5) | PDC_PKT_CLEAR_BSY | ATA_REG_DEVICE;
78 buf[13] = dev_reg;
80 /* device control register */
81 buf[14] = (1 << 5) | PDC_REG_DEVCTL;
82 buf[15] = tf->ctl;
84 return 16; /* offset of next byte */
87 static inline unsigned int pdc_pkt_footer(struct ata_taskfile *tf, u8 *buf,
88 unsigned int i)
90 if (tf->flags & ATA_TFLAG_DEVICE) {
91 buf[i++] = (1 << 5) | ATA_REG_DEVICE;
92 buf[i++] = tf->device;
95 /* and finally the command itself; also includes end-of-pkt marker */
96 buf[i++] = (1 << 5) | PDC_LAST_REG | ATA_REG_CMD;
97 buf[i++] = tf->command;
99 return i;
102 static inline unsigned int pdc_prep_lba28(struct ata_taskfile *tf, u8 *buf, unsigned int i)
104 /* the "(1 << 5)" should be read "(count << 5)" */
106 /* ATA command block registers */
107 buf[i++] = (1 << 5) | ATA_REG_FEATURE;
108 buf[i++] = tf->feature;
110 buf[i++] = (1 << 5) | ATA_REG_NSECT;
111 buf[i++] = tf->nsect;
113 buf[i++] = (1 << 5) | ATA_REG_LBAL;
114 buf[i++] = tf->lbal;
116 buf[i++] = (1 << 5) | ATA_REG_LBAM;
117 buf[i++] = tf->lbam;
119 buf[i++] = (1 << 5) | ATA_REG_LBAH;
120 buf[i++] = tf->lbah;
122 return i;
125 static inline unsigned int pdc_prep_lba48(struct ata_taskfile *tf, u8 *buf, unsigned int i)
127 /* the "(2 << 5)" should be read "(count << 5)" */
129 /* ATA command block registers */
130 buf[i++] = (2 << 5) | ATA_REG_FEATURE;
131 buf[i++] = tf->hob_feature;
132 buf[i++] = tf->feature;
134 buf[i++] = (2 << 5) | ATA_REG_NSECT;
135 buf[i++] = tf->hob_nsect;
136 buf[i++] = tf->nsect;
138 buf[i++] = (2 << 5) | ATA_REG_LBAL;
139 buf[i++] = tf->hob_lbal;
140 buf[i++] = tf->lbal;
142 buf[i++] = (2 << 5) | ATA_REG_LBAM;
143 buf[i++] = tf->hob_lbam;
144 buf[i++] = tf->lbam;
146 buf[i++] = (2 << 5) | ATA_REG_LBAH;
147 buf[i++] = tf->hob_lbah;
148 buf[i++] = tf->lbah;
150 return i;
154 #endif /* __SATA_PROMISE_H__ */