Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
923540a1
Commit
923540a1
authored
Aug 13, 2004
by
Jeff Garzik
Browse files
Options
Browse Files
Download
Plain Diff
Merge pobox.com:/spare/repo/linux-2.6
into pobox.com:/spare/repo/libata-2.6
parents
ab1d1f0d
ce98f369
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
722 additions
and
452 deletions
+722
-452
drivers/scsi/ata_piix.c
drivers/scsi/ata_piix.c
+110
-37
drivers/scsi/libata-core.c
drivers/scsi/libata-core.c
+381
-271
drivers/scsi/libata-scsi.c
drivers/scsi/libata-scsi.c
+44
-17
drivers/scsi/sata_nv.c
drivers/scsi/sata_nv.c
+2
-0
drivers/scsi/sata_promise.c
drivers/scsi/sata_promise.c
+33
-44
drivers/scsi/sata_sil.c
drivers/scsi/sata_sil.c
+5
-2
drivers/scsi/sata_sis.c
drivers/scsi/sata_sis.c
+2
-1
drivers/scsi/sata_svw.c
drivers/scsi/sata_svw.c
+1
-0
drivers/scsi/sata_sx4.c
drivers/scsi/sata_sx4.c
+100
-65
drivers/scsi/sata_via.c
drivers/scsi/sata_via.c
+1
-0
drivers/scsi/sata_vsc.c
drivers/scsi/sata_vsc.c
+1
-0
include/linux/ata.h
include/linux/ata.h
+21
-1
include/linux/libata.h
include/linux/libata.h
+21
-14
No files found.
drivers/scsi/ata_piix.c
View file @
923540a1
...
...
@@ -39,6 +39,7 @@ enum {
ICH5_PMR
=
0x90
,
/* port mapping register */
ICH5_PCS
=
0x92
,
/* port control and status */
PIIX_FLAG_AHCI
=
(
1
<<
28
),
/* AHCI possible */
PIIX_FLAG_CHECKINTR
=
(
1
<<
29
),
/* make sure PCI INTx enabled */
PIIX_FLAG_COMBINED
=
(
1
<<
30
),
/* combined mode possible */
...
...
@@ -58,6 +59,7 @@ enum {
ich5_sata
=
1
,
piix4_pata
=
2
,
ich6_sata
=
3
,
ich6_sata_rm
=
4
,
};
static
int
piix_init_one
(
struct
pci_dev
*
pdev
,
...
...
@@ -65,10 +67,8 @@ static int piix_init_one (struct pci_dev *pdev,
static
void
piix_pata_phy_reset
(
struct
ata_port
*
ap
);
static
void
piix_sata_phy_reset
(
struct
ata_port
*
ap
);
static
void
piix_set_piomode
(
struct
ata_port
*
ap
,
struct
ata_device
*
adev
,
unsigned
int
pio
);
static
void
piix_set_udmamode
(
struct
ata_port
*
ap
,
struct
ata_device
*
adev
,
unsigned
int
udma
);
static
void
piix_set_piomode
(
struct
ata_port
*
ap
,
struct
ata_device
*
adev
);
static
void
piix_set_dmamode
(
struct
ata_port
*
ap
,
struct
ata_device
*
adev
);
static
unsigned
int
in_module_init
=
1
;
...
...
@@ -87,13 +87,9 @@ static struct pci_device_id piix_pci_tbl[] = {
{
0x8086
,
0x24df
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
ich5_sata
},
{
0x8086
,
0x25a3
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
ich5_sata
},
{
0x8086
,
0x25b0
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
ich5_sata
},
/* ICH6 operates in two modes, "looks-like-ICH5" mode,
* and enhanced mode, with queueing and other fancy stuff.
* This is distinguished by PCI class code.
*/
{
0x8086
,
0x2651
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
ich6_sata
},
{
0x8086
,
0x2652
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
ich6_sata
},
{
0x8086
,
0x2652
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
ich6_sata_rm
},
{
0x8086
,
0x2653
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
ich6_sata_rm
},
{
}
/* terminate list */
};
...
...
@@ -126,7 +122,7 @@ static Scsi_Host_Template piix_sht = {
static
struct
ata_port_operations
piix_pata_ops
=
{
.
port_disable
=
ata_port_disable
,
.
set_piomode
=
piix_set_piomode
,
.
set_
udmamode
=
piix_set_u
dmamode
,
.
set_
dmamode
=
piix_set_
dmamode
,
.
tf_load
=
ata_tf_load_pio
,
.
tf_read
=
ata_tf_read_pio
,
...
...
@@ -151,8 +147,6 @@ static struct ata_port_operations piix_pata_ops = {
static
struct
ata_port_operations
piix_sata_ops
=
{
.
port_disable
=
ata_port_disable
,
.
set_piomode
=
piix_set_piomode
,
.
set_udmamode
=
piix_set_udmamode
,
.
tf_load
=
ata_tf_load_pio
,
.
tf_read
=
ata_tf_read_pio
,
...
...
@@ -181,7 +175,12 @@ static struct ata_port_info piix_port_info[] = {
.
sht
=
&
piix_sht
,
.
host_flags
=
ATA_FLAG_SLAVE_POSS
|
ATA_FLAG_SRST
|
PIIX_FLAG_CHECKINTR
,
.
pio_mask
=
0x03
,
/* pio3-4 */
.
pio_mask
=
0x1f
,
/* pio0-4 */
#if 0
.mwdma_mask = 0x06, /* mwdma1-2 */
#else
.
mwdma_mask
=
0x00
,
/* mwdma broken */
#endif
.
udma_mask
=
ATA_UDMA_MASK_40C
,
/* FIXME: cbl det */
.
port_ops
=
&
piix_pata_ops
,
},
...
...
@@ -191,8 +190,9 @@ static struct ata_port_info piix_port_info[] = {
.
sht
=
&
piix_sht
,
.
host_flags
=
ATA_FLAG_SATA
|
ATA_FLAG_SRST
|
PIIX_FLAG_COMBINED
|
PIIX_FLAG_CHECKINTR
,
.
pio_mask
=
0x03
,
/* pio3-4 */
.
udma_mask
=
0x7f
,
/* udma0-6 ; FIXME */
.
pio_mask
=
0x1f
,
/* pio0-4 */
.
mwdma_mask
=
0x07
,
/* mwdma0-2 */
.
udma_mask
=
0x7f
,
/* udma0-6 */
.
port_ops
=
&
piix_sata_ops
,
},
...
...
@@ -200,7 +200,12 @@ static struct ata_port_info piix_port_info[] = {
{
.
sht
=
&
piix_sht
,
.
host_flags
=
ATA_FLAG_SLAVE_POSS
|
ATA_FLAG_SRST
,
.
pio_mask
=
0x03
,
/* pio3-4 */
.
pio_mask
=
0x1f
,
/* pio0-4 */
#if 0
.mwdma_mask = 0x06, /* mwdma1-2 */
#else
.
mwdma_mask
=
0x00
,
/* mwdma broken */
#endif
.
udma_mask
=
ATA_UDMA_MASK_40C
,
/* FIXME: cbl det */
.
port_ops
=
&
piix_pata_ops
,
},
...
...
@@ -211,8 +216,21 @@ static struct ata_port_info piix_port_info[] = {
.
host_flags
=
ATA_FLAG_SATA
|
ATA_FLAG_SRST
|
PIIX_FLAG_COMBINED
|
PIIX_FLAG_CHECKINTR
|
ATA_FLAG_SLAVE_POSS
,
.
pio_mask
=
0x03
,
/* pio3-4 */
.
udma_mask
=
0x7f
,
/* udma0-6 ; FIXME */
.
pio_mask
=
0x1f
,
/* pio0-4 */
.
mwdma_mask
=
0x07
,
/* mwdma0-2 */
.
udma_mask
=
0x7f
,
/* udma0-6 */
.
port_ops
=
&
piix_sata_ops
,
},
/* ich6_sata_rm */
{
.
sht
=
&
piix_sht
,
.
host_flags
=
ATA_FLAG_SATA
|
ATA_FLAG_SRST
|
PIIX_FLAG_COMBINED
|
PIIX_FLAG_CHECKINTR
|
ATA_FLAG_SLAVE_POSS
|
PIIX_FLAG_AHCI
,
.
pio_mask
=
0x1f
,
/* pio0-4 */
.
mwdma_mask
=
0x07
,
/* mwdma0-2 */
.
udma_mask
=
0x7f
,
/* udma0-6 */
.
port_ops
=
&
piix_sata_ops
,
},
};
...
...
@@ -368,11 +386,11 @@ static void piix_sata_phy_reset(struct ata_port *ap)
* None (inherited from caller).
*/
static
void
piix_set_piomode
(
struct
ata_port
*
ap
,
struct
ata_device
*
adev
,
unsigned
int
pio
)
static
void
piix_set_piomode
(
struct
ata_port
*
ap
,
struct
ata_device
*
adev
)
{
unsigned
int
pio
=
adev
->
pio_mode
;
struct
pci_dev
*
dev
=
ap
->
host_set
->
pdev
;
unsigned
int
is_slave
=
(
adev
->
flags
&
ATA_DFLAG_MASTER
)
?
0
:
1
;
unsigned
int
is_slave
=
(
adev
->
devno
!=
0
)
;
unsigned
int
master_port
=
ap
->
port_no
?
0x42
:
0x40
;
unsigned
int
slave_port
=
0x44
;
u16
master_data
;
...
...
@@ -409,7 +427,7 @@ static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev,
}
/**
* piix_set_
u
dmamode - Initialize host controller PATA PIO timings
* piix_set_dmamode - Initialize host controller PATA PIO timings
* @ap: Port whose timings we are configuring
* @adev: um
* @udma: udma mode, 0 - 6
...
...
@@ -420,9 +438,9 @@ static void piix_set_piomode (struct ata_port *ap, struct ata_device *adev,
* None (inherited from caller).
*/
static
void
piix_set_udmamode
(
struct
ata_port
*
ap
,
struct
ata_device
*
adev
,
unsigned
int
udma
)
static
void
piix_set_dmamode
(
struct
ata_port
*
ap
,
struct
ata_device
*
adev
)
{
unsigned
int
udma
=
adev
->
dma_mode
;
/* FIXME: MWDMA too */
struct
pci_dev
*
dev
=
ap
->
host_set
->
pdev
;
u8
maslave
=
ap
->
port_no
?
0x42
:
0x40
;
u8
speed
=
udma
;
...
...
@@ -452,25 +470,38 @@ static void piix_set_udmamode (struct ata_port *ap, struct ata_device *adev,
case
XFER_UDMA_3
:
case
XFER_UDMA_1
:
u_speed
=
1
<<
(
drive_dn
*
4
);
break
;
case
XFER_UDMA_0
:
u_speed
=
0
<<
(
drive_dn
*
4
);
break
;
case
XFER_MW_DMA_2
:
case
XFER_MW_DMA_1
:
break
;
default:
BUG
();
return
;
}
if
(
!
(
reg48
&
u_flag
))
pci_write_config_byte
(
dev
,
0x48
,
reg48
|
u_flag
);
if
(
speed
==
XFER_UDMA_5
)
{
pci_write_config_byte
(
dev
,
0x55
,
(
u8
)
reg55
|
w_flag
);
if
(
speed
>=
XFER_UDMA_0
)
{
if
(
!
(
reg48
&
u_flag
))
pci_write_config_byte
(
dev
,
0x48
,
reg48
|
u_flag
);
if
(
speed
==
XFER_UDMA_5
)
{
pci_write_config_byte
(
dev
,
0x55
,
(
u8
)
reg55
|
w_flag
);
}
else
{
pci_write_config_byte
(
dev
,
0x55
,
(
u8
)
reg55
&
~
w_flag
);
}
if
((
reg4a
&
a_speed
)
!=
u_speed
)
pci_write_config_word
(
dev
,
0x4a
,
(
reg4a
&
~
a_speed
)
|
u_speed
);
if
(
speed
>
XFER_UDMA_2
)
{
if
(
!
(
reg54
&
v_flag
))
pci_write_config_byte
(
dev
,
0x54
,
reg54
|
v_flag
);
}
else
pci_write_config_byte
(
dev
,
0x54
,
reg54
&
~
v_flag
);
}
else
{
pci_write_config_byte
(
dev
,
0x55
,
(
u8
)
reg55
&
~
w_flag
);
if
(
reg48
&
u_flag
)
pci_write_config_byte
(
dev
,
0x48
,
reg48
&
~
u_flag
);
if
(
reg4a
&
a_speed
)
pci_write_config_word
(
dev
,
0x4a
,
reg4a
&
~
a_speed
);
if
(
reg54
&
v_flag
)
pci_write_config_byte
(
dev
,
0x54
,
reg54
&
~
v_flag
);
if
(
reg55
&
w_flag
)
pci_write_config_byte
(
dev
,
0x55
,
(
u8
)
reg55
&
~
w_flag
);
}
if
((
reg4a
&
a_speed
)
!=
u_speed
)
pci_write_config_word
(
dev
,
0x4a
,
(
reg4a
&
~
a_speed
)
|
u_speed
);
if
(
speed
>
XFER_UDMA_2
)
{
if
(
!
(
reg54
&
v_flag
))
pci_write_config_byte
(
dev
,
0x54
,
reg54
|
v_flag
);
}
else
pci_write_config_byte
(
dev
,
0x54
,
reg54
&
~
v_flag
);
}
/* move to PCI layer, integrate w/ MSI stuff */
...
...
@@ -485,6 +516,42 @@ static void pci_enable_intx(struct pci_dev *pdev)
}
}
#define AHCI_PCI_BAR 5
#define AHCI_GLOBAL_CTL 0x04
#define AHCI_ENABLE (1 << 31)
static
int
piix_disable_ahci
(
struct
pci_dev
*
pdev
)
{
void
*
mmio
;
unsigned
long
addr
;
u32
tmp
;
int
rc
=
0
;
/* BUG: pci_enable_device has not yet been called. This
* works because this device is usually set up by BIOS.
*/
addr
=
pci_resource_start
(
pdev
,
AHCI_PCI_BAR
);
if
(
!
addr
||
!
pci_resource_len
(
pdev
,
AHCI_PCI_BAR
))
return
0
;
mmio
=
ioremap
(
addr
,
64
);
if
(
!
mmio
)
return
-
ENOMEM
;
tmp
=
readl
(
mmio
+
AHCI_GLOBAL_CTL
);
if
(
tmp
&
AHCI_ENABLE
)
{
tmp
&=
~
AHCI_ENABLE
;
writel
(
tmp
,
mmio
+
AHCI_GLOBAL_CTL
);
tmp
=
readl
(
mmio
+
AHCI_GLOBAL_CTL
);
if
(
tmp
&
AHCI_ENABLE
)
rc
=
-
EIO
;
}
iounmap
(
mmio
);
return
rc
;
}
/**
* piix_init_one - Register PIIX ATA PCI device with kernel services
* @pdev: PCI device to register
...
...
@@ -517,6 +584,12 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
port_info
[
0
]
=
&
piix_port_info
[
ent
->
driver_data
];
port_info
[
1
]
=
NULL
;
if
(
port_info
[
0
]
->
host_flags
&
PIIX_FLAG_AHCI
)
{
int
rc
=
piix_disable_ahci
(
pdev
);
if
(
rc
)
return
rc
;
}
if
(
port_info
[
0
]
->
host_flags
&
PIIX_FLAG_COMBINED
)
{
u8
tmp
;
pci_read_config_byte
(
pdev
,
ICH5_PMR
,
&
tmp
);
...
...
drivers/scsi/libata-core.c
View file @
923540a1
This diff is collapsed.
Click to expand it.
drivers/scsi/libata-scsi.c
View file @
923540a1
...
...
@@ -339,14 +339,10 @@ static int ata_scsi_qc_complete(struct ata_queued_cmd *qc, u8 drv_stat)
{
struct
scsi_cmnd
*
cmd
=
qc
->
scsicmd
;
if
(
unlikely
(
drv_stat
&
(
ATA_ERR
|
ATA_BUSY
|
ATA_DRQ
)))
{
if
(
is_atapi_taskfile
(
&
qc
->
tf
))
cmd
->
result
=
SAM_STAT_CHECK_CONDITION
;
else
ata_to_sense_error
(
qc
);
}
else
{
if
(
unlikely
(
drv_stat
&
(
ATA_ERR
|
ATA_BUSY
|
ATA_DRQ
)))
ata_to_sense_error
(
qc
);
else
cmd
->
result
=
SAM_STAT_GOOD
;
}
qc
->
scsidone
(
cmd
);
...
...
@@ -964,6 +960,31 @@ void ata_scsi_badcmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), u8
done
(
cmd
);
}
static
int
atapi_qc_complete
(
struct
ata_queued_cmd
*
qc
,
u8
drv_stat
)
{
struct
scsi_cmnd
*
cmd
=
qc
->
scsicmd
;
if
(
unlikely
(
drv_stat
&
(
ATA_ERR
|
ATA_BUSY
|
ATA_DRQ
)))
cmd
->
result
=
SAM_STAT_CHECK_CONDITION
;
else
{
u8
*
scsicmd
=
cmd
->
cmnd
;
if
(
scsicmd
[
0
]
==
INQUIRY
)
{
u8
*
buf
=
NULL
;
unsigned
int
buflen
;
buflen
=
ata_scsi_rbuf_get
(
cmd
,
&
buf
);
buf
[
2
]
=
0x5
;
buf
[
3
]
=
(
buf
[
3
]
&
0xf0
)
|
2
;
ata_scsi_rbuf_put
(
cmd
);
}
cmd
->
result
=
SAM_STAT_GOOD
;
}
qc
->
scsidone
(
cmd
);
return
0
;
}
/**
* atapi_xlat - Initialize PACKET taskfile
* @qc: command structure to be initialized
...
...
@@ -979,6 +1000,13 @@ void ata_scsi_badcmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), u8
static
unsigned
int
atapi_xlat
(
struct
ata_queued_cmd
*
qc
,
u8
*
scsicmd
)
{
struct
scsi_cmnd
*
cmd
=
qc
->
scsicmd
;
struct
ata_device
*
dev
=
qc
->
dev
;
int
using_pio
=
(
dev
->
flags
&
ATA_DFLAG_PIO
);
int
nodata
=
(
cmd
->
sc_data_direction
==
SCSI_DATA_NONE
);
memcpy
(
&
qc
->
cdb
,
scsicmd
,
qc
->
ap
->
cdb_len
);
qc
->
complete_fn
=
atapi_qc_complete
;
qc
->
tf
.
flags
|=
ATA_TFLAG_ISADDR
|
ATA_TFLAG_DEVICE
;
if
(
cmd
->
sc_data_direction
==
SCSI_DATA_WRITE
)
{
...
...
@@ -988,19 +1016,18 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc, u8 *scsicmd)
qc
->
tf
.
command
=
ATA_CMD_PACKET
;
/* no data - interrupt-driven */
if
(
cmd
->
sc_data_direction
==
SCSI_DATA_NONE
)
qc
->
tf
.
protocol
=
ATA_PROT_ATAPI
;
/* PIO data xfer - polling */
else
if
((
qc
->
flags
&
ATA_QCFLAG_DMA
)
==
0
)
{
ata_qc_set_polling
(
qc
);
qc
->
tf
.
protocol
=
ATA_PROT_ATAPI
;
/* no data, or PIO data xfer */
if
(
using_pio
||
nodata
)
{
if
(
nodata
)
qc
->
tf
.
protocol
=
ATA_PROT_ATAPI_NODATA
;
else
qc
->
tf
.
protocol
=
ATA_PROT_ATAPI
;
qc
->
tf
.
lbam
=
(
8
*
1024
)
&
0xff
;
qc
->
tf
.
lbah
=
(
8
*
1024
)
>>
8
;
}
/* DMA data xfer
- interrupt-driven
*/
}
else
{
/* DMA data xfer */
else
{
qc
->
tf
.
protocol
=
ATA_PROT_ATAPI_DMA
;
qc
->
tf
.
feature
|=
ATAPI_PKT_DMA
;
...
...
drivers/scsi/sata_nv.c
View file @
923540a1
...
...
@@ -44,6 +44,7 @@
#define NV_PORTS 2
#define NV_PIO_MASK 0x1f
#define NV_MWDMA_MASK 0x07
#define NV_UDMA_MASK 0x7f
#define NV_PORT0_BMDMA_REG_OFFSET 0x00
#define NV_PORT1_BMDMA_REG_OFFSET 0x08
...
...
@@ -343,6 +344,7 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
probe_ent
->
irq
=
pdev
->
irq
;
probe_ent
->
irq_flags
=
SA_SHIRQ
;
probe_ent
->
pio_mask
=
NV_PIO_MASK
;
probe_ent
->
mwdma_mask
=
NV_MWDMA_MASK
;
probe_ent
->
udma_mask
=
NV_UDMA_MASK
;
probe_ent
->
port
[
0
].
cmd_addr
=
pci_resource_start
(
pdev
,
0
);
...
...
drivers/scsi/sata_promise.c
View file @
923540a1
...
...
@@ -74,7 +74,6 @@ struct pdc_port_priv {
static
u32
pdc_sata_scr_read
(
struct
ata_port
*
ap
,
unsigned
int
sc_reg
);
static
void
pdc_sata_scr_write
(
struct
ata_port
*
ap
,
unsigned
int
sc_reg
,
u32
val
);
static
int
pdc_sata_init_one
(
struct
pci_dev
*
pdev
,
const
struct
pci_device_id
*
ent
);
static
void
pdc_dma_start
(
struct
ata_queued_cmd
*
qc
);
static
irqreturn_t
pdc_interrupt
(
int
irq
,
void
*
dev_instance
,
struct
pt_regs
*
regs
);
static
void
pdc_eng_timeout
(
struct
ata_port
*
ap
);
static
int
pdc_port_start
(
struct
ata_port
*
ap
);
...
...
@@ -83,8 +82,6 @@ static void pdc_phy_reset(struct ata_port *ap);
static
void
pdc_qc_prep
(
struct
ata_queued_cmd
*
qc
);
static
void
pdc_tf_load_mmio
(
struct
ata_port
*
ap
,
struct
ata_taskfile
*
tf
);
static
void
pdc_exec_command_mmio
(
struct
ata_port
*
ap
,
struct
ata_taskfile
*
tf
);
static
inline
void
pdc_dma_complete
(
struct
ata_port
*
ap
,
struct
ata_queued_cmd
*
qc
,
int
have_err
);
static
void
pdc_irq_clear
(
struct
ata_port
*
ap
);
static
int
pdc_qc_issue_prot
(
struct
ata_queued_cmd
*
qc
);
...
...
@@ -130,7 +127,8 @@ static struct ata_port_info pdc_port_info[] = {
.
sht
=
&
pdc_sata_sht
,
.
host_flags
=
ATA_FLAG_SATA
|
ATA_FLAG_NO_LEGACY
|
ATA_FLAG_SRST
|
ATA_FLAG_MMIO
,
.
pio_mask
=
0x03
,
/* pio3-4 */
.
pio_mask
=
0x1f
,
/* pio0-4 */
.
mwdma_mask
=
0x07
,
/* mwdma0-2 */
.
udma_mask
=
0x7f
,
/* udma0-6 ; FIXME */
.
port_ops
=
&
pdc_sata_ops
,
},
...
...
@@ -140,7 +138,8 @@ static struct ata_port_info pdc_port_info[] = {
.
sht
=
&
pdc_sata_sht
,
.
host_flags
=
ATA_FLAG_SATA
|
ATA_FLAG_NO_LEGACY
|
ATA_FLAG_SRST
|
ATA_FLAG_MMIO
,
.
pio_mask
=
0x03
,
/* pio3-4 */
.
pio_mask
=
0x1f
,
/* pio0-4 */
.
mwdma_mask
=
0x07
,
/* mwdma0-2 */
.
udma_mask
=
0x7f
,
/* udma0-6 ; FIXME */
.
port_ops
=
&
pdc_sata_ops
,
},
...
...
@@ -269,26 +268,26 @@ static void pdc_qc_prep(struct ata_queued_cmd *qc)
VPRINTK
(
"ENTER
\n
"
);
ata_qc_prep
(
qc
);
i
=
pdc_pkt_header
(
&
qc
->
tf
,
qc
->
ap
->
prd_dma
,
qc
->
dev
->
devno
,
pp
->
pkt
);
switch
(
qc
->
tf
.
protocol
)
{
case
ATA_PROT_DMA
:
ata_qc_prep
(
qc
);
/* fall through */
if
(
qc
->
tf
.
flags
&
ATA_TFLAG_LBA48
)
i
=
pdc_prep_lba48
(
&
qc
->
tf
,
pp
->
pkt
,
i
);
else
i
=
pdc_prep_lba28
(
&
qc
->
tf
,
pp
->
pkt
,
i
);
case
ATA_PROT_NODATA
:
i
=
pdc_pkt_header
(
&
qc
->
tf
,
qc
->
ap
->
prd_dma
,
qc
->
dev
->
devno
,
pp
->
pkt
);
pdc_pkt_footer
(
&
qc
->
tf
,
pp
->
pkt
,
i
);
}
if
(
qc
->
tf
.
flags
&
ATA_TFLAG_LBA48
)
i
=
pdc_prep_lba48
(
&
qc
->
tf
,
pp
->
pkt
,
i
);
else
i
=
pdc_prep_lba28
(
&
qc
->
tf
,
pp
->
pkt
,
i
);
static
inline
void
pdc_dma_complete
(
struct
ata_port
*
ap
,
struct
ata_queued_cmd
*
qc
,
int
have_err
)
{
u8
err_bit
=
have_err
?
ATA_ERR
:
0
;
pdc_pkt_footer
(
&
qc
->
tf
,
pp
->
pkt
,
i
);
break
;
/* get drive status; clear intr; complete txn */
ata_qc_complete
(
qc
,
ata_wait_idle
(
ap
)
|
err_bit
);
default:
break
;
}
}
static
void
pdc_eng_timeout
(
struct
ata_port
*
ap
)
...
...
@@ -315,17 +314,9 @@ static void pdc_eng_timeout(struct ata_port *ap)
switch
(
qc
->
tf
.
protocol
)
{
case
ATA_PROT_DMA
:
printk
(
KERN_ERR
"ata%u: DMA timeout
\n
"
,
ap
->
id
);
ata_qc_complete
(
qc
,
ata_wait_idle
(
ap
)
|
ATA_ERR
);
break
;
case
ATA_PROT_NODATA
:
drv_stat
=
ata_busy_wait
(
ap
,
ATA_BUSY
|
ATA_DRQ
,
1000
);
printk
(
KERN_ERR
"ata%u: command 0x%x timeout, stat 0x%x
\n
"
,
ap
->
id
,
qc
->
tf
.
command
,
drv_stat
);
ata_qc_complete
(
qc
,
drv_stat
);
printk
(
KERN_ERR
"ata%u: command timeout
\n
"
,
ap
->
id
);
ata_qc_complete
(
qc
,
ata_wait_idle
(
ap
)
|
ATA_ERR
);
break
;
default:
...
...
@@ -358,13 +349,8 @@ static inline unsigned int pdc_host_intr( struct ata_port *ap,
switch
(
qc
->
tf
.
protocol
)
{
case
ATA_PROT_DMA
:
pdc_dma_complete
(
ap
,
qc
,
have_err
);
handled
=
1
;
break
;
case
ATA_PROT_NODATA
:
/* command completion, but no data xfer */
status
=
ata_busy_wait
(
ap
,
ATA_BUSY
|
ATA_DRQ
,
1000
);
DPRINTK
(
"BUS_NODATA (drv_stat 0x%X)
\n
"
,
status
);
case
ATA_PROT_NODATA
:
status
=
ata_wait_idle
(
ap
);
if
(
have_err
)
status
|=
ATA_ERR
;
ata_qc_complete
(
qc
,
status
);
...
...
@@ -440,7 +426,7 @@ static irqreturn_t pdc_interrupt (int irq, void *dev_instance, struct pt_regs *r
return
IRQ_RETVAL
(
handled
);
}
static
inline
void
pdc_
dma
_start
(
struct
ata_queued_cmd
*
qc
)
static
inline
void
pdc_
packet
_start
(
struct
ata_queued_cmd
*
qc
)
{
struct
ata_port
*
ap
=
qc
->
ap
;
struct
pdc_port_priv
*
pp
=
ap
->
private_data
;
...
...
@@ -462,7 +448,8 @@ static int pdc_qc_issue_prot(struct ata_queued_cmd *qc)
{
switch
(
qc
->
tf
.
protocol
)
{
case
ATA_PROT_DMA
:
pdc_dma_start
(
qc
);
case
ATA_PROT_NODATA
:
pdc_packet_start
(
qc
);
return
0
;
case
ATA_PROT_ATAPI_DMA
:
...
...
@@ -478,14 +465,16 @@ static int pdc_qc_issue_prot(struct ata_queued_cmd *qc)
static
void
pdc_tf_load_mmio
(
struct
ata_port
*
ap
,
struct
ata_taskfile
*
tf
)
{
WARN_ON
(
tf
->
protocol
==
ATA_PROT_DMA
);
WARN_ON
(
tf
->
protocol
==
ATA_PROT_DMA
||
tf
->
protocol
==
ATA_PROT_NODATA
);
ata_tf_load_mmio
(
ap
,
tf
);
}
static
void
pdc_exec_command_mmio
(
struct
ata_port
*
ap
,
struct
ata_taskfile
*
tf
)
{
WARN_ON
(
tf
->
protocol
==
ATA_PROT_DMA
);
WARN_ON
(
tf
->
protocol
==
ATA_PROT_DMA
||
tf
->
protocol
==
ATA_PROT_NODATA
);
ata_exec_command_mmio
(
ap
,
tf
);
}
...
...
@@ -539,8 +528,7 @@ static void pdc_host_init(unsigned int chip_id, struct ata_probe_ent *pe)
writel
(
tmp
,
mmio
+
PDC_TBG_MODE
);
readl
(
mmio
+
PDC_TBG_MODE
);
/* flush */
set_current_state
(
TASK_UNINTERRUPTIBLE
);
schedule_timeout
(
msecs_to_jiffies
(
10
)
+
1
);
msleep
(
10
);
/* adjust slew rate control register. */
tmp
=
readl
(
mmio
+
PDC_SLEW_CTL
);
...
...
@@ -601,6 +589,7 @@ static int pdc_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *
probe_ent
->
sht
=
pdc_port_info
[
board_idx
].
sht
;
probe_ent
->
host_flags
=
pdc_port_info
[
board_idx
].
host_flags
;
probe_ent
->
pio_mask
=
pdc_port_info
[
board_idx
].
pio_mask
;
probe_ent
->
mwdma_mask
=
pdc_port_info
[
board_idx
].
mwdma_mask
;
probe_ent
->
udma_mask
=
pdc_port_info
[
board_idx
].
udma_mask
;
probe_ent
->
port_ops
=
pdc_port_info
[
board_idx
].
port_ops
;
...
...
drivers/scsi/sata_sil.c
View file @
923540a1
...
...
@@ -149,7 +149,8 @@ static struct ata_port_info sil_port_info[] = {
.
sht
=
&
sil_sht
,
.
host_flags
=
ATA_FLAG_SATA
|
ATA_FLAG_NO_LEGACY
|
ATA_FLAG_SRST
|
ATA_FLAG_MMIO
,
.
pio_mask
=
0x03
,
/* pio3-4 */
.
pio_mask
=
0x1f
,
/* pio0-4 */
.
mwdma_mask
=
0x07
,
/* mwdma0-2 */
.
udma_mask
=
0x3f
,
/* udma0-5 */
.
port_ops
=
&
sil_ops
,
},
/* sil_3114 */
...
...
@@ -157,7 +158,8 @@ static struct ata_port_info sil_port_info[] = {
.
sht
=
&
sil_sht
,
.
host_flags
=
ATA_FLAG_SATA
|
ATA_FLAG_NO_LEGACY
|
ATA_FLAG_SRST
|
ATA_FLAG_MMIO
,
.
pio_mask
=
0x03
,
/* pio3-4 */
.
pio_mask
=
0x1f
,
/* pio0-4 */
.
mwdma_mask
=
0x07
,
/* mwdma0-2 */
.
udma_mask
=
0x3f
,
/* udma0-5 */
.
port_ops
=
&
sil_ops
,
},
...
...
@@ -363,6 +365,7 @@ static int sil_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
probe_ent
->
sht
=
sil_port_info
[
ent
->
driver_data
].
sht
;
probe_ent
->
n_ports
=
(
ent
->
driver_data
==
sil_3114
)
?
4
:
2
;
probe_ent
->
pio_mask
=
sil_port_info
[
ent
->
driver_data
].
pio_mask
;
probe_ent
->
mwdma_mask
=
sil_port_info
[
ent
->
driver_data
].
mwdma_mask
;
probe_ent
->
udma_mask
=
sil_port_info
[
ent
->
driver_data
].
udma_mask
;
probe_ent
->
irq
=
pdev
->
irq
;
probe_ent
->
irq_flags
=
SA_SHIRQ
;
...
...
drivers/scsi/sata_sis.c
View file @
923540a1
...
...
@@ -230,7 +230,8 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
probe_ent
->
host_flags
|=
SIS_FLAG_CFGSCR
;
}
probe_ent
->
pio_mask
=
0x03
;
probe_ent
->
pio_mask
=
0x1f
;
probe_ent
->
mwdma_mask
=
0x7
;
probe_ent
->
udma_mask
=
0x7f
;
probe_ent
->
port_ops
=
&
sis_ops
;
...
...
drivers/scsi/sata_svw.c
View file @
923540a1
...
...
@@ -343,6 +343,7 @@ static int k2_sata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
* if we don't fill these
*/
probe_ent
->
pio_mask
=
0x1f
;
probe_ent
->
mwdma_mask
=
0x7
;
probe_ent
->
udma_mask
=
0x7f
;
/* We have 4 ports per PCI function */
...
...
drivers/scsi/sata_sx4.c
View file @
923540a1
This diff is collapsed.
Click to expand it.
drivers/scsi/sata_via.c
View file @
923540a1
...
...
@@ -214,6 +214,7 @@ static int svia_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
probe_ent
->
irq
=
pdev
->
irq
;
probe_ent
->
irq_flags
=
SA_SHIRQ
;
probe_ent
->
pio_mask
=
0x1f
;
probe_ent
->
mwdma_mask
=
0x07
;
probe_ent
->
udma_mask
=
0x7f
;
probe_ent
->
port
[
0
].
cmd_addr
=
pci_resource_start
(
pdev
,
0
);
...
...
drivers/scsi/sata_vsc.c
View file @
923540a1
...
...
@@ -320,6 +320,7 @@ static int __devinit vsc_sata_init_one (struct pci_dev *pdev, const struct pci_d
* if we don't fill these
*/
probe_ent
->
pio_mask
=
0x1f
;
probe_ent
->
mwdma_mask
=
0x07
;
probe_ent
->
udma_mask
=
0x7f
;
/* We have 4 ports per PCI function */
...
...
include/linux/ata.h
View file @
923540a1
...
...
@@ -42,6 +42,7 @@ enum {
ATA_ID_SERNO_OFS
=
10
,
ATA_ID_MAJOR_VER
=
80
,
ATA_ID_PIO_MODES
=
64
,
ATA_ID_MWDMA_MODES
=
63
,
ATA_ID_UDMA_MODES
=
88
,
ATA_ID_PIO4
=
(
1
<<
1
),
...
...
@@ -133,13 +134,20 @@ enum {
XFER_UDMA_2
=
0x42
,
XFER_UDMA_1
=
0x41
,
XFER_UDMA_0
=
0x40
,
XFER_MW_DMA_2
=
0x22
,
XFER_MW_DMA_1
=
0x21
,
XFER_MW_DMA_0
=
0x20
,
XFER_PIO_4
=
0x0C
,
XFER_PIO_3
=
0x0B
,
XFER_PIO_2
=
0x0A
,
XFER_PIO_1
=
0x09
,
XFER_PIO_0
=
0x08
,
/* ATAPI stuff */
ATAPI_PKT_DMA
=
(
1
<<
0
),
ATAPI_DMADIR
=
(
1
<<
2
),
/* ATAPI data dir:
0=to device, 1=to host */
ATAPI_CDB_LEN
=
16
,
/* cable types */
ATA_CBL_NONE
=
0
,
...
...
@@ -169,7 +177,8 @@ enum ata_tf_protocols {
ATA_PROT_PIO
,
/* PIO single sector */
ATA_PROT_PIO_MULT
,
/* PIO multiple sector */
ATA_PROT_DMA
,
/* DMA */
ATA_PROT_ATAPI
,
/* packet command */
ATA_PROT_ATAPI
,
/* packet command, PIO data xfer*/
ATA_PROT_ATAPI_NODATA
,
/* packet command, no data */
ATA_PROT_ATAPI_DMA
,
/* packet command with special DMA sauce */
};
...
...
@@ -220,9 +229,20 @@ struct ata_taskfile {
((u64) dev->id[(n) + 1] << 16) | \
((u64) dev->id[(n) + 0]) )
static
inline
int
atapi_cdb_len
(
u16
*
dev_id
)
{
u16
tmp
=
dev_id
[
0
]
&
0x3
;
switch
(
tmp
)
{
case
0
:
return
12
;
case
1
:
return
16
;
default:
return
-
1
;
}
}
static
inline
int
is_atapi_taskfile
(
struct
ata_taskfile
*
tf
)
{
return
(
tf
->
protocol
==
ATA_PROT_ATAPI
)
||
(
tf
->
protocol
==
ATA_PROT_ATAPI_NODATA
)
||
(
tf
->
protocol
==
ATA_PROT_ATAPI_DMA
);
}
...
...
include/linux/libata.h
View file @
923540a1
...
...
@@ -32,7 +32,6 @@
/*
* compile-time options
*/
#undef ATA_FORCE_PIO
/* do not configure or use DMA */
#undef ATA_DEBUG
/* debugging output */
#undef ATA_VERBOSE_DEBUG
/* yet more debugging output */
#undef ATA_IRQ_TRAP
/* define to ack screaming irqs */
...
...
@@ -88,10 +87,7 @@ enum {
/* struct ata_device stuff */
ATA_DFLAG_LBA48
=
(
1
<<
0
),
/* device supports LBA48 */
ATA_DFLAG_PIO
=
(
1
<<
1
),
/* device currently in PIO mode */
ATA_DFLAG_MASTER
=
(
1
<<
2
),
/* is device 0? */
ATA_DFLAG_WCACHE
=
(
1
<<
3
),
/* has write cache we can
* (hopefully) flush? */
ATA_DFLAG_LOCK_SECTORS
=
(
1
<<
4
),
/* don't adjust max_sectors */
ATA_DFLAG_LOCK_SECTORS
=
(
1
<<
2
),
/* don't adjust max_sectors */
ATA_DEV_UNKNOWN
=
0
,
/* unknown device */
ATA_DEV_ATA
=
1
,
/* ATA device */
...
...
@@ -111,7 +107,6 @@ enum {
ATA_FLAG_SATA_RESET
=
(
1
<<
7
),
/* use COMRESET */
ATA_QCFLAG_ACTIVE
=
(
1
<<
1
),
/* cmd not yet ack'd to scsi lyer */
ATA_QCFLAG_DMA
=
(
1
<<
2
),
/* data delivered via DMA */
ATA_QCFLAG_SG
=
(
1
<<
3
),
/* have s/g table? */
ATA_QCFLAG_SINGLE
=
(
1
<<
4
),
/* no s/g, just a single buffer */
ATA_QCFLAG_DMAMAP
=
ATA_QCFLAG_SG
|
ATA_QCFLAG_SINGLE
,
...
...
@@ -140,6 +135,13 @@ enum {
PORT_UNKNOWN
=
0
,
PORT_ENABLED
=
1
,
PORT_DISABLED
=
2
,
/* encoding various smaller bitmaps into a single
* unsigned long bitmap
*/
ATA_SHIFT_UDMA
=
0
,
ATA_SHIFT_MWDMA
=
8
,
ATA_SHIFT_PIO
=
11
,
};
enum
pio_task_states
{
...
...
@@ -188,6 +190,7 @@ struct ata_probe_ent {
struct
ata_ioports
port
[
ATA_MAX_PORTS
];
unsigned
int
n_ports
;
unsigned
int
pio_mask
;
unsigned
int
mwdma_mask
;
unsigned
int
udma_mask
;
unsigned
int
legacy_mode
;
unsigned
long
irq
;
...
...
@@ -215,6 +218,9 @@ struct ata_queued_cmd {
struct
scsi_cmnd
*
scsicmd
;
void
(
*
scsidone
)(
struct
scsi_cmnd
*
);
struct
ata_taskfile
tf
;
u8
cdb
[
ATAPI_CDB_LEN
];
unsigned
long
flags
;
/* ATA_QCFLAG_xxx */
unsigned
int
tag
;
unsigned
int
n_elem
;
...
...
@@ -226,7 +232,6 @@ struct ata_queued_cmd {
unsigned
int
cursg
;
unsigned
int
cursg_ofs
;
struct
ata_taskfile
tf
;
struct
scatterlist
sgent
;
void
*
buf_virt
;
...
...
@@ -251,8 +256,10 @@ struct ata_device {
unsigned
int
class
;
/* ATA_DEV_xxx */
unsigned
int
devno
;
/* 0 or 1 */
u16
id
[
ATA_ID_WORDS
];
/* IDENTIFY xxx DEVICE data */
unsigned
int
pio_mode
;
unsigned
int
udma_mode
;
u8
pio_mode
;
u8
dma_mode
;
u8
xfer_mode
;
unsigned
int
xfer_shift
;
/* ATA_SHIFT_xxx */
/* cache info about current transfer mode */
u8
xfer_protocol
;
/* taskfile xfer protocol */
...
...
@@ -277,8 +284,10 @@ struct ata_port {
unsigned
int
bus_state
;
unsigned
int
port_state
;
unsigned
int
pio_mask
;
unsigned
int
mwdma_mask
;
unsigned
int
udma_mask
;
unsigned
int
cbl
;
/* cable type; ATA_CBL_xxx */
unsigned
int
cdb_len
;
struct
ata_device
device
[
ATA_MAX_DEVICES
];
...
...
@@ -303,10 +312,8 @@ struct ata_port_operations {
void
(
*
dev_config
)
(
struct
ata_port
*
,
struct
ata_device
*
);
void
(
*
set_piomode
)
(
struct
ata_port
*
,
struct
ata_device
*
,
unsigned
int
);
void
(
*
set_udmamode
)
(
struct
ata_port
*
,
struct
ata_device
*
,
unsigned
int
);
void
(
*
set_piomode
)
(
struct
ata_port
*
,
struct
ata_device
*
);
void
(
*
set_dmamode
)
(
struct
ata_port
*
,
struct
ata_device
*
);
void
(
*
tf_load
)
(
struct
ata_port
*
ap
,
struct
ata_taskfile
*
tf
);
void
(
*
tf_read
)
(
struct
ata_port
*
ap
,
struct
ata_taskfile
*
tf
);
...
...
@@ -342,6 +349,7 @@ struct ata_port_info {
Scsi_Host_Template
*
sht
;
unsigned
long
host_flags
;
unsigned
long
pio_mask
;
unsigned
long
mwdma_mask
;
unsigned
long
udma_mask
;
struct
ata_port_operations
*
port_ops
;
};
...
...
@@ -472,7 +480,6 @@ static inline u8 ata_wait_idle(struct ata_port *ap)
static
inline
void
ata_qc_set_polling
(
struct
ata_queued_cmd
*
qc
)
{
qc
->
flags
&=
~
ATA_QCFLAG_DMA
;
qc
->
tf
.
ctl
|=
ATA_NIEN
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment