source: rtems/cpukit/libblock/include/rtems/blkdev.h @ 3899a537

4.104.114.9
Last change on this file since 3899a537 was 3899a537, checked in by Chris Johns <chrisj@…>, on Jul 29, 2008 at 2:21:15 AM

2008-07-29 Chris Johns <chrisj@…>

  • libblock/Makefile.am: Removed src/show_bdbuf.c.
  • libblock/src/show_bdbuf.c: Removed.
  • libblock/include/rtems/bdbuf.h, cpukit/libblock/src/bdbuf.c: Rewritten the bdbuf code. Remove pre-emption disable, score access, fixed many bugs and increased performance.
  • libblock/include/rtems/blkdev.h: Added RTEMS_BLKDEV_CAPABILITIES block device request. Cleaned up comments. Added block and user fields to the sg buffer request. Move to rtems_* namespace.
  • libblock/include/rtems/diskdevs.h, cpukit/libblock/src/diskdevs.c: Move to rtems_* namespace. Add a capabilities field for drivers. Change rtems_disk_lookup to rtems_disk_obtain to match the release call. You do not lookup and release a disk, you obtain and release a disk.
  • libblock/include/rtems/ide_part_table.h, libblock/include/rtems/ramdisk.h, libblock/src/ide_part_table.c: Move to rtems_* namespace.
  • libblock/include/rtems/nvdisk.h: Formatting change.
  • libblock/src/blkdev.c: Move to rtems_* namespace. Change rtems_disk_lookup to rtems_disk_obtain
  • libblock/src/flashdisk.c: Move to rtems_* namespace. Use the new support for the block number in the scatter/grather request struct. This allows non-continuous buffer requests for those drivers that can support increasing performance.
  • libblock/src/nvdisk.c: Move to rtems_* namespace. Removed warnings. Added better error checking. Fixed some comments.
  • libblock/src/ramdisk.c: Move to rtems_* namespace. Added some trace functions to help debugging upper layers. Use the new support for the block number in the scatter/grather request struct. This allows non-continuous buffer requests for those drivers that can support increasing performance.
  • libfs/src/dosfs/fat.c, libfs/src/dosfs/fat.h: Use new chains API. Removed temporary hack and changed set_errno_and_return_minus_one to rtems_set_errno_and_return_minus_one. Move fat_buf_access from header and stopped it being inlined. Updated to libblock changes.
  • libfs/src/dosfs/fat_fat_operations.c, libfs/src/dosfs/fat_file.c, libfs/src/dosfs/msdos_create.c, libfs/src/dosfs/msdos_dir.c, libfs/src/dosfs/msdos_eval.c, libfs/src/dosfs/msdos_file.c, libfs/src/dosfs/msdos_format.c, libfs/src/dosfs/msdos_free.c, libfs/src/dosfs/msdos_initsupp.c, libfs/src/dosfs/msdos_misc.c, libfs/src/dosfs/msdos_mknod.c: Use new chains API. Removed temporary hack and changed set_errno_and_return_minus_one to rtems_set_errno_and_return_minus_one. Updated to libblock changes.
  • libmisc/Makefile.am: Add new ls and rm command files.
  • libmisc/shell/cmp-ls.c, libmisc/shell/extern-ls.h, libmisc/shell/filemode.c, libmisc/shell/print-ls.c, libmisc/shell/pwcache.c, libmisc/shell/utils-ls.c, libmisc/shell/vis.c, shell/vis.h: New.
  • libmisc/shell/extern-cp.h, libmisc/shell/main_cp.c, libmisc/shell/utils-cp.c: Fixed the usage call bug.
  • libmisc/shell/main_blksync.c: Updated to the new block IO ioctl command.
  • libmisc/shell/main_ls.c, libmisc/shell/main_rm.c: Updated to BSD commands with more features.
  • score/src/coremutex.c: Fix the strick order mutex code.
  • libmisc/shell/shell.c: Change shell tasks mode to be timeslice and no ASR.
  • sapi/include/confdefs.h: Change ata_driver_task_priority to rtems_ata_driver_task_priority. Add the new BD buf cache parameters with defaults.
  • score/src/interr.c: Do not return if the CPU halt call returns.
  • Property mode set to 100644
File size: 5.2 KB
Line 
1/**
2 * @file rtems/blkdev.h
3 * block device driver interface definitions
4 */
5 
6/*
7 * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia
8 * Author: Victor V. Vengerov <vvv@oktet.ru>
9 *
10 * @(#) $Id$
11 */
12
13#ifndef _RTEMS_BLKDEV_H
14#define _RTEMS_BLKDEV_H
15
16#include <rtems.h>
17#include <sys/ioctl.h>
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23/*
24 *  Interface with device drivers Block device looks, initialized and behaves
25 * like traditional RTEMS device driver. Heart of the block device driver is in
26 * BIOREQUEST ioctl. This call puts I/O request to the block device queue, in
27 * priority order, for asynchronous processing. When driver executes request,
28 * req_done function invoked, so callee knows about it. Look for details below.
29 */
30
31/*
32 * Block device block number datatype
33 */
34typedef uint32_t rtems_blkdev_bnum;
35
36/* Block device request type */
37typedef enum rtems_blkdev_request_op {
38    RTEMS_BLKDEV_REQ_READ,     /* Read operation */
39    RTEMS_BLKDEV_REQ_WRITE,    /* Write operation */
40    RTEMS_BLKDEV_CAPABILITIES  /* Capabilities request */
41} rtems_blkdev_request_op;
42
43/**
44 * ATA multi-sector buffer requests only supported. This option
45 * means the cache will only supply multiple buffers that are
46 * inorder so the ATA multi-sector command can be used. This is a
47 * hack to work around the current ATA driver.
48 */
49#define RTEMS_BLKDEV_CAP_MULTISECTOR_CONT (1 << 0)
50
51/*
52 * @typedef rtems_blkdev_request_cb
53 *
54 * Type for block device request done callback function.
55 *
56 * @param arg Argument supplied in blkdev_request
57 * @param status RTEMS status code for this operation
58 * @param errno errno value to be passed to the user when
59 *              status != RTEMS_SUCCESSFUL
60 */
61typedef void (* rtems_blkdev_request_cb)(void *arg,
62                                         rtems_status_code status,
63                                         int error);
64
65/**
66 * @struct rtems_blkdev_sg_buffer
67 * Block device scatter/gather buffer structure
68 */
69typedef struct rtems_blkdev_sg_buffer {
70    uint32_t   block;   /* The block number */
71    uint32_t   length;  /* Buffer length */
72    void      *buffer;  /* Buffer pointer */
73    void      *user;    /* User pointer */
74} rtems_blkdev_sg_buffer;
75
76/* blkdev_request (Block Device Request) structure is
77 * used to read/write a number of blocks from/to device.
78 */
79typedef struct rtems_blkdev_request {
80    /* Block device operation (read or write) */
81    rtems_blkdev_request_op req;
82    /* Callback function */
83    rtems_blkdev_request_cb req_done;
84    /* Argument to be passed to callback function*/
85    void *done_arg;
86    /* Last I/O operation completion status */
87    rtems_status_code status; 
88    /* If status != RTEMS_SUCCESSFUL, this field contains error code */
89    int error;
90    /* Start block number */
91    rtems_blkdev_bnum start;
92    /* Number of blocks to be exchanged */
93    uint32_t count;
94    /* Number of buffers provided */
95    uint32_t bufnum;
96
97    /* The task requesting the IO operation. */
98    rtems_id io_task;
99
100    /* List of scatter/gather buffers */
101    rtems_blkdev_sg_buffer bufs[0];
102} rtems_blkdev_request;
103
104/* Block device IOCTL request codes */
105#define RTEMS_BLKIO_REQUEST      _IOWR('B', 1, rtems_blkdev_request)
106#define RTEMS_BLKIO_GETBLKSIZE   _IO('B', 2)
107#define RTEMS_BLKIO_GETSIZE      _IO('B', 3)
108#define RTEMS_BLKIO_SYNCDEV      _IO('B', 4)
109
110/* Device driver interface conventions suppose that driver may
111 * contain initialize/open/close/read/write/ioctl entry points. These
112 * primitives (except initialize) can be implemented in generic fashion,
113 * based upon supplied block device driver ioctl handler. Every block
114 * device driver should provide initialize entry point, which is register
115 * all block devices and appropriate ioctl handlers.
116 */
117
118#define RTEMS_GENERIC_BLOCK_DEVICE_DRIVER_ENTRIES \
119      rtems_blkdev_generic_open, rtems_blkdev_generic_close, \
120      rtems_blkdev_generic_read, rtems_blkdev_generic_write, \
121      rtems_blkdev_generic_ioctl
122
123/* blkdev_generic_read --
124 *     Generic block device read primitive. Implemented using block device
125 *     buffer management primitives.
126 */
127rtems_device_driver
128rtems_blkdev_generic_read(
129    rtems_device_major_number major,
130    rtems_device_minor_number minor,
131    void                    * arg
132);
133
134/* blkdev_generic_write --
135 *     Generic block device driver write primitive. Implemented using block
136 *     device buffer management primitives.
137 */
138rtems_device_driver
139rtems_blkdev_generic_write(
140    rtems_device_major_number major,
141    rtems_device_minor_number minor,
142    void                    * arg
143);
144
145/* blkdev_generic_open --
146 *     Generic block device open primitive.
147 */
148rtems_device_driver
149rtems_blkdev_generic_open(
150    rtems_device_major_number major,
151    rtems_device_minor_number minor,
152    void                    * arg
153);
154
155/* blkdev_generic_close --
156 *     Generic block device close primitive.
157 */
158rtems_device_driver
159rtems_blkdev_generic_close(
160    rtems_device_major_number major,
161    rtems_device_minor_number minor,
162    void                    * arg
163);
164
165/* blkdev_generic_ioctl --
166 *     Generic block device ioctl primitive.
167 */
168rtems_device_driver
169rtems_blkdev_generic_ioctl(
170    rtems_device_major_number major,
171    rtems_device_minor_number minor,
172    void                    * arg
173);
174
175#ifdef __cplusplus
176}
177#endif
178
179#endif
Note: See TracBrowser for help on using the repository browser.