source: mainline/uspace/drv/block/ahci/ahci.h@ 2fd26bb

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 2fd26bb was 8d2dd7f2, checked in by Jakub Jermar <jakub@…>, 8 years ago

Reduce the number of files that include <sys/types.h>

  • Property mode set to 100644
File size: 3.1 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 <async.h>
37#include <devman.h>
38#include <ddf/interrupt.h>
39#include <stdio.h>
40#include <stddef.h>
41#include <stdint.h>
42#include "ahci_hw.h"
43
44/** AHCI Device. */
45typedef struct {
46 /** Pointer to ddf device. */
47 ddf_dev_t *dev;
48
49 /** Pointer to AHCI memory registers. */
50 volatile ahci_memregs_t *memregs;
51
52 /** Pointers to sata devices. */
53 void *sata_devs[AHCI_MAX_PORTS];
54
55 /** Parent session */
56 async_sess_t *parent_sess;
57} ahci_dev_t;
58
59/** SATA Device. */
60typedef struct {
61 /** Pointer to AHCI device. */
62 ahci_dev_t *ahci;
63
64 /** Pointer to ddf function. */
65 ddf_fun_t *fun;
66
67 /** SATA port number (0-31). */
68 uint8_t port_num;
69
70 /** Device in invalid state (disconnected and so on). */
71 bool is_invalid_device;
72
73 /** Pointer to SATA port. */
74 volatile ahci_port_t *port;
75
76 /** Pointer to command header. */
77 volatile ahci_cmdhdr_t *cmd_header;
78
79 /** Pointer to command table. */
80 volatile uint32_t *cmd_table;
81
82 /** Mutex for single operation on device. */
83 fibril_mutex_t lock;
84
85 /** Mutex for event signaling condition variable. */
86 fibril_mutex_t event_lock;
87
88 /** Event signaling condition variable. */
89 fibril_condvar_t event_condvar;
90
91 /** Event interrupt state. */
92 ahci_port_is_t event_pxis;
93
94 /** Block device service id. */
95 service_id_t service_id;
96
97 /** Number of device data blocks. */
98 uint64_t blocks;
99
100 /** Size of device data blocks. */
101 size_t block_size;
102
103 /** Name of SATA device. */
104 char model[STR_BOUNDS(40) + 1];
105
106 /** Device in invalid state (disconnected and so on). */
107 bool is_packet_device;
108
109 /** Highest UDMA mode supported. */
110 uint8_t highest_udma_mode;
111} sata_dev_t;
112
113#endif
Note: See TracBrowser for help on using the repository browser.