Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
ide-dma-sff.c File Reference
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/export.h>
#include <linux/ide.h>
#include <linux/scatterlist.h>
#include <linux/dma-mapping.h>
#include <linux/io.h>

Go to the source code of this file.

Macros

#define CHECK_DMA_MASK   (ATA_DMA_ACTIVE | ATA_DMA_ERR | ATA_DMA_INTR)
 

Functions

int config_drive_for_dma (ide_drive_t *drive)
 
u8 ide_dma_sff_read_status (ide_hwif_t *hwif)
 
 EXPORT_SYMBOL_GPL (ide_dma_sff_read_status)
 
void ide_dma_host_set (ide_drive_t *drive, int on)
 
 EXPORT_SYMBOL_GPL (ide_dma_host_set)
 
int ide_build_dmatable (ide_drive_t *drive, struct ide_cmd *cmd)
 
 EXPORT_SYMBOL_GPL (ide_build_dmatable)
 
int ide_dma_setup (ide_drive_t *drive, struct ide_cmd *cmd)
 
 EXPORT_SYMBOL_GPL (ide_dma_setup)
 
int ide_dma_sff_timer_expiry (ide_drive_t *drive)
 
 EXPORT_SYMBOL_GPL (ide_dma_sff_timer_expiry)
 
void ide_dma_start (ide_drive_t *drive)
 
 EXPORT_SYMBOL_GPL (ide_dma_start)
 
int ide_dma_end (ide_drive_t *drive)
 
 EXPORT_SYMBOL_GPL (ide_dma_end)
 
int ide_dma_test_irq (ide_drive_t *drive)
 
 EXPORT_SYMBOL_GPL (ide_dma_test_irq)
 
 EXPORT_SYMBOL_GPL (sff_dma_ops)
 

Variables

struct ide_dma_ops sff_dma_ops
 

Macro Definition Documentation

#define CHECK_DMA_MASK   (ATA_DMA_ACTIVE | ATA_DMA_ERR | ATA_DMA_INTR)

Function Documentation

int config_drive_for_dma ( ide_drive_t drive)

config_drive_for_dma - attempt to activate IDE DMA : the drive to place in DMA mode

If the drive supports at least mode 2 DMA or UDMA of any kind then attempt to place it into DMA mode. Drives that are known to support DMA but predate the DMA properties or that are known to have DMA handling bugs are also set up appropriately based on the good/bad drive lists.

Definition at line 20 of file ide-dma-sff.c.

EXPORT_SYMBOL_GPL ( ide_dma_sff_read_status  )
EXPORT_SYMBOL_GPL ( ide_dma_host_set  )
EXPORT_SYMBOL_GPL ( ide_build_dmatable  )
EXPORT_SYMBOL_GPL ( ide_dma_setup  )
EXPORT_SYMBOL_GPL ( ide_dma_sff_timer_expiry  )
EXPORT_SYMBOL_GPL ( ide_dma_start  )
EXPORT_SYMBOL_GPL ( ide_dma_end  )
EXPORT_SYMBOL_GPL ( ide_dma_test_irq  )
EXPORT_SYMBOL_GPL ( sff_dma_ops  )
int ide_build_dmatable ( ide_drive_t drive,
struct ide_cmd cmd 
)

ide_build_dmatable - build IDE DMA table

ide_build_dmatable() prepares a dma request. We map the command to get the pci bus addresses of the buffers and then build up the PRD table that the IDE layer wants to be fed.

Most chipsets correctly interpret a length of 0x0000 as 64KB, but at least one (e.g. CS5530) misinterprets it as zero (!). So we break the 64KB entry into two 32KB entries instead.

Returns the number of built PRD entries if all went okay, returns 0 otherwise.

May also be invoked from trm290.c

Definition at line 114 of file ide-dma-sff.c.

int ide_dma_end ( ide_drive_t drive)

Definition at line 285 of file ide-dma-sff.c.

void ide_dma_host_set ( ide_drive_t drive,
int  on 
)

ide_dma_host_set - Enable/disable DMA on a host : drive to control

Enable/disable DMA on an IDE controller following generic bus-mastering IDE controller behaviour.

Definition at line 82 of file ide-dma-sff.c.

int ide_dma_setup ( ide_drive_t drive,
struct ide_cmd cmd 
)

ide_dma_setup - begin a DMA phase : target device : command

Build an IDE DMA PRD (IDE speak for scatter gather table) and then set up the DMA transfer registers for a device that follows generic IDE PCI DMA behaviour. Controllers can override this function if they need to

Returns 0 on success. If a PIO fallback is required then 1 is returned.

Definition at line 187 of file ide-dma-sff.c.

u8 ide_dma_sff_read_status ( ide_hwif_t hwif)

Definition at line 53 of file ide-dma-sff.c.

int ide_dma_sff_timer_expiry ( ide_drive_t drive)

ide_dma_sff_timer_expiry - handle a DMA timeout : Drive that timed out

An IDE DMA transfer timed out. In the event of an error we ask the driver to resolve the problem, if a DMA transfer is still in progress we continue to wait (arguably we need to add a secondary 'I don't care what the drive thinks' timeout here) Finally if we have an interrupt we let it complete the I/O. But only one time - we clear expiry and if it's still not completed after WAIT_CMD, we error and retry in PIO. This can occur if an interrupt is lost or due to hang or bugs.

Definition at line 237 of file ide-dma-sff.c.

void ide_dma_start ( ide_drive_t drive)

Definition at line 263 of file ide-dma-sff.c.

int ide_dma_test_irq ( ide_drive_t drive)

Definition at line 316 of file ide-dma-sff.c.

Variable Documentation

struct ide_dma_ops sff_dma_ops
Initial value:
= {
.dma_host_set = ide_dma_host_set,
.dma_setup = ide_dma_setup,
.dma_start = ide_dma_start,
.dma_end = ide_dma_end,
.dma_test_irq = ide_dma_test_irq,
.dma_lost_irq = ide_dma_lost_irq,
.dma_timer_expiry = ide_dma_sff_timer_expiry,
.dma_sff_read_status = ide_dma_sff_read_status,
}

Definition at line 325 of file ide-dma-sff.c.