source: mainline/uspace/drv/block/ahci/ahci.h@ 1f76b7d

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 1f76b7d 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
RevLine 
[9904eb90]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
[56fd7cf]36#include <async.h>
[9904eb90]37#include <devman.h>
38#include <ddf/interrupt.h>
39#include <stdio.h>
[8d2dd7f2]40#include <stddef.h>
41#include <stdint.h>
[9904eb90]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. */
[ae3ff9f5]50 volatile ahci_memregs_t *memregs;
[9904eb90]51
52 /** Pointers to sata devices. */
[eb3683a]53 void *sata_devs[AHCI_MAX_PORTS];
[56fd7cf]54
55 /** Parent session */
56 async_sess_t *parent_sess;
[9904eb90]57} ahci_dev_t;
58
59/** SATA Device. */
60typedef struct {
61 /** Pointer to AHCI device. */
62 ahci_dev_t *ahci;
63
[56fd7cf]64 /** Pointer to ddf function. */
65 ddf_fun_t *fun;
66
[eb3683a]67 /** SATA port number (0-31). */
[9904eb90]68 uint8_t port_num;
69
70 /** Device in invalid state (disconnected and so on). */
[ae3ff9f5]71 bool is_invalid_device;
[9904eb90]72
73 /** Pointer to SATA port. */
74 volatile ahci_port_t *port;
[ae3ff9f5]75
[9904eb90]76 /** Pointer to command header. */
77 volatile ahci_cmdhdr_t *cmd_header;
[ae3ff9f5]78
[9904eb90]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;
[eb3683a]87
[9904eb90]88 /** Event signaling condition variable. */
89 fibril_condvar_t event_condvar;
90
[eb3683a]91 /** Event interrupt state. */
92 ahci_port_is_t event_pxis;
93
[9904eb90]94 /** Block device service id. */
[eb3683a]95 service_id_t service_id;
[9904eb90]96
97 /** Number of device data blocks. */
98 uint64_t blocks;
[eb3683a]99
[9904eb90]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). */
[ae3ff9f5]107 bool is_packet_device;
[9904eb90]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.