source: mainline/uspace/drv/block/ahci/ahci.h@ 8486c07

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 8486c07 was ae3ff9f5, checked in by Martin Decky <martin@…>, 13 years ago

import AHCI updates (comments, fixes) from Petr Jerman (lp:~petr-jerman/+junk/hos-ahci)

  • Property mode set to 100644
File size: 3.2 KB
Line 
1/*
2 * Copyright (c) 2012 Petr Jerman
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/** @file
30 * Header for AHCI driver.
31 */
32
33#ifndef __AHCI_H__
34#define __AHCI_H__
35
36#include <sys/types.h>
37#include <devman.h>
38#include <ddf/interrupt.h>
39#include <stdio.h>
40#include "ahci_hw.h"
41
42/** AHCI Device. */
43typedef struct {
44 /** Pointer to ddf device. */
45 ddf_dev_t *dev;
46
47 /** Pointer to AHCI memory registers. */
48 volatile ahci_memregs_t *memregs;
49
50 /** AHCI device global timer. */
51 fibril_timer_t *timer;
52
53 /** Pointers to sata devices. */
54 void *sata_devs[32];
55
56 /** Device has harware interrupt. */
57 bool is_hw_interrupt;
58} ahci_dev_t;
59
60/** SATA Device. */
61typedef struct {
62 /** Pointer to AHCI device. */
63 ahci_dev_t *ahci;
64
65 /** SATA port number(0-31). */
66 uint8_t port_num;
67
68 /** Port interrupt states shadow registers. */
69 ahci_port_is_t shadow_pxis;
70
71 /** Device in invalid state (disconnected and so on). */
72 bool is_invalid_device;
73
74 /** Pointer to SATA port. */
75 volatile ahci_port_t *port;
76
77 /** Pointer to command header. */
78 volatile ahci_cmdhdr_t *cmd_header;
79
80 /** Pointer to command table. */
81 volatile uint32_t *cmd_table;
82
83 /** Mutex for single operation on device. */
84 fibril_mutex_t lock;
85
86 /** Mutex for port interrupt state register manipulation. */
87 fibril_mutex_t pxis_lock;
88
89 /** Mutex for event signaling condition variable. */
90 fibril_mutex_t event_lock;
91 /** Event signaling condition variable. */
92 fibril_condvar_t event_condvar;
93
94 /** Block device service id. */
95 service_id_t service_id;
96
97 /** Number of device data blocks. */
98 uint64_t blocks;
99 /** Size of device data blocks. */
100 size_t block_size;
101
102 /** Name of SATA device. */
103 char model[STR_BOUNDS(40) + 1];
104
105 /** Device in invalid state (disconnected and so on). */
106 bool is_packet_device;
107
108 /** Highest UDMA mode supported. */
109 uint8_t highest_udma_mode;
110} sata_dev_t;
111
112#endif
Note: See TracBrowser for help on using the repository browser.