use oxpcie only if enabled to avoid baud bottleneck of uart.
[minix.git] / drivers / filter / inc.h
blob693b8d5ba404bc2a027c38625d9aa5f58abcd217
1 /* Filter driver - general include file */
2 #define _MINIX 1
3 #define _SYSTEM 1
4 #include <minix/config.h>
5 #include <minix/const.h>
6 #include <minix/type.h>
7 #include <minix/com.h>
8 #include <minix/ipc.h>
9 #include <sys/ioc_disk.h>
10 #include <minix/sysutil.h>
11 #include <minix/syslib.h>
12 #include <minix/partition.h>
13 #include <minix/ds.h>
14 #include <minix/callnr.h>
15 #include <minix/driver.h>
16 #include <unistd.h>
17 #include <stdio.h>
18 #include <stdlib.h>
19 #include <errno.h>
20 #include <string.h>
22 #define SECTOR_SIZE 512
24 typedef enum {
25 ST_NIL, /* Zero checksums */
26 ST_XOR, /* XOR-based checksums */
27 ST_CRC, /* CRC32-based checksums */
28 ST_MD5 /* MD5-based checksums */
29 } checksum_type;
31 typedef enum {
32 FLT_WRITE, /* write to up to two disks */
33 FLT_READ, /* read from one disk */
34 FLT_READ2 /* read from both disks */
35 } disk_operation;
37 struct driverinfo {
38 char *label;
39 int minor;
40 endpoint_t endpt;
41 int up_event;
43 int problem; /* one of BD_* */
44 int error; /* one of E*, only relevant if problem>0 */
45 int retries;
46 int kills;
49 /* UP event characterization. */
50 #define UP_EXPECTED 0
51 #define UP_NONE 1
52 #define UP_PENDING 2
54 /* Something was wrong and the disk driver has been restarted/refreshed,
55 * so the request needs to be redone.
57 #define RET_REDO 1
59 /* The cases where the disk driver need to be restarted/refreshed by RS.
60 * BD_DEAD: the disk driver has died. Restart it.
61 * BD_PROTO: a protocol error has occurred. Refresh it.
62 * BD_DATA: a data error has occurred. Refresh it.
64 typedef enum {
65 BD_NONE,
66 BD_DEAD,
67 BD_PROTO,
68 BD_DATA,
69 BD_LAST
70 } driver_state;
72 #define DRIVER_MAIN 0
73 #define DRIVER_BACKUP 1
75 /* Requests for more than this many bytes will be allocated dynamically. */
76 #define BUF_SIZE (256 * 1024)
77 #define SBUF_SIZE (BUF_SIZE * 2)
79 #define LABEL_SIZE 32
81 typedef unsigned long sector_t;
83 /* main.c */
84 extern int USE_CHECKSUM;
85 extern int USE_MIRROR;
86 extern int BAD_SUM_ERROR;
87 extern int USE_SUM_LAYOUT;
88 extern int SUM_TYPE;
89 extern int SUM_SIZE;
90 extern int NR_SUM_SEC;
91 extern int NR_RETRIES;
92 extern int NR_RESTARTS;
93 extern int DRIVER_TIMEOUT;
94 extern int CHUNK_SIZE;
96 extern char MAIN_LABEL[LABEL_SIZE];
97 extern char BACKUP_LABEL[LABEL_SIZE];
98 extern int MAIN_MINOR;
99 extern int BACKUP_MINOR;
101 /* sum.c */
102 extern void sum_init(void);
103 extern int transfer(u64_t pos, char *buffer, size_t *sizep, int flag_rw);
104 extern u64_t convert(u64_t size);
106 /* driver.c */
107 extern void driver_init(void);
108 extern void driver_shutdown(void);
109 extern u64_t get_raw_size(void);
110 extern void reset_kills(void);
111 extern int check_driver(int which);
112 extern int bad_driver(int which, int type, int error);
113 extern int read_write(u64_t pos, char *bufa, char *bufb, size_t *sizep,
114 int flag_rw);
115 extern void ds_event(void);
117 /* util.c */
118 extern char *flt_malloc(size_t size, char *sbuf, size_t ssize);
119 extern void flt_free(char *buf, size_t size, const char *sbuf);
120 extern char *print64(u64_t p);
121 extern clock_t flt_alarm(clock_t dt);