|
|
1.1 root 1: typedef struct List {
2: void *next;
3: } List;
4:
5: typedef struct Alarm {
6: List;
7: int busy;
8: long dt;
9: void (*f)(void*);
10: void *arg;
11: } Alarm;
12:
13: typedef struct IOQ IOQ;
14: typedef struct IOQ {
15: uchar buf[4096];
16: uchar *in;
17: uchar *out;
18: int state;
19: int (*getc)(IOQ*);
20: int (*putc)(IOQ*, int);
21: void *ptr;
22: };
23:
24: enum {
25: Eaddrlen = 6,
26: ETHERMINTU = 60, /* minimum transmit size */
27: ETHERMAXTU = 1514, /* maximum transmit size */
28: ETHERHDRSIZE = 14, /* size of an ethernet header */
29:
30: MaxEther = 2,
31: };
32:
33: typedef struct {
34: uchar d[Eaddrlen];
35: uchar s[Eaddrlen];
36: uchar type[2];
37: uchar data[1500];
38: uchar crc[4];
39: } Etherpkt;
40:
41: enum {
42: Maxxfer = 16*1024, /* maximum transfer size/cmd */
43: Npart = 8+2, /* 8 sub partitions, disk, and partition */
44: };
45:
46: typedef struct {
47: ulong start;
48: ulong end;
49: char name[NAMELEN+1];
50: } Partition;
51:
52: typedef struct {
53: int online;
54: int npart; /* number of real partitions */
55: Partition p[Npart];
56: ulong offset;
57: Partition *current; /* current partition */
58:
59: ulong cap; /* total bytes */
60: int bytes; /* bytes/sector */
61: int sectors; /* sectors/track */
62: int heads; /* heads/cyl */
63: long cyl; /* cylinders/drive */
64:
65: char lba; /* true if drive has logical block addressing */
66: char multi; /* non-zero if drive does multiple block xfers */
67: } Disc;
68:
69: enum {
70: ScsiTestunit = 0x00,
71: ScsiExtsens = 0x03,
72: ScsiInquiry = 0x12,
73: ScsiModesense = 0x1a,
74: ScsiStartunit = 0x1B,
75: ScsiStopunit = 0x1B,
76: ScsiGetcap = 0x25,
77: ScsiRead = 0x08,
78: ScsiWrite = 0x0a,
79: ScsiExtread = 0x28,
80: ScsiExtwrite = 0x2a,
81:
82: /* data direction */
83: ScsiIn = 1,
84: ScsiOut = 0,
85: };
86:
87: typedef struct Scsibuf Scsibuf;
88: typedef struct Scsibuf {
89: void* virt;
90: void* phys;
91: Scsibuf* next;
92: };
93:
94: typedef struct Scsidata {
95: uchar* base;
96: uchar* lim;
97: uchar* ptr;
98: } Scsidata;
99:
100: typedef struct Ureg Ureg;
101:
102: typedef struct Scsi {
103: ulong pid;
104: ushort target;
105: ushort lun;
106: ushort rflag;
107: ushort status;
108: Scsidata cmd;
109: Scsidata data;
110: Scsibuf* b;
111: uchar* save;
112: uchar cmdblk[16];
113: } Scsi;
114:
115: typedef struct Segdesc {
116: ulong d0;
117: ulong d1;
118: } Segdesc;
119:
120: typedef struct Mach {
121: ulong ticks; /* of the clock since boot time */
122: void *alarm; /* alarms bound to this clock */
123: } Mach;
124:
125: extern Mach *m;
126:
127: #define I_MAGIC ((((4*11)+0)*11)+7)
128:
129: typedef struct Exec Exec;
130: struct Exec
131: {
132: uchar magic[4]; /* magic number */
133: uchar text[4]; /* size of text segment */
134: uchar data[4]; /* size of initialized data */
135: uchar bss[4]; /* size of uninitialized data */
136: uchar syms[4]; /* size of symbol table */
137: uchar entry[4]; /* entry point */
138: uchar spsz[4]; /* size of sp/pc offset table */
139: uchar pcsz[4]; /* size of pc/line number table */
140: };
141:
142: /*
143: * bootline passed by boot program
144: */
145: #define BOOTLINE ((char *)0x80000100)
146:
147: /*
148: * Where we leave configuration info.
149: */
150: #define BOOTARGS ((char*)(KZERO|1024))
151: #define BOOTARGSLEN 1024
152: #define MAXCONF 32
153:
154: typedef struct ISAConf {
155: char type[NAMELEN];
156: ulong port;
157: ulong irq;
158: ulong mem;
159: ulong size;
160: uchar ea[6];
161: } ISAConf;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.