CS350 COS
COS
|
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include <sys/kassert.h>
#include <sys/kdebug.h>
#include <sys/kmem.h>
#include <sys/pci.h>
#include <sys/sga.h>
#include "ata.h"
#include "sata.h"
Go to the source code of this file.
Data Structures | |
struct | AHCIDevice |
struct | AHCIHostControl |
struct | AHCIPort |
struct | AHCICommandHeader |
struct | AHCICommandList |
struct | AHCIPRDT |
struct | AHCICommandTable |
struct | AHCIRecvFIS |
struct | AHCI |
Macros | |
#define | AHCI_CAP_S64A 0x80000000 /* Supports 64-bit Addressing */ |
#define | AHCI_CAP_SNCQ 0x40000000 /* Supports NCQ */ |
#define | AHCI_GHC_AE 0x80000000 |
#define | AHCI_GHC_IE 0x00000002 |
#define | AHCI_GHC_HR 0x00000001 |
#define | AHCIPORT_CMD_ICCMASK 0xF0000000 /* Interface Communication Control */ |
#define | AHCIPORT_CMD_ICCSLUMBER 0x60000000 /* ICC Slumber */ |
#define | AHCIPORT_CMD_ICCPARTIAL 0x20000000 /* ICC Partial */ |
#define | AHCIPORT_CMD_ICCACTIVE 0x10000000 /* ICC Active */ |
#define | AHCIPORT_CMD_ICCIDLE 0x00000000 /* ICC Idle */ |
#define | AHCIPORT_CMD_ASP 0x08000000 /* Aggressive Slumber/Partial */ |
#define | AHCIPORT_CMD_ALPE 0x04000000 /* Aggressive Link PM Enable */ |
#define | AHCIPORT_CMD_DLAE 0x02000000 /* Drive LED on ATAPI Enable */ |
#define | AHCIPORT_CMD_ATAPI 0x01000000 /* Device is ATAPI */ |
#define | AHCIPORT_CMD_CPD 0x00100000 /* Cold Presence Detection */ |
#define | AHCIPORT_CMD_ISP 0x00080000 /* Interlock Switch Attached */ |
#define | AHCIPORT_CMD_HPCP 0x00040000 /* Hot Plug Capable Port */ |
#define | AHCIPORT_CMD_PMA 0x00020000 /* Port Multiplier Attached */ |
#define | AHCIPORT_CMD_CPS 0x00010000 /* Cold Presence State */ |
#define | AHCIPORT_CMD_CR 0x00008000 /* Command List Running */ |
#define | AHCIPORT_CMD_FR 0x00004000 /* FIS Receive Running */ |
#define | AHCIPORT_CMD_ISS 0x00002000 /* Interlock Switch State */ |
#define | AHCIPORT_CMD_FRE 0x00000010 /* FIS Receive Enable */ |
#define | AHCIPORT_CMD_CLO 0x00000008 /* Command List Override */ |
#define | AHCIPORT_CMD_POD 0x00000004 /* Power On Device */ |
#define | AHCIPORT_CMD_SUD 0x00000002 /* Spin-Up Device */ |
#define | AHCIPORT_CMD_ST 0x00000001 /* Start */ |
#define | AHCIPORT_TFD_BSY 0x00000080 /* Port Busy */ |
#define | AHCIPORT_TFD_DRQ 0x00000004 /* Data Transfer Requested */ |
#define | AHCIPORT_TFD_ERR 0x00000001 /* Error during Transfer */ |
#define | AHCIPORT_SSTS_DETMASK 0x0000000F /* Device Detection (DET) Mask */ |
#define | AHCIPORT_SSTS_DETNP 0x00000000 /* DET: Not Present */ |
#define | AHCIPORT_SSTS_DETNOTEST 0x00000001 /* DET: Phy not established */ |
#define | AHCIPORT_SSTS_DETPE 0x00000003 /* DET: Present and Established */ |
#define | AHCIPORT_SSTS_DETNE 0x00000004 /* DET: Not Enabled or in BIST mode */ |
#define | AHCI_ABAR 5 |
#define | AHCI_PORT_OFFSET 0x100 |
#define | AHCI_PORT_LENGTH 0x80 |
#define | AHCI_MAX_PORTS 8 |
#define | AHCI_MAX_CMDS 32 |
#define | PGSIZE 4096 |
Typedefs | |
typedef struct AHCIDevice | AHCIDevice |
typedef struct AHCIHostControl | AHCIHostControl |
typedef struct AHCIPort | AHCIPort |
typedef struct AHCICommandHeader | AHCICommandHeader |
typedef struct AHCICommandList | AHCICommandList |
typedef struct AHCIPRDT | AHCIPRDT |
typedef struct AHCICommandTable | AHCICommandTable |
typedef struct AHCIRecvFIS | AHCIRecvFIS |
typedef struct AHCI | AHCI |
Functions | |
void | AHCI_Configure (PCIDevice dev) |
void | AHCI_Init (uint32_t bus, uint32_t slot, uint32_t func) |
void | AHCI_Dump (AHCI *ahci) |
void | AHCI_DumpPort (AHCI *ahci, int port) |
uint64_t | AHCI_IssueCommand (AHCI *ahci, int port, SGArray *sga, void *cfis, int len) |
void | AHCI_WaitPort (AHCI *ahci, int port) |
void | AHCI_IdentifyPort (AHCI *ahci, int port) |
void | AHCI_ResetPort (AHCI *ahci, int port) |
void | AHCI_Reset (AHCI *ahci) |
Variables | |
static AHCIDevice | deviceList [] |
struct AHCIDevice |
struct AHCIHostControl |
struct AHCIPort |
struct AHCICommandHeader |
struct AHCICommandList |
Data Fields | ||
---|---|---|
AHCICommandHeader | cmds[AHCI_MAX_CMDS] |
struct AHCIPRDT |
struct AHCICommandTable |
struct AHCIRecvFIS |
struct AHCI |
Data Fields | ||
---|---|---|
AHCICommandList * | clst[AHCI_MAX_PORTS] | |
AHCICommandTable * | ctbl[AHCI_MAX_PORTS][AHCI_MAX_CMDS] | |
PCIDevice | dev | |
AHCIHostControl * | hc | |
AHCIPort * | port[AHCI_MAX_PORTS] | |
AHCIRecvFIS * | rfis[AHCI_MAX_PORTS] |
#define AHCI_CAP_S64A 0x80000000 /* Supports 64-bit Addressing */ |
#define AHCIPORT_CMD_ALPE 0x04000000 /* Aggressive Link PM Enable */ |
#define AHCIPORT_CMD_ASP 0x08000000 /* Aggressive Slumber/Partial */ |
#define AHCIPORT_CMD_CLO 0x00000008 /* Command List Override */ |
#define AHCIPORT_CMD_CPD 0x00100000 /* Cold Presence Detection */ |
#define AHCIPORT_CMD_DLAE 0x02000000 /* Drive LED on ATAPI Enable */ |
#define AHCIPORT_CMD_HPCP 0x00040000 /* Hot Plug Capable Port */ |
#define AHCIPORT_CMD_ICCMASK 0xF0000000 /* Interface Communication Control */ |
#define AHCIPORT_CMD_ISP 0x00080000 /* Interlock Switch Attached */ |
#define AHCIPORT_CMD_ISS 0x00002000 /* Interlock Switch State */ |
#define AHCIPORT_CMD_PMA 0x00020000 /* Port Multiplier Attached */ |
#define AHCIPORT_SSTS_DETMASK 0x0000000F /* Device Detection (DET) Mask */ |
#define AHCIPORT_SSTS_DETNE 0x00000004 /* DET: Not Enabled or in BIST mode */ |
#define AHCIPORT_SSTS_DETNOTEST 0x00000001 /* DET: Phy not established */ |
#define AHCIPORT_SSTS_DETPE 0x00000003 /* DET: Present and Established */ |
#define AHCIPORT_TFD_DRQ 0x00000004 /* Data Transfer Requested */ |
#define AHCIPORT_TFD_ERR 0x00000001 /* Error during Transfer */ |
#define PGSIZE 4096 |
typedef struct AHCICommandHeader AHCICommandHeader |
typedef struct AHCICommandList AHCICommandList |
typedef struct AHCICommandTable AHCICommandTable |
typedef struct AHCIDevice AHCIDevice |
typedef struct AHCIHostControl AHCIHostControl |
typedef struct AHCIRecvFIS AHCIRecvFIS |
void AHCI_Configure | ( | PCIDevice | dev | ) |
Definition at line 419 of file ahci.c.
void AHCI_Dump | ( | AHCI * | ahci | ) |
void AHCI_DumpPort | ( | AHCI * | ahci, |
int | port | ||
) |
void AHCI_IdentifyPort | ( | AHCI * | ahci, |
int | port | ||
) |
Definition at line 299 of file ahci.c.
Definition at line 183 of file ahci.c.
Definition at line 254 of file ahci.c.
void AHCI_Reset | ( | AHCI * | ahci | ) |
Definition at line 383 of file ahci.c.
void AHCI_ResetPort | ( | AHCI * | ahci, |
int | port | ||
) |
Definition at line 332 of file ahci.c.
void AHCI_WaitPort | ( | AHCI * | ahci, |
int | port | ||
) |
|
static |