aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libata-core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/libata-core.c')
-rw-r--r--drivers/scsi/libata-core.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 9269fd9b814f..d55f12dacfcb 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -67,9 +67,9 @@ static void ata_dev_reread_id(struct ata_port *ap, struct ata_device *dev);
67static void ata_dev_init_params(struct ata_port *ap, struct ata_device *dev); 67static void ata_dev_init_params(struct ata_port *ap, struct ata_device *dev);
68static void ata_set_mode(struct ata_port *ap); 68static void ata_set_mode(struct ata_port *ap);
69static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev); 69static void ata_dev_set_xfermode(struct ata_port *ap, struct ata_device *dev);
70static unsigned int ata_get_mode_mask(struct ata_port *ap, int shift); 70static unsigned int ata_get_mode_mask(const struct ata_port *ap, int shift);
71static int fgb(u32 bitmap); 71static int fgb(u32 bitmap);
72static int ata_choose_xfer_mode(struct ata_port *ap, 72static int ata_choose_xfer_mode(const struct ata_port *ap,
73 u8 *xfer_mode_out, 73 u8 *xfer_mode_out,
74 unsigned int *xfer_shift_out); 74 unsigned int *xfer_shift_out);
75static void __ata_qc_complete(struct ata_queued_cmd *qc); 75static void __ata_qc_complete(struct ata_queued_cmd *qc);
@@ -97,7 +97,7 @@ MODULE_VERSION(DRV_VERSION);
97 * Inherited from caller. 97 * Inherited from caller.
98 */ 98 */
99 99
100static void ata_tf_load_pio(struct ata_port *ap, struct ata_taskfile *tf) 100static void ata_tf_load_pio(struct ata_port *ap, const struct ata_taskfile *tf)
101{ 101{
102 struct ata_ioports *ioaddr = &ap->ioaddr; 102 struct ata_ioports *ioaddr = &ap->ioaddr;
103 unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; 103 unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR;
@@ -155,7 +155,7 @@ static void ata_tf_load_pio(struct ata_port *ap, struct ata_taskfile *tf)
155 * Inherited from caller. 155 * Inherited from caller.
156 */ 156 */
157 157
158static void ata_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf) 158static void ata_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
159{ 159{
160 struct ata_ioports *ioaddr = &ap->ioaddr; 160 struct ata_ioports *ioaddr = &ap->ioaddr;
161 unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR; 161 unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR;
@@ -224,7 +224,7 @@ static void ata_tf_load_mmio(struct ata_port *ap, struct ata_taskfile *tf)
224 * LOCKING: 224 * LOCKING:
225 * Inherited from caller. 225 * Inherited from caller.
226 */ 226 */
227void ata_tf_load(struct ata_port *ap, struct ata_taskfile *tf) 227void ata_tf_load(struct ata_port *ap, const struct ata_taskfile *tf)
228{ 228{
229 if (ap->flags & ATA_FLAG_MMIO) 229 if (ap->flags & ATA_FLAG_MMIO)
230 ata_tf_load_mmio(ap, tf); 230 ata_tf_load_mmio(ap, tf);
@@ -244,7 +244,7 @@ void ata_tf_load(struct ata_port *ap, struct ata_taskfile *tf)
244 * spin_lock_irqsave(host_set lock) 244 * spin_lock_irqsave(host_set lock)
245 */ 245 */
246 246
247static void ata_exec_command_pio(struct ata_port *ap, struct ata_taskfile *tf) 247static void ata_exec_command_pio(struct ata_port *ap, const struct ata_taskfile *tf)
248{ 248{
249 DPRINTK("ata%u: cmd 0x%X\n", ap->id, tf->command); 249 DPRINTK("ata%u: cmd 0x%X\n", ap->id, tf->command);
250 250
@@ -265,7 +265,7 @@ static void ata_exec_command_pio(struct ata_port *ap, struct ata_taskfile *tf)
265 * spin_lock_irqsave(host_set lock) 265 * spin_lock_irqsave(host_set lock)
266 */ 266 */
267 267
268static void ata_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf) 268static void ata_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
269{ 269{
270 DPRINTK("ata%u: cmd 0x%X\n", ap->id, tf->command); 270 DPRINTK("ata%u: cmd 0x%X\n", ap->id, tf->command);
271 271
@@ -285,7 +285,7 @@ static void ata_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf)
285 * LOCKING: 285 * LOCKING:
286 * spin_lock_irqsave(host_set lock) 286 * spin_lock_irqsave(host_set lock)
287 */ 287 */
288void ata_exec_command(struct ata_port *ap, struct ata_taskfile *tf) 288void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf)
289{ 289{
290 if (ap->flags & ATA_FLAG_MMIO) 290 if (ap->flags & ATA_FLAG_MMIO)
291 ata_exec_command_mmio(ap, tf); 291 ata_exec_command_mmio(ap, tf);
@@ -305,7 +305,7 @@ void ata_exec_command(struct ata_port *ap, struct ata_taskfile *tf)
305 * Obtains host_set lock. 305 * Obtains host_set lock.
306 */ 306 */
307 307
308static inline void ata_exec(struct ata_port *ap, struct ata_taskfile *tf) 308static inline void ata_exec(struct ata_port *ap, const struct ata_taskfile *tf)
309{ 309{
310 unsigned long flags; 310 unsigned long flags;
311 311
@@ -328,7 +328,7 @@ static inline void ata_exec(struct ata_port *ap, struct ata_taskfile *tf)
328 * Obtains host_set lock. 328 * Obtains host_set lock.
329 */ 329 */
330 330
331static void ata_tf_to_host(struct ata_port *ap, struct ata_taskfile *tf) 331static void ata_tf_to_host(struct ata_port *ap, const struct ata_taskfile *tf)
332{ 332{
333 ap->ops->tf_load(ap, tf); 333 ap->ops->tf_load(ap, tf);
334 334
@@ -348,7 +348,7 @@ static void ata_tf_to_host(struct ata_port *ap, struct ata_taskfile *tf)
348 * spin_lock_irqsave(host_set lock) 348 * spin_lock_irqsave(host_set lock)
349 */ 349 */
350 350
351void ata_tf_to_host_nolock(struct ata_port *ap, struct ata_taskfile *tf) 351void ata_tf_to_host_nolock(struct ata_port *ap, const struct ata_taskfile *tf)
352{ 352{
353 ap->ops->tf_load(ap, tf); 353 ap->ops->tf_load(ap, tf);
354 ap->ops->exec_command(ap, tf); 354 ap->ops->exec_command(ap, tf);
@@ -558,7 +558,7 @@ u8 ata_chk_err(struct ata_port *ap)
558 * Inherited from caller. 558 * Inherited from caller.
559 */ 559 */
560 560
561void ata_tf_to_fis(struct ata_taskfile *tf, u8 *fis, u8 pmp) 561void ata_tf_to_fis(const struct ata_taskfile *tf, u8 *fis, u8 pmp)
562{ 562{
563 fis[0] = 0x27; /* Register - Host to Device FIS */ 563 fis[0] = 0x27; /* Register - Host to Device FIS */
564 fis[1] = (pmp & 0xf) | (1 << 7); /* Port multiplier number, 564 fis[1] = (pmp & 0xf) | (1 << 7); /* Port multiplier number,
@@ -599,7 +599,7 @@ void ata_tf_to_fis(struct ata_taskfile *tf, u8 *fis, u8 pmp)
599 * Inherited from caller. 599 * Inherited from caller.
600 */ 600 */
601 601
602void ata_tf_from_fis(u8 *fis, struct ata_taskfile *tf) 602void ata_tf_from_fis(const u8 *fis, struct ata_taskfile *tf)
603{ 603{
604 tf->command = fis[2]; /* status */ 604 tf->command = fis[2]; /* status */
605 tf->feature = fis[3]; /* error */ 605 tf->feature = fis[3]; /* error */
@@ -845,7 +845,7 @@ static unsigned int ata_devchk(struct ata_port *ap,
845 * the event of failure. 845 * the event of failure.
846 */ 846 */
847 847
848unsigned int ata_dev_classify(struct ata_taskfile *tf) 848unsigned int ata_dev_classify(const struct ata_taskfile *tf)
849{ 849{
850 /* Apple's open source Darwin code hints that some devices only 850 /* Apple's open source Darwin code hints that some devices only
851 * put a proper signature into the LBA mid/high registers, 851 * put a proper signature into the LBA mid/high registers,
@@ -937,7 +937,7 @@ static u8 ata_dev_try_classify(struct ata_port *ap, unsigned int device)
937 * caller. 937 * caller.
938 */ 938 */
939 939
940void ata_dev_id_string(u16 *id, unsigned char *s, 940void ata_dev_id_string(const u16 *id, unsigned char *s,
941 unsigned int ofs, unsigned int len) 941 unsigned int ofs, unsigned int len)
942{ 942{
943 unsigned int c; 943 unsigned int c;
@@ -1054,7 +1054,7 @@ void ata_dev_select(struct ata_port *ap, unsigned int device,
1054 * caller. 1054 * caller.
1055 */ 1055 */
1056 1056
1057static inline void ata_dump_id(struct ata_device *dev) 1057static inline void ata_dump_id(const struct ata_device *dev)
1058{ 1058{
1059 DPRINTK("49==0x%04x " 1059 DPRINTK("49==0x%04x "
1060 "53==0x%04x " 1060 "53==0x%04x "
@@ -1089,7 +1089,7 @@ static inline void ata_dump_id(struct ata_device *dev)
1089 * FIXME: pre IDE drive timing (do we care ?). 1089 * FIXME: pre IDE drive timing (do we care ?).
1090 */ 1090 */
1091 1091
1092static unsigned int ata_pio_modes(struct ata_device *adev) 1092static unsigned int ata_pio_modes(const struct ata_device *adev)
1093{ 1093{
1094 u16 modes; 1094 u16 modes;
1095 1095
@@ -1352,7 +1352,7 @@ err_out:
1352} 1352}
1353 1353
1354 1354
1355static inline u8 ata_dev_knobble(struct ata_port *ap) 1355static inline u8 ata_dev_knobble(const struct ata_port *ap)
1356{ 1356{
1357 return ((ap->cbl == ATA_CBL_SATA) && (!ata_id_is_sata(ap->device->id))); 1357 return ((ap->cbl == ATA_CBL_SATA) && (!ata_id_is_sata(ap->device->id)));
1358} 1358}
@@ -1684,7 +1684,7 @@ int ata_timing_compute(struct ata_device *adev, unsigned short speed,
1684 return 0; 1684 return 0;
1685} 1685}
1686 1686
1687static struct { 1687static const struct {
1688 unsigned int shift; 1688 unsigned int shift;
1689 u8 base; 1689 u8 base;
1690} xfer_mode_classes[] = { 1690} xfer_mode_classes[] = {
@@ -2093,7 +2093,8 @@ err_out:
2093 DPRINTK("EXIT\n"); 2093 DPRINTK("EXIT\n");
2094} 2094}
2095 2095
2096static void ata_pr_blacklisted(struct ata_port *ap, struct ata_device *dev) 2096static void ata_pr_blacklisted(const struct ata_port *ap,
2097 const struct ata_device *dev)
2097{ 2098{
2098 printk(KERN_WARNING "ata%u: dev %u is on DMA blacklist, disabling DMA\n", 2099 printk(KERN_WARNING "ata%u: dev %u is on DMA blacklist, disabling DMA\n",
2099 ap->id, dev->devno); 2100 ap->id, dev->devno);
@@ -2131,7 +2132,7 @@ static const char * ata_dma_blacklist [] = {
2131 "_NEC DV5800A", 2132 "_NEC DV5800A",
2132}; 2133};
2133 2134
2134static int ata_dma_blacklisted(struct ata_port *ap, struct ata_device *dev) 2135static int ata_dma_blacklisted(const struct ata_device *dev)
2135{ 2136{
2136 unsigned char model_num[40]; 2137 unsigned char model_num[40];
2137 char *s; 2138 char *s;
@@ -2156,9 +2157,9 @@ static int ata_dma_blacklisted(struct ata_port *ap, struct ata_device *dev)
2156 return 0; 2157 return 0;
2157} 2158}
2158 2159
2159static unsigned int ata_get_mode_mask(struct ata_port *ap, int shift) 2160static unsigned int ata_get_mode_mask(const struct ata_port *ap, int shift)
2160{ 2161{
2161 struct ata_device *master, *slave; 2162 const struct ata_device *master, *slave;
2162 unsigned int mask; 2163 unsigned int mask;
2163 2164
2164 master = &ap->device[0]; 2165 master = &ap->device[0];
@@ -2170,14 +2171,14 @@ static unsigned int ata_get_mode_mask(struct ata_port *ap, int shift)
2170 mask = ap->udma_mask; 2171 mask = ap->udma_mask;
2171 if (ata_dev_present(master)) { 2172 if (ata_dev_present(master)) {
2172 mask &= (master->id[ATA_ID_UDMA_MODES] & 0xff); 2173 mask &= (master->id[ATA_ID_UDMA_MODES] & 0xff);
2173 if (ata_dma_blacklisted(ap, master)) { 2174 if (ata_dma_blacklisted(master)) {
2174 mask = 0; 2175 mask = 0;
2175 ata_pr_blacklisted(ap, master); 2176 ata_pr_blacklisted(ap, master);
2176 } 2177 }
2177 } 2178 }
2178 if (ata_dev_present(slave)) { 2179 if (ata_dev_present(slave)) {
2179 mask &= (slave->id[ATA_ID_UDMA_MODES] & 0xff); 2180 mask &= (slave->id[ATA_ID_UDMA_MODES] & 0xff);
2180 if (ata_dma_blacklisted(ap, slave)) { 2181 if (ata_dma_blacklisted(slave)) {
2181 mask = 0; 2182 mask = 0;
2182 ata_pr_blacklisted(ap, slave); 2183 ata_pr_blacklisted(ap, slave);
2183 } 2184 }
@@ -2187,14 +2188,14 @@ static unsigned int ata_get_mode_mask(struct ata_port *ap, int shift)
2187 mask = ap->mwdma_mask; 2188 mask = ap->mwdma_mask;
2188 if (ata_dev_present(master)) { 2189 if (ata_dev_present(master)) {
2189 mask &= (master->id[ATA_ID_MWDMA_MODES] & 0x07); 2190 mask &= (master->id[ATA_ID_MWDMA_MODES] & 0x07);
2190 if (ata_dma_blacklisted(ap, master)) { 2191 if (ata_dma_blacklisted(master)) {
2191 mask = 0; 2192 mask = 0;
2192 ata_pr_blacklisted(ap, master); 2193 ata_pr_blacklisted(ap, master);
2193 } 2194 }
2194 } 2195 }
2195 if (ata_dev_present(slave)) { 2196 if (ata_dev_present(slave)) {
2196 mask &= (slave->id[ATA_ID_MWDMA_MODES] & 0x07); 2197 mask &= (slave->id[ATA_ID_MWDMA_MODES] & 0x07);
2197 if (ata_dma_blacklisted(ap, slave)) { 2198 if (ata_dma_blacklisted(slave)) {
2198 mask = 0; 2199 mask = 0;
2199 ata_pr_blacklisted(ap, slave); 2200 ata_pr_blacklisted(ap, slave);
2200 } 2201 }
@@ -2258,7 +2259,7 @@ static int fgb(u32 bitmap)
2258 * Zero on success, negative on error. 2259 * Zero on success, negative on error.
2259 */ 2260 */
2260 2261
2261static int ata_choose_xfer_mode(struct ata_port *ap, 2262static int ata_choose_xfer_mode(const struct ata_port *ap,
2262 u8 *xfer_mode_out, 2263 u8 *xfer_mode_out,
2263 unsigned int *xfer_shift_out) 2264 unsigned int *xfer_shift_out)
2264{ 2265{
@@ -4144,7 +4145,7 @@ static void ata_host_remove(struct ata_port *ap, unsigned int do_unregister)
4144 4145
4145static void ata_host_init(struct ata_port *ap, struct Scsi_Host *host, 4146static void ata_host_init(struct ata_port *ap, struct Scsi_Host *host,
4146 struct ata_host_set *host_set, 4147 struct ata_host_set *host_set,
4147 struct ata_probe_ent *ent, unsigned int port_no) 4148 const struct ata_probe_ent *ent, unsigned int port_no)
4148{ 4149{
4149 unsigned int i; 4150 unsigned int i;
4150 4151
@@ -4203,7 +4204,7 @@ static void ata_host_init(struct ata_port *ap, struct Scsi_Host *host,
4203 * 4204 *
4204 */ 4205 */
4205 4206
4206static struct ata_port * ata_host_add(struct ata_probe_ent *ent, 4207static struct ata_port * ata_host_add(const struct ata_probe_ent *ent,
4207 struct ata_host_set *host_set, 4208 struct ata_host_set *host_set,
4208 unsigned int port_no) 4209 unsigned int port_no)
4209{ 4210{
@@ -4251,7 +4252,7 @@ err_out:
4251 * 4252 *
4252 */ 4253 */
4253 4254
4254int ata_device_add(struct ata_probe_ent *ent) 4255int ata_device_add(const struct ata_probe_ent *ent)
4255{ 4256{
4256 unsigned int count = 0, i; 4257 unsigned int count = 0, i;
4257 struct device *dev = ent->dev; 4258 struct device *dev = ent->dev;
@@ -4470,7 +4471,7 @@ void ata_std_ports(struct ata_ioports *ioaddr)
4470} 4471}
4471 4472
4472static struct ata_probe_ent * 4473static struct ata_probe_ent *
4473ata_probe_ent_alloc(struct device *dev, struct ata_port_info *port) 4474ata_probe_ent_alloc(struct device *dev, const struct ata_port_info *port)
4474{ 4475{
4475 struct ata_probe_ent *probe_ent; 4476 struct ata_probe_ent *probe_ent;
4476 4477
@@ -4570,7 +4571,6 @@ static struct ata_probe_ent *ata_pci_init_legacy_port(struct pci_dev *pdev, stru
4570 if (!probe_ent) 4571 if (!probe_ent)
4571 return NULL; 4572 return NULL;
4572 4573
4573
4574 probe_ent->legacy_mode = 1; 4574 probe_ent->legacy_mode = 1;
4575 probe_ent->n_ports = 1; 4575 probe_ent->n_ports = 1;
4576 probe_ent->hard_port_no = port_num; 4576 probe_ent->hard_port_no = port_num;
@@ -4783,7 +4783,7 @@ void ata_pci_remove_one (struct pci_dev *pdev)
4783} 4783}
4784 4784
4785/* move to PCI subsystem */ 4785/* move to PCI subsystem */
4786int pci_test_config_bits(struct pci_dev *pdev, struct pci_bits *bits) 4786int pci_test_config_bits(struct pci_dev *pdev, const struct pci_bits *bits)
4787{ 4787{
4788 unsigned long tmp = 0; 4788 unsigned long tmp = 0;
4789 4789