Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations | Functions
sata_nv.c File Reference
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/gfp.h>
#include <linux/pci.h>
#include <linux/init.h>
#include <linux/blkdev.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/device.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_device.h>
#include <linux/libata.h>

Go to the source code of this file.

Data Structures

struct  nv_adma_prd
 
struct  nv_adma_cpb
 
struct  nv_adma_port_priv
 
struct  nv_host_priv
 
struct  defer_queue
 
struct  nv_swncq_port_priv
 
struct  nv_pi_priv
 

Macros

#define DRV_NAME   "sata_nv"
 
#define DRV_VERSION   "3.5"
 
#define NV_ADMA_DMA_BOUNDARY   0xffffffffUL
 
#define NV_ADMA_CHECK_INTR(GCTL, PORT)   ((GCTL) & (1 << (19 + (12 * (PORT)))))
 
#define NV_PI_PRIV(_irq_handler, _sht)   &(struct nv_pi_priv){ .irq_handler = _irq_handler, .sht = _sht }
 

Enumerations

enum  {
  NV_MMIO_BAR = 5, NV_PORTS = 2, NV_PIO_MASK = ATA_PIO4, NV_MWDMA_MASK = ATA_MWDMA2,
  NV_UDMA_MASK = ATA_UDMA6, NV_PORT0_SCR_REG_OFFSET = 0x00, NV_PORT1_SCR_REG_OFFSET = 0x40, NV_INT_STATUS = 0x10,
  NV_INT_ENABLE = 0x11, NV_INT_STATUS_CK804 = 0x440, NV_INT_ENABLE_CK804 = 0x441, NV_INT_DEV = 0x01,
  NV_INT_PM = 0x02, NV_INT_ADDED = 0x04, NV_INT_REMOVED = 0x08, NV_INT_PORT_SHIFT = 4,
  NV_INT_ALL = 0x0f, NV_INT_MASK, NV_INT_CONFIG = 0x12, NV_INT_CONFIG_METHD = 0x01,
  NV_MCP_SATA_CFG_20 = 0x50, NV_MCP_SATA_CFG_20_SATA_SPACE_EN = 0x04, NV_MCP_SATA_CFG_20_PORT0_EN = (1 << 17), NV_MCP_SATA_CFG_20_PORT1_EN = (1 << 16),
  NV_MCP_SATA_CFG_20_PORT0_PWB_EN = (1 << 14), NV_MCP_SATA_CFG_20_PORT1_PWB_EN = (1 << 12), NV_ADMA_MAX_CPBS = 32, NV_ADMA_CPB_SZ = 128,
  NV_ADMA_APRD_SZ = 16, NV_ADMA_SGTBL_LEN, NV_ADMA_SGTBL_TOTAL_LEN = NV_ADMA_SGTBL_LEN + 5, NV_ADMA_SGTBL_SZ = NV_ADMA_SGTBL_LEN * NV_ADMA_APRD_SZ,
  NV_ADMA_PORT_PRIV_DMA_SZ, NV_ADMA_GEN = 0x400, NV_ADMA_GEN_CTL = 0x00, NV_ADMA_NOTIFIER_CLEAR = 0x30,
  NV_ADMA_PORT = 0x480, NV_ADMA_PORT_SIZE = 0x100, NV_ADMA_CTL = 0x40, NV_ADMA_CPB_COUNT = 0x42,
  NV_ADMA_NEXT_CPB_IDX = 0x43, NV_ADMA_STAT = 0x44, NV_ADMA_CPB_BASE_LOW = 0x48, NV_ADMA_CPB_BASE_HIGH = 0x4C,
  NV_ADMA_APPEND = 0x50, NV_ADMA_NOTIFIER = 0x68, NV_ADMA_NOTIFIER_ERROR = 0x6C, NV_ADMA_CTL_HOTPLUG_IEN = (1 << 0),
  NV_ADMA_CTL_CHANNEL_RESET = (1 << 5), NV_ADMA_CTL_GO = (1 << 7), NV_ADMA_CTL_AIEN = (1 << 8), NV_ADMA_CTL_READ_NON_COHERENT = (1 << 11),
  NV_ADMA_CTL_WRITE_NON_COHERENT = (1 << 12), NV_CPB_RESP_DONE = (1 << 0), NV_CPB_RESP_ATA_ERR = (1 << 3), NV_CPB_RESP_CMD_ERR = (1 << 4),
  NV_CPB_RESP_CPB_ERR = (1 << 7), NV_CPB_CTL_CPB_VALID = (1 << 0), NV_CPB_CTL_QUEUE = (1 << 1), NV_CPB_CTL_APRD_VALID = (1 << 2),
  NV_CPB_CTL_IEN = (1 << 3), NV_CPB_CTL_FPDMA = (1 << 4), NV_APRD_WRITE = (1 << 1), NV_APRD_END = (1 << 2),
  NV_APRD_CONT = (1 << 3), NV_ADMA_STAT_TIMEOUT = (1 << 0), NV_ADMA_STAT_HOTUNPLUG = (1 << 1), NV_ADMA_STAT_HOTPLUG = (1 << 2),
  NV_ADMA_STAT_CPBERR = (1 << 4), NV_ADMA_STAT_SERROR = (1 << 5), NV_ADMA_STAT_CMD_COMPLETE = (1 << 6), NV_ADMA_STAT_IDLE = (1 << 8),
  NV_ADMA_STAT_LEGACY = (1 << 9), NV_ADMA_STAT_STOPPED = (1 << 10), NV_ADMA_STAT_DONE = (1 << 12), NV_ADMA_STAT_ERR,
  NV_ADMA_PORT_REGISTER_MODE = (1 << 0), NV_ADMA_ATAPI_SETUP_COMPLETE = (1 << 1), NV_CTL_MCP55 = 0x400, NV_INT_STATUS_MCP55 = 0x440,
  NV_INT_ENABLE_MCP55 = 0x444, NV_NCQ_REG_MCP55 = 0x448, NV_INT_ALL_MCP55 = 0xffff, NV_INT_PORT_SHIFT_MCP55 = 16,
  NV_INT_MASK_MCP55 = NV_INT_ALL_MCP55 & 0xfffd, NV_CTL_PRI_SWNCQ = 0x02, NV_CTL_SEC_SWNCQ = 0x04, NV_SWNCQ_IRQ_DEV = (1 << 0),
  NV_SWNCQ_IRQ_PM = (1 << 1), NV_SWNCQ_IRQ_ADDED = (1 << 2), NV_SWNCQ_IRQ_REMOVED = (1 << 3), NV_SWNCQ_IRQ_BACKOUT = (1 << 4),
  NV_SWNCQ_IRQ_SDBFIS = (1 << 5), NV_SWNCQ_IRQ_DHREGFIS = (1 << 6), NV_SWNCQ_IRQ_DMASETUP = (1 << 7), NV_SWNCQ_IRQ_HOTPLUG
}
 
enum  nv_adma_regbits {
  CMDEND = (1 << 15), WNB = (1 << 14), IGN = (1 << 13), CS1n = (1 << (4 + 8)),
  DA2 = (1 << (2 + 8)), DA1 = (1 << (1 + 8)), DA0 = (1 << (0 + 8))
}
 
enum  ncq_saw_flag_list { ncq_saw_d2h = (1U << 0), ncq_saw_dmas = (1U << 1), ncq_saw_sdb = (1U << 2), ncq_saw_backout = (1U << 3) }
 
enum  nv_host_type {
  GENERIC, NFORCE2, NFORCE3 = NFORCE2, CK804,
  ADMA, MCP5x, SWNCQ
}
 

Functions

 MODULE_AUTHOR ("NVIDIA")
 
 MODULE_DESCRIPTION ("low-level driver for NVIDIA nForce SATA controller")
 
 MODULE_LICENSE ("GPL")
 
 MODULE_DEVICE_TABLE (pci, nv_pci_tbl)
 
 MODULE_VERSION (DRV_VERSION)
 
 module_pci_driver (nv_pci_driver)
 
 module_param_named (adma, adma_enabled, bool, 0444)
 
 MODULE_PARM_DESC (adma,"Enable use of ADMA (Default: false)")
 
 module_param_named (swncq, swncq_enabled, bool, 0444)
 
 MODULE_PARM_DESC (swncq,"Enable use of SWNCQ (Default: true)")
 
 module_param_named (msi, msi_enabled, bool, 0444)
 
 MODULE_PARM_DESC (msi,"Enable use of MSI (Default: false)")
 

Macro Definition Documentation

#define DRV_NAME   "sata_nv"

Definition at line 52 of file sata_nv.c.

#define DRV_VERSION   "3.5"

Definition at line 53 of file sata_nv.c.

#define NV_ADMA_CHECK_INTR (   GCTL,
  PORT 
)    ((GCTL) & (1 << (19 + (12 * (PORT)))))

Definition at line 296 of file sata_nv.c.

#define NV_ADMA_DMA_BOUNDARY   0xffffffffUL

Definition at line 55 of file sata_nv.c.

#define NV_PI_PRIV (   _irq_handler,
  _sht 
)    &(struct nv_pi_priv){ .irq_handler = _irq_handler, .sht = _sht }

Definition at line 536 of file sata_nv.c.

Enumeration Type Documentation

anonymous enum
Enumerator:
NV_MMIO_BAR 
NV_PORTS 
NV_PIO_MASK 
NV_MWDMA_MASK 
NV_UDMA_MASK 
NV_PORT0_SCR_REG_OFFSET 
NV_PORT1_SCR_REG_OFFSET 
NV_INT_STATUS 
NV_INT_ENABLE 
NV_INT_STATUS_CK804 
NV_INT_ENABLE_CK804 
NV_INT_DEV 
NV_INT_PM 
NV_INT_ADDED 
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OTPLUG 
NV_ADMA_STAT_CPBERR 
NV_ADMA_STAT_SERROR 
NV_ADMA_STAT_CMD_COMPLETE 
NV_ADMA_STAT_IDLE 
NV_ADMA_STAT_LEGACY 
NV_ADMA_STAT_STOPPED 
NV_ADMA_STAT_DONE 
NV_ADMA_STAT_ERR 
NV_ADMA_PORT_REGISTER_MODE 
NV_ADMA_ATAPI_SETUP_COMPLETE 
NV_CTL_MCP55 
NV_INT_STATUS_MCP55 
NV_INT_ENABLE_MCP55 
NV_NCQ_REG_MCP55 
NV_INT_ALL_MCP55 
NV_INT_PORT_SHIFT_MCP55 
NV_INT_MASK_MCP55 
NV_CTL_PRI_SWNCQ 
NV_CTL_SEC_SWNCQ 
NV_SWNCQ_IRQ_DEV 
NV_SWNCQ_IRQ_PM 
NV_SWNCQ_IRQ_ADDED 
NV_SWNCQ_IRQ_REMOVED 
NV_SWNCQ_IRQ_BACKOUT 
NV_SWNCQ_IRQ_SDBFIS 
NV_SWNCQ_IRQ_DHREGFIS 
NV_SWNCQ_IRQ_DMASETUP 
NV_SWNCQ_IRQ_HOTPLUG 

Definition at line 57 of file sata_nv.c.

Enumerator:
ncq_saw_d2h 
ncq_saw_dmas 
ncq_saw_sdb 
ncq_saw_backout 

Definition at line 267 of file sata_nv.c.

Enumerator:
CMDEND 
WNB 
IGN 
CS1n 
DA2 
DA1 
DA0 

Definition at line 213 of file sata_nv.c.

Enumerator:
GENERIC 
NFORCE2 
NFORCE3 
CK804 
ADMA 
MCP5x 
SWNCQ 

Definition at line 349 of file sata_nv.c.

Function Documentation

MODULE_AUTHOR ( "NVIDIA"  )
MODULE_DESCRIPTION ( "low-level driver for NVIDIA nForce SATA controller )
MODULE_DEVICE_TABLE ( pci  ,
nv_pci_tbl   
)
MODULE_LICENSE ( "GPL"  )
module_param_named ( adma  ,
adma_enabled  ,
bool  ,
0444   
)
module_param_named ( swncq  ,
swncq_enabled  ,
bool  ,
0444   
)
module_param_named ( msi  ,
msi_enabled  ,
bool  ,
0444   
)
MODULE_PARM_DESC ( adma  ,
"Enable use of ADMA (Default: false)"   
)
MODULE_PARM_DESC ( swncq  ,
"Enable use of SWNCQ (Default: true)"   
)
MODULE_PARM_DESC ( msi  ,
"Enable use of MSI (Default: false)"   
)
module_pci_driver ( nv_pci_driver  )
MODULE_VERSION ( DRV_VERSION  )