Chinaunix首页 | 论坛 | 博客
  • 博客访问: 56524
  • 博文数量: 8
  • 博客积分: 1598
  • 博客等级: 上尉
  • 技术积分: 90
  • 用 户 组: 普通用户
  • 注册时间: 2009-07-09 15:35
文章分类

全部博文(8)

文章存档

2010年(1)

2009年(7)

我的朋友

分类: LINUX

2009-12-25 10:08:42

Part2 ahci driver level

Each AHCI controller implements several sata ports, each port connects
to one SATA device.

AHCI driver needs to setup the command table for each port and use the
command table to issue read/write command to AHCI controller.

In libata, each ata port is represented by an ata_port struct, AHCI
driver has ahci_port_priv as driver private part, it mainly stores the
dma address for the command table.

ahci_port_start:
    alloc memory used for dma (AHCI_PORT_PRIV_DMA_SZ bytes)
    power up the port
    start the port DMA engine


ahci_qc_prep:
    ata_queued_cmd has all the needed info, including
    ata_taskfile (read/write command, sector address)
    scatter-gather list used for DMA
    according to these info, ahci_qc_prep will setup the corresponding
    command slot entry and the command table
    1. convert taskfile to a command FIS
    2. fill the PRDT according to the sg list in ata_queued_cmd
    3. fill the command slot (point to the command table)

ahci_qc_issue:
    Once the command slot and command table have been setup, driver will
    setup the corresponding bit in PORT_CMD_ISSUE to tell the host
    controller there is new command coming.

    For NCQ command, driver needs to setup the corresponding bit in
    PORT_SCR_ACT. Driver needs to test this register to know the
    completion status of issued command, non-NCQ command should read
    PORT_CMD_ISSUE instead (see the interrupt service routine
    ahci_port_intr for details).
阅读(2964) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~