Skip to content

Commit

Permalink
Merge branch 'upstream' of master.kernel.org:/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/jgarzik/libata-dev
  • Loading branch information
Linus Torvalds committed Sep 5, 2005
2 parents da1f136 + d0bd992 commit 94f8c66
Show file tree
Hide file tree
Showing 13 changed files with 104 additions and 100 deletions.
52 changes: 21 additions & 31 deletions drivers/scsi/ahci.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ static void ahci_irq_clear(struct ata_port *ap);
static void ahci_eng_timeout(struct ata_port *ap);
static int ahci_port_start(struct ata_port *ap);
static void ahci_port_stop(struct ata_port *ap);
static void ahci_host_stop(struct ata_host_set *host_set);
static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf);
static void ahci_qc_prep(struct ata_queued_cmd *qc);
static u8 ahci_check_status(struct ata_port *ap);
Expand Down Expand Up @@ -242,7 +241,6 @@ static struct ata_port_operations ahci_ops = {

.port_start = ahci_port_start,
.port_stop = ahci_port_stop,
.host_stop = ahci_host_stop,
};

static struct ata_port_info ahci_port_info[] = {
Expand Down Expand Up @@ -296,26 +294,19 @@ static inline unsigned long ahci_port_base_ul (unsigned long base, unsigned int
return base + 0x100 + (port * 0x80);
}

static inline void *ahci_port_base (void *base, unsigned int port)
static inline void __iomem *ahci_port_base (void __iomem *base, unsigned int port)
{
return (void *) ahci_port_base_ul((unsigned long)base, port);
}

static void ahci_host_stop(struct ata_host_set *host_set)
{
struct ahci_host_priv *hpriv = host_set->private_data;
kfree(hpriv);

ata_host_stop(host_set);
return (void __iomem *) ahci_port_base_ul((unsigned long)base, port);
}

static int ahci_port_start(struct ata_port *ap)
{
struct device *dev = ap->host_set->dev;
struct ahci_host_priv *hpriv = ap->host_set->private_data;
struct ahci_port_priv *pp;
void *mem, *mmio = ap->host_set->mmio_base;
void *port_mmio = ahci_port_base(mmio, ap->port_no);
void __iomem *mmio = ap->host_set->mmio_base;
void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
void *mem;
dma_addr_t mem_dma;

pp = kmalloc(sizeof(*pp), GFP_KERNEL);
Expand Down Expand Up @@ -383,8 +374,8 @@ static void ahci_port_stop(struct ata_port *ap)
{
struct device *dev = ap->host_set->dev;
struct ahci_port_priv *pp = ap->private_data;
void *mmio = ap->host_set->mmio_base;
void *port_mmio = ahci_port_base(mmio, ap->port_no);
void __iomem *mmio = ap->host_set->mmio_base;
void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
u32 tmp;

tmp = readl(port_mmio + PORT_CMD);
Expand Down Expand Up @@ -546,8 +537,8 @@ static void ahci_qc_prep(struct ata_queued_cmd *qc)

static void ahci_intr_error(struct ata_port *ap, u32 irq_stat)
{
void *mmio = ap->host_set->mmio_base;
void *port_mmio = ahci_port_base(mmio, ap->port_no);
void __iomem *mmio = ap->host_set->mmio_base;
void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
u32 tmp;
int work;

Expand Down Expand Up @@ -595,8 +586,8 @@ static void ahci_intr_error(struct ata_port *ap, u32 irq_stat)
static void ahci_eng_timeout(struct ata_port *ap)
{
struct ata_host_set *host_set = ap->host_set;
void *mmio = host_set->mmio_base;
void *port_mmio = ahci_port_base(mmio, ap->port_no);
void __iomem *mmio = host_set->mmio_base;
void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
struct ata_queued_cmd *qc;
unsigned long flags;

Expand Down Expand Up @@ -626,8 +617,8 @@ static void ahci_eng_timeout(struct ata_port *ap)

static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc)
{
void *mmio = ap->host_set->mmio_base;
void *port_mmio = ahci_port_base(mmio, ap->port_no);
void __iomem *mmio = ap->host_set->mmio_base;
void __iomem *port_mmio = ahci_port_base(mmio, ap->port_no);
u32 status, serr, ci;

serr = readl(port_mmio + PORT_SCR_ERR);
Expand Down Expand Up @@ -663,7 +654,7 @@ static irqreturn_t ahci_interrupt (int irq, void *dev_instance, struct pt_regs *
struct ata_host_set *host_set = dev_instance;
struct ahci_host_priv *hpriv;
unsigned int i, handled = 0;
void *mmio;
void __iomem *mmio;
u32 irq_stat, irq_ack = 0;

VPRINTK("ENTER\n");
Expand Down Expand Up @@ -709,7 +700,7 @@ static irqreturn_t ahci_interrupt (int irq, void *dev_instance, struct pt_regs *
static int ahci_qc_issue(struct ata_queued_cmd *qc)
{
struct ata_port *ap = qc->ap;
void *port_mmio = (void *) ap->ioaddr.cmd_addr;
void __iomem *port_mmio = (void __iomem *) ap->ioaddr.cmd_addr;

writel(1, port_mmio + PORT_CMD_ISSUE);
readl(port_mmio + PORT_CMD_ISSUE); /* flush */
Expand Down Expand Up @@ -894,7 +885,7 @@ static void ahci_print_info(struct ata_probe_ent *probe_ent)
{
struct ahci_host_priv *hpriv = probe_ent->private_data;
struct pci_dev *pdev = to_pci_dev(probe_ent->dev);
void *mmio = probe_ent->mmio_base;
void __iomem *mmio = probe_ent->mmio_base;
u32 vers, cap, impl, speed;
const char *speed_s;
u16 cc;
Expand Down Expand Up @@ -967,7 +958,7 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
struct ata_probe_ent *probe_ent = NULL;
struct ahci_host_priv *hpriv;
unsigned long base;
void *mmio_base;
void __iomem *mmio_base;
unsigned int board_idx = (unsigned int) ent->driver_data;
int have_msi, pci_dev_busy = 0;
int rc;
Expand Down Expand Up @@ -1004,8 +995,7 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
probe_ent->dev = pci_dev_to_dev(pdev);
INIT_LIST_HEAD(&probe_ent->node);

mmio_base = ioremap(pci_resource_start(pdev, AHCI_PCI_BAR),
pci_resource_len(pdev, AHCI_PCI_BAR));
mmio_base = pci_iomap(pdev, AHCI_PCI_BAR, 0);
if (mmio_base == NULL) {
rc = -ENOMEM;
goto err_out_free_ent;
Expand Down Expand Up @@ -1049,7 +1039,7 @@ static int ahci_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
err_out_hpriv:
kfree(hpriv);
err_out_iounmap:
iounmap(mmio_base);
pci_iounmap(pdev, mmio_base);
err_out_free_ent:
kfree(probe_ent);
err_out_msi:
Expand Down Expand Up @@ -1089,7 +1079,8 @@ static void ahci_remove_one (struct pci_dev *pdev)
scsi_host_put(ap->host);
}

host_set->ops->host_stop(host_set);
kfree(hpriv);
pci_iounmap(pdev, host_set->mmio_base);
kfree(host_set);

if (have_msi)
Expand All @@ -1106,7 +1097,6 @@ static int __init ahci_init(void)
return pci_module_init(&ahci_pci_driver);
}


static void __exit ahci_exit(void)
{
pci_unregister_driver(&ahci_pci_driver);
Expand Down
11 changes: 5 additions & 6 deletions drivers/scsi/ata_piix.c
Original file line number Diff line number Diff line change
Expand Up @@ -583,20 +583,19 @@ static void pci_enable_intx(struct pci_dev *pdev)
#define AHCI_ENABLE (1 << 31)
static int piix_disable_ahci(struct pci_dev *pdev)
{
void *mmio;
unsigned long addr;
void __iomem *mmio;
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))
if (!pci_resource_start(pdev, AHCI_PCI_BAR) ||
!pci_resource_len(pdev, AHCI_PCI_BAR))
return 0;

mmio = ioremap(addr, 64);
mmio = pci_iomap(pdev, AHCI_PCI_BAR, 64);
if (!mmio)
return -ENOMEM;

Expand All @@ -610,7 +609,7 @@ static int piix_disable_ahci(struct pci_dev *pdev)
rc = -EIO;
}

iounmap(mmio);
pci_iounmap(pdev, mmio);
return rc;
}

Expand Down
15 changes: 14 additions & 1 deletion drivers/scsi/libata-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ static void __ata_qc_complete(struct ata_queued_cmd *qc);
static unsigned int ata_unique_id = 1;
static struct workqueue_struct *ata_wq;

int atapi_enabled = 0;
module_param(atapi_enabled, int, 0444);
MODULE_PARM_DESC(atapi_enabled, "Enable discovery of ATAPI devices (0=off, 1=on)");

MODULE_AUTHOR("Jeff Garzik");
MODULE_DESCRIPTION("Library module for ATA devices");
MODULE_LICENSE("GPL");
Expand Down Expand Up @@ -4200,6 +4204,15 @@ ata_probe_ent_alloc(struct device *dev, struct ata_port_info *port)



#ifdef CONFIG_PCI

void ata_pci_host_stop (struct ata_host_set *host_set)
{
struct pci_dev *pdev = to_pci_dev(host_set->dev);

pci_iounmap(pdev, host_set->mmio_base);
}

/**
* ata_pci_init_native_mode - Initialize native-mode driver
* @pdev: pci device to be initialized
Expand All @@ -4212,7 +4225,6 @@ ata_probe_ent_alloc(struct device *dev, struct ata_port_info *port)
* ata_probe_ent structure should then be freed with kfree().
*/

#ifdef CONFIG_PCI
struct ata_probe_ent *
ata_pci_init_native_mode(struct pci_dev *pdev, struct ata_port_info **port)
{
Expand Down Expand Up @@ -4595,6 +4607,7 @@ EXPORT_SYMBOL_GPL(ata_scsi_simulate);

#ifdef CONFIG_PCI
EXPORT_SYMBOL_GPL(pci_test_config_bits);
EXPORT_SYMBOL_GPL(ata_pci_host_stop);
EXPORT_SYMBOL_GPL(ata_pci_init_native_mode);
EXPORT_SYMBOL_GPL(ata_pci_init_one);
EXPORT_SYMBOL_GPL(ata_pci_remove_one);
Expand Down
8 changes: 4 additions & 4 deletions drivers/scsi/libata-scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1470,10 +1470,10 @@ ata_scsi_find_dev(struct ata_port *ap, struct scsi_device *scsidev)
if (unlikely(!ata_dev_present(dev)))
return NULL;

#ifndef ATA_ENABLE_ATAPI
if (unlikely(dev->class == ATA_DEV_ATAPI))
return NULL;
#endif
if (!atapi_enabled) {
if (unlikely(dev->class == ATA_DEV_ATAPI))
return NULL;
}

return dev;
}
Expand Down
1 change: 1 addition & 0 deletions drivers/scsi/libata.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ struct ata_scsi_args {
};

/* libata-core.c */
extern int atapi_enabled;
extern struct ata_queued_cmd *ata_qc_new_init(struct ata_port *ap,
struct ata_device *dev);
extern void ata_qc_free(struct ata_queued_cmd *qc);
Expand Down
9 changes: 5 additions & 4 deletions drivers/scsi/sata_nv.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,14 +351,16 @@ static void nv_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val)
static void nv_host_stop (struct ata_host_set *host_set)
{
struct nv_host *host = host_set->private_data;
struct pci_dev *pdev = to_pci_dev(host_set->dev);

// Disable hotplug event interrupts.
if (host->host_desc->disable_hotplug)
host->host_desc->disable_hotplug(host_set);

kfree(host);

ata_host_stop(host_set);
if (host_set->mmio_base)
pci_iounmap(pdev, host_set->mmio_base);
}

static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
Expand Down Expand Up @@ -420,8 +422,7 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
if (host->host_flags & NV_HOST_FLAGS_SCR_MMIO) {
unsigned long base;

probe_ent->mmio_base = ioremap(pci_resource_start(pdev, 5),
pci_resource_len(pdev, 5));
probe_ent->mmio_base = pci_iomap(pdev, 5, 0);
if (probe_ent->mmio_base == NULL) {
rc = -EIO;
goto err_out_free_host;
Expand Down Expand Up @@ -457,7 +458,7 @@ static int nv_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)

err_out_iounmap:
if (host->host_flags & NV_HOST_FLAGS_SCR_MMIO)
iounmap(probe_ent->mmio_base);
pci_iounmap(pdev, probe_ent->mmio_base);
err_out_free_host:
kfree(host);
err_out_free_ent:
Expand Down
20 changes: 10 additions & 10 deletions drivers/scsi/sata_promise.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ static void pdc_exec_command_mmio(struct ata_port *ap, struct ata_taskfile *tf);
static void pdc_irq_clear(struct ata_port *ap);
static int pdc_qc_issue_prot(struct ata_queued_cmd *qc);


static Scsi_Host_Template pdc_ata_sht = {
.module = THIS_MODULE,
.name = DRV_NAME,
Expand Down Expand Up @@ -132,7 +133,7 @@ static struct ata_port_operations pdc_sata_ops = {
.scr_write = pdc_sata_scr_write,
.port_start = pdc_port_start,
.port_stop = pdc_port_stop,
.host_stop = ata_host_stop,
.host_stop = ata_pci_host_stop,
};

static struct ata_port_operations pdc_pata_ops = {
Expand All @@ -153,7 +154,7 @@ static struct ata_port_operations pdc_pata_ops = {

.port_start = pdc_port_start,
.port_stop = pdc_port_stop,
.host_stop = ata_host_stop,
.host_stop = ata_pci_host_stop,
};

static struct ata_port_info pdc_port_info[] = {
Expand Down Expand Up @@ -282,7 +283,7 @@ static void pdc_port_stop(struct ata_port *ap)

static void pdc_reset_port(struct ata_port *ap)
{
void *mmio = (void *) ap->ioaddr.cmd_addr + PDC_CTLSTAT;
void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr + PDC_CTLSTAT;
unsigned int i;
u32 tmp;

Expand Down Expand Up @@ -418,7 +419,7 @@ static inline unsigned int pdc_host_intr( struct ata_port *ap,
u8 status;
unsigned int handled = 0, have_err = 0;
u32 tmp;
void *mmio = (void *) ap->ioaddr.cmd_addr + PDC_GLOBAL_CTL;
void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr + PDC_GLOBAL_CTL;

tmp = readl(mmio);
if (tmp & PDC_ERR_MASK) {
Expand Down Expand Up @@ -447,7 +448,7 @@ static inline unsigned int pdc_host_intr( struct ata_port *ap,
static void pdc_irq_clear(struct ata_port *ap)
{
struct ata_host_set *host_set = ap->host_set;
void *mmio = host_set->mmio_base;
void __iomem *mmio = host_set->mmio_base;

readl(mmio + PDC_INT_SEQMASK);
}
Expand All @@ -459,7 +460,7 @@ static irqreturn_t pdc_interrupt (int irq, void *dev_instance, struct pt_regs *r
u32 mask = 0;
unsigned int i, tmp;
unsigned int handled = 0;
void *mmio_base;
void __iomem *mmio_base;

VPRINTK("ENTER\n");

Expand Down Expand Up @@ -581,7 +582,7 @@ static void pdc_ata_setup_port(struct ata_ioports *port, unsigned long base)

static void pdc_host_init(unsigned int chip_id, struct ata_probe_ent *pe)
{
void *mmio = pe->mmio_base;
void __iomem *mmio = pe->mmio_base;
u32 tmp;

/*
Expand Down Expand Up @@ -624,7 +625,7 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
static int printed_version;
struct ata_probe_ent *probe_ent = NULL;
unsigned long base;
void *mmio_base;
void __iomem *mmio_base;
unsigned int board_idx = (unsigned int) ent->driver_data;
int pci_dev_busy = 0;
int rc;
Expand Down Expand Up @@ -663,8 +664,7 @@ static int pdc_ata_init_one (struct pci_dev *pdev, const struct pci_device_id *e
probe_ent->dev = pci_dev_to_dev(pdev);
INIT_LIST_HEAD(&probe_ent->node);

mmio_base = ioremap(pci_resource_start(pdev, 3),
pci_resource_len(pdev, 3));
mmio_base = pci_iomap(pdev, 3, 0);
if (mmio_base == NULL) {
rc = -ENOMEM;
goto err_out_free_ent;
Expand Down
Loading

0 comments on commit 94f8c66

Please sign in to comment.