retire PUBLIC, PRIVATE and FORWARD

This commit is contained in:
Ben Gras
2012-03-25 20:25:53 +02:00
parent 6a73e85ad1
commit 7336a67dfe
603 changed files with 5776 additions and 5779 deletions

View File

@@ -27,7 +27,7 @@ extern struct proc *prc;
#define BSIZE 512 #define BSIZE 512
#define LOGBS 9 #define LOGBS 9
PRIVATE struct file { static struct file {
int fid; int fid;
char *name; char *name;
long cblock; long cblock;
@@ -47,26 +47,26 @@ PRIVATE struct file {
#define e3 smap[1] #define e3 smap[1]
#define f3 smap[2] #define f3 smap[2]
PRIVATE long cnt[3]; /* Sizes of segments */ static long cnt[3]; /* Sizes of segments */
PRIVATE int h_size; /* Size of core header */ static int h_size; /* Size of core header */
PRIVATE char def_name[] = "core"; /* Default core name */ static char def_name[] = "core"; /* Default core name */
#define SIZE_MP_SEG (sizeof(struct mem_map) * NR_LOCAL_SEGS) #define SIZE_MP_SEG (sizeof(struct mem_map) * NR_LOCAL_SEGS)
#define SIZE_KINFO sizeof(struct proc) #define SIZE_KINFO sizeof(struct proc)
#define SIZE_HEADER SIZE_MP_SEG #define SIZE_HEADER SIZE_MP_SEG
FORWARD int kernel_info(int fd ); static int kernel_info(int fd );
FORWARD void setmap(struct file *fp ); static void setmap(struct file *fp );
FORWARD void read_info(struct file *fp ); static void read_info(struct file *fp );
FORWARD void ill_addr(long d , int segment ); static void ill_addr(long d , int segment );
FORWARD long map_addr(long d , int segment ); static long map_addr(long d , int segment );
FORWARD unsigned long c_status(void); static unsigned long c_status(void);
FORWARD long getn(long d, int s); static long getn(long d, int s);
/* /*
* set and display mapping for core file * set and display mapping for core file
*/ */
PRIVATE void setmap(fp) static void setmap(fp)
struct file *fp; struct file *fp;
{ {
long h = (long) h_size; long h = (long) h_size;
@@ -107,7 +107,7 @@ long h = (long) h_size;
} }
/* Print mapping */ /* Print mapping */
PUBLIC void prtmap() void prtmap()
{ {
Printf("%s I & D space\t", (is_separate) ? "Separate " : "Combined "); Printf("%s I & D space\t", (is_separate) ? "Separate " : "Combined ");
if (corepid > 0) { if (corepid > 0) {
@@ -123,7 +123,7 @@ PUBLIC void prtmap()
} }
/* Illegal address */ /* Illegal address */
PRIVATE void ill_addr(d, segment) static void ill_addr(d, segment)
long d; long d;
int segment; int segment;
{ {
@@ -134,7 +134,7 @@ int segment;
/* Map virtual address -> core file addresses /* Map virtual address -> core file addresses
* depends on current segment if Separate I & D * depends on current segment if Separate I & D
*/ */
PRIVATE long map_addr(d, segment) static long map_addr(d, segment)
long d; long d;
int segment; int segment;
{ {
@@ -175,7 +175,7 @@ int segment;
/* Get value with address d and segment s */ /* Get value with address d and segment s */
PRIVATE long getn(d, s) static long getn(d, s)
long d; long d;
int s; int s;
{ {
@@ -209,7 +209,7 @@ int s;
} }
/* Read kernel info from core file into lbuf[] */ /* Read kernel info from core file into lbuf[] */
PRIVATE int kernel_info(fd) static int kernel_info(fd)
int fd; int fd;
{ {
int r; int r;
@@ -225,7 +225,7 @@ int fd;
/* /*
* Print status info from core - returns PC * Print status info from core - returns PC
*/ */
PRIVATE unsigned long c_status() static unsigned long c_status()
{ {
fprintf(stderr, "WARNING: don't know pid from core; using proc nr for pid.\n"); fprintf(stderr, "WARNING: don't know pid from core; using proc nr for pid.\n");
@@ -241,7 +241,7 @@ PRIVATE unsigned long c_status()
} }
/* Read memory maps and kernel info from core file */ /* Read memory maps and kernel info from core file */
PRIVATE void read_info(fp) static void read_info(fp)
struct file *fp; struct file *fp;
{ {
struct mem_map seg[NR_LOCAL_SEGS]; struct mem_map seg[NR_LOCAL_SEGS];
@@ -292,7 +292,7 @@ struct file *fp;
/* initialization for core files /* initialization for core files
* returns PC address from core file * returns PC address from core file
*/ */
PUBLIC unsigned long core_init(filename) unsigned long core_init(filename)
char *filename; char *filename;
{ {
core_file = &Core_File; core_file = &Core_File;
@@ -321,7 +321,7 @@ char *filename;
* always returns 0 * always returns 0
* Similar to core files. * Similar to core files.
*/ */
PUBLIC unsigned long file_init(filename) unsigned long file_init(filename)
char *filename; char *filename;
{ {
core_file = &Core_File; core_file = &Core_File;
@@ -349,7 +349,7 @@ char *filename;
* Read from core file * Read from core file
* Called by mdbtrace() * Called by mdbtrace()
*/ */
PUBLIC long read_core(req, addr, data) long read_core(req, addr, data)
int req; int req;
long addr, data; long addr, data;
{ {

View File

@@ -14,13 +14,13 @@
#include <minix/callnr.h> #include <minix/callnr.h>
#include "proto.h" #include "proto.h"
FORWARD void get_message(message *m, unsigned bx); static void get_message(message *m, unsigned bx);
FORWARD void get_data(char *s, unsigned bx, int cnt); static void get_data(char *s, unsigned bx, int cnt);
PRIVATE message sent; static message sent;
PRIVATE message recv; static message recv;
PRIVATE unsigned saved_addr; static unsigned saved_addr;
PRIVATE int last_call; static int last_call;
#define NOSYS 0 #define NOSYS 0
#define NOP 1 #define NOP 1
@@ -164,7 +164,7 @@ struct decode_system {
REBOOT, M1_I1, NOP, "REBOOT" REBOOT, M1_I1, NOP, "REBOOT"
}; };
PRIVATE void get_message(m,bx) static void get_message(m,bx)
message *m; message *m;
unsigned bx; unsigned bx;
{ {
@@ -181,7 +181,7 @@ unsigned bx;
} }
PRIVATE void get_data(s, bx, cnt) static void get_data(s, bx, cnt)
char *s; char *s;
unsigned bx; unsigned bx;
int cnt; int cnt;
@@ -199,7 +199,7 @@ int cnt;
} }
PUBLIC void decode_result() void decode_result()
{ {
/* Update message */ /* Update message */

View File

@@ -48,18 +48,18 @@ struct symtab_s
unsigned int nsym; unsigned int nsym;
}; };
PRIVATE struct symtab_s symtab; static struct symtab_s symtab;
FORWARD void gnu_sort(struct newnlist *array , struct newnlist *top ); static void gnu_sort(struct newnlist *array , struct newnlist *top );
FORWARD int gnu_symeq(char *t , struct newnlist *sp ); static int gnu_symeq(char *t , struct newnlist *sp );
FORWARD int gnu_symprefix(char *t , struct newnlist *sp ); static int gnu_symprefix(char *t , struct newnlist *sp );
FORWARD struct newnlist *gnu_sname(char *name, int is_text, int static struct newnlist *gnu_sname(char *name, int is_text, int
allflag); allflag);
FORWARD struct newnlist *gnu_sval(off_t value, int where); static struct newnlist *gnu_sval(off_t value, int where);
FORWARD void gnu_sym(struct newnlist *sp, off_t off); static void gnu_sym(struct newnlist *sp, off_t off);
PUBLIC void gnu_init( filename ) void gnu_init( filename )
char *filename; char *filename;
{ {
struct exec header; struct exec header;
@@ -131,7 +131,7 @@ char *filename;
} }
PUBLIC long gnu_symbolvalue( name, is_text ) long gnu_symbolvalue( name, is_text )
char *name; char *name;
int is_text; int is_text;
{ {
@@ -144,7 +144,7 @@ int is_text;
} }
PRIVATE struct newnlist *gnu_sname( name, is_text, allflag ) static struct newnlist *gnu_sname( name, is_text, allflag )
char *name; char *name;
int is_text; int is_text;
int allflag; int allflag;
@@ -204,7 +204,7 @@ int allflag;
return NULL; return NULL;
} }
PRIVATE struct newnlist *gnu_sval( value, where ) static struct newnlist *gnu_sval( value, where )
off_t value; off_t value;
int where; int where;
{ {
@@ -242,7 +242,7 @@ int where;
} }
PRIVATE void gnu_sym( sp, off ) static void gnu_sym( sp, off )
struct newnlist *sp; struct newnlist *sp;
off_t off; off_t off;
{ {
@@ -260,7 +260,7 @@ off_t off;
/* shell sort symbols on value */ /* shell sort symbols on value */
PRIVATE void gnu_sort( array, top ) static void gnu_sort( array, top )
struct newnlist *array; struct newnlist *array;
struct newnlist *top; struct newnlist *top;
{ {
@@ -294,7 +294,7 @@ struct newnlist *top;
while ( (gap /= 3) != 0 ); while ( (gap /= 3) != 0 );
} }
PUBLIC void gnu_symbolic( value, separator ) void gnu_symbolic( value, separator )
off_t value; off_t value;
int separator; int separator;
{ {
@@ -330,14 +330,14 @@ int separator;
} }
PRIVATE int gnu_symeq( t, sp ) static int gnu_symeq( t, sp )
register char *t; register char *t;
struct newnlist *sp; struct newnlist *sp;
{ {
return strncmp( t, sp->n_un.n_name, strlen(t) ) == 0; return strncmp( t, sp->n_un.n_name, strlen(t) ) == 0;
} }
PRIVATE int gnu_symprefix( t, sp ) static int gnu_symprefix( t, sp )
register char *t; register char *t;
struct newnlist *sp; struct newnlist *sp;
{ {
@@ -356,7 +356,7 @@ struct newnlist *sp;
/* list all symbols - test for selection criteria */ /* list all symbols - test for selection criteria */
PUBLIC void gnu_listsym( tchar ) void gnu_listsym( tchar )
char tchar; char tchar;
{ {
register struct symtab_s *tp; register struct symtab_s *tp;
@@ -396,7 +396,7 @@ char tchar;
} }
} }
PUBLIC int gnu_text_symbol(value) int gnu_text_symbol(value)
off_t value; off_t value;
{ {
struct newnlist *sp; struct newnlist *sp;
@@ -410,7 +410,7 @@ off_t value;
return FALSE; return FALSE;
} }
PUBLIC int gnu_finds_data(off,data_seg) int gnu_finds_data(off,data_seg)
off_t off; off_t off;
int data_seg; int data_seg;
{ {
@@ -425,7 +425,7 @@ int data_seg;
return FALSE; return FALSE;
} }
PUBLIC int gnu_finds_pc(pc) int gnu_finds_pc(pc)
off_t pc; off_t pc;
{ {
struct newnlist *sp; struct newnlist *sp;

View File

@@ -13,21 +13,21 @@
#define OUTBUFSIZE 512 #define OUTBUFSIZE 512
#define PAGESIZE 24 #define PAGESIZE 24
PRIVATE int forceupper = FALSE; static int forceupper = FALSE;
PRIVATE int someupper = FALSE; static int someupper = FALSE;
PRIVATE int stringcount = 0; static int stringcount = 0;
PRIVATE char *string_ptr = NULL; /* stringptr ambiguous at 8th char */ static char *string_ptr = NULL; /* stringptr ambiguous at 8th char */
PRIVATE char *stringstart = NULL; static char *stringstart = NULL;
PRIVATE char outbuf[OUTBUFSIZE]; static char outbuf[OUTBUFSIZE];
PRIVATE FILE *cmdfile = stdin; static FILE *cmdfile = stdin;
PRIVATE FILE *outfile = stdout; static FILE *outfile = stdout;
PRIVATE FILE *logfile; static FILE *logfile;
PRIVATE int lineno; static int lineno;
int _doprnt(const char *format, va_list ap, FILE *stream ); int _doprnt(const char *format, va_list ap, FILE *stream );
PUBLIC char *get_cmd(cbuf, csize) char *get_cmd(cbuf, csize)
char *cbuf; char *cbuf;
int csize; int csize;
{ {
@@ -50,7 +50,7 @@ char *r;
return r; return r;
} }
PUBLIC void openin(s) void openin(s)
char *s; char *s;
{ {
char *t; char *t;
@@ -70,7 +70,7 @@ char *t;
* from MINIX library * from MINIX library
* followed by outstr() * followed by outstr()
*/ */
PUBLIC int Printf(const char *format, ...) int Printf(const char *format, ...)
{ {
va_list ap; va_list ap;
int retval; int retval;
@@ -102,7 +102,7 @@ PUBLIC int Printf(const char *format, ...)
/* /*
* Set logging options * Set logging options
*/ */
PUBLIC void logging( c, name ) void logging( c, name )
int c; int c;
char *name; char *name;
{ {
@@ -142,7 +142,7 @@ char *t;
} }
/* Output system error string */ /* Output system error string */
PUBLIC void do_error(m) void do_error(m)
char *m; char *m;
{ {
outstr(m); outstr(m);
@@ -151,7 +151,7 @@ char *m;
outstr("\n"); outstr("\n");
} }
PUBLIC void closestring() void closestring()
{ {
/* close string device */ /* close string device */
@@ -159,7 +159,7 @@ PUBLIC void closestring()
stringstart = string_ptr = NULL; stringstart = string_ptr = NULL;
} }
PUBLIC int mytolower(ch) int mytolower(ch)
int ch; int ch;
{ {
/* convert char to lower case */ /* convert char to lower case */
@@ -170,7 +170,7 @@ int ch;
} }
PUBLIC void openstring(string) void openstring(string)
char *string; char *string;
{ {
/* open string device */ /* open string device */
@@ -179,7 +179,7 @@ char *string;
stringstart = string_ptr = string; stringstart = string_ptr = string;
} }
PUBLIC void outbyte(byte) void outbyte(byte)
int byte; int byte;
{ {
/* print char to currently open output devices */ /* print char to currently open output devices */
@@ -215,15 +215,15 @@ int byte;
} }
PUBLIC void outcomma() void outcomma()
{ {
/* print comma */ /* print comma */
outbyte(','); outbyte(',');
} }
PRIVATE char hexdigits[] = "0123456789ABCDEF"; static char hexdigits[] = "0123456789ABCDEF";
PUBLIC void outh4(num) void outh4(num)
unsigned num; unsigned num;
{ {
/* print 4 bits hex */ /* print 4 bits hex */
@@ -231,7 +231,7 @@ unsigned num;
outbyte(hexdigits[num % 16]); outbyte(hexdigits[num % 16]);
} }
PUBLIC void outh8(num) void outh8(num)
unsigned num; unsigned num;
{ {
/* print 8 bits hex */ /* print 8 bits hex */
@@ -240,7 +240,7 @@ unsigned num;
outh4(num); outh4(num);
} }
PUBLIC void outh16(num) void outh16(num)
unsigned num; unsigned num;
{ {
/* print 16 bits hex */ /* print 16 bits hex */
@@ -249,7 +249,7 @@ unsigned num;
outh8(num); outh8(num);
} }
PUBLIC void outh32(num) void outh32(num)
unsigned num; unsigned num;
{ {
/* print 32 bits hex */ /* print 32 bits hex */
@@ -258,14 +258,14 @@ unsigned num;
outh16((u16_t) num); outh16((u16_t) num);
} }
PUBLIC void outspace() void outspace()
{ {
/* print space */ /* print space */
outbyte(' '); outbyte(' ');
} }
PUBLIC void outstr(s) void outstr(s)
register char *s; register char *s;
{ {
/* print string */ /* print string */
@@ -274,14 +274,14 @@ register char *s;
outbyte(*s++); outbyte(*s++);
} }
PUBLIC void outtab() void outtab()
{ {
/* print tab */ /* print tab */
outbyte('\t'); outbyte('\t');
} }
PUBLIC void outustr(s) void outustr(s)
register char *s; register char *s;
{ {
/* print string, perhaps converting case to upper */ /* print string, perhaps converting case to upper */
@@ -293,14 +293,14 @@ register char *s;
} }
PUBLIC int stringpos() int stringpos()
{ {
/* return current offset of string device */ /* return current offset of string device */
return string_ptr - stringstart; return string_ptr - stringstart;
} }
PUBLIC int stringtab() int stringtab()
{ {
/* return current "tab" spot of string device */ /* return current "tab" spot of string device */

View File

@@ -15,7 +15,7 @@
#include <sgtty.h> #include <sgtty.h>
#include "proto.h" #include "proto.h"
PRIVATE int get_request; static int get_request;
/* /*
* decode ioctl call * decode ioctl call

View File

@@ -24,12 +24,12 @@
struct proc *prc; struct proc *prc;
long lbuf[SIZ]; long lbuf[SIZ];
PRIVATE char segment_name[] = "TDS"; static char segment_name[] = "TDS";
/* /*
* Display memory maps * Display memory maps
*/ */
PUBLIC void disp_maps() void disp_maps()
{ {
int i; int i;
long int vir, phy, len; long int vir, phy, len;
@@ -45,7 +45,7 @@ PUBLIC void disp_maps()
} }
} }
PUBLIC void update() void update()
{ {
int i; int i;
@@ -68,7 +68,7 @@ PUBLIC void update()
} }
PUBLIC int disp_regs() int disp_regs()
{ {
int i; int i;
@@ -118,13 +118,13 @@ PUBLIC int disp_regs()
#ifdef MINIX_PC #ifdef MINIX_PC
#ifdef __i386 #ifdef __i386
PRIVATE char regs[] = "fs gs ds es di si bp bx dx cx ax ip cs ps sp ss"; static char regs[] = "fs gs ds es di si bp bx dx cx ax ip cs ps sp ss";
#else #else
PRIVATE char regs[] = "es ds di si bp bx dx cx ax ip cs ps sp ss"; static char regs[] = "es ds di si bp bx dx cx ax ip cs ps sp ss";
#endif #endif
/* Get register for pid at offset k */ /* Get register for pid at offset k */
PUBLIC long get_reg(pid, k) long get_reg(pid, k)
int pid; int pid;
long k; long k;
{ {
@@ -149,7 +149,7 @@ long k;
/* Set register for pid at offset k */ /* Set register for pid at offset k */
PUBLIC void set_reg(pid, k, value) void set_reg(pid, k, value)
int pid; int pid;
long k; long k;
long value; long value;
@@ -164,7 +164,7 @@ long value;
} }
PUBLIC long reg_addr(s) long reg_addr(s)
char *s; char *s;
{ {
long val; long val;
@@ -198,7 +198,7 @@ char *s;
} }
PUBLIC int outsegreg(num) int outsegreg(num)
off_t num; off_t num;
{ {
/* print segment register */ /* print segment register */
@@ -217,14 +217,14 @@ off_t num;
#ifdef MINIX_ST #ifdef MINIX_ST
/* Get register for pid at offset k */ /* Get register for pid at offset k */
PUBLIC long get_reg(pid, k) long get_reg(pid, k)
int pid; int pid;
long k; long k;
{ {
return ptrace(T_GETUSER, pid, k, 0L); return ptrace(T_GETUSER, pid, k, 0L);
} }
PUBLIC long reg_addr(s) long reg_addr(s)
char *s; char *s;
{ {
long val; long val;

View File

@@ -56,14 +56,14 @@ extern struct proc *prc;
#define MAXLINE 128 #define MAXLINE 128
#define MAXARG 20 #define MAXARG 20
PRIVATE unsigned long lastexp = 0L; /* last expression and segment */ static unsigned long lastexp = 0L; /* last expression and segment */
PRIVATE int lastseg = NOSEG; static int lastseg = NOSEG;
PRIVATE char *prog; /* prog name */ static char *prog; /* prog name */
PRIVATE char sbuf[MAXLINE]; static char sbuf[MAXLINE];
PRIVATE char cbuf[MAXLINE]; static char cbuf[MAXLINE];
PRIVATE char *cmd; /* current command */ static char *cmd; /* current command */
PRIVATE char *cmdstart; /* start of command */ static char *cmdstart; /* start of command */
PRIVATE jmp_buf mainlp; static jmp_buf mainlp;
struct b_pnt { struct b_pnt {
@@ -75,30 +75,30 @@ struct b_pnt {
int main(int argc, char *argv[]); int main(int argc, char *argv[]);
FORWARD void cleanup(void); static void cleanup(void);
FORWARD void freepnt(struct b_pnt *pnt ); static void freepnt(struct b_pnt *pnt );
FORWARD void findbpnt(int verbose ); static void findbpnt(int verbose );
FORWARD int exebpnt(int restart ); static int exebpnt(int restart );
FORWARD void catch(int sig ); static void catch(int sig );
FORWARD int run(char *name , char *argstr , int tflg ); static int run(char *name , char *argstr , int tflg );
FORWARD int dowait(void); static int dowait(void);
FORWARD void backtrace(int all ); static void backtrace(int all );
FORWARD void modify(long addr , int cnt , int verbose , int size ); static void modify(long addr , int cnt , int verbose , int size );
FORWARD void display(long addr , int req ); static void display(long addr , int req );
FORWARD void fill(long addr , int req ); static void fill(long addr , int req );
FORWARD void dorun(char *cmd ); static void dorun(char *cmd );
FORWARD void not_for_core(void); static void not_for_core(void);
FORWARD void command(void); static void command(void);
PRIVATE void cleanup() static void cleanup()
{ {
curpid = 0; curpid = 0;
curpnt = NULL; curpnt = NULL;
while (b_head) freepnt(b_head); while (b_head) freepnt(b_head);
} }
PRIVATE void findbpnt(verbose) static void findbpnt(verbose)
int verbose; int verbose;
{ {
for (curpnt = b_head; curpnt; curpnt = curpnt->nxt) { for (curpnt = b_head; curpnt; curpnt = curpnt->nxt) {
@@ -121,7 +121,7 @@ int verbose;
if (verbose) Printf("Unknown breakpoint hit.\n"); if (verbose) Printf("Unknown breakpoint hit.\n");
} }
PRIVATE int exebpnt(restart) static int exebpnt(restart)
int restart; int restart;
{ {
ptrace(T_STEP, curpid, 0L, (long) restart); ptrace(T_STEP, curpid, 0L, (long) restart);
@@ -132,7 +132,7 @@ int restart;
} }
PRIVATE void freepnt(pnt) static void freepnt(pnt)
struct b_pnt *pnt; struct b_pnt *pnt;
{ {
if (pnt->prv) if (pnt->prv)
@@ -146,7 +146,7 @@ struct b_pnt *pnt;
} }
PUBLIC long breakpt(addr, cmd) long breakpt(addr, cmd)
long addr; long addr;
char *cmd; char *cmd;
{ {
@@ -182,7 +182,7 @@ char *cmd;
return new->oldval; return new->oldval;
} }
PRIVATE void catch(sig) static void catch(sig)
int sig; int sig;
{ {
signal(sig, catch); signal(sig, catch);
@@ -192,7 +192,7 @@ int sig;
} }
PRIVATE int dowait() static int dowait()
{ {
int stat; int stat;
@@ -215,7 +215,7 @@ PRIVATE int dowait()
PUBLIC void tstart(req, verbose, val, cnt) void tstart(req, verbose, val, cnt)
int req, verbose, val, cnt; int req, verbose, val, cnt;
{ {
if (curpid == 0) { if (curpid == 0) {
@@ -255,7 +255,7 @@ int req, verbose, val, cnt;
if ( verbose ) dasm((long) PC_MEMBER(prc), 1, 1); if ( verbose ) dasm((long) PC_MEMBER(prc), 1, 1);
} }
PRIVATE int run(name, argstr, tflg) static int run(name, argstr, tflg)
char *name, *argstr; char *name, *argstr;
int tflg; int tflg;
{ {
@@ -301,7 +301,7 @@ int tflg;
} }
PRIVATE void dorun(cmd) static void dorun(cmd)
char *cmd; char *cmd;
{ {
if (curpid = run(prog, cmd, 1)) { if (curpid = run(prog, cmd, 1)) {
@@ -316,7 +316,7 @@ char *cmd;
/* /*
* backtrace - inspect the stack * backtrace - inspect the stack
*/ */
PRIVATE void backtrace(all) static void backtrace(all)
int all; int all;
{ {
unsigned long pc, bp, off, val, obp; unsigned long pc, bp, off, val, obp;
@@ -397,7 +397,7 @@ skiplp:
while (all && (reg_t) bp); while (all && (reg_t) bp);
} }
PRIVATE void modify(addr, cnt, verbose, size) static void modify(addr, cnt, verbose, size)
long addr; long addr;
int cnt, verbose, size; int cnt, verbose, size;
{ {
@@ -438,7 +438,7 @@ int cnt, verbose, size;
return; return;
} }
PRIVATE void display(addr, req) static void display(addr, req)
long addr; long addr;
int req; int req;
{ {
@@ -533,7 +533,7 @@ exitlp:
Printf("\n"); Printf("\n");
} }
PRIVATE void fill(addr, req) static void fill(addr, req)
long addr; long addr;
int req; int req;
{ {
@@ -579,13 +579,13 @@ int req;
while (--count > 0); while (--count > 0);
} }
PRIVATE void not_for_core() static void not_for_core()
{ {
if (corepid > 0) if (corepid > 0)
mdb_error("Illegal command for 'core' file\n"); mdb_error("Illegal command for 'core' file\n");
} }
PRIVATE void command() static void command()
{ {
char c, *p; char c, *p;
int i; int i;
@@ -856,14 +856,14 @@ PRIVATE void command()
if (*cmd == ';') cmd = skip(cmd + 1); if (*cmd == ';') cmd = skip(cmd + 1);
} }
PUBLIC void mdb_error(s) void mdb_error(s)
char *s; char *s;
{ {
Printf("%s",s); Printf("%s",s);
longjmp(mainlp, 0); longjmp(mainlp, 0);
} }
PUBLIC int main(argc, argv) int main(argc, argv)
int argc; int argc;
char *argv[]; char *argv[];
{ {

View File

@@ -15,18 +15,18 @@ struct address_s
off_t base; off_t base;
}; };
PRIVATE int bits32; static int bits32;
PRIVATE struct address_s uptr; static struct address_s uptr;
FORWARD u8_t get8(void); static u8_t get8(void);
FORWARD u16_t get16(void); static u16_t get16(void);
FORWARD u32_t get32(void); static u32_t get32(void);
FORWARD u8_t peek_byte(off_t addr); static u8_t peek_byte(off_t addr);
FORWARD u16_t peek_word(off_t addr); static u16_t peek_word(off_t addr);
FORWARD int puti(void); static int puti(void);
FORWARD int outsegaddr(struct address_s *addr); static int outsegaddr(struct address_s *addr);
FORWARD int outssegaddr(struct address_s *addr); static int outssegaddr(struct address_s *addr);
FORWARD int show1instruction(void); static int show1instruction(void);
/************************* UNASM ******************************/ /************************* UNASM ******************************/
@@ -62,73 +62,73 @@ typedef int reg_pt;
typedef int su16_t; typedef int su16_t;
typedef int su8_pt; typedef int su8_pt;
FORWARD su8_pt get8s(void); static su8_pt get8s(void);
FORWARD void getmodregrm(void); static void getmodregrm(void);
FORWARD void i_00_to_3f(opcode_pt opc ); static void i_00_to_3f(opcode_pt opc );
FORWARD void i_40_to_5f(opcode_pt opc ); static void i_40_to_5f(opcode_pt opc );
FORWARD void i_60_to_6f(opcode_pt opc ); static void i_60_to_6f(opcode_pt opc );
FORWARD void i_70_to_7f(opcode_pt opc ); static void i_70_to_7f(opcode_pt opc );
FORWARD void i_80(opcode_pt opc ); static void i_80(opcode_pt opc );
FORWARD void i_88(opcode_pt opc ); static void i_88(opcode_pt opc );
FORWARD void i_90(opcode_pt opc ); static void i_90(opcode_pt opc );
FORWARD void i_98(opcode_pt opc ); static void i_98(opcode_pt opc );
FORWARD void i_a0(opcode_pt opc ); static void i_a0(opcode_pt opc );
FORWARD void i_a8(opcode_pt opc ); static void i_a8(opcode_pt opc );
FORWARD void i_b0(opcode_pt opc ); static void i_b0(opcode_pt opc );
FORWARD void i_b8(opcode_pt opc ); static void i_b8(opcode_pt opc );
FORWARD void i_c0(opcode_pt opc ); static void i_c0(opcode_pt opc );
FORWARD void i_c8(opcode_pt opc ); static void i_c8(opcode_pt opc );
FORWARD void i_d0(opcode_pt opc ); static void i_d0(opcode_pt opc );
FORWARD void i_d8(opcode_pt opc ); static void i_d8(opcode_pt opc );
FORWARD void i_e0(opcode_pt opc ); static void i_e0(opcode_pt opc );
FORWARD void i_e8(opcode_pt opc ); static void i_e8(opcode_pt opc );
FORWARD void i_f0(opcode_pt opc ); static void i_f0(opcode_pt opc );
FORWARD void i_f8(opcode_pt opc ); static void i_f8(opcode_pt opc );
FORWARD void outad(opcode_pt opc ); static void outad(opcode_pt opc );
FORWARD void outad1(opcode_pt opc ); static void outad1(opcode_pt opc );
FORWARD void outalorx(opcode_pt opc ); static void outalorx(opcode_pt opc );
FORWARD void outax(void); static void outax(void);
FORWARD void outbptr(void); static void outbptr(void);
FORWARD void outbwptr(opcode_pt opc ); static void outbwptr(opcode_pt opc );
FORWARD void outea(opcode_pt wordflags ); static void outea(opcode_pt wordflags );
FORWARD void outf1(void); static void outf1(void);
FORWARD void out32offset(void); static void out32offset(void);
FORWARD void outfishy(void); static void outfishy(void);
FORWARD void outgetaddr(void); static void outgetaddr(void);
FORWARD void outimmed(opcode_pt signwordflag ); static void outimmed(opcode_pt signwordflag );
FORWARD void outpc(off_t pc ); static void outpc(off_t pc );
FORWARD void outsegpc(void); static void outsegpc(void);
FORWARD void oututstr(char *s ); static void oututstr(char *s );
FORWARD void outword(void); static void outword(void);
FORWARD void outwptr(void); static void outwptr(void);
FORWARD void outwsize(void); static void outwsize(void);
FORWARD void pagef(void); static void pagef(void);
FORWARD void shift(opcode_pt opc ); static void shift(opcode_pt opc );
FORWARD void checkmemory(void); static void checkmemory(void);
FORWARD void CL(void); static void CL(void);
FORWARD void Eb(void); static void Eb(void);
FORWARD void Ev(void); static void Ev(void);
FORWARD void EvGv(void); static void EvGv(void);
FORWARD void EvIb(void); static void EvIb(void);
FORWARD void Ew(void); static void Ew(void);
FORWARD void EwRw(void); static void EwRw(void);
FORWARD void Gv(void); static void Gv(void);
FORWARD void Gv1(void); static void Gv1(void);
FORWARD void GvEv(void); static void GvEv(void);
FORWARD void GvEw(void); static void GvEw(void);
FORWARD void GvM(void); static void GvM(void);
FORWARD void GvMa(void); static void GvMa(void);
FORWARD void GvMp(void); static void GvMp(void);
FORWARD void Ib(void); static void Ib(void);
FORWARD void Iw(void); static void Iw(void);
FORWARD void Iv(void); static void Iv(void);
FORWARD void Jb(void); static void Jb(void);
FORWARD void Jv(void); static void Jv(void);
FORWARD void Ms(void); static void Ms(void);
typedef void(*pfv_t) (opcode_pt opc ); typedef void(*pfv_t) (opcode_pt opc );
PRIVATE pfv_t optable[] = static pfv_t optable[] =
{ {
i_00_to_3f, i_00_to_3f,
i_00_to_3f, i_00_to_3f,
@@ -164,33 +164,33 @@ PRIVATE pfv_t optable[] =
i_f8, i_f8,
}; };
PRIVATE char fishy[] = "???"; static char fishy[] = "???";
PRIVATE char movtab[] = "mov\t"; static char movtab[] = "mov\t";
PRIVATE char *genreg[] = static char *genreg[] =
{ {
"al", "cl", "dl", "bl", "ah", "ch", "dh", "bh", "al", "cl", "dl", "bl", "ah", "ch", "dh", "bh",
"ax", "cx", "dx", "bx", "sp", "bp", "si", "di", "ax", "cx", "dx", "bx", "sp", "bp", "si", "di",
"eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi", "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi",
}; };
PRIVATE char *segreg[] = static char *segreg[] =
{ {
"es", "cs", "ss", "ds", "fs", "gs", "?s", "?s", "es", "cs", "ss", "ds", "fs", "gs", "?s", "?s",
}; };
PRIVATE char *indreg[] = static char *indreg[] =
{ {
"bx+si", "bx+di", "bp+si", "bp+di", "si", "di", "bp", "bx", "bx+si", "bx+di", "bp+si", "bp+di", "si", "di", "bp", "bx",
}; };
PRIVATE char *str_00_to_3f[] = static char *str_00_to_3f[] =
{ {
/* index by (opcode >> 3) & 7 */ /* index by (opcode >> 3) & 7 */
"add", "or", "adc", "sbb", "and", "sub", "xor", "cmp", "add", "or", "adc", "sbb", "and", "sub", "xor", "cmp",
}; };
PRIVATE char *sstr_00_to_3f[] = static char *sstr_00_to_3f[] =
{ {
/* index ((opc>>2) & 0x0E) + (opc & 7) - 6 */ /* index ((opc>>2) & 0x0E) + (opc & 7) - 6 */
"push\tes", "pop\tes", "push\tcs", "pop\tcs", "push\tes", "pop\tes", "push\tcs", "pop\tcs",
@@ -198,7 +198,7 @@ PRIVATE char *sstr_00_to_3f[] =
"es:", "daa", "cs:", "das", "ss:", "aaa", "ds:", "aas", "es:", "daa", "cs:", "das", "ss:", "aaa", "ds:", "aas",
}; };
PRIVATE char *sstr_0f[] = static char *sstr_0f[] =
{ {
"push\tfs", "pop\tfs", fishy, "bt\t", "shld\t", "shld\t", fishy, fishy, "push\tfs", "pop\tfs", fishy, "bt\t", "shld\t", "shld\t", fishy, fishy,
"push\tgs", "pop\tgs", fishy, "bts\t", "shrd\t", "shrd\t", fishy, "imul\t", "push\tgs", "pop\tgs", fishy, "bts\t", "shrd\t", "shrd\t", fishy, "imul\t",
@@ -206,69 +206,69 @@ PRIVATE char *sstr_0f[] =
fishy, fishy, "", "btc\t", "bsf\t", "bsr\t", "movsx\t", "movsx\t", fishy, fishy, "", "btc\t", "bsf\t", "bsr\t", "movsx\t", "movsx\t",
}; };
PRIVATE char *ssstr_0f[] = static char *ssstr_0f[] =
{ {
"sldt\t", "str\t", "lldt\t", "ltr\t", "verr\t", "verw\t", fishy, fishy, "sldt\t", "str\t", "lldt\t", "ltr\t", "verr\t", "verw\t", fishy, fishy,
"sgdt\t", "sidt\t", "lgdt\t", "lidt\t", "smsw\t", fishy, "lmsw\t", fishy, "sgdt\t", "sidt\t", "lgdt\t", "lidt\t", "smsw\t", fishy, "lmsw\t", fishy,
fishy, fishy, fishy, fishy, "bt\t", "bts\t", "btr\t", "btc\t", fishy, fishy, fishy, fishy, "bt\t", "bts\t", "btr\t", "btc\t",
}; };
PRIVATE char *str_40_to_5f[] = static char *str_40_to_5f[] =
{ {
/* index by (opcode >> 3) & 3 */ /* index by (opcode >> 3) & 3 */
"inc\t", "dec\t", "push\t", "pop\t", "inc\t", "dec\t", "push\t", "pop\t",
}; };
PRIVATE char *str_60_to_6f[] = static char *str_60_to_6f[] =
{ {
"pusha", "popa", "bound\t", "arpl\t", "fs:", "gs:", "os:", "as:", "pusha", "popa", "bound\t", "arpl\t", "fs:", "gs:", "os:", "as:",
"push\t", "imul\t", "push\t", "imul\t", "insb", "ins", "outsb", "outs", "push\t", "imul\t", "push\t", "imul\t", "insb", "ins", "outsb", "outs",
}; };
PRIVATE char *str_flags[] = static char *str_flags[] =
{ {
/* opcodes 0x70 to 0x7F, and 0x0F80 to 0x0F9F */ /* opcodes 0x70 to 0x7F, and 0x0F80 to 0x0F9F */
"o", "no", "b", "nb", "z", "nz", "be", "a", "o", "no", "b", "nb", "z", "nz", "be", "a",
"s", "ns", "pe", "po", "l", "ge", "le", "g", "s", "ns", "pe", "po", "l", "ge", "le", "g",
}; };
PRIVATE char *str_98[] = static char *str_98[] =
{ {
"cbw", "cwd", "call\t", "wait", "pushf", "popf", "sahf", "lahf", "cbw", "cwd", "call\t", "wait", "pushf", "popf", "sahf", "lahf",
"cwde", "cdq", "call\t", "wait", "pushfd", "popfd", "sahf", "lahf", "cwde", "cdq", "call\t", "wait", "pushfd", "popfd", "sahf", "lahf",
}; };
PRIVATE char *str_a0[] = static char *str_a0[] =
{ {
movtab, movtab, movtab, movtab, "movsb", "movs", "cmpsb", "cmps", movtab, movtab, movtab, movtab, "movsb", "movs", "cmpsb", "cmps",
}; };
PRIVATE char *str_a8[] = static char *str_a8[] =
{ {
"test\t", "test\t", "stosb", "stos", "lodsb", "lods", "scasb", "scas", "test\t", "test\t", "stosb", "stos", "lodsb", "lods", "scasb", "scas",
}; };
PRIVATE char *str_c0[] = static char *str_c0[] =
{ {
"", "", "ret\t", "ret", "les\t", "lds\t", movtab, movtab, "", "", "ret\t", "ret", "les\t", "lds\t", movtab, movtab,
}; };
PRIVATE char *str_c8[] = static char *str_c8[] =
{ {
"enter\t", "leave", "retf\t", "retf", "int\t3", "int\t", "into", "iret", "enter\t", "leave", "retf\t", "retf", "int\t3", "int\t", "into", "iret",
}; };
PRIVATE char *str_d0[] = static char *str_d0[] =
{ {
"aam", "aad", "db\td6", "xlat", "aam", "aad", "db\td6", "xlat",
}; };
PRIVATE char *sstr_d0[] = static char *sstr_d0[] =
{ {
"rol", "ror", "rcl", "rcr", "shl", "shr", fishy, "sar", "rol", "ror", "rcl", "rcr", "shl", "shr", fishy, "sar",
}; };
PRIVATE char *str_d8[] = static char *str_d8[] =
{ {
"fadd", "fmul", "fcom", "fcomp", "fsub", "fsubr", "fdiv", "fdivr", "fadd", "fmul", "fcom", "fcomp", "fsub", "fsubr", "fdiv", "fdivr",
"fld", NULL, "fst", "fstp", "fldenv", "fldcw", "fstenv", "fstcw", "fld", NULL, "fst", "fstp", "fldenv", "fldcw", "fstenv", "fstcw",
@@ -280,7 +280,7 @@ PRIVATE char *str_d8[] =
"fild", NULL, "fist", "fistp", "fbld", "fild", "fbstp", "fistp", "fild", NULL, "fist", "fistp", "fbld", "fild", "fbstp", "fistp",
}; };
PRIVATE char *str1_d8[] = static char *str1_d8[] =
{ {
"fadd", "fmul", "fcom", "fcomp", "fsub", "fsubr", "fdiv", "fdivr", "fadd", "fmul", "fcom", "fcomp", "fsub", "fsubr", "fdiv", "fdivr",
"fld", "fxch", "\0\0", NULL, "\0\10", "\0\20", "\0\30", "\0\40", "fld", "fxch", "\0\0", NULL, "\0\10", "\0\20", "\0\30", "\0\40",
@@ -292,7 +292,7 @@ PRIVATE char *str1_d8[] =
NULL, NULL, NULL, NULL, "\0\100", NULL, NULL, NULL, NULL, NULL, NULL, NULL, "\0\100", NULL, NULL, NULL,
}; };
PRIVATE unsigned char size_d8[] = static unsigned char size_d8[] =
{ {
4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 4, 4, 14-28, 2, 14-28, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 4, 4, 14-28, 2, 14-28, 2,
4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 4, 4, 0, 10, 0, 10, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0, 4, 4, 0, 10, 0, 10,
@@ -300,7 +300,7 @@ PRIVATE unsigned char size_d8[] =
2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 10, 8, 10, 8, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 10, 8, 10, 8,
}; };
PRIVATE char *sstr_d8[] = static char *sstr_d8[] =
{ {
"fnop", NULL, NULL, NULL, /* D9D0 */ "fnop", NULL, NULL, NULL, /* D9D0 */
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -322,57 +322,57 @@ PRIVATE char *sstr_d8[] =
"fstsw\tax", NULL, NULL, NULL, "fstsw\tax", NULL, NULL, NULL,
}; };
PRIVATE char *str_e0[] = static char *str_e0[] =
{ {
"loopnz\t", "loopz\t", "loop\t", "jcxz\t", "loopnz\t", "loopz\t", "loop\t", "jcxz\t",
"in\t", "in\t", "out\t", "out\t", "in\t", "in\t", "out\t", "out\t",
}; };
PRIVATE char *str_e8[] = static char *str_e8[] =
{ {
"call\t", "jmp\t", "jmp\t", "jmp\t", "call\t", "jmp\t", "jmp\t", "jmp\t",
"in\t", "in\t", "out\t", "out\t", "in\t", "in\t", "out\t", "out\t",
}; };
PRIVATE char *str_f0[] = static char *str_f0[] =
{ {
"lock\t", "db\tf1", "repnz\t", "repz\t", "lock\t", "db\tf1", "repnz\t", "repz\t",
"hlt", "cmc", "hlt", "cmc",
/* other 2 from sstr_f0 */ /* other 2 from sstr_f0 */
}; };
PRIVATE char *sstr_f0[] = static char *sstr_f0[] =
{ {
"test\t", fishy, "not\t", "neg\t", "test\t", fishy, "not\t", "neg\t",
"mul\t", "imul\t", "div\t", "idiv\t", "mul\t", "imul\t", "div\t", "idiv\t",
}; };
PRIVATE char *str_f8[] = static char *str_f8[] =
{ {
"clc", "stc", "cli", "sti", "clc", "stc", "cli", "sti",
"cld", "std", "cld", "std",
/* other 2 from sstr_f8 */ /* other 2 from sstr_f8 */
}; };
PRIVATE char *sstr_f8[] = static char *sstr_f8[] =
{ {
"inc\t", "dec\t", "call\t", "call\tfar ", "inc\t", "dec\t", "call\t", "call\tfar ",
"jmp\t", "jmp\tfar ", "push\t", "???\t", "jmp\t", "jmp\tfar ", "push\t", "???\t",
}; };
PRIVATE int data_seg; /* data segment (munged name for asld) */ static int data_seg; /* data segment (munged name for asld) */
PRIVATE unsigned hasize; /* half address size in bits */ static unsigned hasize; /* half address size in bits */
PRIVATE unsigned hdefsize; static unsigned hdefsize;
PRIVATE unsigned hosize; /* half operand size in bits */ static unsigned hosize; /* half operand size in bits */
/* for easy index into reg tables */ /* for easy index into reg tables */
PRIVATE opcode_pt mod; static opcode_pt mod;
PRIVATE off_t offtable[2]; static off_t offtable[2];
PRIVATE off_t *offptr; static off_t *offptr;
PRIVATE off_t *off1ptr; static off_t *off1ptr;
PRIVATE opcode_pt reg; static opcode_pt reg;
PRIVATE opcode_pt rm; static opcode_pt rm;
PRIVATE su8_pt get8s() static su8_pt get8s()
{ {
su8_pt got; su8_pt got;
@@ -381,7 +381,7 @@ PRIVATE su8_pt get8s()
return got; return got;
} }
PRIVATE void getmodregrm() static void getmodregrm()
{ {
opcode_pt modregrm; opcode_pt modregrm;
@@ -391,7 +391,7 @@ PRIVATE void getmodregrm()
rm = (modregrm & RM_MASK) >> RM_SHIFT; rm = (modregrm & RM_MASK) >> RM_SHIFT;
} }
PRIVATE void i_00_to_3f(opc) static void i_00_to_3f(opc)
opcode_pt opc; opcode_pt opc;
{ {
opcode_pt sub; opcode_pt sub;
@@ -424,14 +424,14 @@ opcode_pt opc;
} }
} }
PRIVATE void i_40_to_5f(opc) static void i_40_to_5f(opc)
opcode_pt opc; opcode_pt opc;
{ {
outustr(str_40_to_5f[(opc >> 3) & 3]); outustr(str_40_to_5f[(opc >> 3) & 3]);
outustr(genreg[hosize + (opc & 7)]); outustr(genreg[hosize + (opc & 7)]);
} }
PRIVATE void i_60_to_6f(opc) static void i_60_to_6f(opc)
opcode_pt opc; opcode_pt opc;
{ {
/* most for 386, some for 286 */ /* most for 386, some for 286 */
@@ -485,7 +485,7 @@ opcode_pt opc;
} }
} }
PRIVATE void i_70_to_7f(opc) static void i_70_to_7f(opc)
opcode_pt opc; opcode_pt opc;
{ {
outustr("j"); outustr("j");
@@ -493,7 +493,7 @@ opcode_pt opc;
Jb(); Jb();
} }
PRIVATE void i_80(opc) static void i_80(opc)
opcode_pt opc; opcode_pt opc;
{ {
if (opc >= 4) if (opc >= 4)
@@ -519,7 +519,7 @@ opcode_pt opc;
} }
} }
PRIVATE void i_88(opc) static void i_88(opc)
opcode_pt opc; opcode_pt opc;
{ {
if (opc < 4) if (opc < 4)
@@ -559,7 +559,7 @@ opcode_pt opc;
} }
} }
PRIVATE void i_90(opc) static void i_90(opc)
opcode_pt opc; opcode_pt opc;
{ {
if (opc == 0) if (opc == 0)
@@ -573,7 +573,7 @@ opcode_pt opc;
} }
} }
PRIVATE void i_98(opc) static void i_98(opc)
opcode_pt opc; opcode_pt opc;
{ {
outustr((str_98 - 8)[opc + hosize]); outustr((str_98 - 8)[opc + hosize]);
@@ -581,7 +581,7 @@ opcode_pt opc;
outsegpc(); outsegpc();
} }
PRIVATE void i_a0(opc) static void i_a0(opc)
opcode_pt opc; opcode_pt opc;
{ {
outustr(str_a0[opc]); outustr(str_a0[opc]);
@@ -599,7 +599,7 @@ opcode_pt opc;
outwsize(); outwsize();
} }
PRIVATE void i_a8(opc) static void i_a8(opc)
opcode_pt opc; opcode_pt opc;
{ {
outustr(str_a8[opc]); outustr(str_a8[opc]);
@@ -613,7 +613,7 @@ opcode_pt opc;
outwsize(); outwsize();
} }
PRIVATE void i_b0(opc) static void i_b0(opc)
opcode_pt opc; opcode_pt opc;
{ {
outustr(movtab); outustr(movtab);
@@ -622,7 +622,7 @@ opcode_pt opc;
Ib(); Ib();
} }
PRIVATE void i_b8(opc) static void i_b8(opc)
opcode_pt opc; opcode_pt opc;
{ {
outustr(movtab); outustr(movtab);
@@ -631,7 +631,7 @@ opcode_pt opc;
Iv(); Iv();
} }
PRIVATE void i_c0(opc) static void i_c0(opc)
opcode_pt opc; opcode_pt opc;
{ {
outustr(str_c0[opc]); outustr(str_c0[opc]);
@@ -654,7 +654,7 @@ opcode_pt opc;
shift(opc); shift(opc);
} }
PRIVATE void i_c8(opc) static void i_c8(opc)
opcode_pt opc; opcode_pt opc;
{ {
outustr(str_c8[opc]); outustr(str_c8[opc]);
@@ -672,7 +672,7 @@ opcode_pt opc;
outwsize(); outwsize();
} }
PRIVATE void i_d0(opc) static void i_d0(opc)
opcode_pt opc; opcode_pt opc;
{ {
opcode_pt aabyte; opcode_pt aabyte;
@@ -691,7 +691,7 @@ opcode_pt opc;
} }
} }
PRIVATE void i_d8(opc) static void i_d8(opc)
opcode_pt opc; opcode_pt opc;
{ {
opcode_pt esc; opcode_pt esc;
@@ -746,7 +746,7 @@ escape:
outea(opc); outea(opc);
} }
PRIVATE void i_e0(opc) static void i_e0(opc)
opcode_pt opc; opcode_pt opc;
{ {
outustr(str_e0[opc]); outustr(str_e0[opc]);
@@ -766,7 +766,7 @@ opcode_pt opc;
} }
} }
PRIVATE void i_e8(opc) static void i_e8(opc)
opcode_pt opc; opcode_pt opc;
{ {
outustr(str_e8[opc]); outustr(str_e8[opc]);
@@ -793,7 +793,7 @@ opcode_pt opc;
} }
} }
PRIVATE void i_f0(opc) static void i_f0(opc)
opcode_pt opc; opcode_pt opc;
{ {
if (opc < 6) if (opc < 6)
@@ -812,7 +812,7 @@ opcode_pt opc;
} }
} }
PRIVATE void i_f8(opc) static void i_f8(opc)
opcode_pt opc; opcode_pt opc;
{ {
if (opc < 6) if (opc < 6)
@@ -829,14 +829,14 @@ opcode_pt opc;
} }
} }
PRIVATE void outad(opc) static void outad(opc)
opcode_pt opc; opcode_pt opc;
{ {
getmodregrm(); getmodregrm();
outad1(opc); outad1(opc);
} }
PRIVATE void outad1(opc) static void outad1(opc)
opcode_pt opc; opcode_pt opc;
{ {
if (!(opc & TOREGBIT)) if (!(opc & TOREGBIT))
@@ -855,7 +855,7 @@ opcode_pt opc;
} }
} }
PRIVATE void outalorx(opc) static void outalorx(opc)
opcode_pt opc; opcode_pt opc;
{ {
if (opc & WORDBIT) if (opc & WORDBIT)
@@ -864,17 +864,17 @@ opcode_pt opc;
outustr(genreg[0]); outustr(genreg[0]);
} }
PRIVATE void outax() static void outax()
{ {
outustr(genreg[hosize]); outustr(genreg[hosize]);
} }
PRIVATE void outbptr() static void outbptr()
{ {
outustr("byte ptr "); outustr("byte ptr ");
} }
PRIVATE void outbwptr(opc) static void outbwptr(opc)
opcode_pt opc; opcode_pt opc;
{ {
if (mod != REG_MOD) if (mod != REG_MOD)
@@ -886,7 +886,7 @@ opcode_pt opc;
} }
} }
PRIVATE void outea(wordflags) static void outea(wordflags)
opcode_pt wordflags; opcode_pt wordflags;
{ {
reg_pt base; reg_pt base;
@@ -943,7 +943,7 @@ opcode_pt wordflags;
} }
} }
PRIVATE void outf1() static void outf1()
{ {
outustr("st("); outustr("st(");
outbyte((int) (rm + '0')); outbyte((int) (rm + '0'));
@@ -952,7 +952,7 @@ PRIVATE void outf1()
#if (_WORD_SIZE == 4) #if (_WORD_SIZE == 4)
PRIVATE void out32offset() static void out32offset()
{ {
off_t off; off_t off;
@@ -965,12 +965,12 @@ PRIVATE void out32offset()
} }
#endif #endif
PRIVATE void outfishy() static void outfishy()
{ {
outustr("\t???"); outustr("\t???");
} }
PRIVATE void outgetaddr() static void outgetaddr()
{ {
off_t off; off_t off;
@@ -987,7 +987,7 @@ PRIVATE void outgetaddr()
outh16((u16_t) off); outh16((u16_t) off);
} }
PRIVATE void outimmed(signwordflag) static void outimmed(signwordflag)
opcode_pt signwordflag; opcode_pt signwordflag;
{ {
su8_pt byte; su8_pt byte;
@@ -1012,7 +1012,7 @@ opcode_pt signwordflag;
Ib(); Ib();
} }
PRIVATE void outpc(pc) static void outpc(pc)
off_t pc; off_t pc;
{ {
if (hosize == 8) if (hosize == 8)
@@ -1026,7 +1026,7 @@ off_t pc;
outh16((u16_t) pc); outh16((u16_t) pc);
} }
PRIVATE void outsegpc() static void outsegpc()
{ {
off_t oldbase; off_t oldbase;
off_t pc; off_t pc;
@@ -1043,25 +1043,25 @@ PRIVATE void outsegpc()
uptr.base = oldbase; uptr.base = oldbase;
} }
PRIVATE void oututstr(s) static void oututstr(s)
char *s; char *s;
{ {
outustr(s); outustr(s);
outtab(); outtab();
} }
PRIVATE void outword() static void outword()
{ {
outustr("dword " + ((16 - hosize) >> 3)); outustr("dword " + ((16 - hosize) >> 3));
} }
PRIVATE void outwptr() static void outwptr()
{ {
outword(); outword();
outustr("ptr "); outustr("ptr ");
} }
PRIVATE void outwsize() static void outwsize()
{ {
if (hosize == 16) if (hosize == 16)
outustr("d"); outustr("d");
@@ -1069,7 +1069,7 @@ PRIVATE void outwsize()
outustr("w"); outustr("w");
} }
PRIVATE void pagef() static void pagef()
{ {
opcode_pt opc; opcode_pt opc;
int regbad; int regbad;
@@ -1214,7 +1214,7 @@ PRIVATE void pagef()
outstr(fishy); outstr(fishy);
} }
PRIVATE int puti() static int puti()
{ {
static int hadprefix; static int hadprefix;
opcode_pt opcode; opcode_pt opcode;
@@ -1270,7 +1270,7 @@ more:
return TRUE; return TRUE;
} }
PRIVATE void shift(opc) static void shift(opc)
opcode_pt opc; opcode_pt opc;
{ {
getmodregrm(); getmodregrm();
@@ -1286,28 +1286,28 @@ opcode_pt opc;
outbyte('1'); outbyte('1');
} }
PRIVATE void checkmemory() static void checkmemory()
{ {
if (mod == REG_MOD) if (mod == REG_MOD)
outfishy(); outfishy();
} }
PRIVATE void CL() static void CL()
{ {
outustr(genreg[1]); outustr(genreg[1]);
} }
PRIVATE void Eb() static void Eb()
{ {
outea(0); outea(0);
} }
PRIVATE void Ev() static void Ev()
{ {
outea(WORDBIT); outea(WORDBIT);
} }
PRIVATE void EvGv() static void EvGv()
{ {
getmodregrm(); getmodregrm();
Ev(); Ev();
@@ -1315,77 +1315,77 @@ PRIVATE void EvGv()
Gv1(); Gv1();
} }
PRIVATE void EvIb() static void EvIb()
{ {
Ev(); Ev();
outcomma(); outcomma();
Ib(); Ib();
} }
PRIVATE void Ew() static void Ew()
{ {
hosize = 8; hosize = 8;
Ev(); Ev();
} }
PRIVATE void EwRw() static void EwRw()
{ {
hosize = 8; hosize = 8;
EvGv(); EvGv();
} }
PRIVATE void Gv() static void Gv()
{ {
getmodregrm(); getmodregrm();
Gv1(); Gv1();
} }
PRIVATE void Gv1() static void Gv1()
{ {
outustr(genreg[hosize + reg]); outustr(genreg[hosize + reg]);
} }
PRIVATE void GvEv() static void GvEv()
{ {
Gv(); Gv();
outcomma(); outcomma();
Ev(); Ev();
} }
PRIVATE void GvEw() static void GvEw()
{ {
Gv(); Gv();
outcomma(); outcomma();
Ew(); Ew();
} }
PRIVATE void GvM() static void GvM()
{ {
GvEv(); GvEv();
checkmemory(); checkmemory();
} }
PRIVATE void GvMa() static void GvMa()
{ {
GvM(); GvM();
} }
PRIVATE void GvMp() static void GvMp()
{ {
GvM(); GvM();
} }
PRIVATE void Ib() static void Ib()
{ {
outh8(get8()); outh8(get8());
} }
PRIVATE void Iw() static void Iw()
{ {
outh16(get16()); outh16(get16());
} }
PRIVATE void Iv() static void Iv()
{ {
if (hosize == 16) if (hosize == 16)
outh32(get32()); outh32(get32());
@@ -1393,7 +1393,7 @@ PRIVATE void Iv()
Iw(); Iw();
} }
PRIVATE void Jb() static void Jb()
{ {
off_t pcjump; off_t pcjump;
@@ -1401,7 +1401,7 @@ PRIVATE void Jb()
outpc(pcjump + uptr.off); outpc(pcjump + uptr.off);
} }
PRIVATE void Jv() static void Jv()
{ {
off_t pcjump; off_t pcjump;
@@ -1412,7 +1412,7 @@ PRIVATE void Jv()
outpc(pcjump + uptr.off); outpc(pcjump + uptr.off);
} }
PRIVATE void Ms() static void Ms()
{ {
Ev(); Ev();
checkmemory(); checkmemory();
@@ -1420,7 +1420,7 @@ PRIVATE void Ms()
/********************* DASM ******************************/ /********************* DASM ******************************/
PUBLIC long dasm( addr, count, symflg ) long dasm( addr, count, symflg )
long addr; long addr;
int count; int count;
int symflg; int symflg;
@@ -1437,7 +1437,7 @@ int symflg;
} }
PRIVATE int show1instruction() static int show1instruction()
{ {
register int column; register int column;
int idone; int idone;
@@ -1481,7 +1481,7 @@ PRIVATE int show1instruction()
} }
PRIVATE u8_t get8() static u8_t get8()
{ {
/* get 8 bits current instruction pointer and advance pointer */ /* get 8 bits current instruction pointer and advance pointer */
@@ -1492,7 +1492,7 @@ PRIVATE u8_t get8()
return temp; return temp;
} }
PRIVATE u16_t get16() static u16_t get16()
{ {
/* get 16 bits from current instruction pointer and advance pointer */ /* get 16 bits from current instruction pointer and advance pointer */
@@ -1503,7 +1503,7 @@ PRIVATE u16_t get16()
return temp; return temp;
} }
PRIVATE u32_t get32() static u32_t get32()
{ {
/* get 32 bits from current instruction pointer and advance pointer */ /* get 32 bits from current instruction pointer and advance pointer */
@@ -1515,7 +1515,7 @@ PRIVATE u32_t get32()
} }
PRIVATE int outsegaddr(addr) static int outsegaddr(addr)
struct address_s *addr; struct address_s *addr;
{ {
/* print segmented address */ /* print segmented address */
@@ -1538,7 +1538,7 @@ struct address_s *addr;
return bytes_printed + 4; return bytes_printed + 4;
} }
PRIVATE int outssegaddr(addr) static int outssegaddr(addr)
struct address_s *addr; struct address_s *addr;
{ {
/* print 32 bit segmented address and 2 spaces */ /* print 32 bit segmented address and 2 spaces */
@@ -1551,13 +1551,13 @@ struct address_s *addr;
return bytes_printed + 2; return bytes_printed + 2;
} }
PRIVATE u8_t peek_byte(addr) static u8_t peek_byte(addr)
off_t addr; off_t addr;
{ {
return (u8_t) peek_dword(addr) & 0xFF; /* 8 bits only */ return (u8_t) peek_dword(addr) & 0xFF; /* 8 bits only */
} }
PRIVATE u16_t peek_word(addr) static u16_t peek_word(addr)
off_t addr; off_t addr;
{ {
return (u16_t) peek_dword(addr); return (u16_t) peek_dword(addr);

View File

@@ -16,15 +16,15 @@
#include <string.h> #include <string.h>
#include "proto.h" #include "proto.h"
FORWARD long value(char *s , char **s_p , int *seg_p ); static long value(char *s , char **s_p , int *seg_p );
FORWARD long lookup(char *s , char **s_p , int *seg_p ); static long lookup(char *s , char **s_p , int *seg_p );
#define idchar(c) (isalpha(c) || isdigit(c) || (c) == '_') #define idchar(c) (isalpha(c) || isdigit(c) || (c) == '_')
/* /*
* Get an expression for mdb * Get an expression for mdb
*/ */
PUBLIC char *getexp(buf, exp_p, seg_p) char *getexp(buf, exp_p, seg_p)
char *buf; char *buf;
int *seg_p; int *seg_p;
long *exp_p; long *exp_p;
@@ -62,7 +62,7 @@ long *exp_p;
* \n 0L * \n 0L
* then calls lookup for symbols * then calls lookup for symbols
*/ */
PRIVATE long value(s, s_p, seg_p) static long value(s, s_p, seg_p)
char *s, **s_p; char *s, **s_p;
int *seg_p; int *seg_p;
{ {
@@ -94,7 +94,7 @@ int *seg_p;
* Handle special cases: _start T: D: S: * Handle special cases: _start T: D: S:
* then call symbolvalue() * then call symbolvalue()
*/ */
PRIVATE long lookup(s, s_p, seg_p) static long lookup(s, s_p, seg_p)
char *s, **s_p; char *s, **s_p;
int *seg_p; int *seg_p;
{ {
@@ -148,7 +148,7 @@ int *seg_p;
} }
/* Skip spaces */ /* Skip spaces */
PUBLIC char *skip(s) char *skip(s)
register char *s; register char *s;
{ {
while (isspace(*s)) ++s; while (isspace(*s)) ++s;

View File

@@ -12,10 +12,10 @@
#include <sys/ptrace.h> #include <sys/ptrace.h>
#include "proto.h" #include "proto.h"
FORWARD void pr_ascii(long val , int size ); static void pr_ascii(long val , int size );
/* Print ascii */ /* Print ascii */
PRIVATE void pr_ascii(val, size) static void pr_ascii(val, size)
long val; long val;
int size; int size;
{ {
@@ -42,7 +42,7 @@ int size;
} }
/* Dump stack */ /* Dump stack */
PUBLIC void dump_stack(cnt) void dump_stack(cnt)
long cnt; long cnt;
{ {
vir_bytes v, vi; vir_bytes v, vi;
@@ -81,7 +81,7 @@ long cnt;
/* Get file size */ /* Get file size */
PUBLIC off_t file_size(fd) off_t file_size(fd)
int fd; int fd;
{ {
struct stat st; struct stat st;
@@ -95,7 +95,7 @@ struct stat st;
} }
/* Print help page */ /* Print help page */
PUBLIC void help_page() void help_page()
{ {
outstr("\nHelp for mdb. For more details, type 'command ?'\n"); outstr("\nHelp for mdb. For more details, type 'command ?'\n");
outstr("!#\t- Shell escape / Set Variable or register\n"); outstr("!#\t- Shell escape / Set Variable or register\n");
@@ -133,7 +133,7 @@ PUBLIC void help_page()
outstr(" mdb [-fc] file\n"); outstr(" mdb [-fc] file\n");
} }
PUBLIC void version_info() void version_info()
{ {
Printf("\nmdb version %s.%d for Minix", MDBVERSION, MDBBUILD ); Printf("\nmdb version %s.%d for Minix", MDBVERSION, MDBBUILD );
Printf(" %s.%s", OS_RELEASE, OS_VERSION); Printf(" %s.%s", OS_RELEASE, OS_VERSION);
@@ -151,7 +151,7 @@ PUBLIC void version_info()
} }
/* Print help message on command */ /* Print help message on command */
PUBLIC void help_on(h) void help_on(h)
int h; int h;
{ {

View File

@@ -20,18 +20,18 @@ struct symtab_s
unsigned nsym; unsigned nsym;
}; };
PRIVATE struct symtab_s symtab; static struct symtab_s symtab;
PRIVATE int type_of_exec; static int type_of_exec;
FORWARD int check_exec(struct exec *hdr); static int check_exec(struct exec *hdr);
FORWARD void sortsyms(struct nlist *array , struct nlist *top ); static void sortsyms(struct nlist *array , struct nlist *top );
FORWARD int symeq(char *t , struct nlist *sp ); static int symeq(char *t , struct nlist *sp );
FORWARD int symprefix(char *t , struct nlist *sp ); static int symprefix(char *t , struct nlist *sp );
FORWARD struct nlist *findsname(char *name, int is_text, int allflag); static struct nlist *findsname(char *name, int is_text, int allflag);
FORWARD void outsym(struct nlist *sp, off_t off); static void outsym(struct nlist *sp, off_t off);
FORWARD struct nlist *findsval(off_t value, int where); static struct nlist *findsval(off_t value, int where);
PUBLIC void syminit( filename ) void syminit( filename )
char *filename; char *filename;
{ {
int fd; int fd;
@@ -100,7 +100,7 @@ char *filename;
* return type of exec * return type of exec
* or exit * or exit
*/ */
PRIVATE int check_exec(hdr) static int check_exec(hdr)
struct exec *hdr; struct exec *hdr;
{ {
long magic; long magic;
@@ -159,7 +159,7 @@ long magic;
} }
PUBLIC long symbolvalue( name, is_text ) long symbolvalue( name, is_text )
char *name; char *name;
int is_text; int is_text;
{ {
@@ -178,7 +178,7 @@ register struct nlist *sp;
return 0L; return 0L;
} }
PRIVATE struct nlist *findsname( name, is_text, allflag ) static struct nlist *findsname( name, is_text, allflag )
char *name; char *name;
int is_text; int is_text;
int allflag; int allflag;
@@ -240,7 +240,7 @@ int allflag;
return NULL; return NULL;
} }
PRIVATE struct nlist *findsval( value, where ) static struct nlist *findsval( value, where )
off_t value; off_t value;
int where; int where;
{ {
@@ -277,7 +277,7 @@ int where;
} }
PUBLIC void printhex(v) void printhex(v)
off_t v; off_t v;
{ {
if ( v >= 65536L ) if ( v >= 65536L )
@@ -289,7 +289,7 @@ off_t v;
} }
PRIVATE void outsym( sp, off ) static void outsym( sp, off )
struct nlist *sp; struct nlist *sp;
off_t off; off_t off;
{ {
@@ -307,7 +307,7 @@ off_t off;
/* shell sort symbols on value */ /* shell sort symbols on value */
PRIVATE void sortsyms( array, top ) static void sortsyms( array, top )
struct nlist *array; struct nlist *array;
struct nlist *top; struct nlist *top;
{ {
@@ -341,7 +341,7 @@ struct nlist *top;
while ( (gap /= 3) != 0 ); while ( (gap /= 3) != 0 );
} }
PUBLIC void symbolic( value, separator ) void symbolic( value, separator )
off_t value; off_t value;
int separator; int separator;
{ {
@@ -386,14 +386,14 @@ int separator;
} }
PRIVATE int symeq( t, sp ) static int symeq( t, sp )
register char *t; register char *t;
struct nlist *sp; struct nlist *sp;
{ {
return strncmp( t, sp->n_name, sizeof sp->n_name ) == 0; return strncmp( t, sp->n_name, sizeof sp->n_name ) == 0;
} }
PRIVATE int symprefix( t, sp ) static int symprefix( t, sp )
register char *t; register char *t;
struct nlist *sp; struct nlist *sp;
{ {
@@ -412,7 +412,7 @@ struct nlist *sp;
/* list all symbols - test for selection criteria */ /* list all symbols - test for selection criteria */
PUBLIC void listsym(cmd) void listsym(cmd)
char *cmd; char *cmd;
{ {
register struct symtab_s *tp; register struct symtab_s *tp;
@@ -473,7 +473,7 @@ char *cmd;
} }
PUBLIC int text_symbol(value) int text_symbol(value)
off_t value; off_t value;
{ {
struct nlist *sp; struct nlist *sp;
@@ -492,7 +492,7 @@ struct nlist *sp;
return FALSE; return FALSE;
} }
PUBLIC int finds_data(off,data_seg) int finds_data(off,data_seg)
off_t off; off_t off;
int data_seg; int data_seg;
{ {
@@ -512,7 +512,7 @@ struct nlist *sp;
return FALSE; return FALSE;
} }
PUBLIC int finds_pc(pc) int finds_pc(pc)
off_t pc; off_t pc;
{ {
struct nlist *sp; struct nlist *sp;

View File

@@ -17,9 +17,9 @@
#define SYSCALL_OLD 0x20CD #define SYSCALL_OLD 0x20CD
#endif #endif
PRIVATE long intaddr; static long intaddr;
PUBLIC void start_syscall(addr) void start_syscall(addr)
long addr; long addr;
{ {
long old; long old;
@@ -45,7 +45,7 @@ long old;
} }
PUBLIC void do_syscall(addr) void do_syscall(addr)
long addr; long addr;
{ {
unsigned reg_ax,reg_bx; unsigned reg_ax,reg_bx;

View File

@@ -11,7 +11,7 @@
* Call ptrace and check for error if debugging running process * Call ptrace and check for error if debugging running process
* Otherwise read 'core' file * Otherwise read 'core' file
*/ */
PUBLIC long mdbtrace(req, pid, addr, data) long mdbtrace(req, pid, addr, data)
int req, pid; int req, pid;
long addr, data; long addr, data;
{ {
@@ -43,7 +43,7 @@ long addr, data;
} }
/* Used by disassembler */ /* Used by disassembler */
PUBLIC u32_t peek_dword(addr) u32_t peek_dword(addr)
off_t addr; off_t addr;
{ {
return mdbtrace(T_GETINS, curpid, addr, 0L); return mdbtrace(T_GETINS, curpid, addr, 0L);

View File

@@ -100,8 +100,8 @@ void eat_dir(Ino_t parent);
void eat_file(Ino_t inode, int f); void eat_file(Ino_t inode, int f);
void enter_dir(Ino_t parent, char *name, Ino_t child); void enter_dir(Ino_t parent, char *name, Ino_t child);
void incr_size(Ino_t n, long count); void incr_size(Ino_t n, long count);
PRIVATE ino_t alloc_inode(int mode, int usrid, int grpid); static ino_t alloc_inode(int mode, int usrid, int grpid);
PRIVATE zone_t alloc_zone(void); static zone_t alloc_zone(void);
void add_zone(Ino_t n, zone_t z, long bytes, long cur_time); void add_zone(Ino_t n, zone_t z, long bytes, long cur_time);
void add_z_1(Ino_t n, zone_t z, long bytes, long cur_time); void add_z_1(Ino_t n, zone_t z, long bytes, long cur_time);
void add_z_2(Ino_t n, zone_t z, long bytes, long cur_time); void add_z_2(Ino_t n, zone_t z, long bytes, long cur_time);
@@ -880,7 +880,7 @@ long count;
/*================================================================ /*================================================================
* allocation assist group * allocation assist group
*===============================================================*/ *===============================================================*/
PRIVATE ino_t alloc_inode(mode, usrid, grpid) static ino_t alloc_inode(mode, usrid, grpid)
int mode, usrid, grpid; int mode, usrid, grpid;
{ {
ino_t num; ino_t num;
@@ -924,7 +924,7 @@ int mode, usrid, grpid;
} }
PRIVATE zone_t alloc_zone() static zone_t alloc_zone()
{ {
/* Allocate a new zone */ /* Allocate a new zone */
/* Works for zone > block */ /* Works for zone > block */

View File

@@ -135,7 +135,7 @@ int gettynames(void);
* Tname assumes that the first three letters of the tty's name can be omitted * Tname assumes that the first three letters of the tty's name can be omitted
* and returns the rest (except for the console, which yields "co"). * and returns the rest (except for the console, which yields "co").
*/ */
PRIVATE char *tname(dev_t dev_nr) static char *tname(dev_t dev_nr)
{ {
unsigned int i; unsigned int i;
@@ -149,7 +149,7 @@ PRIVATE char *tname(dev_t dev_nr)
} }
/* Find a task by its endpoint. */ /* Find a task by its endpoint. */
PRIVATE struct pstat *findtask(endpoint_t endpt) static struct pstat *findtask(endpoint_t endpt)
{ {
struct pstat *ps; struct pstat *ps;
unsigned int slot; unsigned int slot;
@@ -168,7 +168,7 @@ PRIVATE struct pstat *findtask(endpoint_t endpt)
} }
/* Return canonical task name of the given endpoint. */ /* Return canonical task name of the given endpoint. */
PRIVATE char *taskname(endpoint_t endpt) static char *taskname(endpoint_t endpt)
{ {
struct pstat *ps; struct pstat *ps;
@@ -180,7 +180,7 @@ PRIVATE char *taskname(endpoint_t endpt)
/* Prrecv prints the RECV field for process with pstat buffer pointer ps. /* Prrecv prints the RECV field for process with pstat buffer pointer ps.
* This is either "ANY", "taskname", or "(blockreason) taskname". * This is either "ANY", "taskname", or "(blockreason) taskname".
*/ */
PRIVATE char *prrecv(struct pstat *ps) static char *prrecv(struct pstat *ps)
{ {
char *blkstr, *task; /* reason for blocking and task */ char *blkstr, *task; /* reason for blocking and task */
static char recvstr[20]; static char recvstr[20];
@@ -212,7 +212,7 @@ PRIVATE char *prrecv(struct pstat *ps)
return recvstr; return recvstr;
} }
PRIVATE void getkinfo(void) static void getkinfo(void)
{ {
FILE *fp; FILE *fp;

View File

@@ -32,14 +32,14 @@
#include "config.h" #include "config.h"
#include "proto.h" #include "proto.h"
PRIVATE int class_recurs; /* Nesting level of class statements */ static int class_recurs; /* Nesting level of class statements */
#define MAX_CLASS_RECURS 100 /* Max nesting level for classes */ #define MAX_CLASS_RECURS 100 /* Max nesting level for classes */
#include "parse.h" #include "parse.h"
FORWARD void do_service(config_t *cpe, config_t *config, struct rs_config *); static void do_service(config_t *cpe, config_t *config, struct rs_config *);
PRIVATE void do_class(config_t *cpe, config_t *config, struct rs_config *rs_config) static void do_class(config_t *cpe, config_t *config, struct rs_config *rs_config)
{ {
config_t *cp, *cp1; config_t *cp, *cp1;
@@ -110,7 +110,7 @@ PRIVATE void do_class(config_t *cpe, config_t *config, struct rs_config *rs_conf
class_recurs--; class_recurs--;
} }
PRIVATE void do_uid(config_t *cpe, struct rs_start *rs_start) static void do_uid(config_t *cpe, struct rs_start *rs_start)
{ {
uid_t uid; uid_t uid;
struct passwd *pw; struct passwd *pw;
@@ -155,7 +155,7 @@ PRIVATE void do_uid(config_t *cpe, struct rs_start *rs_start)
rs_start->rss_uid= uid; rs_start->rss_uid= uid;
} }
PRIVATE void do_sigmgr(config_t *cpe, struct rs_start *rs_start) static void do_sigmgr(config_t *cpe, struct rs_start *rs_start)
{ {
endpoint_t sigmgr_ep; endpoint_t sigmgr_ep;
int r; int r;
@@ -192,7 +192,7 @@ PRIVATE void do_sigmgr(config_t *cpe, struct rs_start *rs_start)
rs_start->rss_sigmgr= sigmgr_ep; rs_start->rss_sigmgr= sigmgr_ep;
} }
PRIVATE void do_type(config_t *cpe, struct rs_config *rs_config) static void do_type(config_t *cpe, struct rs_config *rs_config)
{ {
if (cpe->next != NULL) if (cpe->next != NULL)
{ {
@@ -223,7 +223,7 @@ PRIVATE void do_type(config_t *cpe, struct rs_config *rs_config)
cpe->file, cpe->line); cpe->file, cpe->line);
} }
PRIVATE void do_descr(config_t *cpe, struct rs_config *rs_config) static void do_descr(config_t *cpe, struct rs_config *rs_config)
{ {
if (cpe->next != NULL) if (cpe->next != NULL)
{ {
@@ -249,7 +249,7 @@ PRIVATE void do_descr(config_t *cpe, struct rs_config *rs_config)
rs_config->descr = cpe->word; rs_config->descr = cpe->word;
} }
PRIVATE void do_scheduler(config_t *cpe, struct rs_start *rs_start) static void do_scheduler(config_t *cpe, struct rs_start *rs_start)
{ {
endpoint_t scheduler_ep; endpoint_t scheduler_ep;
int r; int r;
@@ -286,7 +286,7 @@ PRIVATE void do_scheduler(config_t *cpe, struct rs_start *rs_start)
rs_start->rss_scheduler= scheduler_ep; rs_start->rss_scheduler= scheduler_ep;
} }
PRIVATE void do_priority(config_t *cpe, struct rs_start *rs_start) static void do_priority(config_t *cpe, struct rs_start *rs_start)
{ {
int priority_val; int priority_val;
char *check; char *check;
@@ -324,7 +324,7 @@ PRIVATE void do_priority(config_t *cpe, struct rs_start *rs_start)
rs_start->rss_priority= priority_val; rs_start->rss_priority= priority_val;
} }
PRIVATE void do_quantum(config_t *cpe, struct rs_start *rs_start) static void do_quantum(config_t *cpe, struct rs_start *rs_start)
{ {
int quantum_val; int quantum_val;
char *check; char *check;
@@ -362,7 +362,7 @@ PRIVATE void do_quantum(config_t *cpe, struct rs_start *rs_start)
rs_start->rss_quantum= quantum_val; rs_start->rss_quantum= quantum_val;
} }
PRIVATE void do_cpu(config_t *cpe, struct rs_start *rs_start) static void do_cpu(config_t *cpe, struct rs_start *rs_start)
{ {
int cpu; int cpu;
char *check; char *check;
@@ -400,7 +400,7 @@ PRIVATE void do_cpu(config_t *cpe, struct rs_start *rs_start)
rs_start->rss_cpu= cpu; rs_start->rss_cpu= cpu;
} }
PRIVATE void do_irq(config_t *cpe, struct rs_start *rs_start) static void do_irq(config_t *cpe, struct rs_start *rs_start)
{ {
int irq; int irq;
int first; int first;
@@ -455,7 +455,7 @@ PRIVATE void do_irq(config_t *cpe, struct rs_start *rs_start)
} }
} }
PRIVATE void do_io(config_t *cpe, struct rs_start *rs_start) static void do_io(config_t *cpe, struct rs_start *rs_start)
{ {
unsigned base, len; unsigned base, len;
int first; int first;
@@ -517,7 +517,7 @@ PRIVATE void do_io(config_t *cpe, struct rs_start *rs_start)
} }
} }
PRIVATE void do_pci_device(config_t *cpe, struct rs_start *rs_start) static void do_pci_device(config_t *cpe, struct rs_start *rs_start)
{ {
u16_t vid, did; u16_t vid, did;
char *check, *check2; char *check, *check2;
@@ -554,7 +554,7 @@ PRIVATE void do_pci_device(config_t *cpe, struct rs_start *rs_start)
} }
} }
PRIVATE void do_pci_class(config_t *cpe, struct rs_start *rs_start) static void do_pci_class(config_t *cpe, struct rs_start *rs_start)
{ {
u8_t baseclass, subclass, interface; u8_t baseclass, subclass, interface;
u32_t class_id, mask; u32_t class_id, mask;
@@ -607,7 +607,7 @@ PRIVATE void do_pci_class(config_t *cpe, struct rs_start *rs_start)
} }
} }
PRIVATE void do_pci(config_t *cpe, struct rs_start *rs_start) static void do_pci(config_t *cpe, struct rs_start *rs_start)
{ {
if (cpe == NULL) if (cpe == NULL)
return; /* Empty PCI statement */ return; /* Empty PCI statement */
@@ -637,7 +637,7 @@ PRIVATE void do_pci(config_t *cpe, struct rs_start *rs_start)
cpe->word, cpe->file, cpe->line); cpe->word, cpe->file, cpe->line);
} }
PRIVATE void do_ipc(config_t *cpe, struct rs_start *rs_start) static void do_ipc(config_t *cpe, struct rs_start *rs_start)
{ {
char *list; char *list;
const char *word; const char *word;
@@ -734,7 +734,7 @@ struct
{ NULL, 0 }, { NULL, 0 },
}; };
PRIVATE void do_vm(config_t *cpe, struct rs_start *rs_start) static void do_vm(config_t *cpe, struct rs_start *rs_start)
{ {
int i, first; int i, first;
@@ -821,7 +821,7 @@ struct
{ NULL, 0 } { NULL, 0 }
}; };
PRIVATE void do_system(config_t *cpe, struct rs_start *rs_start) static void do_system(config_t *cpe, struct rs_start *rs_start)
{ {
int i, first; int i, first;
@@ -882,7 +882,7 @@ PRIVATE void do_system(config_t *cpe, struct rs_start *rs_start)
} }
} }
PRIVATE void do_control(config_t *cpe, struct rs_start *rs_start) static void do_control(config_t *cpe, struct rs_start *rs_start)
{ {
int nr_control = 0; int nr_control = 0;
@@ -912,7 +912,7 @@ PRIVATE void do_control(config_t *cpe, struct rs_start *rs_start)
} }
} }
PRIVATE void do_service(config_t *cpe, config_t *config, struct rs_config *rs_config) static void do_service(config_t *cpe, config_t *config, struct rs_config *rs_config)
{ {
struct rs_start *rs_start = &rs_config->rs_start; struct rs_start *rs_start = &rs_config->rs_start;
config_t *cp; config_t *cp;
@@ -1031,7 +1031,7 @@ PRIVATE void do_service(config_t *cpe, config_t *config, struct rs_config *rs_co
} }
} }
PRIVATE const char *do_config(const char *label, char *filename, struct rs_config *rs_config) static const char *do_config(const char *label, char *filename, struct rs_config *rs_config)
{ {
config_t *config, *cp, *cpe; config_t *config, *cp, *cpe;
struct passwd *pw; struct passwd *pw;
@@ -1109,7 +1109,7 @@ PRIVATE const char *do_config(const char *label, char *filename, struct rs_confi
} }
/* returns failure */ /* returns failure */
PUBLIC const char *parse_config(char *progname, int custom_config, char *req_config, const char *parse_config(char *progname, int custom_config, char *req_config,
struct rs_config *rs_config) struct rs_config *rs_config)
{ {
char *specificconfig, *specific_pkg_config; char *specificconfig, *specific_pkg_config;

View File

@@ -40,7 +40,7 @@
#include "proto.h" #include "proto.h"
/* This array defines all known requests. */ /* This array defines all known requests. */
PRIVATE char *known_requests[] = { static char *known_requests[] = {
"up", "up",
"down", "down",
"refresh", "refresh",
@@ -105,28 +105,28 @@ PRIVATE char *known_requests[] = {
* parameters passed to this utility. Request parameters that are needed * parameters passed to this utility. Request parameters that are needed
* are stored globally in the following variables: * are stored globally in the following variables:
*/ */
PRIVATE int req_type; static int req_type;
PRIVATE int do_run= 0; /* 'run' command instead of 'up' */ static int do_run= 0; /* 'run' command instead of 'up' */
PRIVATE char *req_label = NULL; static char *req_label = NULL;
PRIVATE char *req_path = NULL; static char *req_path = NULL;
PRIVATE char *req_path_self = SELF_REQ_PATH; static char *req_path_self = SELF_REQ_PATH;
PRIVATE char *req_args = ""; static char *req_args = "";
PRIVATE int req_major = 0; static int req_major = 0;
PRIVATE int devman_id = 0; static int devman_id = 0;
PRIVATE int req_dev_style = STYLE_NDEV; static int req_dev_style = STYLE_NDEV;
PRIVATE long req_period = 0; static long req_period = 0;
PRIVATE char *req_script = NULL; static char *req_script = NULL;
PRIVATE char *req_config = PATH_CONFIG; static char *req_config = PATH_CONFIG;
PRIVATE int custom_config_file = 0; static int custom_config_file = 0;
PRIVATE int req_lu_state = DEFAULT_LU_STATE; static int req_lu_state = DEFAULT_LU_STATE;
PRIVATE int req_lu_maxtime = DEFAULT_LU_MAXTIME; static int req_lu_maxtime = DEFAULT_LU_MAXTIME;
/* Buffer to build "/command arg1 arg2 ..." string to pass to RS server. */ /* Buffer to build "/command arg1 arg2 ..." string to pass to RS server. */
PRIVATE char command[4096]; static char command[4096];
/* An error occurred. Report the problem, print the usage, and exit. /* An error occurred. Report the problem, print the usage, and exit.
*/ */
PRIVATE void print_usage(char *app_name, char *problem) static void print_usage(char *app_name, char *problem)
{ {
fprintf(stderr, "Warning, %s\n", problem); fprintf(stderr, "Warning, %s\n", problem);
fprintf(stderr, "Usage:\n"); fprintf(stderr, "Usage:\n");
@@ -145,7 +145,7 @@ PRIVATE void print_usage(char *app_name, char *problem)
/* A request to the RS server failed. Report and exit. /* A request to the RS server failed. Report and exit.
*/ */
PRIVATE void failure(int request) static void failure(int request)
{ {
fprintf(stderr, "Request 0x%x to RS failed: %s (error %d)\n", request, strerror(errno), errno); fprintf(stderr, "Request 0x%x to RS failed: %s (error %d)\n", request, strerror(errno), errno);
exit(errno); exit(errno);
@@ -155,7 +155,7 @@ PRIVATE void failure(int request)
/* Parse and verify correctness of arguments. Report problem and exit if an /* Parse and verify correctness of arguments. Report problem and exit if an
* error is found. Store needed parameters in global variables. * error is found. Store needed parameters in global variables.
*/ */
PRIVATE int parse_arguments(int argc, char **argv, u32_t *rss_flags) static int parse_arguments(int argc, char **argv, u32_t *rss_flags)
{ {
struct stat stat_buf; struct stat stat_buf;
char *hz, *buff; char *hz, *buff;
@@ -412,7 +412,7 @@ PRIVATE int parse_arguments(int argc, char **argv, u32_t *rss_flags)
/* Main program. /* Main program.
*/ */
PUBLIC int main(int argc, char **argv) int main(int argc, char **argv)
{ {
message m; message m;
int result = EXIT_SUCCESS; int result = EXIT_SUCCESS;

View File

@@ -5,11 +5,11 @@
#include "pci.h" #include "pci.h"
PUBLIC int acpi_enabled; int acpi_enabled;
PUBLIC struct machine machine; struct machine machine;
/* don't know where ACPI tables are, we may need to access any memory */ /* don't know where ACPI tables are, we may need to access any memory */
PRIVATE int init_mem_priv(void) static int init_mem_priv(void)
{ {
struct mem_range mr; struct mem_range mr;
@@ -19,7 +19,7 @@ PRIVATE int init_mem_priv(void)
return sys_privctl(SELF, SYS_PRIV_ADD_MEM, &mr); return sys_privctl(SELF, SYS_PRIV_ADD_MEM, &mr);
} }
PRIVATE void set_machine_mode(void) static void set_machine_mode(void)
{ {
ACPI_OBJECT arg1; ACPI_OBJECT arg1;
ACPI_OBJECT_LIST args; ACPI_OBJECT_LIST args;
@@ -40,7 +40,7 @@ PRIVATE void set_machine_mode(void)
machine.apic_enabled ? "APIC" : "PIC"); machine.apic_enabled ? "APIC" : "PIC");
} }
PRIVATE ACPI_STATUS init_acpica(void) static ACPI_STATUS init_acpica(void)
{ {
ACPI_STATUS status; ACPI_STATUS status;
@@ -71,7 +71,7 @@ PRIVATE ACPI_STATUS init_acpica(void)
return AE_OK; return AE_OK;
} }
PUBLIC void init_acpi(void) void init_acpi(void)
{ {
ACPI_STATUS acpi_err; ACPI_STATUS acpi_err;
/* test conditions for acpi */ /* test conditions for acpi */
@@ -98,14 +98,14 @@ PUBLIC void init_acpi(void)
} }
} }
PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) static int sef_cb_init_fresh(int type, sef_init_info_t *info)
{ {
init_acpi(); init_acpi();
return OK; return OK;
} }
PRIVATE void sef_local_startup() static void sef_local_startup()
{ {
/* Register init callbacks. */ /* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh); sef_setcb_init_fresh(sef_cb_init_fresh);

View File

@@ -124,7 +124,7 @@
extern struct machine machine; extern struct machine machine;
PRIVATE u32_t pci_inb(u16_t port) { static u32_t pci_inb(u16_t port) {
u32_t value; u32_t value;
int s; int s;
if ((s=sys_inb(port, &value)) !=OK) if ((s=sys_inb(port, &value)) !=OK)
@@ -132,7 +132,7 @@ PRIVATE u32_t pci_inb(u16_t port) {
return value; return value;
} }
PRIVATE u32_t pci_inw(u16_t port) { static u32_t pci_inw(u16_t port) {
u32_t value; u32_t value;
int s; int s;
if ((s=sys_inw(port, &value)) !=OK) if ((s=sys_inw(port, &value)) !=OK)
@@ -140,7 +140,7 @@ PRIVATE u32_t pci_inw(u16_t port) {
return value; return value;
} }
PRIVATE u32_t pci_inl(u16_t port) { static u32_t pci_inl(u16_t port) {
u32_t value; u32_t value;
int s; int s;
if ((s=sys_inl(port, &value)) !=OK) if ((s=sys_inl(port, &value)) !=OK)
@@ -148,19 +148,19 @@ PRIVATE u32_t pci_inl(u16_t port) {
return value; return value;
} }
PRIVATE void pci_outb(u16_t port, u8_t value) { static void pci_outb(u16_t port, u8_t value) {
int s; int s;
if ((s=sys_outb(port, value)) !=OK) if ((s=sys_outb(port, value)) !=OK)
printf("ACPI: warning, sys_outb failed: %d\n", s); printf("ACPI: warning, sys_outb failed: %d\n", s);
} }
PRIVATE void pci_outw(u16_t port, u16_t value) { static void pci_outw(u16_t port, u16_t value) {
int s; int s;
if ((s=sys_outw(port, value)) !=OK) if ((s=sys_outw(port, value)) !=OK)
printf("ACPI: warning, sys_outw failed: %d\n", s); printf("ACPI: warning, sys_outw failed: %d\n", s);
} }
PRIVATE void pci_outl(u16_t port, u32_t value) { static void pci_outl(u16_t port, u32_t value) {
int s; int s;
if ((s=sys_outl(port, value)) !=OK) if ((s=sys_outl(port, value)) !=OK)
printf("ACPI: warning, sys_outl failed: %d\n", s); printf("ACPI: warning, sys_outl failed: %d\n", s);
@@ -965,7 +965,7 @@ AcpiOsSignal (
* *
*****************************************************************************/ *****************************************************************************/
PUBLIC ACPI_PHYSICAL_ADDRESS AcpiOsGetRootPointer ( ACPI_PHYSICAL_ADDRESS AcpiOsGetRootPointer (
void) void)
{ {
return machine.acpi_rsdp; return machine.acpi_rsdp;

View File

@@ -20,14 +20,14 @@ struct pci_bridge {
struct pci_bridge * children[PCI_MAX_DEVICES]; struct pci_bridge * children[PCI_MAX_DEVICES];
}; };
PRIVATE struct pci_bridge pci_root_bridge; static struct pci_bridge pci_root_bridge;
struct irq_resource { struct irq_resource {
struct pci_bridge * bridge; struct pci_bridge * bridge;
ACPI_PCI_ROUTING_TABLE * tbl; ACPI_PCI_ROUTING_TABLE * tbl;
}; };
PRIVATE struct pci_bridge * find_bridge(struct pci_bridge * root, static struct pci_bridge * find_bridge(struct pci_bridge * root,
int pbnr, int pbnr,
int dev, int dev,
int sbnr) int sbnr)
@@ -68,7 +68,7 @@ PRIVATE struct pci_bridge * find_bridge(struct pci_bridge * root,
return NULL; return NULL;
} }
PUBLIC void do_map_bridge(message *m) void do_map_bridge(message *m)
{ {
int err = OK; int err = OK;
unsigned dev = ((struct acpi_map_bridge_req *)m)->device; unsigned dev = ((struct acpi_map_bridge_req *)m)->device;
@@ -92,7 +92,7 @@ map_error:
} }
#if 0 #if 0
PRIVATE ACPI_STATUS device_get_int(ACPI_HANDLE handle, static ACPI_STATUS device_get_int(ACPI_HANDLE handle,
char * name, char * name,
ACPI_INTEGER * val) ACPI_INTEGER * val)
{ {
@@ -113,7 +113,7 @@ PRIVATE ACPI_STATUS device_get_int(ACPI_HANDLE handle,
} }
#endif #endif
PUBLIC void do_get_irq(message *m) void do_get_irq(message *m)
{ {
struct pci_bridge * bridge; struct pci_bridge * bridge;
int irq; int irq;
@@ -134,7 +134,7 @@ PUBLIC void do_get_irq(message *m)
((struct acpi_get_irq_resp *)m)->irq = irq; ((struct acpi_get_irq_resp *)m)->irq = irq;
} }
PRIVATE void add_irq(struct pci_bridge * bridge, static void add_irq(struct pci_bridge * bridge,
unsigned dev, unsigned dev,
unsigned pin, unsigned pin,
u8_t irq) u8_t irq)
@@ -144,7 +144,7 @@ PRIVATE void add_irq(struct pci_bridge * bridge,
bridge->irqtable[dev * PCI_MAX_PINS + pin] = irq; bridge->irqtable[dev * PCI_MAX_PINS + pin] = irq;
} }
PRIVATE ACPI_STATUS get_irq_resource(ACPI_RESOURCE *res, void *context) static ACPI_STATUS get_irq_resource(ACPI_RESOURCE *res, void *context)
{ {
struct irq_resource * ires = (struct irq_resource *) context; struct irq_resource * ires = (struct irq_resource *) context;
@@ -165,7 +165,7 @@ PRIVATE ACPI_STATUS get_irq_resource(ACPI_RESOURCE *res, void *context)
return AE_OK; return AE_OK;
} }
PRIVATE ACPI_STATUS get_pci_irq_routing(struct pci_bridge * bridge) static ACPI_STATUS get_pci_irq_routing(struct pci_bridge * bridge)
{ {
ACPI_STATUS status; ACPI_STATUS status;
ACPI_BUFFER abuff; ACPI_BUFFER abuff;
@@ -230,7 +230,7 @@ PRIVATE ACPI_STATUS get_pci_irq_routing(struct pci_bridge * bridge)
return AE_OK; return AE_OK;
} }
PRIVATE void bridge_init_irqtable(struct pci_bridge * bridge) static void bridge_init_irqtable(struct pci_bridge * bridge)
{ {
int i; int i;
@@ -238,7 +238,7 @@ PRIVATE void bridge_init_irqtable(struct pci_bridge * bridge)
bridge->irqtable[i] = -1; bridge->irqtable[i] = -1;
} }
PRIVATE ACPI_STATUS add_pci_dev(ACPI_HANDLE handle, static ACPI_STATUS add_pci_dev(ACPI_HANDLE handle,
UINT32 level, UINT32 level,
void *context, void *context,
void **retval) void **retval)
@@ -283,7 +283,7 @@ PRIVATE ACPI_STATUS add_pci_dev(ACPI_HANDLE handle,
return status; return status;
} }
PRIVATE ACPI_STATUS add_pci_root_dev(ACPI_HANDLE handle, static ACPI_STATUS add_pci_root_dev(ACPI_HANDLE handle,
UINT32 level, UINT32 level,
void *context, void *context,
void **retval) void **retval)
@@ -311,7 +311,7 @@ PRIVATE ACPI_STATUS add_pci_root_dev(ACPI_HANDLE handle,
return status; return status;
} }
PUBLIC void pci_scan_devices(void) void pci_scan_devices(void)
{ {
ACPI_STATUS status; ACPI_STATUS status;

View File

@@ -112,7 +112,7 @@
#include "ahci.h" #include "ahci.h"
/* Host Bus Adapter (HBA) state. */ /* Host Bus Adapter (HBA) state. */
PRIVATE struct { static struct {
volatile u32_t *base; /* base address of memory-mapped registers */ volatile u32_t *base; /* base address of memory-mapped registers */
size_t size; /* size of memory-mapped register area */ size_t size; /* size of memory-mapped register area */
@@ -125,7 +125,7 @@ PRIVATE struct {
} hba_state; } hba_state;
/* Port state. */ /* Port state. */
PRIVATE struct port_state { static struct port_state {
int state; /* port state */ int state; /* port state */
unsigned int flags; /* port flags */ unsigned int flags; /* port flags */
@@ -171,21 +171,21 @@ PRIVATE struct port_state {
} cmd_info[NR_CMDS]; } cmd_info[NR_CMDS];
} port_state[NR_PORTS]; } port_state[NR_PORTS];
PRIVATE int ahci_instance; /* driver instance number */ static int ahci_instance; /* driver instance number */
PRIVATE int ahci_verbose; /* verbosity level (0..4) */ static int ahci_verbose; /* verbosity level (0..4) */
/* Timeout values. These can be overridden with environment variables. */ /* Timeout values. These can be overridden with environment variables. */
PRIVATE long ahci_spinup_timeout = SPINUP_TIMEOUT; static long ahci_spinup_timeout = SPINUP_TIMEOUT;
PRIVATE long ahci_sig_timeout = SIG_TIMEOUT; static long ahci_sig_timeout = SIG_TIMEOUT;
PRIVATE long ahci_sig_checks = NR_SIG_CHECKS; static long ahci_sig_checks = NR_SIG_CHECKS;
PRIVATE long ahci_command_timeout = COMMAND_TIMEOUT; static long ahci_command_timeout = COMMAND_TIMEOUT;
PRIVATE long ahci_transfer_timeout = TRANSFER_TIMEOUT; static long ahci_transfer_timeout = TRANSFER_TIMEOUT;
PRIVATE long ahci_flush_timeout = FLUSH_TIMEOUT; static long ahci_flush_timeout = FLUSH_TIMEOUT;
PRIVATE int ahci_map[MAX_DRIVES]; /* device-to-port mapping */ static int ahci_map[MAX_DRIVES]; /* device-to-port mapping */
PRIVATE int ahci_exiting = FALSE; /* exit after last close? */ static int ahci_exiting = FALSE; /* exit after last close? */
#define BUILD_ARG(port, tag) (((port) << 8) | (tag)) #define BUILD_ARG(port, tag) (((port) << 8) | (tag))
#define GET_PORT(arg) ((arg) >> 8) #define GET_PORT(arg) ((arg) >> 8)
@@ -196,29 +196,29 @@ PRIVATE int ahci_exiting = FALSE; /* exit after last close? */
printf s; \ printf s; \
} while (0) } while (0)
PRIVATE void port_set_cmd(struct port_state *ps, int cmd, cmd_fis_t *fis, static void port_set_cmd(struct port_state *ps, int cmd, cmd_fis_t *fis,
u8_t packet[ATAPI_PACKET_SIZE], prd_t *prdt, int nr_prds, int write); u8_t packet[ATAPI_PACKET_SIZE], prd_t *prdt, int nr_prds, int write);
PRIVATE void port_issue(struct port_state *ps, int cmd, clock_t timeout); static void port_issue(struct port_state *ps, int cmd, clock_t timeout);
PRIVATE int port_exec(struct port_state *ps, int cmd, clock_t timeout); static int port_exec(struct port_state *ps, int cmd, clock_t timeout);
PRIVATE void port_timeout(struct timer *tp); static void port_timeout(struct timer *tp);
PRIVATE void port_disconnect(struct port_state *ps); static void port_disconnect(struct port_state *ps);
PRIVATE char *ahci_portname(struct port_state *ps); static char *ahci_portname(struct port_state *ps);
PRIVATE int ahci_open(dev_t minor, int access); static int ahci_open(dev_t minor, int access);
PRIVATE int ahci_close(dev_t minor); static int ahci_close(dev_t minor);
PRIVATE ssize_t ahci_transfer(dev_t minor, int do_write, u64_t position, static ssize_t ahci_transfer(dev_t minor, int do_write, u64_t position,
endpoint_t endpt, iovec_t *iovec, unsigned int count, endpoint_t endpt, iovec_t *iovec, unsigned int count,
int flags); int flags);
PRIVATE struct device *ahci_part(dev_t minor); static struct device *ahci_part(dev_t minor);
PRIVATE void ahci_alarm(clock_t stamp); static void ahci_alarm(clock_t stamp);
PRIVATE int ahci_ioctl(dev_t minor, unsigned int request, endpoint_t endpt, static int ahci_ioctl(dev_t minor, unsigned int request, endpoint_t endpt,
cp_grant_id_t grant); cp_grant_id_t grant);
PRIVATE void ahci_intr(unsigned int irqs); static void ahci_intr(unsigned int irqs);
PRIVATE int ahci_device(dev_t minor, device_id_t *id); static int ahci_device(dev_t minor, device_id_t *id);
PRIVATE struct port_state *ahci_get_port(dev_t minor); static struct port_state *ahci_get_port(dev_t minor);
/* AHCI driver table. */ /* AHCI driver table. */
PRIVATE struct blockdriver ahci_dtab = { static struct blockdriver ahci_dtab = {
BLOCKDRIVER_TYPE_DISK, BLOCKDRIVER_TYPE_DISK,
ahci_open, ahci_open,
ahci_close, ahci_close,
@@ -236,7 +236,7 @@ PRIVATE struct blockdriver ahci_dtab = {
/*===========================================================================* /*===========================================================================*
* atapi_exec * * atapi_exec *
*===========================================================================*/ *===========================================================================*/
PRIVATE int atapi_exec(struct port_state *ps, int cmd, static int atapi_exec(struct port_state *ps, int cmd,
u8_t packet[ATAPI_PACKET_SIZE], size_t size, int write) u8_t packet[ATAPI_PACKET_SIZE], size_t size, int write)
{ {
/* Execute an ATAPI command. Return OK or error. /* Execute an ATAPI command. Return OK or error.
@@ -272,7 +272,7 @@ PRIVATE int atapi_exec(struct port_state *ps, int cmd,
/*===========================================================================* /*===========================================================================*
* atapi_test_unit * * atapi_test_unit *
*===========================================================================*/ *===========================================================================*/
PRIVATE int atapi_test_unit(struct port_state *ps, int cmd) static int atapi_test_unit(struct port_state *ps, int cmd)
{ {
/* Test whether the ATAPI device and medium are ready. /* Test whether the ATAPI device and medium are ready.
*/ */
@@ -287,7 +287,7 @@ PRIVATE int atapi_test_unit(struct port_state *ps, int cmd)
/*===========================================================================* /*===========================================================================*
* atapi_request_sense * * atapi_request_sense *
*===========================================================================*/ *===========================================================================*/
PRIVATE int atapi_request_sense(struct port_state *ps, int cmd, int *sense) static int atapi_request_sense(struct port_state *ps, int cmd, int *sense)
{ {
/* Request error (sense) information from an ATAPI device, and return /* Request error (sense) information from an ATAPI device, and return
* the sense key. The additional sense codes are not used at this time. * the sense key. The additional sense codes are not used at this time.
@@ -316,7 +316,7 @@ PRIVATE int atapi_request_sense(struct port_state *ps, int cmd, int *sense)
/*===========================================================================* /*===========================================================================*
* atapi_load_eject * * atapi_load_eject *
*===========================================================================*/ *===========================================================================*/
PRIVATE int atapi_load_eject(struct port_state *ps, int cmd, int load) static int atapi_load_eject(struct port_state *ps, int cmd, int load)
{ {
/* Load or eject a medium in an ATAPI device. /* Load or eject a medium in an ATAPI device.
*/ */
@@ -332,7 +332,7 @@ PRIVATE int atapi_load_eject(struct port_state *ps, int cmd, int load)
/*===========================================================================* /*===========================================================================*
* atapi_read_capacity * * atapi_read_capacity *
*===========================================================================*/ *===========================================================================*/
PRIVATE int atapi_read_capacity(struct port_state *ps, int cmd) static int atapi_read_capacity(struct port_state *ps, int cmd)
{ {
/* Retrieve the LBA count and sector size of an ATAPI medium. /* Retrieve the LBA count and sector size of an ATAPI medium.
*/ */
@@ -372,7 +372,7 @@ PRIVATE int atapi_read_capacity(struct port_state *ps, int cmd)
/*===========================================================================* /*===========================================================================*
* atapi_check_medium * * atapi_check_medium *
*===========================================================================*/ *===========================================================================*/
PRIVATE int atapi_check_medium(struct port_state *ps, int cmd) static int atapi_check_medium(struct port_state *ps, int cmd)
{ {
/* Check whether a medium is present in a removable-media ATAPI device. /* Check whether a medium is present in a removable-media ATAPI device.
* If a new medium is detected, get its total and sector size. Return * If a new medium is detected, get its total and sector size. Return
@@ -407,7 +407,7 @@ PRIVATE int atapi_check_medium(struct port_state *ps, int cmd)
/*===========================================================================* /*===========================================================================*
* atapi_id_check * * atapi_id_check *
*===========================================================================*/ *===========================================================================*/
PRIVATE int atapi_id_check(struct port_state *ps, u16_t *buf) static int atapi_id_check(struct port_state *ps, u16_t *buf)
{ {
/* Determine whether we support this ATAPI device based on the /* Determine whether we support this ATAPI device based on the
* identification data it returned, and store some of its properties. * identification data it returned, and store some of its properties.
@@ -462,7 +462,7 @@ PRIVATE int atapi_id_check(struct port_state *ps, u16_t *buf)
/*===========================================================================* /*===========================================================================*
* atapi_transfer * * atapi_transfer *
*===========================================================================*/ *===========================================================================*/
PRIVATE int atapi_transfer(struct port_state *ps, int cmd, u64_t start_lba, static int atapi_transfer(struct port_state *ps, int cmd, u64_t start_lba,
unsigned int count, int write, prd_t *prdt, int nr_prds) unsigned int count, int write, prd_t *prdt, int nr_prds)
{ {
/* Perform data transfer from or to an ATAPI device. /* Perform data transfer from or to an ATAPI device.
@@ -498,7 +498,7 @@ PRIVATE int atapi_transfer(struct port_state *ps, int cmd, u64_t start_lba,
/*===========================================================================* /*===========================================================================*
* ata_id_check * * ata_id_check *
*===========================================================================*/ *===========================================================================*/
PRIVATE int ata_id_check(struct port_state *ps, u16_t *buf) static int ata_id_check(struct port_state *ps, u16_t *buf)
{ {
/* Determine whether we support this ATA device based on the /* Determine whether we support this ATA device based on the
* identification data it returned, and store some of its properties. * identification data it returned, and store some of its properties.
@@ -574,7 +574,7 @@ PRIVATE int ata_id_check(struct port_state *ps, u16_t *buf)
/*===========================================================================* /*===========================================================================*
* ata_transfer * * ata_transfer *
*===========================================================================*/ *===========================================================================*/
PRIVATE int ata_transfer(struct port_state *ps, int cmd, u64_t start_lba, static int ata_transfer(struct port_state *ps, int cmd, u64_t start_lba,
unsigned int count, int write, int force, prd_t *prdt, int nr_prds) unsigned int count, int write, int force, prd_t *prdt, int nr_prds)
{ {
/* Perform data transfer from or to an ATA device. /* Perform data transfer from or to an ATA device.
@@ -624,7 +624,7 @@ PRIVATE int ata_transfer(struct port_state *ps, int cmd, u64_t start_lba,
/*===========================================================================* /*===========================================================================*
* gen_identify * * gen_identify *
*===========================================================================*/ *===========================================================================*/
PRIVATE int gen_identify(struct port_state *ps, int blocking) static int gen_identify(struct port_state *ps, int blocking)
{ {
/* Identify an ATA or ATAPI device. If the blocking flag is set, block /* Identify an ATA or ATAPI device. If the blocking flag is set, block
* until the command has completed; otherwise return immediately. * until the command has completed; otherwise return immediately.
@@ -657,7 +657,7 @@ PRIVATE int gen_identify(struct port_state *ps, int blocking)
/*===========================================================================* /*===========================================================================*
* gen_flush_wcache * * gen_flush_wcache *
*===========================================================================*/ *===========================================================================*/
PRIVATE int gen_flush_wcache(struct port_state *ps) static int gen_flush_wcache(struct port_state *ps)
{ {
/* Flush the device's write cache. /* Flush the device's write cache.
*/ */
@@ -690,7 +690,7 @@ PRIVATE int gen_flush_wcache(struct port_state *ps)
/*===========================================================================* /*===========================================================================*
* gen_get_wcache * * gen_get_wcache *
*===========================================================================*/ *===========================================================================*/
PRIVATE int gen_get_wcache(struct port_state *ps, int *val) static int gen_get_wcache(struct port_state *ps, int *val)
{ {
/* Retrieve the status of the device's write cache. /* Retrieve the status of the device's write cache.
*/ */
@@ -713,7 +713,7 @@ PRIVATE int gen_get_wcache(struct port_state *ps, int *val)
/*===========================================================================* /*===========================================================================*
* gen_set_wcache * * gen_set_wcache *
*===========================================================================*/ *===========================================================================*/
PRIVATE int gen_set_wcache(struct port_state *ps, int enable) static int gen_set_wcache(struct port_state *ps, int enable)
{ {
/* Enable or disable the device's write cache. /* Enable or disable the device's write cache.
*/ */
@@ -744,7 +744,7 @@ PRIVATE int gen_set_wcache(struct port_state *ps, int enable)
/*===========================================================================* /*===========================================================================*
* ct_set_fis * * ct_set_fis *
*===========================================================================*/ *===========================================================================*/
PRIVATE vir_bytes ct_set_fis(u8_t *ct, cmd_fis_t *fis, unsigned int tag) static vir_bytes ct_set_fis(u8_t *ct, cmd_fis_t *fis, unsigned int tag)
{ {
/* Fill in the Frame Information Structure part of a command table, /* Fill in the Frame Information Structure part of a command table,
* and return the resulting FIS size (in bytes). We only support the * and return the resulting FIS size (in bytes). We only support the
@@ -782,7 +782,7 @@ PRIVATE vir_bytes ct_set_fis(u8_t *ct, cmd_fis_t *fis, unsigned int tag)
/*===========================================================================* /*===========================================================================*
* ct_set_packet * * ct_set_packet *
*===========================================================================*/ *===========================================================================*/
PRIVATE void ct_set_packet(u8_t *ct, u8_t packet[ATAPI_PACKET_SIZE]) static void ct_set_packet(u8_t *ct, u8_t packet[ATAPI_PACKET_SIZE])
{ {
/* Fill in the packet part of a command table. /* Fill in the packet part of a command table.
*/ */
@@ -793,7 +793,7 @@ PRIVATE void ct_set_packet(u8_t *ct, u8_t packet[ATAPI_PACKET_SIZE])
/*===========================================================================* /*===========================================================================*
* ct_set_prdt * * ct_set_prdt *
*===========================================================================*/ *===========================================================================*/
PRIVATE void ct_set_prdt(u8_t *ct, prd_t *prdt, int nr_prds) static void ct_set_prdt(u8_t *ct, prd_t *prdt, int nr_prds)
{ {
/* Fill in the PRDT part of a command table. /* Fill in the PRDT part of a command table.
*/ */
@@ -813,7 +813,7 @@ PRIVATE void ct_set_prdt(u8_t *ct, prd_t *prdt, int nr_prds)
/*===========================================================================* /*===========================================================================*
* port_set_cmd * * port_set_cmd *
*===========================================================================*/ *===========================================================================*/
PRIVATE void port_set_cmd(struct port_state *ps, int cmd, cmd_fis_t *fis, static void port_set_cmd(struct port_state *ps, int cmd, cmd_fis_t *fis,
u8_t packet[ATAPI_PACKET_SIZE], prd_t *prdt, int nr_prds, int write) u8_t packet[ATAPI_PACKET_SIZE], prd_t *prdt, int nr_prds, int write)
{ {
/* Prepare the given command for execution, by constructing a command /* Prepare the given command for execution, by constructing a command
@@ -868,7 +868,7 @@ PRIVATE void port_set_cmd(struct port_state *ps, int cmd, cmd_fis_t *fis,
/*===========================================================================* /*===========================================================================*
* port_finish_cmd * * port_finish_cmd *
*===========================================================================*/ *===========================================================================*/
PRIVATE void port_finish_cmd(struct port_state *ps, int cmd, int result) static void port_finish_cmd(struct port_state *ps, int cmd, int result)
{ {
/* Finish a command that has either succeeded or failed. /* Finish a command that has either succeeded or failed.
*/ */
@@ -895,7 +895,7 @@ PRIVATE void port_finish_cmd(struct port_state *ps, int cmd, int result)
/*===========================================================================* /*===========================================================================*
* port_fail_cmds * * port_fail_cmds *
*===========================================================================*/ *===========================================================================*/
PRIVATE void port_fail_cmds(struct port_state *ps) static void port_fail_cmds(struct port_state *ps)
{ {
/* Fail all ongoing commands for a device. /* Fail all ongoing commands for a device.
*/ */
@@ -909,7 +909,7 @@ PRIVATE void port_fail_cmds(struct port_state *ps)
/*===========================================================================* /*===========================================================================*
* port_check_cmds * * port_check_cmds *
*===========================================================================*/ *===========================================================================*/
PRIVATE void port_check_cmds(struct port_state *ps) static void port_check_cmds(struct port_state *ps)
{ {
/* Check what commands have completed, and finish them. /* Check what commands have completed, and finish them.
*/ */
@@ -933,7 +933,7 @@ PRIVATE void port_check_cmds(struct port_state *ps)
/*===========================================================================* /*===========================================================================*
* port_find_cmd * * port_find_cmd *
*===========================================================================*/ *===========================================================================*/
PRIVATE int port_find_cmd(struct port_state *ps) static int port_find_cmd(struct port_state *ps)
{ {
/* Find a free command tag to queue the current request. /* Find a free command tag to queue the current request.
*/ */
@@ -954,7 +954,7 @@ PRIVATE int port_find_cmd(struct port_state *ps)
/*===========================================================================* /*===========================================================================*
* port_get_padbuf * * port_get_padbuf *
*===========================================================================*/ *===========================================================================*/
PRIVATE int port_get_padbuf(struct port_state *ps, size_t size) static int port_get_padbuf(struct port_state *ps, size_t size)
{ {
/* Make available a temporary buffer for use by this port. Enlarge the /* Make available a temporary buffer for use by this port. Enlarge the
* previous buffer if applicable and necessary, potentially changing * previous buffer if applicable and necessary, potentially changing
@@ -987,7 +987,7 @@ PRIVATE int port_get_padbuf(struct port_state *ps, size_t size)
/*===========================================================================* /*===========================================================================*
* sum_iovec * * sum_iovec *
*===========================================================================*/ *===========================================================================*/
PRIVATE int sum_iovec(struct port_state *ps, endpoint_t endpt, static int sum_iovec(struct port_state *ps, endpoint_t endpt,
iovec_s_t *iovec, int nr_req, vir_bytes *total) iovec_s_t *iovec, int nr_req, vir_bytes *total)
{ {
/* Retrieve the total size of the given I/O vector. Check for alignment /* Retrieve the total size of the given I/O vector. Check for alignment
@@ -1024,7 +1024,7 @@ PRIVATE int sum_iovec(struct port_state *ps, endpoint_t endpt,
/*===========================================================================* /*===========================================================================*
* setup_prdt * * setup_prdt *
*===========================================================================*/ *===========================================================================*/
PRIVATE int setup_prdt(struct port_state *ps, endpoint_t endpt, static int setup_prdt(struct port_state *ps, endpoint_t endpt,
iovec_s_t *iovec, int nr_req, vir_bytes size, vir_bytes lead, iovec_s_t *iovec, int nr_req, vir_bytes size, vir_bytes lead,
int write, prd_t *prdt) int write, prd_t *prdt)
{ {
@@ -1107,7 +1107,7 @@ PRIVATE int setup_prdt(struct port_state *ps, endpoint_t endpt,
/*===========================================================================* /*===========================================================================*
* port_transfer * * port_transfer *
*===========================================================================*/ *===========================================================================*/
PRIVATE ssize_t port_transfer(struct port_state *ps, u64_t pos, u64_t eof, static ssize_t port_transfer(struct port_state *ps, u64_t pos, u64_t eof,
endpoint_t endpt, iovec_s_t *iovec, int nr_req, int write, int flags) endpoint_t endpt, iovec_s_t *iovec, int nr_req, int write, int flags)
{ {
/* Perform an I/O transfer on a port. /* Perform an I/O transfer on a port.
@@ -1189,7 +1189,7 @@ PRIVATE ssize_t port_transfer(struct port_state *ps, u64_t pos, u64_t eof,
/*===========================================================================* /*===========================================================================*
* port_start * * port_start *
*===========================================================================*/ *===========================================================================*/
PRIVATE void port_start(struct port_state *ps) static void port_start(struct port_state *ps)
{ {
/* Start the given port, allowing for the execution of commands and the /* Start the given port, allowing for the execution of commands and the
* transfer of data on that port. * transfer of data on that port.
@@ -1214,7 +1214,7 @@ PRIVATE void port_start(struct port_state *ps)
/*===========================================================================* /*===========================================================================*
* port_restart * * port_restart *
*===========================================================================*/ *===========================================================================*/
PRIVATE void port_restart(struct port_state *ps) static void port_restart(struct port_state *ps)
{ {
/* Restart a port after a fatal error has occurred. /* Restart a port after a fatal error has occurred.
*/ */
@@ -1267,7 +1267,7 @@ PRIVATE void port_restart(struct port_state *ps)
/*===========================================================================* /*===========================================================================*
* port_stop * * port_stop *
*===========================================================================*/ *===========================================================================*/
PRIVATE void port_stop(struct port_state *ps) static void port_stop(struct port_state *ps)
{ {
/* Stop the given port, if not already stopped. /* Stop the given port, if not already stopped.
*/ */
@@ -1309,7 +1309,7 @@ PRIVATE void port_stop(struct port_state *ps)
/*===========================================================================* /*===========================================================================*
* port_sig_check * * port_sig_check *
*===========================================================================*/ *===========================================================================*/
PRIVATE void port_sig_check(struct port_state *ps) static void port_sig_check(struct port_state *ps)
{ {
/* Check whether the device's signature has become available yet, and /* Check whether the device's signature has become available yet, and
* if so, start identifying the device. * if so, start identifying the device.
@@ -1393,7 +1393,7 @@ PRIVATE void port_sig_check(struct port_state *ps)
/*===========================================================================* /*===========================================================================*
* print_string * * print_string *
*===========================================================================*/ *===========================================================================*/
PRIVATE void print_string(u16_t *buf, int start, int end) static void print_string(u16_t *buf, int start, int end)
{ {
/* Print a string that is stored as little-endian words and padded with /* Print a string that is stored as little-endian words and padded with
* trailing spaces. * trailing spaces.
@@ -1414,7 +1414,7 @@ PRIVATE void print_string(u16_t *buf, int start, int end)
/*===========================================================================* /*===========================================================================*
* port_id_check * * port_id_check *
*===========================================================================*/ *===========================================================================*/
PRIVATE void port_id_check(struct port_state *ps, int success) static void port_id_check(struct port_state *ps, int success)
{ {
/* The device identification command has either completed or timed out. /* The device identification command has either completed or timed out.
* Decide whether this device is usable or not, and store some of its * Decide whether this device is usable or not, and store some of its
@@ -1483,7 +1483,7 @@ PRIVATE void port_id_check(struct port_state *ps, int success)
/*===========================================================================* /*===========================================================================*
* port_connect * * port_connect *
*===========================================================================*/ *===========================================================================*/
PRIVATE void port_connect(struct port_state *ps) static void port_connect(struct port_state *ps)
{ {
/* A device has been found to be attached to this port. Start the port, /* A device has been found to be attached to this port. Start the port,
* and do timed polling for its signature to become available. * and do timed polling for its signature to become available.
@@ -1508,7 +1508,7 @@ PRIVATE void port_connect(struct port_state *ps)
/*===========================================================================* /*===========================================================================*
* port_disconnect * * port_disconnect *
*===========================================================================*/ *===========================================================================*/
PRIVATE void port_disconnect(struct port_state *ps) static void port_disconnect(struct port_state *ps)
{ {
/* The device has detached from this port. Stop the port if necessary. /* The device has detached from this port. Stop the port if necessary.
*/ */
@@ -1538,7 +1538,7 @@ PRIVATE void port_disconnect(struct port_state *ps)
/*===========================================================================* /*===========================================================================*
* port_intr * * port_intr *
*===========================================================================*/ *===========================================================================*/
PRIVATE void port_intr(struct port_state *ps) static void port_intr(struct port_state *ps)
{ {
/* Process an interrupt on this port. /* Process an interrupt on this port.
*/ */
@@ -1619,7 +1619,7 @@ PRIVATE void port_intr(struct port_state *ps)
/*===========================================================================* /*===========================================================================*
* port_timeout * * port_timeout *
*===========================================================================*/ *===========================================================================*/
PRIVATE void port_timeout(struct timer *tp) static void port_timeout(struct timer *tp)
{ {
/* A timeout has occurred on this port. Figure out what the timeout is /* A timeout has occurred on this port. Figure out what the timeout is
* for, and take appropriate action. * for, and take appropriate action.
@@ -1705,7 +1705,7 @@ PRIVATE void port_timeout(struct timer *tp)
/*===========================================================================* /*===========================================================================*
* port_wait * * port_wait *
*===========================================================================*/ *===========================================================================*/
PRIVATE void port_wait(struct port_state *ps) static void port_wait(struct port_state *ps)
{ {
/* Suspend the current thread until the given port is no longer busy, /* Suspend the current thread until the given port is no longer busy,
* due to either command completion or timeout. * due to either command completion or timeout.
@@ -1722,7 +1722,7 @@ PRIVATE void port_wait(struct port_state *ps)
/*===========================================================================* /*===========================================================================*
* port_issue * * port_issue *
*===========================================================================*/ *===========================================================================*/
PRIVATE void port_issue(struct port_state *ps, int cmd, clock_t timeout) static void port_issue(struct port_state *ps, int cmd, clock_t timeout)
{ {
/* Issue a command to the port, and set a timer to trigger a timeout /* Issue a command to the port, and set a timer to trigger a timeout
* if the command takes too long to complete. * if the command takes too long to complete.
@@ -1751,7 +1751,7 @@ PRIVATE void port_issue(struct port_state *ps, int cmd, clock_t timeout)
/*===========================================================================* /*===========================================================================*
* port_exec * * port_exec *
*===========================================================================*/ *===========================================================================*/
PRIVATE int port_exec(struct port_state *ps, int cmd, clock_t timeout) static int port_exec(struct port_state *ps, int cmd, clock_t timeout)
{ {
/* Execute a command on a port, wait for the command to complete or for /* Execute a command on a port, wait for the command to complete or for
* a timeout, and return whether the command succeeded or not. * a timeout, and return whether the command succeeded or not.
@@ -1789,7 +1789,7 @@ PRIVATE int port_exec(struct port_state *ps, int cmd, clock_t timeout)
/*===========================================================================* /*===========================================================================*
* port_alloc * * port_alloc *
*===========================================================================*/ *===========================================================================*/
PRIVATE void port_alloc(struct port_state *ps) static void port_alloc(struct port_state *ps)
{ {
/* Allocate memory for the given port. We try to cram everything into /* Allocate memory for the given port. We try to cram everything into
* one 4K-page in order to limit memory usage as much as possible. * one 4K-page in order to limit memory usage as much as possible.
@@ -1854,7 +1854,7 @@ PRIVATE void port_alloc(struct port_state *ps)
/*===========================================================================* /*===========================================================================*
* port_free * * port_free *
*===========================================================================*/ *===========================================================================*/
PRIVATE void port_free(struct port_state *ps) static void port_free(struct port_state *ps)
{ {
/* Free previously allocated memory for the given port. /* Free previously allocated memory for the given port.
*/ */
@@ -1874,7 +1874,7 @@ PRIVATE void port_free(struct port_state *ps)
/*===========================================================================* /*===========================================================================*
* port_init * * port_init *
*===========================================================================*/ *===========================================================================*/
PRIVATE void port_init(struct port_state *ps) static void port_init(struct port_state *ps)
{ {
/* Initialize the given port. /* Initialize the given port.
*/ */
@@ -1918,7 +1918,7 @@ PRIVATE void port_init(struct port_state *ps)
/*===========================================================================* /*===========================================================================*
* ahci_probe * * ahci_probe *
*===========================================================================*/ *===========================================================================*/
PRIVATE int ahci_probe(int skip) static int ahci_probe(int skip)
{ {
/* Find a matching PCI device. /* Find a matching PCI device.
*/ */
@@ -1945,7 +1945,7 @@ PRIVATE int ahci_probe(int skip)
/*===========================================================================* /*===========================================================================*
* ahci_reset * * ahci_reset *
*===========================================================================*/ *===========================================================================*/
PRIVATE void ahci_reset(void) static void ahci_reset(void)
{ {
/* Reset the HBA. Do not enable AHCI mode afterwards. /* Reset the HBA. Do not enable AHCI mode afterwards.
*/ */
@@ -1967,7 +1967,7 @@ PRIVATE void ahci_reset(void)
/*===========================================================================* /*===========================================================================*
* ahci_init * * ahci_init *
*===========================================================================*/ *===========================================================================*/
PRIVATE void ahci_init(int devind) static void ahci_init(int devind)
{ {
/* Initialize the device. /* Initialize the device.
*/ */
@@ -2048,7 +2048,7 @@ PRIVATE void ahci_init(int devind)
/*===========================================================================* /*===========================================================================*
* ahci_stop * * ahci_stop *
*===========================================================================*/ *===========================================================================*/
PRIVATE void ahci_stop(void) static void ahci_stop(void)
{ {
/* Disable AHCI, and clean up resources to the extent possible. /* Disable AHCI, and clean up resources to the extent possible.
*/ */
@@ -2078,7 +2078,7 @@ PRIVATE void ahci_stop(void)
/*===========================================================================* /*===========================================================================*
* ahci_alarm * * ahci_alarm *
*===========================================================================*/ *===========================================================================*/
PRIVATE void ahci_alarm(clock_t stamp) static void ahci_alarm(clock_t stamp)
{ {
/* Process an alarm. /* Process an alarm.
*/ */
@@ -2090,7 +2090,7 @@ PRIVATE void ahci_alarm(clock_t stamp)
/*===========================================================================* /*===========================================================================*
* ahci_intr * * ahci_intr *
*===========================================================================*/ *===========================================================================*/
PRIVATE void ahci_intr(unsigned int UNUSED(irqs)) static void ahci_intr(unsigned int UNUSED(irqs))
{ {
/* Process an interrupt. /* Process an interrupt.
*/ */
@@ -2127,7 +2127,7 @@ PRIVATE void ahci_intr(unsigned int UNUSED(irqs))
/*===========================================================================* /*===========================================================================*
* ahci_get_var * * ahci_get_var *
*===========================================================================*/ *===========================================================================*/
PRIVATE void ahci_get_var(char *name, long *v, int timeout) static void ahci_get_var(char *name, long *v, int timeout)
{ {
/* Retrieve an environment variable, and optionall adjust it to the /* Retrieve an environment variable, and optionall adjust it to the
* scale that we are using internally. * scale that we are using internally.
@@ -2144,7 +2144,7 @@ PRIVATE void ahci_get_var(char *name, long *v, int timeout)
/*===========================================================================* /*===========================================================================*
* ahci_get_params * * ahci_get_params *
*===========================================================================*/ *===========================================================================*/
PRIVATE void ahci_get_params(void) static void ahci_get_params(void)
{ {
/* Retrieve and parse parameters passed to this driver, except the /* Retrieve and parse parameters passed to this driver, except the
* device-to-port mapping, which has to be parsed later. * device-to-port mapping, which has to be parsed later.
@@ -2173,7 +2173,7 @@ PRIVATE void ahci_get_params(void)
/*===========================================================================* /*===========================================================================*
* ahci_set_mapping * * ahci_set_mapping *
*===========================================================================*/ *===========================================================================*/
PRIVATE void ahci_set_mapping(void) static void ahci_set_mapping(void)
{ {
/* Construct a mapping from device nodes to port numbers. /* Construct a mapping from device nodes to port numbers.
*/ */
@@ -2226,7 +2226,7 @@ PRIVATE void ahci_set_mapping(void)
/*===========================================================================* /*===========================================================================*
* sef_cb_init_fresh * * sef_cb_init_fresh *
*===========================================================================*/ *===========================================================================*/
PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info)) static int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
{ {
/* Initialize the driver. /* Initialize the driver.
*/ */
@@ -2256,7 +2256,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
/*===========================================================================* /*===========================================================================*
* sef_cb_signal_handler * * sef_cb_signal_handler *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_cb_signal_handler(int signo) static void sef_cb_signal_handler(int signo)
{ {
/* In case of a termination signal, shut down this driver. /* In case of a termination signal, shut down this driver.
*/ */
@@ -2282,7 +2282,7 @@ PRIVATE void sef_cb_signal_handler(int signo)
/*===========================================================================* /*===========================================================================*
* sef_local_startup * * sef_local_startup *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_local_startup(void) static void sef_local_startup(void)
{ {
/* Set callbacks and initialize the System Event Framework (SEF). /* Set callbacks and initialize the System Event Framework (SEF).
*/ */
@@ -2301,7 +2301,7 @@ PRIVATE void sef_local_startup(void)
/*===========================================================================* /*===========================================================================*
* ahci_portname * * ahci_portname *
*===========================================================================*/ *===========================================================================*/
PRIVATE char *ahci_portname(struct port_state *ps) static char *ahci_portname(struct port_state *ps)
{ {
/* Return a printable name for the given port. Whenever we can, print a /* Return a printable name for the given port. Whenever we can, print a
* "Dx" device number rather than a "Pxx" port number, because the user * "Dx" device number rather than a "Pxx" port number, because the user
@@ -2328,7 +2328,7 @@ PRIVATE char *ahci_portname(struct port_state *ps)
/*===========================================================================* /*===========================================================================*
* ahci_map_minor * * ahci_map_minor *
*===========================================================================*/ *===========================================================================*/
PRIVATE struct port_state *ahci_map_minor(dev_t minor, struct device **dvp) static struct port_state *ahci_map_minor(dev_t minor, struct device **dvp)
{ {
/* Map a minor device number to a port and a pointer to the partition's /* Map a minor device number to a port and a pointer to the partition's
* device structure. Return NULL if this minor device number does not * device structure. Return NULL if this minor device number does not
@@ -2364,7 +2364,7 @@ PRIVATE struct port_state *ahci_map_minor(dev_t minor, struct device **dvp)
/*===========================================================================* /*===========================================================================*
* ahci_part * * ahci_part *
*===========================================================================*/ *===========================================================================*/
PRIVATE struct device *ahci_part(dev_t minor) static struct device *ahci_part(dev_t minor)
{ {
/* Return a pointer to the partition information structure of the given /* Return a pointer to the partition information structure of the given
* minor device. * minor device.
@@ -2380,7 +2380,7 @@ PRIVATE struct device *ahci_part(dev_t minor)
/*===========================================================================* /*===========================================================================*
* ahci_open * * ahci_open *
*===========================================================================*/ *===========================================================================*/
PRIVATE int ahci_open(dev_t minor, int access) static int ahci_open(dev_t minor, int access)
{ {
/* Open a device. /* Open a device.
*/ */
@@ -2450,7 +2450,7 @@ PRIVATE int ahci_open(dev_t minor, int access)
/*===========================================================================* /*===========================================================================*
* ahci_close * * ahci_close *
*===========================================================================*/ *===========================================================================*/
PRIVATE int ahci_close(dev_t minor) static int ahci_close(dev_t minor)
{ {
/* Close a device. /* Close a device.
*/ */
@@ -2506,7 +2506,7 @@ PRIVATE int ahci_close(dev_t minor)
/*===========================================================================* /*===========================================================================*
* ahci_transfer * * ahci_transfer *
*===========================================================================*/ *===========================================================================*/
PRIVATE ssize_t ahci_transfer(dev_t minor, int do_write, u64_t position, static ssize_t ahci_transfer(dev_t minor, int do_write, u64_t position,
endpoint_t endpt, iovec_t *iovec, unsigned int count, int flags) endpoint_t endpt, iovec_t *iovec, unsigned int count, int flags)
{ {
/* Perform data transfer on the selected device. /* Perform data transfer on the selected device.
@@ -2541,7 +2541,7 @@ PRIVATE ssize_t ahci_transfer(dev_t minor, int do_write, u64_t position,
/*===========================================================================* /*===========================================================================*
* ahci_ioctl * * ahci_ioctl *
*===========================================================================*/ *===========================================================================*/
PRIVATE int ahci_ioctl(dev_t minor, unsigned int request, endpoint_t endpt, static int ahci_ioctl(dev_t minor, unsigned int request, endpoint_t endpt,
cp_grant_id_t grant) cp_grant_id_t grant)
{ {
/* Process I/O control requests. /* Process I/O control requests.
@@ -2598,7 +2598,7 @@ PRIVATE int ahci_ioctl(dev_t minor, unsigned int request, endpoint_t endpt,
/*===========================================================================* /*===========================================================================*
* ahci_device * * ahci_device *
*===========================================================================*/ *===========================================================================*/
PRIVATE int ahci_device(dev_t minor, device_id_t *id) static int ahci_device(dev_t minor, device_id_t *id)
{ {
/* Map a minor device number to a device ID. /* Map a minor device number to a device ID.
*/ */
@@ -2616,7 +2616,7 @@ PRIVATE int ahci_device(dev_t minor, device_id_t *id)
/*===========================================================================* /*===========================================================================*
* ahci_get_port * * ahci_get_port *
*===========================================================================*/ *===========================================================================*/
PRIVATE struct port_state *ahci_get_port(dev_t minor) static struct port_state *ahci_get_port(dev_t minor)
{ {
/* Get the port structure associated with the given minor device. /* Get the port structure associated with the given minor device.
* Called only from worker threads, so the minor device is already * Called only from worker threads, so the minor device is already
@@ -2634,7 +2634,7 @@ PRIVATE struct port_state *ahci_get_port(dev_t minor)
/*===========================================================================* /*===========================================================================*
* main * * main *
*===========================================================================*/ *===========================================================================*/
PUBLIC int main(int argc, char **argv) int main(int argc, char **argv)
{ {
/* Driver task. /* Driver task.
*/ */

View File

@@ -59,9 +59,9 @@ static void del_range(phys_bytes busaddr, phys_bytes size);
static void report_exceptions(void); static void report_exceptions(void);
/* SEF functions and variables. */ /* SEF functions and variables. */
FORWARD void sef_local_startup(void); static void sef_local_startup(void);
FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info); static int sef_cb_init_fresh(int type, sef_init_info_t *info);
FORWARD void sef_cb_signal_handler(int signo); static void sef_cb_signal_handler(int signo);
int main(void) int main(void)
{ {
@@ -92,7 +92,7 @@ int main(void)
/*===========================================================================* /*===========================================================================*
* sef_local_startup * * sef_local_startup *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_local_startup() static void sef_local_startup()
{ {
/* Register init callbacks. */ /* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh); sef_setcb_init_fresh(sef_cb_init_fresh);
@@ -113,7 +113,7 @@ PRIVATE void sef_local_startup()
/*===========================================================================* /*===========================================================================*
* sef_cb_init_fresh * * sef_cb_init_fresh *
*===========================================================================*/ *===========================================================================*/
PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info)) static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{ {
/* Initialize the amddev driver. */ /* Initialize the amddev driver. */
int r, n_maps, n_domains, revision; int r, n_maps, n_domains, revision;
@@ -157,7 +157,7 @@ PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
/*===========================================================================* /*===========================================================================*
* sef_cb_signal_handler * * sef_cb_signal_handler *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_cb_signal_handler(int signo) static void sef_cb_signal_handler(int signo)
{ {
int r; int r;
endpoint_t proc_e; endpoint_t proc_e;

View File

@@ -44,29 +44,29 @@ struct command {
}; };
/* Timeouts and max retries. */ /* Timeouts and max retries. */
PRIVATE int timeout_usecs = DEF_TIMEOUT_USECS; static int timeout_usecs = DEF_TIMEOUT_USECS;
PRIVATE int max_errors = MAX_ERRORS; static int max_errors = MAX_ERRORS;
PRIVATE long w_standard_timeouts = 0; static long w_standard_timeouts = 0;
PRIVATE long w_pci_debug = 0; static long w_pci_debug = 0;
PRIVATE long w_instance = 0; static long w_instance = 0;
PRIVATE long disable_dma = 0; static long disable_dma = 0;
PRIVATE long atapi_debug = 0; static long atapi_debug = 0;
PRIVATE long w_identify_wakeup_ticks; static long w_identify_wakeup_ticks;
PRIVATE long wakeup_ticks; static long wakeup_ticks;
PRIVATE long w_atapi_dma; static long w_atapi_dma;
PRIVATE int w_testing = 0; static int w_testing = 0;
PRIVATE int w_silent = 0; static int w_silent = 0;
PRIVATE int w_next_drive = 0; static int w_next_drive = 0;
PRIVATE u32_t system_hz; static u32_t system_hz;
/* The struct wini is indexed by controller first, then drive (0-3). /* The struct wini is indexed by controller first, then drive (0-3).
* Controller 0 is always the 'compatability' ide controller, at * Controller 0 is always the 'compatability' ide controller, at
* the fixed locations, whether present or not. * the fixed locations, whether present or not.
*/ */
PRIVATE struct wini { /* main drive struct, one entry per drive */ static struct wini { /* main drive struct, one entry per drive */
unsigned state; /* drive state: deaf, initialized, dead */ unsigned state; /* drive state: deaf, initialized, dead */
unsigned short w_status; /* device status register */ unsigned short w_status; /* device status register */
unsigned base_cmd; /* command base register */ unsigned base_cmd; /* command base register */
@@ -92,19 +92,19 @@ PRIVATE struct wini { /* main drive struct, one entry per drive */
struct device subpart[SUB_PER_DRIVE]; /* subpartitions */ struct device subpart[SUB_PER_DRIVE]; /* subpartitions */
} wini[MAX_DRIVES], *w_wn; } wini[MAX_DRIVES], *w_wn;
PRIVATE int w_device = -1; static int w_device = -1;
PUBLIC int w_command; /* current command in execution */ int w_command; /* current command in execution */
PRIVATE int w_drive; /* selected drive */ static int w_drive; /* selected drive */
PRIVATE struct device *w_dv; /* device's base and size */ static struct device *w_dv; /* device's base and size */
PRIVATE u8_t *tmp_buf; static u8_t *tmp_buf;
#define ATA_DMA_SECTORS 64 #define ATA_DMA_SECTORS 64
#define ATA_DMA_BUF_SIZE (ATA_DMA_SECTORS*SECTOR_SIZE) #define ATA_DMA_BUF_SIZE (ATA_DMA_SECTORS*SECTOR_SIZE)
PRIVATE char *dma_buf; static char *dma_buf;
PRIVATE phys_bytes dma_buf_phys; static phys_bytes dma_buf_phys;
#define N_PRDTE 1024 /* Should be enough for large requests */ #define N_PRDTE 1024 /* Should be enough for large requests */
@@ -117,13 +117,13 @@ struct prdte
}; };
#define PRDT_BYTES (sizeof(struct prdte) * N_PRDTE) #define PRDT_BYTES (sizeof(struct prdte) * N_PRDTE)
PRIVATE struct prdte *prdt; static struct prdte *prdt;
PRIVATE phys_bytes prdt_phys; static phys_bytes prdt_phys;
#define PRDTE_FL_EOT 0x80 /* End of table */ #define PRDTE_FL_EOT 0x80 /* End of table */
/* IDE devices we trust are IDE devices. */ /* IDE devices we trust are IDE devices. */
PRIVATE struct quirk static struct quirk
{ {
int pci_class, pci_subclass, pci_interface; int pci_class, pci_subclass, pci_interface;
u16_t vendor; u16_t vendor;
@@ -136,58 +136,58 @@ PRIVATE struct quirk
{ 0, 0, 0, 0, 0 } /* end of list */ { 0, 0, 0, 0, 0 } /* end of list */
}; };
FORWARD void init_params(void); static void init_params(void);
FORWARD void init_drive(struct wini *w, int base_cmd, int base_ctl, int static void init_drive(struct wini *w, int base_cmd, int base_ctl, int
base_dma, int irq, int ack, int hook, int drive); base_dma, int irq, int ack, int hook, int drive);
FORWARD void init_params_pci(int); static void init_params_pci(int);
FORWARD int w_do_open(dev_t minor, int access); static int w_do_open(dev_t minor, int access);
FORWARD struct device *w_prepare(dev_t dev); static struct device *w_prepare(dev_t dev);
FORWARD struct device *w_part(dev_t minor); static struct device *w_part(dev_t minor);
FORWARD int w_identify(void); static int w_identify(void);
FORWARD char *w_name(void); static char *w_name(void);
FORWARD int w_specify(void); static int w_specify(void);
FORWARD int w_io_test(void); static int w_io_test(void);
FORWARD ssize_t w_transfer(dev_t minor, int do_write, u64_t position, static ssize_t w_transfer(dev_t minor, int do_write, u64_t position,
endpoint_t proc_nr, iovec_t *iov, unsigned int nr_req, int flags); endpoint_t proc_nr, iovec_t *iov, unsigned int nr_req, int flags);
FORWARD int com_out(struct command *cmd); static int com_out(struct command *cmd);
FORWARD int com_out_ext(struct command *cmd); static int com_out_ext(struct command *cmd);
FORWARD int setup_dma(unsigned *sizep, endpoint_t proc_nr, iovec_t *iov, static int setup_dma(unsigned *sizep, endpoint_t proc_nr, iovec_t *iov,
size_t addr_offset, int do_write); size_t addr_offset, int do_write);
FORWARD void w_need_reset(void); static void w_need_reset(void);
FORWARD void ack_irqs(unsigned int); static void ack_irqs(unsigned int);
FORWARD int w_do_close(dev_t minor); static int w_do_close(dev_t minor);
FORWARD int w_ioctl(dev_t minor, unsigned int request, endpoint_t endpt, static int w_ioctl(dev_t minor, unsigned int request, endpoint_t endpt,
cp_grant_id_t grant); cp_grant_id_t grant);
FORWARD void w_hw_int(unsigned int irqs); static void w_hw_int(unsigned int irqs);
FORWARD int com_simple(struct command *cmd); static int com_simple(struct command *cmd);
FORWARD void w_timeout(void); static void w_timeout(void);
FORWARD int w_reset(void); static int w_reset(void);
FORWARD void w_intr_wait(void); static void w_intr_wait(void);
FORWARD int at_intr_wait(void); static int at_intr_wait(void);
FORWARD int w_waitfor(int mask, int value); static int w_waitfor(int mask, int value);
FORWARD int w_waitfor_dma(int mask, int value); static int w_waitfor_dma(int mask, int value);
FORWARD void w_geometry(dev_t minor, struct partition *entry); static void w_geometry(dev_t minor, struct partition *entry);
#if ENABLE_ATAPI #if ENABLE_ATAPI
FORWARD int atapi_sendpacket(u8_t *packet, unsigned cnt, int do_dma); static int atapi_sendpacket(u8_t *packet, unsigned cnt, int do_dma);
FORWARD int atapi_intr_wait(int dma, size_t max); static int atapi_intr_wait(int dma, size_t max);
FORWARD int atapi_open(void); static int atapi_open(void);
FORWARD void atapi_close(void); static void atapi_close(void);
FORWARD int atapi_transfer(int do_write, u64_t position, endpoint_t static int atapi_transfer(int do_write, u64_t position, endpoint_t
endpt, iovec_t *iov, unsigned int nr_req); endpt, iovec_t *iov, unsigned int nr_req);
#endif #endif
#define sys_voutb(out, n) at_voutb((out), (n)) #define sys_voutb(out, n) at_voutb((out), (n))
FORWARD int at_voutb(pvb_pair_t *, int n); static int at_voutb(pvb_pair_t *, int n);
#define sys_vinb(in, n) at_vinb((in), (n)) #define sys_vinb(in, n) at_vinb((in), (n))
FORWARD int at_vinb(pvb_pair_t *, int n); static int at_vinb(pvb_pair_t *, int n);
#undef sys_outb #undef sys_outb
#undef sys_inb #undef sys_inb
#undef sys_outl #undef sys_outl
FORWARD int at_out(int line, u32_t port, u32_t value, char *typename, static int at_out(int line, u32_t port, u32_t value, char *typename,
int type); int type);
FORWARD int at_in(int line, u32_t port, u32_t *value, char *typename, static int at_in(int line, u32_t port, u32_t *value, char *typename,
int type); int type);
#define sys_outb(p, v) at_out(__LINE__, (p), (v), "outb", _DIO_BYTE) #define sys_outb(p, v) at_out(__LINE__, (p), (v), "outb", _DIO_BYTE)
@@ -195,7 +195,7 @@ FORWARD int at_in(int line, u32_t port, u32_t *value, char *typename,
#define sys_outl(p, v) at_out(__LINE__, (p), (v), "outl", _DIO_LONG) #define sys_outl(p, v) at_out(__LINE__, (p), (v), "outl", _DIO_LONG)
/* Entry points to this driver. */ /* Entry points to this driver. */
PRIVATE struct blockdriver w_dtab = { static struct blockdriver w_dtab = {
BLOCKDRIVER_TYPE_DISK,/* handle partition requests */ BLOCKDRIVER_TYPE_DISK,/* handle partition requests */
w_do_open, /* open or mount request, initialize device */ w_do_open, /* open or mount request, initialize device */
w_do_close, /* release device */ w_do_close, /* release device */
@@ -211,8 +211,8 @@ PRIVATE struct blockdriver w_dtab = {
}; };
/* SEF functions and variables. */ /* SEF functions and variables. */
FORWARD void sef_local_startup(void); static void sef_local_startup(void);
FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info); static int sef_cb_init_fresh(int type, sef_init_info_t *info);
EXTERN int sef_cb_lu_prepare(int state); EXTERN int sef_cb_lu_prepare(int state);
EXTERN int sef_cb_lu_state_isvalid(int state); EXTERN int sef_cb_lu_state_isvalid(int state);
EXTERN void sef_cb_lu_state_dump(int state); EXTERN void sef_cb_lu_state_dump(int state);
@@ -220,7 +220,7 @@ EXTERN void sef_cb_lu_state_dump(int state);
/*===========================================================================* /*===========================================================================*
* at_winchester_task * * at_winchester_task *
*===========================================================================*/ *===========================================================================*/
PUBLIC int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
/* SEF local startup. */ /* SEF local startup. */
env_setargs(argc, argv); env_setargs(argc, argv);
@@ -235,7 +235,7 @@ PUBLIC int main(int argc, char *argv[])
/*===========================================================================* /*===========================================================================*
* sef_local_startup * * sef_local_startup *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_local_startup(void) static void sef_local_startup(void)
{ {
/* Register init callbacks. */ /* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh); sef_setcb_init_fresh(sef_cb_init_fresh);
@@ -253,7 +253,7 @@ PRIVATE void sef_local_startup(void)
/*===========================================================================* /*===========================================================================*
* sef_cb_init_fresh * * sef_cb_init_fresh *
*===========================================================================*/ *===========================================================================*/
PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info)) static int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
{ {
/* Initialize the at_wini driver. */ /* Initialize the at_wini driver. */
system_hz = sys_hz(); system_hz = sys_hz();
@@ -276,7 +276,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
/*===========================================================================* /*===========================================================================*
* init_params * * init_params *
*===========================================================================*/ *===========================================================================*/
PRIVATE void init_params(void) static void init_params(void)
{ {
/* This routine is called at startup to initialize the drive parameters. */ /* This routine is called at startup to initialize the drive parameters. */
@@ -376,7 +376,7 @@ PRIVATE void init_params(void)
/*===========================================================================* /*===========================================================================*
* init_drive * * init_drive *
*===========================================================================*/ *===========================================================================*/
PRIVATE void init_drive(struct wini *w, int base_cmd, int base_ctl, static void init_drive(struct wini *w, int base_cmd, int base_ctl,
int base_dma, int irq, int ack, int hook, int drive) int base_dma, int irq, int ack, int hook, int drive)
{ {
w->state = 0; w->state = 0;
@@ -396,7 +396,7 @@ PRIVATE void init_drive(struct wini *w, int base_cmd, int base_ctl,
w->dma = 0; w->dma = 0;
} }
PRIVATE int quirkmatch(struct quirk *table, u8_t bcr, u8_t scr, u8_t interface, u16_t vid, u16_t did) { static int quirkmatch(struct quirk *table, u8_t bcr, u8_t scr, u8_t interface, u16_t vid, u16_t did) {
while(table->vendor) { while(table->vendor) {
if(table->vendor == vid && table->device == did && if(table->vendor == vid && table->device == did &&
table->pci_class == bcr && table->pci_class == bcr &&
@@ -414,7 +414,7 @@ PRIVATE int quirkmatch(struct quirk *table, u8_t bcr, u8_t scr, u8_t interface,
/*===========================================================================* /*===========================================================================*
* init_params_pci * * init_params_pci *
*===========================================================================*/ *===========================================================================*/
PRIVATE void init_params_pci(int skip) static void init_params_pci(int skip)
{ {
int i, r, devind, drive, pci_compat = 0; int i, r, devind, drive, pci_compat = 0;
int irq, irq_hook; int irq, irq_hook;
@@ -570,7 +570,7 @@ PRIVATE void init_params_pci(int skip)
/*===========================================================================* /*===========================================================================*
* w_do_open * * w_do_open *
*===========================================================================*/ *===========================================================================*/
PRIVATE int w_do_open(dev_t minor, int access) static int w_do_open(dev_t minor, int access)
{ {
/* Device open: Initialize the controller and read the partition table. */ /* Device open: Initialize the controller and read the partition table. */
@@ -639,7 +639,7 @@ PRIVATE int w_do_open(dev_t minor, int access)
/*===========================================================================* /*===========================================================================*
* w_prepare * * w_prepare *
*===========================================================================*/ *===========================================================================*/
PRIVATE struct device *w_prepare(dev_t device) static struct device *w_prepare(dev_t device)
{ {
/* Prepare for I/O on a device. */ /* Prepare for I/O on a device. */
w_device = (int) device; w_device = (int) device;
@@ -663,7 +663,7 @@ PRIVATE struct device *w_prepare(dev_t device)
/*===========================================================================* /*===========================================================================*
* w_part * * w_part *
*===========================================================================*/ *===========================================================================*/
PRIVATE struct device *w_part(dev_t device) static struct device *w_part(dev_t device)
{ {
/* Return a pointer to the partition information of the given minor device. */ /* Return a pointer to the partition information of the given minor device. */
@@ -681,7 +681,7 @@ PRIVATE struct device *w_part(dev_t device)
/*===========================================================================* /*===========================================================================*
* check_dma * * check_dma *
*===========================================================================*/ *===========================================================================*/
PRIVATE void static void
check_dma(struct wini *wn) check_dma(struct wini *wn)
{ {
u32_t dma_status, dma_base; u32_t dma_status, dma_base;
@@ -764,7 +764,7 @@ check_dma(struct wini *wn)
/*===========================================================================* /*===========================================================================*
* w_identify * * w_identify *
*===========================================================================*/ *===========================================================================*/
PRIVATE int w_identify(void) static int w_identify(void)
{ {
/* Find out if a device exists, if it is an old AT disk, or a newer ATA /* Find out if a device exists, if it is an old AT disk, or a newer ATA
* drive, a removable media device, etc. * drive, a removable media device, etc.
@@ -916,7 +916,7 @@ PRIVATE int w_identify(void)
/*===========================================================================* /*===========================================================================*
* w_name * * w_name *
*===========================================================================*/ *===========================================================================*/
PRIVATE char *w_name(void) static char *w_name(void)
{ {
/* Return a name for the current device. */ /* Return a name for the current device. */
static char name[] = "AT0-D0"; static char name[] = "AT0-D0";
@@ -929,7 +929,7 @@ PRIVATE char *w_name(void)
/*===========================================================================* /*===========================================================================*
* w_io_test * * w_io_test *
*===========================================================================*/ *===========================================================================*/
PRIVATE int w_io_test(void) static int w_io_test(void)
{ {
int save_dev; int save_dev;
int save_timeout, save_errors, save_wakeup; int save_timeout, save_errors, save_wakeup;
@@ -987,7 +987,7 @@ PRIVATE int w_io_test(void)
/*===========================================================================* /*===========================================================================*
* w_specify * * w_specify *
*===========================================================================*/ *===========================================================================*/
PRIVATE int w_specify(void) static int w_specify(void)
{ {
/* Routine to initialize the drive after boot or when a reset is needed. */ /* Routine to initialize the drive after boot or when a reset is needed. */
@@ -1026,7 +1026,7 @@ PRIVATE int w_specify(void)
/*===========================================================================* /*===========================================================================*
* do_transfer * * do_transfer *
*===========================================================================*/ *===========================================================================*/
PRIVATE int do_transfer(const struct wini *wn, unsigned int precomp, static int do_transfer(const struct wini *wn, unsigned int precomp,
unsigned int count, unsigned int sector, unsigned int count, unsigned int sector,
unsigned int do_write, int do_dma) unsigned int do_write, int do_dma)
{ {
@@ -1098,7 +1098,7 @@ PRIVATE int do_transfer(const struct wini *wn, unsigned int precomp,
return com_out(&cmd); return com_out(&cmd);
} }
PRIVATE void stop_dma(const struct wini *wn) static void stop_dma(const struct wini *wn)
{ {
int r; int r;
@@ -1107,7 +1107,7 @@ PRIVATE void stop_dma(const struct wini *wn)
if (r != 0) panic("stop_dma: sys_outb failed: %d", r); if (r != 0) panic("stop_dma: sys_outb failed: %d", r);
} }
PRIVATE void start_dma(const struct wini *wn, int do_write) static void start_dma(const struct wini *wn, int do_write)
{ {
u32_t v; u32_t v;
int r; int r;
@@ -1123,7 +1123,7 @@ PRIVATE void start_dma(const struct wini *wn, int do_write)
if (r != 0) panic("start_dma: sys_outb failed: %d", r); if (r != 0) panic("start_dma: sys_outb failed: %d", r);
} }
PRIVATE int error_dma(const struct wini *wn) static int error_dma(const struct wini *wn)
{ {
int r; int r;
u32_t v; u32_t v;
@@ -1158,7 +1158,7 @@ PRIVATE int error_dma(const struct wini *wn)
/*===========================================================================* /*===========================================================================*
* w_transfer * * w_transfer *
*===========================================================================*/ *===========================================================================*/
PRIVATE ssize_t w_transfer( static ssize_t w_transfer(
dev_t minor, /* minor device to perform the transfer on */ dev_t minor, /* minor device to perform the transfer on */
int do_write, /* read or write? */ int do_write, /* read or write? */
u64_t position, /* offset on device to read or write */ u64_t position, /* offset on device to read or write */
@@ -1382,7 +1382,7 @@ PRIVATE ssize_t w_transfer(
/*===========================================================================* /*===========================================================================*
* com_out * * com_out *
*===========================================================================*/ *===========================================================================*/
PRIVATE int com_out(cmd) static int com_out(cmd)
struct command *cmd; /* Command block */ struct command *cmd; /* Command block */
{ {
/* Output the command block to the winchester controller and return status */ /* Output the command block to the winchester controller and return status */
@@ -1433,7 +1433,7 @@ struct command *cmd; /* Command block */
/*===========================================================================* /*===========================================================================*
* com_out_ext * * com_out_ext *
*===========================================================================*/ *===========================================================================*/
PRIVATE int com_out_ext(cmd) static int com_out_ext(cmd)
struct command *cmd; /* Command block */ struct command *cmd; /* Command block */
{ {
/* Output the command block to the winchester controller and return status */ /* Output the command block to the winchester controller and return status */
@@ -1487,7 +1487,7 @@ struct command *cmd; /* Command block */
/*===========================================================================* /*===========================================================================*
* setup_dma * * setup_dma *
*===========================================================================*/ *===========================================================================*/
PRIVATE int setup_dma( static int setup_dma(
unsigned *sizep, unsigned *sizep,
endpoint_t proc_nr, endpoint_t proc_nr,
iovec_t *iov, iovec_t *iov,
@@ -1611,7 +1611,7 @@ PRIVATE int setup_dma(
/*===========================================================================* /*===========================================================================*
* w_need_reset * * w_need_reset *
*===========================================================================*/ *===========================================================================*/
PRIVATE void w_need_reset(void) static void w_need_reset(void)
{ {
/* The controller needs to be reset. */ /* The controller needs to be reset. */
struct wini *wn; struct wini *wn;
@@ -1627,7 +1627,7 @@ PRIVATE void w_need_reset(void)
/*===========================================================================* /*===========================================================================*
* w_do_close * * w_do_close *
*===========================================================================*/ *===========================================================================*/
PRIVATE int w_do_close(dev_t minor) static int w_do_close(dev_t minor)
{ {
/* Device close: Release a device. */ /* Device close: Release a device. */
if (w_prepare(minor) == NULL) if (w_prepare(minor) == NULL)
@@ -1642,7 +1642,7 @@ PRIVATE int w_do_close(dev_t minor)
/*===========================================================================* /*===========================================================================*
* com_simple * * com_simple *
*===========================================================================*/ *===========================================================================*/
PRIVATE int com_simple(cmd) static int com_simple(cmd)
struct command *cmd; /* Command block */ struct command *cmd; /* Command block */
{ {
/* A simple controller command, only one interrupt and no data-out phase. */ /* A simple controller command, only one interrupt and no data-out phase. */
@@ -1658,7 +1658,7 @@ struct command *cmd; /* Command block */
/*===========================================================================* /*===========================================================================*
* w_timeout * * w_timeout *
*===========================================================================*/ *===========================================================================*/
PRIVATE void w_timeout(void) static void w_timeout(void)
{ {
struct wini *wn = w_wn; struct wini *wn = w_wn;
@@ -1691,7 +1691,7 @@ PRIVATE void w_timeout(void)
/*===========================================================================* /*===========================================================================*
* w_reset * * w_reset *
*===========================================================================*/ *===========================================================================*/
PRIVATE int w_reset(void) static int w_reset(void)
{ {
/* Issue a reset to the controller. This is done after any catastrophe, /* Issue a reset to the controller. This is done after any catastrophe,
* like the controller refusing to respond. * like the controller refusing to respond.
@@ -1737,7 +1737,7 @@ PRIVATE int w_reset(void)
/*===========================================================================* /*===========================================================================*
* w_intr_wait * * w_intr_wait *
*===========================================================================*/ *===========================================================================*/
PRIVATE void w_intr_wait(void) static void w_intr_wait(void)
{ {
/* Wait for a task completion interrupt. */ /* Wait for a task completion interrupt. */
@@ -1794,7 +1794,7 @@ PRIVATE void w_intr_wait(void)
/*===========================================================================* /*===========================================================================*
* at_intr_wait * * at_intr_wait *
*===========================================================================*/ *===========================================================================*/
PRIVATE int at_intr_wait(void) static int at_intr_wait(void)
{ {
/* Wait for an interrupt, study the status bits and return error/success. */ /* Wait for an interrupt, study the status bits and return error/success. */
int r, s; int r, s;
@@ -1819,7 +1819,7 @@ PRIVATE int at_intr_wait(void)
/*===========================================================================* /*===========================================================================*
* w_waitfor * * w_waitfor *
*===========================================================================*/ *===========================================================================*/
PRIVATE int w_waitfor(mask, value) static int w_waitfor(mask, value)
int mask; /* status mask */ int mask; /* status mask */
int value; /* required status */ int value; /* required status */
{ {
@@ -1845,7 +1845,7 @@ int value; /* required status */
/*===========================================================================* /*===========================================================================*
* w_waitfor_dma * * w_waitfor_dma *
*===========================================================================*/ *===========================================================================*/
PRIVATE int w_waitfor_dma(mask, value) static int w_waitfor_dma(mask, value)
int mask; /* status mask */ int mask; /* status mask */
int value; /* required status */ int value; /* required status */
{ {
@@ -1869,7 +1869,7 @@ int value; /* required status */
/*===========================================================================* /*===========================================================================*
* w_geometry * * w_geometry *
*===========================================================================*/ *===========================================================================*/
PRIVATE void w_geometry(dev_t minor, struct partition *entry) static void w_geometry(dev_t minor, struct partition *entry)
{ {
struct wini *wn; struct wini *wn;
@@ -1892,7 +1892,7 @@ PRIVATE void w_geometry(dev_t minor, struct partition *entry)
/*===========================================================================* /*===========================================================================*
* atapi_open * * atapi_open *
*===========================================================================*/ *===========================================================================*/
PRIVATE int atapi_open(void) static int atapi_open(void)
{ {
/* Should load and lock the device and obtain its size. For now just set the /* Should load and lock the device and obtain its size. For now just set the
* size of the device to something big. What is really needed is a generic * size of the device to something big. What is really needed is a generic
@@ -1905,12 +1905,12 @@ PRIVATE int atapi_open(void)
/*===========================================================================* /*===========================================================================*
* atapi_close * * atapi_close *
*===========================================================================*/ *===========================================================================*/
PRIVATE void atapi_close(void) static void atapi_close(void)
{ {
/* Should unlock the device. For now do nothing. (XXX) */ /* Should unlock the device. For now do nothing. (XXX) */
} }
PRIVATE void sense_request(void) static void sense_request(void)
{ {
int r, i; int r, i;
static u8_t sense[100], packet[ATAPI_PACKETSIZE]; static u8_t sense[100], packet[ATAPI_PACKETSIZE];
@@ -1943,7 +1943,7 @@ PRIVATE void sense_request(void)
/*===========================================================================* /*===========================================================================*
* atapi_transfer * * atapi_transfer *
*===========================================================================*/ *===========================================================================*/
PRIVATE int atapi_transfer( static int atapi_transfer(
int do_write, /* read or write? */ int do_write, /* read or write? */
u64_t position, /* offset on device to read or write */ u64_t position, /* offset on device to read or write */
endpoint_t proc_nr, /* process doing the request */ endpoint_t proc_nr, /* process doing the request */
@@ -2141,7 +2141,7 @@ PRIVATE int atapi_transfer(
/*===========================================================================* /*===========================================================================*
* atapi_sendpacket * * atapi_sendpacket *
*===========================================================================*/ *===========================================================================*/
PRIVATE int atapi_sendpacket(packet, cnt, do_dma) static int atapi_sendpacket(packet, cnt, do_dma)
u8_t *packet; u8_t *packet;
unsigned cnt; unsigned cnt;
int do_dma; int do_dma;
@@ -2204,7 +2204,7 @@ int do_dma;
/*===========================================================================* /*===========================================================================*
* w_ioctl * * w_ioctl *
*===========================================================================*/ *===========================================================================*/
PRIVATE int w_ioctl(dev_t minor, unsigned int request, endpoint_t endpt, static int w_ioctl(dev_t minor, unsigned int request, endpoint_t endpt,
cp_grant_id_t grant) cp_grant_id_t grant)
{ {
int r, timeout, prev, count; int r, timeout, prev, count;
@@ -2285,7 +2285,7 @@ PRIVATE int w_ioctl(dev_t minor, unsigned int request, endpoint_t endpt,
/*===========================================================================* /*===========================================================================*
* w_hw_int * * w_hw_int *
*===========================================================================*/ *===========================================================================*/
PRIVATE void w_hw_int(unsigned int irqs) static void w_hw_int(unsigned int irqs)
{ {
/* Leftover interrupt(s) received; ack it/them. */ /* Leftover interrupt(s) received; ack it/them. */
ack_irqs(irqs); ack_irqs(irqs);
@@ -2295,7 +2295,7 @@ PRIVATE void w_hw_int(unsigned int irqs)
/*===========================================================================* /*===========================================================================*
* ack_irqs * * ack_irqs *
*===========================================================================*/ *===========================================================================*/
PRIVATE void ack_irqs(unsigned int irqs) static void ack_irqs(unsigned int irqs)
{ {
unsigned int drive; unsigned int drive;
u32_t w_status; u32_t w_status;
@@ -2323,7 +2323,7 @@ PRIVATE void ack_irqs(unsigned int irqs)
#define STSTR(a) if (status & STATUS_ ## a) { strcat(str, #a); strcat(str, " "); } #define STSTR(a) if (status & STATUS_ ## a) { strcat(str, #a); strcat(str, " "); }
#define ERRSTR(a) if (e & ERROR_ ## a) { strcat(str, #a); strcat(str, " "); } #define ERRSTR(a) if (e & ERROR_ ## a) { strcat(str, #a); strcat(str, " "); }
PRIVATE char *strstatus(int status) static char *strstatus(int status)
{ {
static char str[200]; static char str[200];
str[0] = '\0'; str[0] = '\0';
@@ -2338,7 +2338,7 @@ PRIVATE char *strstatus(int status)
return str; return str;
} }
PRIVATE char *strerr(int e) static char *strerr(int e)
{ {
static char str[200]; static char str[200];
str[0] = '\0'; str[0] = '\0';
@@ -2358,7 +2358,7 @@ PRIVATE char *strerr(int e)
/*===========================================================================* /*===========================================================================*
* atapi_intr_wait * * atapi_intr_wait *
*===========================================================================*/ *===========================================================================*/
PRIVATE int atapi_intr_wait(int UNUSED(do_dma), size_t UNUSED(max)) static int atapi_intr_wait(int UNUSED(do_dma), size_t UNUSED(max))
{ {
/* Wait for an interrupt and study the results. Returns a number of bytes /* Wait for an interrupt and study the results. Returns a number of bytes
* that need to be transferred, or an error code. * that need to be transferred, or an error code.
@@ -2431,7 +2431,7 @@ PRIVATE int atapi_intr_wait(int UNUSED(do_dma), size_t UNUSED(max))
#undef sys_voutb #undef sys_voutb
#undef sys_vinb #undef sys_vinb
PRIVATE int at_voutb(pvb_pair_t *pvb, int n) static int at_voutb(pvb_pair_t *pvb, int n)
{ {
int s, i; int s, i;
if ((s=sys_voutb(pvb,n)) == OK) if ((s=sys_voutb(pvb,n)) == OK)
@@ -2442,7 +2442,7 @@ PRIVATE int at_voutb(pvb_pair_t *pvb, int n)
panic("sys_voutb failed"); panic("sys_voutb failed");
} }
PRIVATE int at_vinb(pvb_pair_t *pvb, int n) static int at_vinb(pvb_pair_t *pvb, int n)
{ {
int s, i; int s, i;
if ((s=sys_vinb(pvb,n)) == OK) if ((s=sys_vinb(pvb,n)) == OK)
@@ -2453,7 +2453,7 @@ PRIVATE int at_vinb(pvb_pair_t *pvb, int n)
panic("sys_vinb failed"); panic("sys_vinb failed");
} }
PRIVATE int at_out(int line, u32_t port, u32_t value, char *typename, int type) static int at_out(int line, u32_t port, u32_t value, char *typename, int type)
{ {
int s; int s;
s = sys_out(port, value, type); s = sys_out(port, value, type);
@@ -2465,7 +2465,7 @@ PRIVATE int at_out(int line, u32_t port, u32_t value, char *typename, int type)
} }
PRIVATE int at_in(int line, u32_t port, u32_t *value, char *typename, int type) static int at_in(int line, u32_t port, u32_t *value, char *typename, int type)
{ {
int s; int s;
s = sys_in(port, value, type); s = sys_in(port, value, type);

View File

@@ -19,7 +19,7 @@ EXTERN int w_command;
/*===========================================================================* /*===========================================================================*
* sef_cb_lu_prepare * * sef_cb_lu_prepare *
*===========================================================================*/ *===========================================================================*/
PUBLIC int sef_cb_lu_prepare(int state) int sef_cb_lu_prepare(int state)
{ {
int is_ready; int is_ready;
@@ -49,7 +49,7 @@ PUBLIC int sef_cb_lu_prepare(int state)
/*===========================================================================* /*===========================================================================*
* sef_cb_lu_state_isvalid * * sef_cb_lu_state_isvalid *
*===========================================================================*/ *===========================================================================*/
PUBLIC int sef_cb_lu_state_isvalid(int state) int sef_cb_lu_state_isvalid(int state)
{ {
return SEF_LU_STATE_IS_STANDARD(state) || AT_STATE_IS_CUSTOM(state); return SEF_LU_STATE_IS_STANDARD(state) || AT_STATE_IS_CUSTOM(state);
} }
@@ -57,7 +57,7 @@ PUBLIC int sef_cb_lu_state_isvalid(int state)
/*===========================================================================* /*===========================================================================*
* sef_cb_lu_state_dump * * sef_cb_lu_state_dump *
*===========================================================================*/ *===========================================================================*/
PUBLIC void sef_cb_lu_state_dump(int state) void sef_cb_lu_state_dump(int state)
{ {
sef_lu_dprint("at_wini: live update state = %d\n", state); sef_lu_dprint("at_wini: live update state = %d\n", state);
sef_lu_dprint("at_wini: w_command = 0x%02X\n", w_command); sef_lu_dprint("at_wini: w_command = 0x%02X\n", w_command);

View File

@@ -32,7 +32,7 @@ typedef struct {
u8_t data[ATL2_RXD_SIZE - sizeof(u32_t) * 2]; u8_t data[ATL2_RXD_SIZE - sizeof(u32_t) * 2];
} rxd_t; } rxd_t;
PRIVATE struct { static struct {
int devind; /* PCI device index */ int devind; /* PCI device index */
int irq; /* IRQ number */ int irq; /* IRQ number */
int hook_id; /* IRQ hook ID */ int hook_id; /* IRQ hook ID */
@@ -82,14 +82,14 @@ PRIVATE struct {
#define ATL2_ALIGN_32(n) (((n) + 3) & ~3) #define ATL2_ALIGN_32(n) (((n) + 3) & ~3)
PRIVATE iovec_s_t iovec[NR_IOREQS]; static iovec_s_t iovec[NR_IOREQS];
PRIVATE int instance; static int instance;
/*===========================================================================* /*===========================================================================*
* atl2_read_vpd * * atl2_read_vpd *
*===========================================================================*/ *===========================================================================*/
PRIVATE int atl2_read_vpd(int index, u32_t *res) static int atl2_read_vpd(int index, u32_t *res)
{ {
/* Read a value from the VPD register area. /* Read a value from the VPD register area.
*/ */
@@ -123,7 +123,7 @@ PRIVATE int atl2_read_vpd(int index, u32_t *res)
/*===========================================================================* /*===========================================================================*
* atl2_get_vpd_hwaddr * * atl2_get_vpd_hwaddr *
*===========================================================================*/ *===========================================================================*/
PRIVATE int atl2_get_vpd_hwaddr(void) static int atl2_get_vpd_hwaddr(void)
{ {
/* Read the MAC address from the EEPROM, using the Vital Product Data /* Read the MAC address from the EEPROM, using the Vital Product Data
* register interface. * register interface.
@@ -176,7 +176,7 @@ PRIVATE int atl2_get_vpd_hwaddr(void)
/*===========================================================================* /*===========================================================================*
* atl2_get_hwaddr * * atl2_get_hwaddr *
*===========================================================================*/ *===========================================================================*/
PRIVATE void atl2_get_hwaddr(void) static void atl2_get_hwaddr(void)
{ {
/* Get the MAC address of the card. First try the EEPROM; if that /* Get the MAC address of the card. First try the EEPROM; if that
* fails, just use whatever the card was already set to. * fails, just use whatever the card was already set to.
@@ -196,7 +196,7 @@ PRIVATE void atl2_get_hwaddr(void)
/*===========================================================================* /*===========================================================================*
* atl2_read_mdio * * atl2_read_mdio *
*===========================================================================*/ *===========================================================================*/
PRIVATE int atl2_read_mdio(int addr, u16_t *res) static int atl2_read_mdio(int addr, u16_t *res)
{ {
/* Read a MII PHY register using MDIO. /* Read a MII PHY register using MDIO.
*/ */
@@ -227,7 +227,7 @@ PRIVATE int atl2_read_mdio(int addr, u16_t *res)
/*===========================================================================* /*===========================================================================*
* atl2_alloc_dma * * atl2_alloc_dma *
*===========================================================================*/ *===========================================================================*/
PRIVATE int atl2_alloc_dma(void) static int atl2_alloc_dma(void)
{ {
/* Allocate DMA ring buffers. /* Allocate DMA ring buffers.
*/ */
@@ -263,7 +263,7 @@ PRIVATE int atl2_alloc_dma(void)
/*===========================================================================* /*===========================================================================*
* atl2_stop * * atl2_stop *
*===========================================================================*/ *===========================================================================*/
PRIVATE int atl2_stop(void) static int atl2_stop(void)
{ {
/* Stop the device. /* Stop the device.
*/ */
@@ -299,7 +299,7 @@ PRIVATE int atl2_stop(void)
/*===========================================================================* /*===========================================================================*
* atl2_reset * * atl2_reset *
*===========================================================================*/ *===========================================================================*/
PRIVATE int atl2_reset(void) static int atl2_reset(void)
{ {
/* Reset the device to a known good state. /* Reset the device to a known good state.
*/ */
@@ -334,7 +334,7 @@ PRIVATE int atl2_reset(void)
/*===========================================================================* /*===========================================================================*
* atl2_set_mode * * atl2_set_mode *
*===========================================================================*/ *===========================================================================*/
PRIVATE void atl2_set_mode(void) static void atl2_set_mode(void)
{ {
/* Reconfigure the device's promiscuity, multicast, and broadcast mode /* Reconfigure the device's promiscuity, multicast, and broadcast mode
* settings. * settings.
@@ -357,7 +357,7 @@ PRIVATE void atl2_set_mode(void)
/*===========================================================================* /*===========================================================================*
* atl2_setup * * atl2_setup *
*===========================================================================*/ *===========================================================================*/
PRIVATE int atl2_setup(void) static int atl2_setup(void)
{ {
/* Set up the device for normal operation. /* Set up the device for normal operation.
*/ */
@@ -457,7 +457,7 @@ PRIVATE int atl2_setup(void)
/*===========================================================================* /*===========================================================================*
* atl2_probe * * atl2_probe *
*===========================================================================*/ *===========================================================================*/
PRIVATE int atl2_probe(int skip) static int atl2_probe(int skip)
{ {
/* Find a matching PCI device. /* Find a matching PCI device.
*/ */
@@ -490,7 +490,7 @@ PRIVATE int atl2_probe(int skip)
/*===========================================================================* /*===========================================================================*
* atl2_init * * atl2_init *
*===========================================================================*/ *===========================================================================*/
PRIVATE void atl2_init(int devind) static void atl2_init(int devind)
{ {
/* Initialize the device. /* Initialize the device.
*/ */
@@ -537,7 +537,7 @@ PRIVATE void atl2_init(int devind)
/*===========================================================================* /*===========================================================================*
* atl2_tx_stat * * atl2_tx_stat *
*===========================================================================*/ *===========================================================================*/
PRIVATE void atl2_tx_stat(u32_t stat) static void atl2_tx_stat(u32_t stat)
{ {
/* Update statistics for packet transmission. /* Update statistics for packet transmission.
*/ */
@@ -564,7 +564,7 @@ PRIVATE void atl2_tx_stat(u32_t stat)
/*===========================================================================* /*===========================================================================*
* atl2_rx_stat * * atl2_rx_stat *
*===========================================================================*/ *===========================================================================*/
PRIVATE void atl2_rx_stat(u32_t stat) static void atl2_rx_stat(u32_t stat)
{ {
/* Update statistics for packet receipt. /* Update statistics for packet receipt.
*/ */
@@ -587,7 +587,7 @@ PRIVATE void atl2_rx_stat(u32_t stat)
/*===========================================================================* /*===========================================================================*
* atl2_tx_advance * * atl2_tx_advance *
*===========================================================================*/ *===========================================================================*/
PRIVATE int atl2_tx_advance(void) static int atl2_tx_advance(void)
{ {
/* Advance the TxD/TxS tails by as many sent packets as found. /* Advance the TxD/TxS tails by as many sent packets as found.
*/ */
@@ -642,7 +642,7 @@ PRIVATE int atl2_tx_advance(void)
/*===========================================================================* /*===========================================================================*
* atl2_rx_advance * * atl2_rx_advance *
*===========================================================================*/ *===========================================================================*/
PRIVATE void atl2_rx_advance(int next) static void atl2_rx_advance(int next)
{ {
/* Advance the RxD tail by as many failed receipts as possible, and /* Advance the RxD tail by as many failed receipts as possible, and
* see if there is an actual packet left to receive. If 'next' is set, * see if there is an actual packet left to receive. If 'next' is set,
@@ -710,7 +710,7 @@ PRIVATE void atl2_rx_advance(int next)
/*===========================================================================* /*===========================================================================*
* atl2_reply * * atl2_reply *
*===========================================================================*/ *===========================================================================*/
PRIVATE void atl2_reply(void) static void atl2_reply(void)
{ {
/* Send a task reply to Inet. /* Send a task reply to Inet.
*/ */
@@ -740,7 +740,7 @@ PRIVATE void atl2_reply(void)
/*===========================================================================* /*===========================================================================*
* atl2_readv * * atl2_readv *
*===========================================================================*/ *===========================================================================*/
PRIVATE void atl2_readv(const message *m, int from_int) static void atl2_readv(const message *m, int from_int)
{ {
/* Read packet data. /* Read packet data.
*/ */
@@ -835,7 +835,7 @@ suspend:
/*===========================================================================* /*===========================================================================*
* atl2_writev * * atl2_writev *
*===========================================================================*/ *===========================================================================*/
PRIVATE void atl2_writev(const message *m, int from_int) static void atl2_writev(const message *m, int from_int)
{ {
/* Write packet data. /* Write packet data.
*/ */
@@ -959,7 +959,7 @@ suspend:
/*===========================================================================* /*===========================================================================*
* atl2_intr * * atl2_intr *
*===========================================================================*/ *===========================================================================*/
PRIVATE void atl2_intr(const message *UNUSED(m)) static void atl2_intr(const message *UNUSED(m))
{ {
/* Interrupt received. /* Interrupt received.
*/ */
@@ -1014,7 +1014,7 @@ PRIVATE void atl2_intr(const message *UNUSED(m))
/*===========================================================================* /*===========================================================================*
* atl2_conf * * atl2_conf *
*===========================================================================*/ *===========================================================================*/
PRIVATE void atl2_conf(message *m) static void atl2_conf(message *m)
{ {
/* Configure the mode of the card. /* Configure the mode of the card.
*/ */
@@ -1044,7 +1044,7 @@ PRIVATE void atl2_conf(message *m)
/*===========================================================================* /*===========================================================================*
* atl2_getstat * * atl2_getstat *
*===========================================================================*/ *===========================================================================*/
PRIVATE void atl2_getstat(message *m) static void atl2_getstat(message *m)
{ {
/* Copy out statistics. /* Copy out statistics.
*/ */
@@ -1062,7 +1062,7 @@ PRIVATE void atl2_getstat(message *m)
/*===========================================================================* /*===========================================================================*
* atl2_dump_link * * atl2_dump_link *
*===========================================================================*/ *===========================================================================*/
PRIVATE void atl2_dump_link(void) static void atl2_dump_link(void)
{ {
/* Dump link status. /* Dump link status.
*/ */
@@ -1099,7 +1099,7 @@ PRIVATE void atl2_dump_link(void)
/*===========================================================================* /*===========================================================================*
* atl2_dump * * atl2_dump *
*===========================================================================*/ *===========================================================================*/
PRIVATE void atl2_dump(void) static void atl2_dump(void)
{ {
/* Dump statistics. /* Dump statistics.
*/ */
@@ -1143,7 +1143,7 @@ PRIVATE void atl2_dump(void)
/*===========================================================================* /*===========================================================================*
* sef_cb_init_fresh * * sef_cb_init_fresh *
*===========================================================================*/ *===========================================================================*/
PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info)) static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{ {
/* Initialize the atl2 driver. /* Initialize the atl2 driver.
*/ */
@@ -1184,7 +1184,7 @@ PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
/*===========================================================================* /*===========================================================================*
* sef_cb_signal_handler * * sef_cb_signal_handler *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_cb_signal_handler(int signo) static void sef_cb_signal_handler(int signo)
{ {
/* In case of a termination signal, shut down this driver. /* In case of a termination signal, shut down this driver.
* Stop the device, and deallocate resources as proof of concept. * Stop the device, and deallocate resources as proof of concept.
@@ -1214,7 +1214,7 @@ PRIVATE void sef_cb_signal_handler(int signo)
/*===========================================================================* /*===========================================================================*
* sef_local_startup * * sef_local_startup *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_local_startup(void) static void sef_local_startup(void)
{ {
/* Register init callbacks. */ /* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh); sef_setcb_init_fresh(sef_cb_init_fresh);

View File

@@ -26,15 +26,15 @@
#define MUTE 0x80 #define MUTE 0x80
FORWARD int ak4531_write(u8_t address, u8_t data); static int ak4531_write(u8_t address, u8_t data);
FORWARD int ak4531_finished(void); static int ak4531_finished(void);
FORWARD int set_volume(struct volume_level *level, int cmd_left, int static int set_volume(struct volume_level *level, int cmd_left, int
cmd_right, int max_level); cmd_right, int max_level);
PRIVATE u16_t base_address; static u16_t base_address;
PRIVATE u16_t status_register; static u16_t status_register;
PRIVATE u16_t status_bit; static u16_t status_bit;
PRIVATE u16_t poll_address; static u16_t poll_address;
u8_t mixer_values[0x20] = { u8_t mixer_values[0x20] = {
0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, /* 0x00 - 0x07 */ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, /* 0x00 - 0x07 */
@@ -53,7 +53,7 @@ u8_t mixer_values[0x20] = {
PRIVATE int ak4531_finished(void) { static int ak4531_finished(void) {
int i; int i;
u16_t cstat; u16_t cstat;
for (i = 0; i < 0x40000; i++) { for (i = 0; i < 0x40000; i++) {
@@ -66,7 +66,7 @@ PRIVATE int ak4531_finished(void) {
} }
PRIVATE int ak4531_write (u8_t address, u8_t data) { static int ak4531_write (u8_t address, u8_t data) {
u16_t to_be_written; u16_t to_be_written;
@@ -80,7 +80,7 @@ PRIVATE int ak4531_write (u8_t address, u8_t data) {
} }
PUBLIC int ak4531_init(u16_t base, u16_t status_reg, u16_t bit, int ak4531_init(u16_t base, u16_t status_reg, u16_t bit,
u16_t poll) { u16_t poll) {
int i; int i;
@@ -107,7 +107,7 @@ PUBLIC int ak4531_init(u16_t base, u16_t status_reg, u16_t bit,
} }
PUBLIC int ak4531_get_set_volume(struct volume_level *level, int flag) { int ak4531_get_set_volume(struct volume_level *level, int flag) {
int cmd_left, cmd_right, max_level; int cmd_left, cmd_right, max_level;
max_level = 0x1f; max_level = 0x1f;
@@ -160,7 +160,7 @@ PUBLIC int ak4531_get_set_volume(struct volume_level *level, int flag) {
} }
PRIVATE int set_volume(struct volume_level *level, int cmd_left, int cmd_right, static int set_volume(struct volume_level *level, int cmd_left, int cmd_right,
int max_level) { int max_level) {
if(level->right < 0) level->right = 0; if(level->right < 0) level->right = 0;

View File

@@ -28,32 +28,32 @@
/* prototypes of private functions */ /* prototypes of private functions */
FORWARD int detect_hw(void); static int detect_hw(void);
FORWARD int disable_int(int sub_dev); static int disable_int(int sub_dev);
FORWARD int set_stereo(u32_t stereo, int sub_dev); static int set_stereo(u32_t stereo, int sub_dev);
FORWARD int set_bits(u32_t nr_of_bits, int sub_dev); static int set_bits(u32_t nr_of_bits, int sub_dev);
FORWARD int set_sample_rate(u32_t rate, int sub_dev); static int set_sample_rate(u32_t rate, int sub_dev);
FORWARD int set_sign(u32_t val, int sub_dev); static int set_sign(u32_t val, int sub_dev);
FORWARD int get_max_frag_size(u32_t * val, int *len, int sub_dev); static int get_max_frag_size(u32_t * val, int *len, int sub_dev);
FORWARD int set_frag_size(u32_t fragment_size, int sub_dev); static int set_frag_size(u32_t fragment_size, int sub_dev);
FORWARD int set_int_cnt(int sub_dev); static int set_int_cnt(int sub_dev);
FORWARD int free_buf(u32_t *val, int *len, int sub_dev); static int free_buf(u32_t *val, int *len, int sub_dev);
FORWARD int get_samples_in_buf(u32_t *val, int *len, int sub_dev); static int get_samples_in_buf(u32_t *val, int *len, int sub_dev);
FORWARD int get_set_volume(struct volume_level *level, int *len, int static int get_set_volume(struct volume_level *level, int *len, int
sub_dev, int flag); sub_dev, int flag);
FORWARD int reset(int sub_dev); static int reset(int sub_dev);
DEV_STRUCT dev; DEV_STRUCT dev;
aud_sub_dev_conf_t aud_conf[4]; aud_sub_dev_conf_t aud_conf[4];
PUBLIC sub_dev_t sub_dev[4]; sub_dev_t sub_dev[4];
PUBLIC special_file_t special_file[4]; special_file_t special_file[4];
PUBLIC drv_t drv; drv_t drv;
PUBLIC int drv_init(void) { int drv_init(void) {
drv.DriverName = DRIVER_NAME; drv.DriverName = DRIVER_NAME;
drv.NrOfSubDevices = 4; drv.NrOfSubDevices = 4;
drv.NrOfSpecialFiles = 4; drv.NrOfSpecialFiles = 4;
@@ -106,7 +106,7 @@ PUBLIC int drv_init(void) {
} }
PUBLIC int drv_init_hw (void) { int drv_init_hw (void) {
u16_t i, j; u16_t i, j;
u16_t chip_sel_ctrl_reg; u16_t chip_sel_ctrl_reg;
@@ -167,7 +167,7 @@ PUBLIC int drv_init_hw (void) {
} }
PRIVATE int detect_hw(void) { static int detect_hw(void) {
u32_t device; u32_t device;
int devind; int devind;
u16_t v_id, d_id; u16_t v_id, d_id;
@@ -210,7 +210,7 @@ PRIVATE int detect_hw(void) {
} }
PRIVATE int reset(int chan) { static int reset(int chan) {
drv_stop(chan); drv_stop(chan);
sub_dev[chan].OutOfData = 1; sub_dev[chan].OutOfData = 1;
@@ -455,7 +455,7 @@ int drv_resume(int sub_dev) {
} }
PRIVATE int set_bits(u32_t nr_of_bits, int sub_dev) { static int set_bits(u32_t nr_of_bits, int sub_dev) {
/* set format bits for specified channel. */ /* set format bits for specified channel. */
u16_t size_16_bit, ser_interface; u16_t size_16_bit, ser_interface;
@@ -479,7 +479,7 @@ PRIVATE int set_bits(u32_t nr_of_bits, int sub_dev) {
} }
PRIVATE int set_stereo(u32_t stereo, int sub_dev) { static int set_stereo(u32_t stereo, int sub_dev) {
/* set format bits for specified channel. */ /* set format bits for specified channel. */
u16_t stereo_bit, ser_interface; u16_t stereo_bit, ser_interface;
@@ -501,12 +501,12 @@ PRIVATE int set_stereo(u32_t stereo, int sub_dev) {
} }
PRIVATE int set_sign(u32_t UNUSED(val), int UNUSED(sub_dev)) { static int set_sign(u32_t UNUSED(val), int UNUSED(sub_dev)) {
return OK; return OK;
} }
PRIVATE int set_frag_size(u32_t fragment_size, int sub_dev_nr) { static int set_frag_size(u32_t fragment_size, int sub_dev_nr) {
if (fragment_size > (sub_dev[sub_dev_nr].DmaSize / if (fragment_size > (sub_dev[sub_dev_nr].DmaSize /
sub_dev[sub_dev_nr].NrOfDmaFragments) || sub_dev[sub_dev_nr].NrOfDmaFragments) ||
fragment_size < sub_dev[sub_dev_nr].MinFragmentSize) { fragment_size < sub_dev[sub_dev_nr].MinFragmentSize) {
@@ -518,7 +518,7 @@ PRIVATE int set_frag_size(u32_t fragment_size, int sub_dev_nr) {
} }
PRIVATE int set_sample_rate(u32_t rate, int sub_dev) { static int set_sample_rate(u32_t rate, int sub_dev) {
/* currently only 44.1kHz */ /* currently only 44.1kHz */
u32_t controlRegister; u32_t controlRegister;
@@ -536,7 +536,7 @@ PRIVATE int set_sample_rate(u32_t rate, int sub_dev) {
} }
PRIVATE int set_int_cnt(int chan) { static int set_int_cnt(int chan) {
/* Write interrupt count for specified channel. /* Write interrupt count for specified channel.
After <DspFragmentSize> bytes, an interrupt will be generated */ After <DspFragmentSize> bytes, an interrupt will be generated */
@@ -573,7 +573,7 @@ PRIVATE int set_int_cnt(int chan) {
} }
PRIVATE int get_max_frag_size(u32_t * val, int * len, int sub_dev_nr) { static int get_max_frag_size(u32_t * val, int * len, int sub_dev_nr) {
*len = sizeof(*val); *len = sizeof(*val);
*val = (sub_dev[sub_dev_nr].DmaSize / *val = (sub_dev[sub_dev_nr].DmaSize /
sub_dev[sub_dev_nr].NrOfDmaFragments); sub_dev[sub_dev_nr].NrOfDmaFragments);
@@ -581,7 +581,7 @@ PRIVATE int get_max_frag_size(u32_t * val, int * len, int sub_dev_nr) {
} }
PRIVATE int disable_int(int chan) { static int disable_int(int chan) {
u16_t ser_interface, int_en_bit; u16_t ser_interface, int_en_bit;
switch(chan) { switch(chan) {
@@ -597,7 +597,7 @@ PRIVATE int disable_int(int chan) {
} }
PRIVATE int get_samples_in_buf (u32_t *samples_in_buf, int *len, int chan) { static int get_samples_in_buf (u32_t *samples_in_buf, int *len, int chan) {
u16_t samp_ct_reg; u16_t samp_ct_reg;
u16_t curr_samp_ct_reg; u16_t curr_samp_ct_reg;
u16_t curr_samp_ct; /* counts back from SAMP_CT till 0 */ u16_t curr_samp_ct; /* counts back from SAMP_CT till 0 */
@@ -629,7 +629,7 @@ PRIVATE int get_samples_in_buf (u32_t *samples_in_buf, int *len, int chan) {
/* returns 1 if there are free buffers */ /* returns 1 if there are free buffers */
PRIVATE int free_buf (u32_t *val, int *len, int sub_dev_nr) { static int free_buf (u32_t *val, int *len, int sub_dev_nr) {
*len = sizeof(*val); *len = sizeof(*val);
if (sub_dev[sub_dev_nr].BufLength == if (sub_dev[sub_dev_nr].BufLength ==
sub_dev[sub_dev_nr].NrOfExtraBuffers) { sub_dev[sub_dev_nr].NrOfExtraBuffers) {
@@ -642,7 +642,7 @@ PRIVATE int free_buf (u32_t *val, int *len, int sub_dev_nr) {
} }
PRIVATE int get_set_volume(struct volume_level *level, int *len, int sub_dev, static int get_set_volume(struct volume_level *level, int *len, int sub_dev,
int flag) { int flag) {
*len = sizeof(struct volume_level); *len = sizeof(struct volume_level);
if (sub_dev == MIXER) { if (sub_dev == MIXER) {

View File

@@ -14,7 +14,7 @@
/*===========================================================================* /*===========================================================================*
* helper functions for I/O * * helper functions for I/O *
*===========================================================================*/ *===========================================================================*/
PUBLIC u32_t pci_inb(u16_t port) { u32_t pci_inb(u16_t port) {
u32_t value; u32_t value;
int s; int s;
if ((s=sys_inb(port, &value)) !=OK) if ((s=sys_inb(port, &value)) !=OK)
@@ -23,7 +23,7 @@ PUBLIC u32_t pci_inb(u16_t port) {
} }
PUBLIC u32_t pci_inw(u16_t port) { u32_t pci_inw(u16_t port) {
u32_t value; u32_t value;
int s; int s;
if ((s=sys_inw(port, &value)) !=OK) if ((s=sys_inw(port, &value)) !=OK)
@@ -32,7 +32,7 @@ PUBLIC u32_t pci_inw(u16_t port) {
} }
PUBLIC u32_t pci_inl(u16_t port) { u32_t pci_inl(u16_t port) {
u32_t value; u32_t value;
int s; int s;
if ((s=sys_inl(port, &value)) !=OK) if ((s=sys_inl(port, &value)) !=OK)
@@ -41,21 +41,21 @@ PUBLIC u32_t pci_inl(u16_t port) {
} }
PUBLIC void pci_outb(u16_t port, u8_t value) { void pci_outb(u16_t port, u8_t value) {
int s; int s;
if ((s=sys_outb(port, value)) !=OK) if ((s=sys_outb(port, value)) !=OK)
printf("%s: warning, sys_outb failed: %d\n", DRIVER_NAME, s); printf("%s: warning, sys_outb failed: %d\n", DRIVER_NAME, s);
} }
PUBLIC void pci_outw(u16_t port, u16_t value) { void pci_outw(u16_t port, u16_t value) {
int s; int s;
if ((s=sys_outw(port, value)) !=OK) if ((s=sys_outw(port, value)) !=OK)
printf("%s: warning, sys_outw failed: %d\n", DRIVER_NAME, s); printf("%s: warning, sys_outw failed: %d\n", DRIVER_NAME, s);
} }
PUBLIC void pci_outl(u16_t port, u32_t value) { void pci_outl(u16_t port, u32_t value) {
int s; int s;
if ((s=sys_outl(port, value)) !=OK) if ((s=sys_outl(port, value)) !=OK)
printf("%s: warning, sys_outl failed: %d\n", DRIVER_NAME, s); printf("%s: warning, sys_outl failed: %d\n", DRIVER_NAME, s);

View File

@@ -6,15 +6,15 @@
/* AC97 Mixer and Mode control function prototypes */ /* AC97 Mixer and Mode control function prototypes */
FORWARD int AC97_write(const DEV_STRUCT * pCC, u16_t wAddr, u16_t static int AC97_write(const DEV_STRUCT * pCC, u16_t wAddr, u16_t
wData); wData);
FORWARD int AC97_write_unsynced(const DEV_STRUCT * pCC, u16_t wAddr, static int AC97_write_unsynced(const DEV_STRUCT * pCC, u16_t wAddr,
u16_t wData); u16_t wData);
FORWARD int AC97_read_unsynced(const DEV_STRUCT * pCC, u16_t wAddr, static int AC97_read_unsynced(const DEV_STRUCT * pCC, u16_t wAddr,
u16_t *data); u16_t *data);
FORWARD void set_nice_volume(void); static void set_nice_volume(void);
FORWARD int AC97_get_volume(struct volume_level *level); static int AC97_get_volume(struct volume_level *level);
FORWARD int AC97_set_volume(const struct volume_level *level); static int AC97_set_volume(const struct volume_level *level);
@@ -56,7 +56,7 @@ static DEV_STRUCT *dev;
#if 0 #if 0
PRIVATE void set_src_sync_state (int state) static void set_src_sync_state (int state)
{ {
if (state < 0) if (state < 0)
SrcSyncState = SRC_UNSYNCED; SrcSyncState = SRC_UNSYNCED;
@@ -68,7 +68,7 @@ PRIVATE void set_src_sync_state (int state)
#endif #endif
PRIVATE int AC97_write (const DEV_STRUCT * pCC, u16_t wAddr, u16_t wData) static int AC97_write (const DEV_STRUCT * pCC, u16_t wAddr, u16_t wData)
{ {
u32_t dtemp, i; u32_t dtemp, i;
u16_t wBaseAddr = pCC->base; u16_t wBaseAddr = pCC->base;
@@ -133,7 +133,7 @@ u16_t wBaseAddr = pCC->base;
#if 0 #if 0
PRIVATE int AC97_read (const DEV_STRUCT * pCC, u16_t wAddr, u16_t *data) static int AC97_read (const DEV_STRUCT * pCC, u16_t wAddr, u16_t *data)
{ {
u32_t dtemp, i; u32_t dtemp, i;
u16_t base = pCC->base; u16_t base = pCC->base;
@@ -207,7 +207,7 @@ u16_t base = pCC->base;
#endif #endif
PRIVATE int AC97_write_unsynced (const DEV_STRUCT * pCC, u16_t wAddr, static int AC97_write_unsynced (const DEV_STRUCT * pCC, u16_t wAddr,
u16_t wData) u16_t wData)
{ {
/* wait for WIP to go away */ /* wait for WIP to go away */
@@ -220,7 +220,7 @@ PRIVATE int AC97_write_unsynced (const DEV_STRUCT * pCC, u16_t wAddr,
} }
PRIVATE int AC97_read_unsynced (const DEV_STRUCT * pCC, u16_t wAddr, static int AC97_read_unsynced (const DEV_STRUCT * pCC, u16_t wAddr,
u16_t *data) u16_t *data)
{ {
u32_t dtemp; u32_t dtemp;
@@ -309,7 +309,7 @@ int AC97_init( DEV_STRUCT * pCC ) {
} }
PRIVATE void set_nice_volume(void) { static void set_nice_volume(void) {
/* goofy code to set the DAC1 channel to an audibe volume /* goofy code to set the DAC1 channel to an audibe volume
to be able to test it without using the mixer */ to be able to test it without using the mixer */
@@ -340,7 +340,7 @@ PRIVATE void set_nice_volume(void) {
} }
PRIVATE int get_volume(u8_t *left, u8_t *right, int cmd) { static int get_volume(u8_t *left, u8_t *right, int cmd) {
u16_t value; u16_t value;
AC97_read_unsynced(dev, (u16_t)cmd, &value); AC97_read_unsynced(dev, (u16_t)cmd, &value);
@@ -352,7 +352,7 @@ PRIVATE int get_volume(u8_t *left, u8_t *right, int cmd) {
} }
PRIVATE int set_volume(int left, int right, int cmd) { static int set_volume(int left, int right, int cmd) {
u16_t waarde; u16_t waarde;
waarde = (u16_t)((left<<8)|right); waarde = (u16_t)((left<<8)|right);
@@ -393,7 +393,7 @@ int AC97_get_set_volume(struct volume_level *level, int flag) {
} }
PRIVATE int AC97_get_volume(struct volume_level *level) { static int AC97_get_volume(struct volume_level *level) {
int cmd; int cmd;
u8_t left; u8_t left;
u8_t right; u8_t right;
@@ -453,7 +453,7 @@ PRIVATE int AC97_get_volume(struct volume_level *level) {
} }
PRIVATE int AC97_set_volume(const struct volume_level *level) { static int AC97_set_volume(const struct volume_level *level) {
int cmd; int cmd;
int left; int left;
int right; int right;

View File

@@ -34,32 +34,32 @@
/* prototypes of private functions */ /* prototypes of private functions */
FORWARD int detect_hw(void); static int detect_hw(void);
FORWARD int disable_int(int sub_dev); static int disable_int(int sub_dev);
FORWARD int set_stereo(u32_t stereo, int sub_dev); static int set_stereo(u32_t stereo, int sub_dev);
FORWARD int set_bits(u32_t nr_of_bits, int sub_dev); static int set_bits(u32_t nr_of_bits, int sub_dev);
FORWARD int set_sample_rate(u32_t rate, int sub_dev); static int set_sample_rate(u32_t rate, int sub_dev);
FORWARD int set_sign(u32_t val, int sub_dev); static int set_sign(u32_t val, int sub_dev);
FORWARD int get_max_frag_size(u32_t * val, int *len, int sub_dev); static int get_max_frag_size(u32_t * val, int *len, int sub_dev);
FORWARD int set_frag_size(u32_t fragment_size, int sub_dev); static int set_frag_size(u32_t fragment_size, int sub_dev);
FORWARD int set_int_cnt(int sub_dev); static int set_int_cnt(int sub_dev);
FORWARD int free_buf(u32_t *val, int *len, int sub_dev); static int free_buf(u32_t *val, int *len, int sub_dev);
FORWARD int get_samples_in_buf(u32_t *val, int *len, int sub_dev); static int get_samples_in_buf(u32_t *val, int *len, int sub_dev);
FORWARD int get_set_volume(struct volume_level *level, int *len, int static int get_set_volume(struct volume_level *level, int *len, int
sub_dev, int flag); sub_dev, int flag);
FORWARD int reset(int sub_dev); static int reset(int sub_dev);
DEV_STRUCT dev; DEV_STRUCT dev;
aud_sub_dev_conf_t aud_conf[4]; aud_sub_dev_conf_t aud_conf[4];
PUBLIC sub_dev_t sub_dev[4]; sub_dev_t sub_dev[4];
PUBLIC special_file_t special_file[4]; special_file_t special_file[4];
PUBLIC drv_t drv; drv_t drv;
PUBLIC int drv_init(void) { int drv_init(void) {
drv.DriverName = DRIVER_NAME; drv.DriverName = DRIVER_NAME;
drv.NrOfSubDevices = 4; drv.NrOfSubDevices = 4;
drv.NrOfSpecialFiles = 4; drv.NrOfSpecialFiles = 4;
@@ -112,7 +112,7 @@ PUBLIC int drv_init(void) {
} }
PUBLIC int drv_init_hw (void) { int drv_init_hw (void) {
u16_t i, j; u16_t i, j;
/* First, detect the hardware */ /* First, detect the hardware */
@@ -169,7 +169,7 @@ PUBLIC int drv_init_hw (void) {
} }
PRIVATE int detect_hw(void) { static int detect_hw(void) {
u32_t device; u32_t device;
int devind; int devind;
u16_t v_id, d_id; u16_t v_id, d_id;
@@ -212,7 +212,7 @@ PRIVATE int detect_hw(void) {
} }
PRIVATE int reset(int chan) { static int reset(int chan) {
drv_stop(chan); drv_stop(chan);
sub_dev[chan].OutOfData = 1; sub_dev[chan].OutOfData = 1;
@@ -456,7 +456,7 @@ int drv_resume(int sub_dev) {
} }
PRIVATE int set_bits(u32_t nr_of_bits, int sub_dev) { static int set_bits(u32_t nr_of_bits, int sub_dev) {
/* set format bits for specified channel. */ /* set format bits for specified channel. */
u16_t size_16_bit, ser_interface; u16_t size_16_bit, ser_interface;
@@ -480,7 +480,7 @@ PRIVATE int set_bits(u32_t nr_of_bits, int sub_dev) {
} }
PRIVATE int set_stereo(u32_t stereo, int sub_dev) { static int set_stereo(u32_t stereo, int sub_dev) {
/* set format bits for specified channel. */ /* set format bits for specified channel. */
u16_t stereo_bit, ser_interface; u16_t stereo_bit, ser_interface;
@@ -502,12 +502,12 @@ PRIVATE int set_stereo(u32_t stereo, int sub_dev) {
} }
PRIVATE int set_sign(u32_t UNUSED(val), int UNUSED(sub_dev)) { static int set_sign(u32_t UNUSED(val), int UNUSED(sub_dev)) {
return OK; return OK;
} }
PRIVATE int set_frag_size(u32_t fragment_size, int sub_dev_nr) { static int set_frag_size(u32_t fragment_size, int sub_dev_nr) {
if (fragment_size > (sub_dev[sub_dev_nr].DmaSize / if (fragment_size > (sub_dev[sub_dev_nr].DmaSize /
sub_dev[sub_dev_nr].NrOfDmaFragments) || sub_dev[sub_dev_nr].NrOfDmaFragments) ||
fragment_size < sub_dev[sub_dev_nr].MinFragmentSize) { fragment_size < sub_dev[sub_dev_nr].MinFragmentSize) {
@@ -519,7 +519,7 @@ PRIVATE int set_frag_size(u32_t fragment_size, int sub_dev_nr) {
} }
PRIVATE int set_sample_rate(u32_t rate, int sub_dev) { static int set_sample_rate(u32_t rate, int sub_dev) {
u32_t src_base_reg; u32_t src_base_reg;
if (rate > MAX_RATE || rate < MIN_RATE) { if (rate > MAX_RATE || rate < MIN_RATE) {
@@ -538,7 +538,7 @@ PRIVATE int set_sample_rate(u32_t rate, int sub_dev) {
} }
PRIVATE int set_int_cnt(int chan) { static int set_int_cnt(int chan) {
/* Write interrupt count for specified channel. /* Write interrupt count for specified channel.
After <DspFragmentSize> bytes, an interrupt will be generated */ After <DspFragmentSize> bytes, an interrupt will be generated */
@@ -575,7 +575,7 @@ PRIVATE int set_int_cnt(int chan) {
} }
PRIVATE int get_max_frag_size(u32_t * val, int * len, int sub_dev_nr) { static int get_max_frag_size(u32_t * val, int * len, int sub_dev_nr) {
*len = sizeof(*val); *len = sizeof(*val);
*val = (sub_dev[sub_dev_nr].DmaSize / *val = (sub_dev[sub_dev_nr].DmaSize /
sub_dev[sub_dev_nr].NrOfDmaFragments); sub_dev[sub_dev_nr].NrOfDmaFragments);
@@ -583,7 +583,7 @@ PRIVATE int get_max_frag_size(u32_t * val, int * len, int sub_dev_nr) {
} }
PRIVATE int disable_int(int chan) { static int disable_int(int chan) {
u16_t ser_interface, int_en_bit; u16_t ser_interface, int_en_bit;
switch(chan) { switch(chan) {
@@ -599,7 +599,7 @@ PRIVATE int disable_int(int chan) {
} }
PRIVATE int get_samples_in_buf (u32_t *samples_in_buf, int *len, int chan) { static int get_samples_in_buf (u32_t *samples_in_buf, int *len, int chan) {
u16_t samp_ct_reg; u16_t samp_ct_reg;
u16_t curr_samp_ct_reg; u16_t curr_samp_ct_reg;
u16_t curr_samp_ct; /* counts back from SAMP_CT till 0 */ u16_t curr_samp_ct; /* counts back from SAMP_CT till 0 */
@@ -631,7 +631,7 @@ PRIVATE int get_samples_in_buf (u32_t *samples_in_buf, int *len, int chan) {
/* returns 1 if there are free buffers */ /* returns 1 if there are free buffers */
PRIVATE int free_buf (u32_t *val, int *len, int sub_dev_nr) { static int free_buf (u32_t *val, int *len, int sub_dev_nr) {
*len = sizeof(*val); *len = sizeof(*val);
if (sub_dev[sub_dev_nr].BufLength == if (sub_dev[sub_dev_nr].BufLength ==
sub_dev[sub_dev_nr].NrOfExtraBuffers) { sub_dev[sub_dev_nr].NrOfExtraBuffers) {
@@ -644,7 +644,7 @@ PRIVATE int free_buf (u32_t *val, int *len, int sub_dev_nr) {
} }
PRIVATE int get_set_volume(struct volume_level *level, int *len, int sub_dev, static int get_set_volume(struct volume_level *level, int *len, int sub_dev,
int flag) { int flag) {
*len = sizeof(struct volume_level); *len = sizeof(struct volume_level);
if (sub_dev == MIXER) { if (sub_dev == MIXER) {

View File

@@ -14,7 +14,7 @@
/*===========================================================================* /*===========================================================================*
* helper functions for I/O * * helper functions for I/O *
*===========================================================================*/ *===========================================================================*/
PUBLIC u32_t pci_inb(u16_t port) { u32_t pci_inb(u16_t port) {
u32_t value; u32_t value;
int s; int s;
if ((s=sys_inb(port, &value)) !=OK) if ((s=sys_inb(port, &value)) !=OK)
@@ -23,7 +23,7 @@ PUBLIC u32_t pci_inb(u16_t port) {
} }
PUBLIC u32_t pci_inw(u16_t port) { u32_t pci_inw(u16_t port) {
u32_t value; u32_t value;
int s; int s;
if ((s=sys_inw(port, &value)) !=OK) if ((s=sys_inw(port, &value)) !=OK)
@@ -32,7 +32,7 @@ PUBLIC u32_t pci_inw(u16_t port) {
} }
PUBLIC u32_t pci_inl(u16_t port) { u32_t pci_inl(u16_t port) {
u32_t value; u32_t value;
int s; int s;
if ((s=sys_inl(port, &value)) !=OK) if ((s=sys_inl(port, &value)) !=OK)
@@ -41,21 +41,21 @@ PUBLIC u32_t pci_inl(u16_t port) {
} }
PUBLIC void pci_outb(u16_t port, u8_t value) { void pci_outb(u16_t port, u8_t value) {
int s; int s;
if ((s=sys_outb(port, value)) !=OK) if ((s=sys_outb(port, value)) !=OK)
printf("%s: warning, sys_outb failed: %d\n", DRIVER_NAME, s); printf("%s: warning, sys_outb failed: %d\n", DRIVER_NAME, s);
} }
PUBLIC void pci_outw(u16_t port, u16_t value) { void pci_outw(u16_t port, u16_t value) {
int s; int s;
if ((s=sys_outw(port, value)) !=OK) if ((s=sys_outw(port, value)) !=OK)
printf("%s: warning, sys_outw failed: %d\n", DRIVER_NAME, s); printf("%s: warning, sys_outw failed: %d\n", DRIVER_NAME, s);
} }
PUBLIC void pci_outl(u16_t port, u32_t value) { void pci_outl(u16_t port, u32_t value) {
int s; int s;
if ((s=sys_outl(port, value)) !=OK) if ((s=sys_outl(port, value)) !=OK)
printf("%s: warning, sys_outl failed: %d\n", DRIVER_NAME, s); printf("%s: warning, sys_outl failed: %d\n", DRIVER_NAME, s);

View File

@@ -34,9 +34,9 @@
FORWARD int src_reg_read(const DEV_STRUCT * DSP, u16_t reg, u16_t static int src_reg_read(const DEV_STRUCT * DSP, u16_t reg, u16_t
*data); *data);
FORWARD int src_reg_write(const DEV_STRUCT * DSP, u16_t reg, u16_t val); static int src_reg_write(const DEV_STRUCT * DSP, u16_t reg, u16_t val);
int src_init ( DEV_STRUCT * DSP ) { int src_init ( DEV_STRUCT * DSP ) {
@@ -103,7 +103,7 @@ int src_init ( DEV_STRUCT * DSP ) {
} }
PRIVATE int src_reg_read(const DEV_STRUCT * DSP, u16_t reg, u16_t *data) { static int src_reg_read(const DEV_STRUCT * DSP, u16_t reg, u16_t *data) {
u32_t dtemp; u32_t dtemp;
/* wait for ready */ /* wait for ready */
@@ -129,7 +129,7 @@ PRIVATE int src_reg_read(const DEV_STRUCT * DSP, u16_t reg, u16_t *data) {
} }
PRIVATE int src_reg_write(const DEV_STRUCT * DSP, u16_t reg, u16_t val) { static int src_reg_write(const DEV_STRUCT * DSP, u16_t reg, u16_t val) {
u32_t dtemp; u32_t dtemp;
/* wait for ready */ /* wait for ready */

View File

@@ -3,10 +3,10 @@
FORWARD int get_set_volume(struct volume_level *level, int flag); static int get_set_volume(struct volume_level *level, int flag);
FORWARD int get_set_input(struct inout_ctrl *input, int flag, int static int get_set_input(struct inout_ctrl *input, int flag, int
channel); channel);
FORWARD int get_set_output(struct inout_ctrl *output, int flag); static int get_set_output(struct inout_ctrl *output, int flag);
@@ -14,7 +14,7 @@ FORWARD int get_set_output(struct inout_ctrl *output, int flag);
/*=========================================================================* /*=========================================================================*
* mixer_ioctl * mixer_ioctl
*=========================================================================*/ *=========================================================================*/
PUBLIC int mixer_ioctl(int request, void *val, int *UNUSED(len)) { int mixer_ioctl(int request, void *val, int *UNUSED(len)) {
int status; int status;
switch(request) { switch(request) {
@@ -36,7 +36,7 @@ PUBLIC int mixer_ioctl(int request, void *val, int *UNUSED(len)) {
/*=========================================================================* /*=========================================================================*
* mixer_init * mixer_init
*=========================================================================*/ *=========================================================================*/
PUBLIC int mixer_init() { int mixer_init() {
/* Try to detect the mixer by writing to MIXER_DAC_LEVEL if the /* Try to detect the mixer by writing to MIXER_DAC_LEVEL if the
* value written can be read back the mixer is there * value written can be read back the mixer is there
*/ */
@@ -60,7 +60,7 @@ PUBLIC int mixer_init() {
/*=========================================================================* /*=========================================================================*
* get_set_volume * * get_set_volume *
*=========================================================================*/ *=========================================================================*/
PRIVATE int get_set_volume(struct volume_level *level, int flag) { static int get_set_volume(struct volume_level *level, int flag) {
int cmd_left, cmd_right, shift, max_level; int cmd_left, cmd_right, shift, max_level;
shift = 3; shift = 3;
@@ -133,7 +133,7 @@ PRIVATE int get_set_volume(struct volume_level *level, int flag) {
/*=========================================================================* /*=========================================================================*
* get_set_input * * get_set_input *
*=========================================================================*/ *=========================================================================*/
PRIVATE int get_set_input(struct inout_ctrl *input, int flag, int channel) { static int get_set_input(struct inout_ctrl *input, int flag, int channel) {
int input_cmd, input_mask, mask, del_mask, shift; int input_cmd, input_mask, mask, del_mask, shift;
input_cmd = (channel == 0 ? MIXER_IN_LEFT : MIXER_IN_RIGHT); input_cmd = (channel == 0 ? MIXER_IN_LEFT : MIXER_IN_RIGHT);
@@ -187,7 +187,7 @@ PRIVATE int get_set_input(struct inout_ctrl *input, int flag, int channel) {
/*=========================================================================* /*=========================================================================*
* get_set_output * * get_set_output *
*=========================================================================*/ *=========================================================================*/
PRIVATE int get_set_output(struct inout_ctrl *output, int flag) { static int get_set_output(struct inout_ctrl *output, int flag) {
int output_mask, mask, del_mask, shift; int output_mask, mask, del_mask, shift;
mask = mixer_get(MIXER_OUTPUT_CTRL); mask = mixer_get(MIXER_OUTPUT_CTRL);
@@ -233,7 +233,7 @@ PRIVATE int get_set_output(struct inout_ctrl *output, int flag) {
PUBLIC int mixer_set(int reg, int data) { int mixer_set(int reg, int data) {
int i; int i;
sb16_outb(MIXER_REG, reg); sb16_outb(MIXER_REG, reg);
@@ -245,7 +245,7 @@ PUBLIC int mixer_set(int reg, int data) {
PUBLIC int mixer_get(int reg) { int mixer_get(int reg) {
int i; int i;
sb16_outb(MIXER_REG, reg); sb16_outb(MIXER_REG, reg);

View File

@@ -11,34 +11,34 @@
#include "mixer.h" #include "mixer.h"
FORWARD void dsp_dma_setup(phys_bytes address, int count, int sub_dev); static void dsp_dma_setup(phys_bytes address, int count, int sub_dev);
FORWARD int dsp_ioctl(int request, void *val, int *len); static int dsp_ioctl(int request, void *val, int *len);
FORWARD int dsp_set_size(unsigned int size); static int dsp_set_size(unsigned int size);
FORWARD int dsp_set_speed(unsigned int speed); static int dsp_set_speed(unsigned int speed);
FORWARD int dsp_set_stereo(unsigned int stereo); static int dsp_set_stereo(unsigned int stereo);
FORWARD int dsp_set_bits(unsigned int bits); static int dsp_set_bits(unsigned int bits);
FORWARD int dsp_set_sign(unsigned int sign); static int dsp_set_sign(unsigned int sign);
FORWARD int dsp_get_max_frag_size(u32_t *val, int *len); static int dsp_get_max_frag_size(u32_t *val, int *len);
PRIVATE unsigned int DspStereo = DEFAULT_STEREO; static unsigned int DspStereo = DEFAULT_STEREO;
PRIVATE unsigned int DspSpeed = DEFAULT_SPEED; static unsigned int DspSpeed = DEFAULT_SPEED;
PRIVATE unsigned int DspBits = DEFAULT_BITS; static unsigned int DspBits = DEFAULT_BITS;
PRIVATE unsigned int DspSign = DEFAULT_SIGN; static unsigned int DspSign = DEFAULT_SIGN;
PRIVATE unsigned int DspFragmentSize; static unsigned int DspFragmentSize;
PRIVATE phys_bytes DmaPhys; static phys_bytes DmaPhys;
PRIVATE int running = FALSE; static int running = FALSE;
PUBLIC sub_dev_t sub_dev[2]; sub_dev_t sub_dev[2];
PUBLIC special_file_t special_file[3]; special_file_t special_file[3];
PUBLIC drv_t drv; drv_t drv;
PUBLIC int drv_init(void) { int drv_init(void) {
drv.DriverName = "SB16"; drv.DriverName = "SB16";
drv.NrOfSubDevices = 2; drv.NrOfSubDevices = 2;
drv.NrOfSpecialFiles = 3; drv.NrOfSpecialFiles = 3;
@@ -72,7 +72,7 @@ PUBLIC int drv_init(void) {
} }
PUBLIC int drv_init_hw(void) { int drv_init_hw(void) {
int i; int i;
int DspVersion[2]; int DspVersion[2];
Dprint(("drv_init_hw():\n")); Dprint(("drv_init_hw():\n"));
@@ -114,7 +114,7 @@ PUBLIC int drv_init_hw(void) {
PUBLIC int drv_reset(void) { int drv_reset(void) {
int i; int i;
Dprint(("drv_reset():\n")); Dprint(("drv_reset():\n"));
@@ -131,7 +131,7 @@ PUBLIC int drv_reset(void) {
PUBLIC int drv_start(int channel, int DmaMode) { int drv_start(int channel, int DmaMode) {
Dprint(("drv_start():\n")); Dprint(("drv_start():\n"));
drv_reset(); drv_reset();
@@ -178,7 +178,7 @@ PUBLIC int drv_start(int channel, int DmaMode) {
PUBLIC int drv_stop(int sub_dev) { int drv_stop(int sub_dev) {
if(running) { if(running) {
Dprint(("drv_stop():\n")); Dprint(("drv_stop():\n"));
dsp_command((DspBits == 8 ? DSP_CMD_DMA8HALT : DSP_CMD_DMA16HALT)); dsp_command((DspBits == 8 ? DSP_CMD_DMA8HALT : DSP_CMD_DMA16HALT));
@@ -190,7 +190,7 @@ PUBLIC int drv_stop(int sub_dev) {
PUBLIC int drv_set_dma(u32_t dma, u32_t UNUSED(length), int UNUSED(chan)) { int drv_set_dma(u32_t dma, u32_t UNUSED(length), int UNUSED(chan)) {
Dprint(("drv_set_dma():\n")); Dprint(("drv_set_dma():\n"));
DmaPhys = dma; DmaPhys = dma;
return OK; return OK;
@@ -198,7 +198,7 @@ PUBLIC int drv_set_dma(u32_t dma, u32_t UNUSED(length), int UNUSED(chan)) {
PUBLIC int drv_reenable_int(int UNUSED(chan)) { int drv_reenable_int(int UNUSED(chan)) {
Dprint(("drv_reenable_int()\n")); Dprint(("drv_reenable_int()\n"));
sb16_inb((DspBits == 8 ? DSP_DATA_AVL : DSP_DATA16_AVL)); sb16_inb((DspBits == 8 ? DSP_DATA_AVL : DSP_DATA16_AVL));
return OK; return OK;
@@ -206,33 +206,33 @@ PUBLIC int drv_reenable_int(int UNUSED(chan)) {
PUBLIC int drv_int_sum(void) { int drv_int_sum(void) {
return mixer_get(MIXER_IRQ_STATUS) & 0x0F; return mixer_get(MIXER_IRQ_STATUS) & 0x0F;
} }
PUBLIC int drv_int(int sub_dev) { int drv_int(int sub_dev) {
return sub_dev == AUDIO && mixer_get(MIXER_IRQ_STATUS) & 0x03; return sub_dev == AUDIO && mixer_get(MIXER_IRQ_STATUS) & 0x03;
} }
PUBLIC int drv_pause(int chan) { int drv_pause(int chan) {
drv_stop(chan); drv_stop(chan);
return OK; return OK;
} }
PUBLIC int drv_resume(int UNUSED(chan)) { int drv_resume(int UNUSED(chan)) {
dsp_command((DspBits == 8 ? DSP_CMD_DMA8CONT : DSP_CMD_DMA16CONT)); dsp_command((DspBits == 8 ? DSP_CMD_DMA8CONT : DSP_CMD_DMA16CONT));
return OK; return OK;
} }
PUBLIC int drv_io_ctl(int request, void *val, int *len, int sub_dev) { int drv_io_ctl(int request, void *val, int *len, int sub_dev) {
Dprint(("dsp_ioctl: got ioctl %d, argument: %d sub_dev: %d\n", request, val, sub_dev)); Dprint(("dsp_ioctl: got ioctl %d, argument: %d sub_dev: %d\n", request, val, sub_dev));
if(sub_dev == AUDIO) { if(sub_dev == AUDIO) {
@@ -246,7 +246,7 @@ PUBLIC int drv_io_ctl(int request, void *val, int *len, int sub_dev) {
PUBLIC int drv_get_irq(char *irq) { int drv_get_irq(char *irq) {
Dprint(("drv_get_irq():\n")); Dprint(("drv_get_irq():\n"));
*irq = SB_IRQ; *irq = SB_IRQ;
return OK; return OK;
@@ -254,7 +254,7 @@ PUBLIC int drv_get_irq(char *irq) {
PUBLIC int drv_get_frag_size(u32_t *frag_size, int UNUSED(sub_dev)) { int drv_get_frag_size(u32_t *frag_size, int UNUSED(sub_dev)) {
Dprint(("drv_get_frag_size():\n")); Dprint(("drv_get_frag_size():\n"));
*frag_size = DspFragmentSize; *frag_size = DspFragmentSize;
return OK; return OK;
@@ -262,7 +262,7 @@ PUBLIC int drv_get_frag_size(u32_t *frag_size, int UNUSED(sub_dev)) {
PRIVATE int dsp_ioctl(int request, void *val, int *len) { static int dsp_ioctl(int request, void *val, int *len) {
int status; int status;
switch(request) { switch(request) {
@@ -281,7 +281,7 @@ PRIVATE int dsp_ioctl(int request, void *val, int *len) {
PRIVATE void dsp_dma_setup(phys_bytes address, int count, int DmaMode) { static void dsp_dma_setup(phys_bytes address, int count, int DmaMode) {
pvb_pair_t pvb[9]; pvb_pair_t pvb[9];
Dprint(("Setting up %d bit DMA\n", DspBits)); Dprint(("Setting up %d bit DMA\n", DspBits));
@@ -326,7 +326,7 @@ PRIVATE void dsp_dma_setup(phys_bytes address, int count, int DmaMode) {
PRIVATE int dsp_set_size(unsigned int size) { static int dsp_set_size(unsigned int size) {
Dprint(("dsp_set_size(): set fragment size to %u\n", size)); Dprint(("dsp_set_size(): set fragment size to %u\n", size));
/* Sanity checks */ /* Sanity checks */
@@ -341,7 +341,7 @@ PRIVATE int dsp_set_size(unsigned int size) {
PRIVATE int dsp_set_speed(unsigned int speed) { static int dsp_set_speed(unsigned int speed) {
Dprint(("sb16: setting speed to %u, stereo = %d\n", speed, DspStereo)); Dprint(("sb16: setting speed to %u, stereo = %d\n", speed, DspStereo));
if(speed < DSP_MIN_SPEED || speed > DSP_MAX_SPEED) { if(speed < DSP_MIN_SPEED || speed > DSP_MAX_SPEED) {
@@ -369,7 +369,7 @@ PRIVATE int dsp_set_speed(unsigned int speed) {
PRIVATE int dsp_set_stereo(unsigned int stereo) { static int dsp_set_stereo(unsigned int stereo) {
if(stereo) { if(stereo) {
DspStereo = 1; DspStereo = 1;
} else { } else {
@@ -381,7 +381,7 @@ PRIVATE int dsp_set_stereo(unsigned int stereo) {
PRIVATE int dsp_set_bits(unsigned int bits) { static int dsp_set_bits(unsigned int bits) {
/* Sanity checks */ /* Sanity checks */
if(bits != 8 && bits != 16) { if(bits != 8 && bits != 16) {
return EINVAL; return EINVAL;
@@ -394,7 +394,7 @@ PRIVATE int dsp_set_bits(unsigned int bits) {
PRIVATE int dsp_set_sign(unsigned int sign) { static int dsp_set_sign(unsigned int sign) {
Dprint(("sb16: set sign to %u\n", sign)); Dprint(("sb16: set sign to %u\n", sign));
DspSign = (sign > 0 ? 1 : 0); DspSign = (sign > 0 ? 1 : 0);
@@ -404,7 +404,7 @@ PRIVATE int dsp_set_sign(unsigned int sign) {
PRIVATE int dsp_get_max_frag_size(u32_t *val, int *len) { static int dsp_get_max_frag_size(u32_t *val, int *len) {
*len = sizeof(*val); *len = sizeof(*val);
*val = sub_dev[AUDIO].DmaSize / sub_dev[AUDIO].NrOfDmaFragments; *val = sub_dev[AUDIO].DmaSize / sub_dev[AUDIO].NrOfDmaFragments;
return OK; return OK;
@@ -412,7 +412,7 @@ PRIVATE int dsp_get_max_frag_size(u32_t *val, int *len) {
PUBLIC int dsp_command(int value) { int dsp_command(int value) {
int i; int i;
for (i = 0; i < SB_TIMEOUT; i++) { for (i = 0; i < SB_TIMEOUT; i++) {
@@ -428,7 +428,7 @@ PUBLIC int dsp_command(int value) {
PUBLIC int sb16_inb(int port) { int sb16_inb(int port) {
int s; int s;
u32_t value; u32_t value;
@@ -440,7 +440,7 @@ PUBLIC int sb16_inb(int port) {
PUBLIC void sb16_outb(int port, int value) { void sb16_outb(int port, int value) {
int s; int s;
if ((s=sys_outb(port, value)) != OK) if ((s=sys_outb(port, value)) != OK)

View File

@@ -36,7 +36,7 @@
#define NR_SUBDEVS (MAX_DRIVES * SUB_PER_DRIVE) #define NR_SUBDEVS (MAX_DRIVES * SUB_PER_DRIVE)
/* Variables. */ /* Variables. */
PRIVATE struct wini { /* main drive struct, one entry per drive */ static struct wini { /* main drive struct, one entry per drive */
unsigned cylinders; /* number of cylinders */ unsigned cylinders; /* number of cylinders */
unsigned heads; /* number of heads */ unsigned heads; /* number of heads */
unsigned sectors; /* number of sectors per track */ unsigned sectors; /* number of sectors per track */
@@ -48,27 +48,27 @@ PRIVATE struct wini { /* main drive struct, one entry per drive */
struct device subpart[SUB_PER_DRIVE]; /* subpartitions */ struct device subpart[SUB_PER_DRIVE]; /* subpartitions */
} wini[MAX_DRIVES], *w_wn; } wini[MAX_DRIVES], *w_wn;
PRIVATE int w_drive; /* selected drive */ static int w_drive; /* selected drive */
PRIVATE struct device *w_dv; /* device's base and size */ static struct device *w_dv; /* device's base and size */
PRIVATE char *bios_buf_v; static char *bios_buf_v;
PRIVATE phys_bytes bios_buf_phys; static phys_bytes bios_buf_phys;
PRIVATE int remap_first = 0; /* Remap drives for CD HD emulation */ static int remap_first = 0; /* Remap drives for CD HD emulation */
#define BIOSBUF 16384 #define BIOSBUF 16384
int main(void); int main(void);
FORWARD struct device *w_prepare(dev_t device); static struct device *w_prepare(dev_t device);
FORWARD struct device *w_part(dev_t minor); static struct device *w_part(dev_t minor);
FORWARD ssize_t w_transfer(dev_t minor, int do_write, u64_t position, static ssize_t w_transfer(dev_t minor, int do_write, u64_t position,
endpoint_t endpt, iovec_t *iov, unsigned int nr_req, int flags); endpoint_t endpt, iovec_t *iov, unsigned int nr_req, int flags);
FORWARD int w_do_open(dev_t minor, int access); static int w_do_open(dev_t minor, int access);
FORWARD int w_do_close(dev_t minor); static int w_do_close(dev_t minor);
FORWARD void w_init(void); static void w_init(void);
FORWARD void w_geometry(dev_t minor, struct partition *entry); static void w_geometry(dev_t minor, struct partition *entry);
FORWARD int w_ioctl(dev_t minor, unsigned int request, endpoint_t endpt, static int w_ioctl(dev_t minor, unsigned int request, endpoint_t endpt,
cp_grant_id_t grant); cp_grant_id_t grant);
/* Entry points to this driver. */ /* Entry points to this driver. */
PRIVATE struct blockdriver w_dtab = { static struct blockdriver w_dtab = {
BLOCKDRIVER_TYPE_DISK, /* handle partition requests */ BLOCKDRIVER_TYPE_DISK, /* handle partition requests */
w_do_open, /* open or mount request, initialize device */ w_do_open, /* open or mount request, initialize device */
w_do_close, /* release device */ w_do_close, /* release device */
@@ -84,13 +84,13 @@ PRIVATE struct blockdriver w_dtab = {
}; };
/* SEF functions and variables. */ /* SEF functions and variables. */
FORWARD void sef_local_startup(void); static void sef_local_startup(void);
FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info); static int sef_cb_init_fresh(int type, sef_init_info_t *info);
/*===========================================================================* /*===========================================================================*
* bios_winchester_task * * bios_winchester_task *
*===========================================================================*/ *===========================================================================*/
PUBLIC int main(void) int main(void)
{ {
/* SEF local startup. */ /* SEF local startup. */
sef_local_startup(); sef_local_startup();
@@ -104,7 +104,7 @@ PUBLIC int main(void)
/*===========================================================================* /*===========================================================================*
* sef_local_startup * * sef_local_startup *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_local_startup(void) static void sef_local_startup(void)
{ {
/* Register init callbacks. */ /* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh); sef_setcb_init_fresh(sef_cb_init_fresh);
@@ -121,7 +121,7 @@ PRIVATE void sef_local_startup(void)
/*===========================================================================* /*===========================================================================*
* sef_cb_init_fresh * * sef_cb_init_fresh *
*===========================================================================*/ *===========================================================================*/
PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info)) static int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
{ {
/* Initialize the bios_wini driver. */ /* Initialize the bios_wini driver. */
long v; long v;
@@ -139,7 +139,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
/*===========================================================================* /*===========================================================================*
* w_prepare * * w_prepare *
*===========================================================================*/ *===========================================================================*/
PRIVATE struct device *w_prepare(dev_t device) static struct device *w_prepare(dev_t device)
{ {
/* Prepare for I/O on a device. */ /* Prepare for I/O on a device. */
@@ -163,7 +163,7 @@ PRIVATE struct device *w_prepare(dev_t device)
/*===========================================================================* /*===========================================================================*
* w_part * * w_part *
*===========================================================================*/ *===========================================================================*/
PRIVATE struct device *w_part(dev_t minor) static struct device *w_part(dev_t minor)
{ {
/* Return a pointer to the partition information of the given minor device. */ /* Return a pointer to the partition information of the given minor device. */
@@ -173,7 +173,7 @@ PRIVATE struct device *w_part(dev_t minor)
/*===========================================================================* /*===========================================================================*
* w_transfer * * w_transfer *
*===========================================================================*/ *===========================================================================*/
PRIVATE ssize_t w_transfer( static ssize_t w_transfer(
dev_t minor, /* minor device number */ dev_t minor, /* minor device number */
int do_write, /* read or write? */ int do_write, /* read or write? */
u64_t pos64, /* offset on device to read or write */ u64_t pos64, /* offset on device to read or write */
@@ -356,7 +356,7 @@ PRIVATE ssize_t w_transfer(
/*============================================================================* /*============================================================================*
* w_do_open * * w_do_open *
*============================================================================*/ *============================================================================*/
PRIVATE int w_do_open(dev_t minor, int UNUSED(access)) static int w_do_open(dev_t minor, int UNUSED(access))
{ {
/* Device open: Initialize the controller and read the partition table. */ /* Device open: Initialize the controller and read the partition table. */
@@ -376,7 +376,7 @@ PRIVATE int w_do_open(dev_t minor, int UNUSED(access))
/*============================================================================* /*============================================================================*
* w_do_close * * w_do_close *
*============================================================================*/ *============================================================================*/
PRIVATE int w_do_close(dev_t minor) static int w_do_close(dev_t minor)
{ {
/* Device close: Release a device. */ /* Device close: Release a device. */
@@ -388,7 +388,7 @@ PRIVATE int w_do_close(dev_t minor)
/*===========================================================================* /*===========================================================================*
* w_init * * w_init *
*===========================================================================*/ *===========================================================================*/
PRIVATE void w_init(void) static void w_init(void)
{ {
/* This routine is called at startup to initialize the drive parameters. */ /* This routine is called at startup to initialize the drive parameters. */
@@ -498,7 +498,7 @@ PRIVATE void w_init(void)
/*============================================================================* /*============================================================================*
* w_geometry * * w_geometry *
*============================================================================*/ *============================================================================*/
PRIVATE void w_geometry(dev_t minor, struct partition *entry) static void w_geometry(dev_t minor, struct partition *entry)
{ {
if (w_prepare(minor) == NULL) return; if (w_prepare(minor) == NULL) return;
@@ -510,7 +510,7 @@ PRIVATE void w_geometry(dev_t minor, struct partition *entry)
/*============================================================================* /*============================================================================*
* w_ioctl * * w_ioctl *
*============================================================================*/ *============================================================================*/
PRIVATE int w_ioctl(dev_t minor, unsigned int request, endpoint_t endpt, static int w_ioctl(dev_t minor, unsigned int request, endpoint_t endpt,
cp_grant_id_t grant) cp_grant_id_t grant)
{ {
int count; int count;

View File

@@ -26,28 +26,28 @@
#include "dec21140A.h" #include "dec21140A.h"
PRIVATE u32_t io_inl(u16_t); static u32_t io_inl(u16_t);
PRIVATE void io_outl(u16_t, u32_t); static void io_outl(u16_t, u32_t);
PRIVATE void do_conf(const message *); static void do_conf(const message *);
PRIVATE void do_get_stat_s(message *); static void do_get_stat_s(message *);
PRIVATE void do_interrupt(const dpeth_t *); static void do_interrupt(const dpeth_t *);
PRIVATE void do_reply(dpeth_t *); static void do_reply(dpeth_t *);
PRIVATE void do_vread_s(const message *, int); static void do_vread_s(const message *, int);
PRIVATE void do_watchdog(void *); static void do_watchdog(void *);
PRIVATE void de_update_conf(dpeth_t *); static void de_update_conf(dpeth_t *);
PRIVATE int de_probe(dpeth_t *, int skip); static int de_probe(dpeth_t *, int skip);
PRIVATE void de_conf_addr(dpeth_t *); static void de_conf_addr(dpeth_t *);
PRIVATE void de_first_init(dpeth_t *); static void de_first_init(dpeth_t *);
PRIVATE void de_reset(const dpeth_t *); static void de_reset(const dpeth_t *);
PRIVATE void de_hw_conf(const dpeth_t *); static void de_hw_conf(const dpeth_t *);
PRIVATE void de_start(const dpeth_t *); static void de_start(const dpeth_t *);
PRIVATE void de_setup_frame(const dpeth_t *); static void de_setup_frame(const dpeth_t *);
PRIVATE u16_t de_read_rom(const dpeth_t *, u8_t, u8_t); static u16_t de_read_rom(const dpeth_t *, u8_t, u8_t);
PRIVATE int de_calc_iov_size(iovec_dat_s_t *); static int de_calc_iov_size(iovec_dat_s_t *);
PRIVATE void de_next_iov(iovec_dat_s_t *); static void de_next_iov(iovec_dat_s_t *);
PRIVATE void do_vwrite_s(const message *, int); static void do_vwrite_s(const message *, int);
PRIVATE void de_get_userdata_s(int, cp_grant_id_t, vir_bytes, int, void static void de_get_userdata_s(int, cp_grant_id_t, vir_bytes, int, void
*); *);
/* Error messages */ /* Error messages */
@@ -60,12 +60,12 @@ static char str_StatErrMsg[] = "Unable to send stats";
static char str_AlignErrMsg[] = "Bad align of buffer/descriptor"; static char str_AlignErrMsg[] = "Bad align of buffer/descriptor";
static char str_DevName[] = "dec21140A:eth#?"; static char str_DevName[] = "dec21140A:eth#?";
PRIVATE dpeth_t de_state; static dpeth_t de_state;
PRIVATE int de_instance; static int de_instance;
/* SEF functions and variables. */ /* SEF functions and variables. */
FORWARD void sef_local_startup(void); static void sef_local_startup(void);
FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info); static int sef_cb_init_fresh(int type, sef_init_info_t *info);
/*===========================================================================* /*===========================================================================*
* main * * main *
@@ -126,7 +126,7 @@ int main(int argc, char *argv[])
/*===========================================================================* /*===========================================================================*
* sef_local_startup * * sef_local_startup *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_local_startup() static void sef_local_startup()
{ {
/* Register init callbacks. */ /* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh); sef_setcb_init_fresh(sef_cb_init_fresh);
@@ -147,7 +147,7 @@ PRIVATE void sef_local_startup()
/*===========================================================================* /*===========================================================================*
* sef_cb_init_fresh * * sef_cb_init_fresh *
*===========================================================================*/ *===========================================================================*/
PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info)) static int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
{ {
/* Initialize the DEC 21140A driver. */ /* Initialize the DEC 21140A driver. */
int fkeys, sfkeys; int fkeys, sfkeys;
@@ -169,7 +169,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
return OK; return OK;
} }
PRIVATE void do_get_stat_s(message * mp) static void do_get_stat_s(message * mp)
{ {
int rc; int rc;
dpeth_t *dep; dpeth_t *dep;
@@ -188,7 +188,7 @@ PRIVATE void do_get_stat_s(message * mp)
return; return;
} }
PRIVATE void do_conf(const message * mp) static void do_conf(const message * mp)
{ {
int r; int r;
dpeth_t *dep; dpeth_t *dep;
@@ -257,7 +257,7 @@ PRIVATE void do_conf(const message * mp)
return; return;
} }
PRIVATE void do_reply(dpeth_t * dep) static void do_reply(dpeth_t * dep)
{ {
message reply; message reply;
int r, flags = DL_NOFLAGS; int r, flags = DL_NOFLAGS;
@@ -279,13 +279,13 @@ PRIVATE void do_reply(dpeth_t * dep)
return; return;
} }
PRIVATE void do_watchdog(void *UNUSED(message)) static void do_watchdog(void *UNUSED(message))
{ {
/* nothing here yet */ /* nothing here yet */
return; return;
} }
PRIVATE int de_probe(dpeth_t *dep, int skip) static int de_probe(dpeth_t *dep, int skip)
{ {
int i, r, devind; int i, r, devind;
u16_t vid, did, temp16; u16_t vid, did, temp16;
@@ -345,7 +345,7 @@ PRIVATE int de_probe(dpeth_t *dep, int skip)
return TRUE; return TRUE;
} }
PRIVATE u16_t de_read_rom(const dpeth_t *dep, u8_t addr, u8_t nbAddrBits){ static u16_t de_read_rom(const dpeth_t *dep, u8_t addr, u8_t nbAddrBits){
u16_t retVal = 0; u16_t retVal = 0;
int i; int i;
u32_t csr = 0; u32_t csr = 0;
@@ -421,7 +421,7 @@ static void de_update_conf(dpeth_t * dep)
return; return;
} }
PRIVATE void do_vread_s(const message * mp, int from_int) static void do_vread_s(const message * mp, int from_int)
{ {
u8_t *buffer; u8_t *buffer;
u32_t size; u32_t size;
@@ -552,7 +552,7 @@ PRIVATE void do_vread_s(const message * mp, int from_int)
return; return;
} }
PRIVATE void de_conf_addr(dpeth_t * dep) static void de_conf_addr(dpeth_t * dep)
{ {
static char ea_fmt[] = "x:x:x:x:x:x"; static char ea_fmt[] = "x:x:x:x:x:x";
char ea_key[16]; char ea_key[16];
@@ -574,7 +574,7 @@ PRIVATE void de_conf_addr(dpeth_t * dep)
return; return;
} }
PRIVATE void de_first_init(dpeth_t *dep) static void de_first_init(dpeth_t *dep)
{ {
int i,j,r; int i,j,r;
vir_bytes descr_vir = (vir_bytes)dep->sendrecv_descr_buf; vir_bytes descr_vir = (vir_bytes)dep->sendrecv_descr_buf;
@@ -666,7 +666,7 @@ PRIVATE void de_first_init(dpeth_t *dep)
sys_irqenable(&dep->de_hook); sys_irqenable(&dep->de_hook);
} }
PRIVATE void do_interrupt(const dpeth_t *dep){ static void do_interrupt(const dpeth_t *dep){
u32_t val; u32_t val;
val = io_inl(CSR_ADDR(dep, CSR5)); val = io_inl(CSR_ADDR(dep, CSR5));
@@ -687,11 +687,11 @@ PRIVATE void do_interrupt(const dpeth_t *dep){
return; return;
} }
PRIVATE void de_reset(const dpeth_t *dep){ static void de_reset(const dpeth_t *dep){
io_outl(CSR_ADDR(dep, CSR0), CSR0_SWR); io_outl(CSR_ADDR(dep, CSR0), CSR0_SWR);
} }
PRIVATE void de_hw_conf(const dpeth_t *dep){ static void de_hw_conf(const dpeth_t *dep){
u32_t val; u32_t val;
/* CSR0 - global host bus prop */ /* CSR0 - global host bus prop */
@@ -716,13 +716,13 @@ PRIVATE void de_hw_conf(const dpeth_t *dep){
io_outl(CSR_ADDR(dep, CSR6), val); io_outl(CSR_ADDR(dep, CSR6), val);
} }
PRIVATE void de_start(const dpeth_t *dep){ static void de_start(const dpeth_t *dep){
u32_t val; u32_t val;
val = io_inl(CSR_ADDR(dep, CSR6)) | CSR6_ST | CSR6_SR; val = io_inl(CSR_ADDR(dep, CSR6)) | CSR6_ST | CSR6_SR;
io_outl(CSR_ADDR(dep, CSR6), val); io_outl(CSR_ADDR(dep, CSR6), val);
} }
PRIVATE void de_setup_frame(const dpeth_t *dep){ static void de_setup_frame(const dpeth_t *dep){
int i; int i;
u32_t val; u32_t val;
@@ -756,7 +756,7 @@ PRIVATE void de_setup_frame(const dpeth_t *dep){
return; return;
} }
PRIVATE int de_calc_iov_size(iovec_dat_s_t * iovp){ static int de_calc_iov_size(iovec_dat_s_t * iovp){
int size, ix; int size, ix;
size = ix = 0; size = ix = 0;
@@ -770,7 +770,7 @@ PRIVATE int de_calc_iov_size(iovec_dat_s_t * iovp){
return size; return size;
} }
PRIVATE void de_get_userdata_s(int user_proc, cp_grant_id_t grant, static void de_get_userdata_s(int user_proc, cp_grant_id_t grant,
vir_bytes offset, int count, void *loc_addr){ vir_bytes offset, int count, void *loc_addr){
int rc; int rc;
vir_bytes len; vir_bytes len;
@@ -782,7 +782,7 @@ PRIVATE void de_get_userdata_s(int user_proc, cp_grant_id_t grant,
return; return;
} }
PRIVATE void de_next_iov(iovec_dat_s_t * iovp){ static void de_next_iov(iovec_dat_s_t * iovp){
iovp->iod_iovec_s -= IOVEC_NR; iovp->iod_iovec_s -= IOVEC_NR;
iovp->iod_iovec_offset += IOVEC_NR * sizeof(iovec_t); iovp->iod_iovec_offset += IOVEC_NR * sizeof(iovec_t);
@@ -791,7 +791,7 @@ PRIVATE void de_next_iov(iovec_dat_s_t * iovp){
return; return;
} }
PRIVATE void do_vwrite_s(const message * mp, int from_int){ static void do_vwrite_s(const message * mp, int from_int){
static u8_t setupDone = 0; static u8_t setupDone = 0;
int size, r, bytes, ix, totalsize; int size, r, bytes, ix, totalsize;
dpeth_t *dep; dpeth_t *dep;
@@ -881,19 +881,19 @@ PRIVATE void do_vwrite_s(const message * mp, int from_int){
do_reply(dep); do_reply(dep);
} }
PRIVATE void warning(const char *type, int err){ static void warning(const char *type, int err){
printf("Warning: %s sys_%s failed (%d)\n", str_DevName, type, err); printf("Warning: %s sys_%s failed (%d)\n", str_DevName, type, err);
return; return;
} }
PRIVATE u32_t io_inl(u16_t port){ static u32_t io_inl(u16_t port){
u32_t value; u32_t value;
int rc; int rc;
if ((rc = sys_inl(port, &value)) != OK) warning("inl", rc); if ((rc = sys_inl(port, &value)) != OK) warning("inl", rc);
return value; return value;
} }
PRIVATE void io_outl(u16_t port, u32_t value){ static void io_outl(u16_t port, u32_t value){
int rc; int rc;
if ((rc = sys_outl(port, value)) != OK) warning("outl", rc); if ((rc = sys_outl(port, value)) != OK) warning("outl", rc);
return; return;

View File

@@ -44,7 +44,7 @@ typedef struct dp_conf
} dp_conf_t; } dp_conf_t;
#define DP_CONF_NR 4 #define DP_CONF_NR 4
PRIVATE dp_conf_t dp_conf[DP_CONF_NR]= /* Card addresses */ static dp_conf_t dp_conf[DP_CONF_NR]= /* Card addresses */
{ {
/* I/O port, IRQ, Buffer address. */ /* I/O port, IRQ, Buffer address. */
{ 0x280, 3, 0xD0000, }, { 0x280, 3, 0xD0000, },
@@ -124,11 +124,11 @@ static void do_vir_insw(port_t port, int proc, vir_bytes buf, size_t
size); size);
/* SEF functions and variables. */ /* SEF functions and variables. */
FORWARD void sef_local_startup(void); static void sef_local_startup(void);
FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info); static int sef_cb_init_fresh(int type, sef_init_info_t *info);
FORWARD void sef_cb_signal_handler(int signo); static void sef_cb_signal_handler(int signo);
PRIVATE void handle_hw_intr(void) static void handle_hw_intr(void)
{ {
int r, irq; int r, irq;
dpeth_t *dep; dpeth_t *dep;
@@ -202,7 +202,7 @@ int main(int argc, char *argv[])
/*===========================================================================* /*===========================================================================*
* sef_local_startup * * sef_local_startup *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_local_startup() static void sef_local_startup()
{ {
/* Register init callbacks. */ /* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh); sef_setcb_init_fresh(sef_cb_init_fresh);
@@ -223,7 +223,7 @@ PRIVATE void sef_local_startup()
/*===========================================================================* /*===========================================================================*
* sef_cb_init_fresh * * sef_cb_init_fresh *
*===========================================================================*/ *===========================================================================*/
PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info)) static int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
{ {
/* Initialize the dp8390 driver. */ /* Initialize the dp8390 driver. */
dpeth_t *dep; dpeth_t *dep;
@@ -253,7 +253,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
/*===========================================================================* /*===========================================================================*
* sef_cb_signal_handler * * sef_cb_signal_handler *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_cb_signal_handler(int signo) static void sef_cb_signal_handler(int signo)
{ {
/* Only check for termination signal, ignore anything else. */ /* Only check for termination signal, ignore anything else. */
if (signo != SIGTERM) return; if (signo != SIGTERM) return;

View File

@@ -29,10 +29,10 @@ extern u32_t system_hz;
typedef int(*testf_t) (dpeth_t *dep, int pos, u8_t *pat); typedef int(*testf_t) (dpeth_t *dep, int pos, u8_t *pat);
PRIVATE u8_t pat0[]= { 0x00, 0x00, 0x00, 0x00 }; static u8_t pat0[]= { 0x00, 0x00, 0x00, 0x00 };
PRIVATE u8_t pat1[]= { 0xFF, 0xFF, 0xFF, 0xFF }; static u8_t pat1[]= { 0xFF, 0xFF, 0xFF, 0xFF };
PRIVATE u8_t pat2[]= { 0xA5, 0x5A, 0x69, 0x96 }; static u8_t pat2[]= { 0xA5, 0x5A, 0x69, 0x96 };
PRIVATE u8_t pat3[]= { 0x96, 0x69, 0x5A, 0xA5 }; static u8_t pat3[]= { 0x96, 0x69, 0x5A, 0xA5 };
static int test_8(dpeth_t *dep, int pos, u8_t *pat); static int test_8(dpeth_t *dep, int pos, u8_t *pat);
static int test_16(dpeth_t *dep, int pos, u8_t *pat); static int test_16(dpeth_t *dep, int pos, u8_t *pat);

View File

@@ -30,7 +30,7 @@ static void set_ee_word(dpeth_t *dep, int a, u16_t w);
static void ee_wds(dpeth_t *dep); static void ee_wds(dpeth_t *dep);
#endif #endif
PUBLIC int rtl_probe(dep, skip) int rtl_probe(dep, skip)
struct dpeth *dep; struct dpeth *dep;
int skip; int skip;
{ {

View File

@@ -384,7 +384,7 @@ static void el1_init(dpeth_t * dep)
** Name: int el1_probe(dpeth_t *dep) ** Name: int el1_probe(dpeth_t *dep)
** Function: Checks for presence of the board. ** Function: Checks for presence of the board.
*/ */
PUBLIC int el1_probe(dpeth_t * dep) int el1_probe(dpeth_t * dep)
{ {
int ix; int ix;

View File

@@ -555,7 +555,7 @@ static void el3_write_id(port_t port)
** Name: int el3_probe(dpeth_t *dep) ** Name: int el3_probe(dpeth_t *dep)
** Function: Checks for presence of the board. ** Function: Checks for presence of the board.
*/ */
PUBLIC int el3_probe(dpeth_t * dep) int el3_probe(dpeth_t * dep)
{ {
port_t id_port; port_t id_port;

View File

@@ -25,7 +25,7 @@ static void warning(const char *type, int err)
** Name: unsigned int inb(unsigned short int port); ** Name: unsigned int inb(unsigned short int port);
** Function: Reads a byte from specified i/o port. ** Function: Reads a byte from specified i/o port.
*/ */
PUBLIC unsigned int inb(unsigned short port) unsigned int inb(unsigned short port)
{ {
u32_t value; u32_t value;
int rc; int rc;
@@ -38,7 +38,7 @@ PUBLIC unsigned int inb(unsigned short port)
** Name: unsigned int inw(unsigned short int port); ** Name: unsigned int inw(unsigned short int port);
** Function: Reads a word from specified i/o port. ** Function: Reads a word from specified i/o port.
*/ */
PUBLIC unsigned int inw(unsigned short port) unsigned int inw(unsigned short port)
{ {
u32_t value; u32_t value;
int rc; int rc;
@@ -51,7 +51,7 @@ PUBLIC unsigned int inw(unsigned short port)
** Name: unsigned int insb(unsigned short int port, int proc_nr, void *buffer, int count); ** Name: unsigned int insb(unsigned short int port, int proc_nr, void *buffer, int count);
** Function: Reads a sequence of bytes from specified i/o port to user space buffer. ** Function: Reads a sequence of bytes from specified i/o port to user space buffer.
*/ */
PUBLIC void insb(unsigned short int port, endpoint_t proc_nr, void insb(unsigned short int port, endpoint_t proc_nr,
void *buffer, int count) void *buffer, int count)
{ {
int rc; int rc;
@@ -66,7 +66,7 @@ PUBLIC void insb(unsigned short int port, endpoint_t proc_nr,
** Name: void outb(unsigned short int port, unsigned long value); ** Name: void outb(unsigned short int port, unsigned long value);
** Function: Writes a byte to specified i/o port. ** Function: Writes a byte to specified i/o port.
*/ */
PUBLIC void outb(unsigned short port, unsigned long value) void outb(unsigned short port, unsigned long value)
{ {
int rc; int rc;
@@ -78,7 +78,7 @@ PUBLIC void outb(unsigned short port, unsigned long value)
** Name: void outw(unsigned short int port, unsigned long value); ** Name: void outw(unsigned short int port, unsigned long value);
** Function: Writes a word to specified i/o port. ** Function: Writes a word to specified i/o port.
*/ */
PUBLIC void outw(unsigned short port, unsigned long value) void outw(unsigned short port, unsigned long value)
{ {
int rc; int rc;
@@ -90,7 +90,7 @@ PUBLIC void outw(unsigned short port, unsigned long value)
** Name: void outsb(unsigned short int port, int proc_nr, void *buffer, int count); ** Name: void outsb(unsigned short int port, int proc_nr, void *buffer, int count);
** Function: Writes a sequence of bytes from user space to specified i/o port. ** Function: Writes a sequence of bytes from user space to specified i/o port.
*/ */
PUBLIC void outsb(unsigned short port, endpoint_t proc_nr, void *buffer, int count) void outsb(unsigned short port, endpoint_t proc_nr, void *buffer, int count)
{ {
int rc; int rc;

View File

@@ -312,7 +312,7 @@ static void do_init(const message * mp)
** Name: void dp_next_iovec(iovec_dat_t *iovp) ** Name: void dp_next_iovec(iovec_dat_t *iovp)
** Function: Retrieves data from next iovec element. ** Function: Retrieves data from next iovec element.
*/ */
PUBLIC void dp_next_iovec(iovec_dat_s_t * iovp) void dp_next_iovec(iovec_dat_s_t * iovp)
{ {
iovp->iod_iovec_s -= IOVEC_NR; iovp->iod_iovec_s -= IOVEC_NR;
@@ -470,7 +470,7 @@ static void do_watchdog(const void *UNUSED(message))
return; return;
} }
PRIVATE void handle_hw_intr(void) static void handle_hw_intr(void)
{ {
dpeth_t *dep; dpeth_t *dep;
@@ -488,15 +488,15 @@ PRIVATE void handle_hw_intr(void)
} }
/* SEF functions and variables. */ /* SEF functions and variables. */
FORWARD void sef_local_startup(void); static void sef_local_startup(void);
FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info); static int sef_cb_init_fresh(int type, sef_init_info_t *info);
FORWARD void sef_cb_signal_handler(int signo); static void sef_cb_signal_handler(int signo);
/* /*
** Name: int dpeth_task(void) ** Name: int dpeth_task(void)
** Function: Main entry for dp task ** Function: Main entry for dp task
*/ */
PUBLIC int main(int argc, char **argv) int main(int argc, char **argv)
{ {
message m; message m;
int ipc_status; int ipc_status;
@@ -560,7 +560,7 @@ PUBLIC int main(int argc, char **argv)
/*===========================================================================* /*===========================================================================*
* sef_local_startup * * sef_local_startup *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_local_startup() static void sef_local_startup()
{ {
/* Register init callbacks. */ /* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh); sef_setcb_init_fresh(sef_cb_init_fresh);
@@ -581,7 +581,7 @@ PRIVATE void sef_local_startup()
/*===========================================================================* /*===========================================================================*
* sef_cb_init_fresh * * sef_cb_init_fresh *
*===========================================================================*/ *===========================================================================*/
PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info)) static int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
{ {
/* Initialize the dpeth driver. */ /* Initialize the dpeth driver. */
int fkeys, sfkeys; int fkeys, sfkeys;
@@ -605,7 +605,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
/*===========================================================================* /*===========================================================================*
* sef_cb_signal_handler * * sef_cb_signal_handler *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_cb_signal_handler(int signo) static void sef_cb_signal_handler(int signo)
{ {
/* Only check for termination signal, ignore anything else. */ /* Only check for termination signal, ignore anything else. */
if (signo != SIGTERM) return; if (signo != SIGTERM) return;

View File

@@ -101,7 +101,7 @@ static void ne_init(dpeth_t * dep)
** Note that the NE1000 is an 8bit card and has a memory ** Note that the NE1000 is an 8bit card and has a memory
** region distict from the 16bit NE2000. ** region distict from the 16bit NE2000.
*/ */
PUBLIC int ne_probe(dpeth_t * dep) int ne_probe(dpeth_t * dep)
{ {
int ix, wd, loc1, loc2; int ix, wd, loc1, loc2;
char EPROM[32]; char EPROM[32];

View File

@@ -21,7 +21,7 @@ static char tx_rx_buff[8192];
** Name: void *alloc_buff(dpeth_t *dep, int size) ** Name: void *alloc_buff(dpeth_t *dep, int size)
** Function: Allocates a buffer from the common pool. ** Function: Allocates a buffer from the common pool.
*/ */
PUBLIC void *alloc_buff(dpeth_t *dep, int size) void *alloc_buff(dpeth_t *dep, int size)
{ {
m_hdr_t *ptr, *wrk = allocptr; m_hdr_t *ptr, *wrk = allocptr;
int units = ((size + sizeof(m_hdr_t) - 1) / sizeof(m_hdr_t)) + 1; int units = ((size + sizeof(m_hdr_t) - 1) / sizeof(m_hdr_t)) + 1;
@@ -52,7 +52,7 @@ PUBLIC void *alloc_buff(dpeth_t *dep, int size)
** Name: void free_buff(dpeth_t *dep, void *blk) ** Name: void free_buff(dpeth_t *dep, void *blk)
** Function: Returns a buffer to the common pool. ** Function: Returns a buffer to the common pool.
*/ */
PUBLIC void free_buff(dpeth_t *dep, void *blk) void free_buff(dpeth_t *dep, void *blk)
{ {
m_hdr_t *wrk, *ptr = (m_hdr_t *) blk - 1; m_hdr_t *wrk, *ptr = (m_hdr_t *) blk - 1;
@@ -80,7 +80,7 @@ PUBLIC void free_buff(dpeth_t *dep, void *blk)
** Name: void init_buff(dpeth_t *dep, buff_t **tx_buff) ** Name: void init_buff(dpeth_t *dep, buff_t **tx_buff)
** Function: Initalizes driver data structures. ** Function: Initalizes driver data structures.
*/ */
PUBLIC void init_buff(dpeth_t *dep, buff_t **tx_buff) void init_buff(dpeth_t *dep, buff_t **tx_buff)
{ {
/* Initializes buffer pool */ /* Initializes buffer pool */
@@ -105,7 +105,7 @@ PUBLIC void init_buff(dpeth_t *dep, buff_t **tx_buff)
** Name: void mem2user(dpeth_t *dep, buff_t *rxbuff); ** Name: void mem2user(dpeth_t *dep, buff_t *rxbuff);
** Function: Copies a packet from local buffer to user area. ** Function: Copies a packet from local buffer to user area.
*/ */
PUBLIC void mem2user(dpeth_t *dep, buff_t *rxbuff) void mem2user(dpeth_t *dep, buff_t *rxbuff)
{ {
int bytes, ix = 0; int bytes, ix = 0;
iovec_dat_s_t *iovp = &dep->de_read_iovec; iovec_dat_s_t *iovp = &dep->de_read_iovec;
@@ -137,7 +137,7 @@ PUBLIC void mem2user(dpeth_t *dep, buff_t *rxbuff)
** Name: void user2mem(dpeth_t *dep, buff_t *txbuff) ** Name: void user2mem(dpeth_t *dep, buff_t *txbuff)
** Function: Copies a packet from user area to local buffer. ** Function: Copies a packet from user area to local buffer.
*/ */
PUBLIC void user2mem(dpeth_t *dep, buff_t *txbuff) void user2mem(dpeth_t *dep, buff_t *txbuff)
{ {
int bytes, ix = 0; int bytes, ix = 0;
iovec_dat_s_t *iovp = &dep->de_write_iovec; iovec_dat_s_t *iovp = &dep->de_write_iovec;

View File

@@ -21,37 +21,37 @@
#include "e1000_reg.h" #include "e1000_reg.h"
#include "e1000_pci.h" #include "e1000_pci.h"
PRIVATE int e1000_instance; static int e1000_instance;
PRIVATE e1000_t e1000_state; static e1000_t e1000_state;
PRIVATE void e1000_init(message *mp); static void e1000_init(message *mp);
PRIVATE void e1000_init_pci(void); static void e1000_init_pci(void);
PRIVATE int e1000_probe(e1000_t *e, int skip); static int e1000_probe(e1000_t *e, int skip);
PRIVATE int e1000_init_hw(e1000_t *e); static int e1000_init_hw(e1000_t *e);
PRIVATE void e1000_init_addr(e1000_t *e); static void e1000_init_addr(e1000_t *e);
PRIVATE void e1000_init_buf(e1000_t *e); static void e1000_init_buf(e1000_t *e);
PRIVATE void e1000_reset_hw(e1000_t *e); static void e1000_reset_hw(e1000_t *e);
PRIVATE void e1000_writev_s(message *mp, int from_int); static void e1000_writev_s(message *mp, int from_int);
PRIVATE void e1000_readv_s(message *mp, int from_int); static void e1000_readv_s(message *mp, int from_int);
PRIVATE void e1000_getstat_s(message *mp); static void e1000_getstat_s(message *mp);
PRIVATE void e1000_interrupt(message *mp); static void e1000_interrupt(message *mp);
PRIVATE int e1000_link_changed(e1000_t *e); static int e1000_link_changed(e1000_t *e);
PRIVATE void e1000_stop(e1000_t *e); static void e1000_stop(e1000_t *e);
PRIVATE uint32_t e1000_reg_read(e1000_t *e, uint32_t reg); static uint32_t e1000_reg_read(e1000_t *e, uint32_t reg);
PRIVATE void e1000_reg_write(e1000_t *e, uint32_t reg, uint32_t value); static void e1000_reg_write(e1000_t *e, uint32_t reg, uint32_t value);
PRIVATE void e1000_reg_set(e1000_t *e, uint32_t reg, uint32_t value); static void e1000_reg_set(e1000_t *e, uint32_t reg, uint32_t value);
PRIVATE void e1000_reg_unset(e1000_t *e, uint32_t reg, uint32_t value); static void e1000_reg_unset(e1000_t *e, uint32_t reg, uint32_t value);
PRIVATE u16_t eeprom_eerd(void *e, int reg); static u16_t eeprom_eerd(void *e, int reg);
PRIVATE u16_t eeprom_ich(void *e, int reg); static u16_t eeprom_ich(void *e, int reg);
PRIVATE int eeprom_ich_init(e1000_t *e); static int eeprom_ich_init(e1000_t *e);
PRIVATE int eeprom_ich_cycle(const e1000_t *e, u32_t timeout); static int eeprom_ich_cycle(const e1000_t *e, u32_t timeout);
PRIVATE void reply(e1000_t *e); static void reply(e1000_t *e);
PRIVATE void mess_reply(message *req, message *reply); static void mess_reply(message *req, message *reply);
/* SEF functions and variables. */ /* SEF functions and variables. */
FORWARD void sef_local_startup(void); static void sef_local_startup(void);
FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info); static int sef_cb_init_fresh(int type, sef_init_info_t *info);
FORWARD void sef_cb_signal_handler(int signo); static void sef_cb_signal_handler(int signo);
/*===========================================================================* /*===========================================================================*
* main * * main *
@@ -104,7 +104,7 @@ int main(int argc, char *argv[])
/*===========================================================================* /*===========================================================================*
* sef_local_startup * * sef_local_startup *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_local_startup() static void sef_local_startup()
{ {
/* Register init callbacks. */ /* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh); sef_setcb_init_fresh(sef_cb_init_fresh);
@@ -125,7 +125,7 @@ PRIVATE void sef_local_startup()
/*===========================================================================* /*===========================================================================*
* sef_cb_init_fresh * * sef_cb_init_fresh *
*===========================================================================*/ *===========================================================================*/
PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info)) static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{ {
/* Initialize the e1000 driver. */ /* Initialize the e1000 driver. */
long v; long v;
@@ -153,7 +153,7 @@ PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
/*===========================================================================* /*===========================================================================*
* sef_cb_signal_handler * * sef_cb_signal_handler *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_cb_signal_handler(int signo) static void sef_cb_signal_handler(int signo)
{ {
e1000_t *e; e1000_t *e;
e = &e1000_state; e = &e1000_state;
@@ -169,7 +169,7 @@ PRIVATE void sef_cb_signal_handler(int signo)
/*===========================================================================* /*===========================================================================*
* e1000_init * * e1000_init *
*===========================================================================*/ *===========================================================================*/
PRIVATE void e1000_init(message *mp) static void e1000_init(message *mp)
{ {
static int first_time = 1; static int first_time = 1;
message reply_mess; message reply_mess;
@@ -203,7 +203,7 @@ PRIVATE void e1000_init(message *mp)
/*===========================================================================* /*===========================================================================*
* e1000_int_pci * * e1000_int_pci *
*===========================================================================*/ *===========================================================================*/
PRIVATE void e1000_init_pci() static void e1000_init_pci()
{ {
e1000_t *e; e1000_t *e;
@@ -220,7 +220,7 @@ PRIVATE void e1000_init_pci()
/*===========================================================================* /*===========================================================================*
* e1000_probe * * e1000_probe *
*===========================================================================*/ *===========================================================================*/
PRIVATE int e1000_probe(e1000_t *e, int skip) static int e1000_probe(e1000_t *e, int skip)
{ {
int r, devind, ioflag; int r, devind, ioflag;
u16_t vid, did, cr; u16_t vid, did, cr;
@@ -359,7 +359,7 @@ PRIVATE int e1000_probe(e1000_t *e, int skip)
/*===========================================================================* /*===========================================================================*
* e1000_init_hw * * e1000_init_hw *
*===========================================================================*/ *===========================================================================*/
PRIVATE int e1000_init_hw(e) static int e1000_init_hw(e)
e1000_t *e; e1000_t *e;
{ {
int r, i; int r, i;
@@ -424,7 +424,7 @@ e1000_t *e;
/*===========================================================================* /*===========================================================================*
* e1000_init_addr * * e1000_init_addr *
*===========================================================================*/ *===========================================================================*/
PRIVATE void e1000_init_addr(e) static void e1000_init_addr(e)
e1000_t *e; e1000_t *e;
{ {
static char eakey[]= E1000_ENVVAR "#_EA"; static char eakey[]= E1000_ENVVAR "#_EA";
@@ -474,7 +474,7 @@ e1000_t *e;
/*===========================================================================* /*===========================================================================*
* e1000_init_buf * * e1000_init_buf *
*===========================================================================*/ *===========================================================================*/
PRIVATE void e1000_init_buf(e) static void e1000_init_buf(e)
e1000_t *e; e1000_t *e;
{ {
phys_bytes rx_desc_p, rx_buff_p; phys_bytes rx_desc_p, rx_buff_p;
@@ -570,7 +570,7 @@ e1000_t *e;
/*===========================================================================* /*===========================================================================*
* e1000_reset_hw * * e1000_reset_hw *
*===========================================================================*/ *===========================================================================*/
PRIVATE void e1000_reset_hw(e) static void e1000_reset_hw(e)
e1000_t *e; e1000_t *e;
{ {
/* Assert a Device Reset signal. */ /* Assert a Device Reset signal. */
@@ -583,7 +583,7 @@ e1000_t *e;
/*===========================================================================* /*===========================================================================*
* e1000_writev_s * * e1000_writev_s *
*===========================================================================*/ *===========================================================================*/
PRIVATE void e1000_writev_s(mp, from_int) static void e1000_writev_s(mp, from_int)
message *mp; message *mp;
int from_int; int from_int;
{ {
@@ -676,7 +676,7 @@ int from_int;
/*===========================================================================* /*===========================================================================*
* e1000_readv_s * * e1000_readv_s *
*===========================================================================*/ *===========================================================================*/
PRIVATE void e1000_readv_s(mp, from_int) static void e1000_readv_s(mp, from_int)
message *mp; message *mp;
int from_int; int from_int;
{ {
@@ -765,7 +765,7 @@ int from_int;
/*===========================================================================* /*===========================================================================*
* e1000_getstat_s * * e1000_getstat_s *
*===========================================================================*/ *===========================================================================*/
PRIVATE void e1000_getstat_s(mp) static void e1000_getstat_s(mp)
message *mp; message *mp;
{ {
int r; int r;
@@ -800,7 +800,7 @@ message *mp;
/*===========================================================================* /*===========================================================================*
* e1000_interrupt * * e1000_interrupt *
*===========================================================================*/ *===========================================================================*/
PRIVATE void e1000_interrupt(mp) static void e1000_interrupt(mp)
message *mp; message *mp;
{ {
e1000_t *e; e1000_t *e;
@@ -837,7 +837,7 @@ message *mp;
/*===========================================================================* /*===========================================================================*
* e1000_link_changed * * e1000_link_changed *
*===========================================================================*/ *===========================================================================*/
PRIVATE int e1000_link_changed(e) static int e1000_link_changed(e)
e1000_t *e; e1000_t *e;
{ {
E1000_DEBUG(4, ("%s: link_changed()\n", e->name)); E1000_DEBUG(4, ("%s: link_changed()\n", e->name));
@@ -847,7 +847,7 @@ e1000_t *e;
/*===========================================================================* /*===========================================================================*
* e1000_stop * * e1000_stop *
*===========================================================================*/ *===========================================================================*/
PRIVATE void e1000_stop(e) static void e1000_stop(e)
e1000_t *e; e1000_t *e;
{ {
E1000_DEBUG(3, ("%s: stop()\n", e->name)); E1000_DEBUG(3, ("%s: stop()\n", e->name));
@@ -860,7 +860,7 @@ e1000_t *e;
/*===========================================================================* /*===========================================================================*
* e1000_reg_read * * e1000_reg_read *
*===========================================================================*/ *===========================================================================*/
PRIVATE uint32_t e1000_reg_read(e, reg) static uint32_t e1000_reg_read(e, reg)
e1000_t *e; e1000_t *e;
uint32_t reg; uint32_t reg;
{ {
@@ -879,7 +879,7 @@ uint32_t reg;
/*===========================================================================* /*===========================================================================*
* e1000_reg_write * * e1000_reg_write *
*===========================================================================*/ *===========================================================================*/
PRIVATE void e1000_reg_write(e, reg, value) static void e1000_reg_write(e, reg, value)
e1000_t *e; e1000_t *e;
uint32_t reg; uint32_t reg;
uint32_t value; uint32_t value;
@@ -894,7 +894,7 @@ uint32_t value;
/*===========================================================================* /*===========================================================================*
* e1000_reg_set * * e1000_reg_set *
*===========================================================================*/ *===========================================================================*/
PRIVATE void e1000_reg_set(e, reg, value) static void e1000_reg_set(e, reg, value)
e1000_t *e; e1000_t *e;
uint32_t reg; uint32_t reg;
uint32_t value; uint32_t value;
@@ -911,7 +911,7 @@ uint32_t value;
/*===========================================================================* /*===========================================================================*
* e1000_reg_unset * * e1000_reg_unset *
*===========================================================================*/ *===========================================================================*/
PRIVATE void e1000_reg_unset(e, reg, value) static void e1000_reg_unset(e, reg, value)
e1000_t *e; e1000_t *e;
uint32_t reg; uint32_t reg;
uint32_t value; uint32_t value;
@@ -929,7 +929,7 @@ uint32_t value;
/*===========================================================================* /*===========================================================================*
* eeprom_eerd * * eeprom_eerd *
*===========================================================================*/ *===========================================================================*/
PRIVATE u16_t eeprom_eerd(v, reg) static u16_t eeprom_eerd(v, reg)
void *v; void *v;
int reg; int reg;
{ {
@@ -949,7 +949,7 @@ int reg;
/*===========================================================================* /*===========================================================================*
* eeprom_ich_init * * eeprom_ich_init *
*===========================================================================*/ *===========================================================================*/
PRIVATE int eeprom_ich_init(e) static int eeprom_ich_init(e)
e1000_t *e; e1000_t *e;
{ {
union ich8_hws_flash_status hsfsts; union ich8_hws_flash_status hsfsts;
@@ -1029,7 +1029,7 @@ out:
/*===========================================================================* /*===========================================================================*
* eeprom_ich_cycle * * eeprom_ich_cycle *
*===========================================================================*/ *===========================================================================*/
PRIVATE int eeprom_ich_cycle(const e1000_t *e, u32_t timeout) static int eeprom_ich_cycle(const e1000_t *e, u32_t timeout)
{ {
union ich8_hws_flash_ctrl hsflctl; union ich8_hws_flash_ctrl hsflctl;
union ich8_hws_flash_status hsfsts; union ich8_hws_flash_status hsfsts;
@@ -1062,7 +1062,7 @@ PRIVATE int eeprom_ich_cycle(const e1000_t *e, u32_t timeout)
/*===========================================================================* /*===========================================================================*
* eeprom_ich * * eeprom_ich *
*===========================================================================*/ *===========================================================================*/
PRIVATE u16_t eeprom_ich(v, reg) static u16_t eeprom_ich(v, reg)
void *v; void *v;
int reg; int reg;
{ {
@@ -1144,7 +1144,7 @@ out:
/*===========================================================================* /*===========================================================================*
* reply * * reply *
*===========================================================================*/ *===========================================================================*/
PRIVATE void reply(e) static void reply(e)
e1000_t *e; e1000_t *e;
{ {
message msg; message msg;
@@ -1192,7 +1192,7 @@ e1000_t *e;
/*===========================================================================* /*===========================================================================*
* mess_reply * * mess_reply *
*===========================================================================*/ *===========================================================================*/
PRIVATE void mess_reply(req, reply_mess) static void mess_reply(req, reply_mess)
message *req; message *req;
message *reply_mess; message *reply_mess;
{ {

View File

@@ -7,7 +7,7 @@
/*===========================================================================* /*===========================================================================*
* get_rand * * get_rand *
*===========================================================================*/ *===========================================================================*/
PRIVATE u32_t get_rand(u32_t max) static u32_t get_rand(u32_t max)
{ {
/* Las Vegas algorithm for getting a random number in the range from /* Las Vegas algorithm for getting a random number in the range from
* 0 to max, inclusive. * 0 to max, inclusive.
@@ -35,7 +35,7 @@ PRIVATE u32_t get_rand(u32_t max)
/*===========================================================================* /*===========================================================================*
* get_range * * get_range *
*===========================================================================*/ *===========================================================================*/
PRIVATE size_t get_range(struct fbd_rule *rule, u64_t pos, size_t *size, static size_t get_range(struct fbd_rule *rule, u64_t pos, size_t *size,
u64_t *skip) u64_t *skip)
{ {
/* Compute the range within the given request range that is affected /* Compute the range within the given request range that is affected
@@ -82,7 +82,7 @@ PRIVATE size_t get_range(struct fbd_rule *rule, u64_t pos, size_t *size,
/*===========================================================================* /*===========================================================================*
* limit_range * * limit_range *
*===========================================================================*/ *===========================================================================*/
PRIVATE void limit_range(iovec_t *iov, unsigned *count, size_t size) static void limit_range(iovec_t *iov, unsigned *count, size_t size)
{ {
/* Limit the given vector to the given size. /* Limit the given vector to the given size.
*/ */
@@ -104,7 +104,7 @@ PRIVATE void limit_range(iovec_t *iov, unsigned *count, size_t size)
/*===========================================================================* /*===========================================================================*
* action_io_corrupt * * action_io_corrupt *
*===========================================================================*/ *===========================================================================*/
PRIVATE void action_io_corrupt(struct fbd_rule *rule, char *buf, size_t size, static void action_io_corrupt(struct fbd_rule *rule, char *buf, size_t size,
u64_t pos, int UNUSED(flag)) u64_t pos, int UNUSED(flag))
{ {
u64_t skip; u64_t skip;
@@ -151,7 +151,7 @@ PRIVATE void action_io_corrupt(struct fbd_rule *rule, char *buf, size_t size,
/*===========================================================================* /*===========================================================================*
* action_pre_error * * action_pre_error *
*===========================================================================*/ *===========================================================================*/
PRIVATE void action_pre_error(struct fbd_rule *rule, iovec_t *iov, static void action_pre_error(struct fbd_rule *rule, iovec_t *iov,
unsigned *count, size_t *size, u64_t *pos) unsigned *count, size_t *size, u64_t *pos)
{ {
/* Limit the request to the part that precedes the matched range. */ /* Limit the request to the part that precedes the matched range. */
@@ -163,7 +163,7 @@ PRIVATE void action_pre_error(struct fbd_rule *rule, iovec_t *iov,
/*===========================================================================* /*===========================================================================*
* action_post_error * * action_post_error *
*===========================================================================*/ *===========================================================================*/
PRIVATE void action_post_error(struct fbd_rule *rule, size_t UNUSED(osize), static void action_post_error(struct fbd_rule *rule, size_t UNUSED(osize),
int *result) int *result)
{ {
/* Upon success of the first part, return the specified error code. */ /* Upon success of the first part, return the specified error code. */
@@ -174,7 +174,7 @@ PRIVATE void action_post_error(struct fbd_rule *rule, size_t UNUSED(osize),
/*===========================================================================* /*===========================================================================*
* action_pre_misdir * * action_pre_misdir *
*===========================================================================*/ *===========================================================================*/
PRIVATE void action_pre_misdir(struct fbd_rule *rule, iovec_t *UNUSED(iov), static void action_pre_misdir(struct fbd_rule *rule, iovec_t *UNUSED(iov),
unsigned *UNUSED(count), size_t *UNUSED(size), u64_t *pos) unsigned *UNUSED(count), size_t *UNUSED(size), u64_t *pos)
{ {
/* Randomize the request position to fall within the range (and have /* Randomize the request position to fall within the range (and have
@@ -201,7 +201,7 @@ PRIVATE void action_pre_misdir(struct fbd_rule *rule, iovec_t *UNUSED(iov),
/*===========================================================================* /*===========================================================================*
* action_pre_losttorn * * action_pre_losttorn *
*===========================================================================*/ *===========================================================================*/
PRIVATE void action_pre_losttorn(struct fbd_rule *rule, iovec_t *iov, static void action_pre_losttorn(struct fbd_rule *rule, iovec_t *iov,
unsigned *count, size_t *size, u64_t *UNUSED(pos)) unsigned *count, size_t *size, u64_t *UNUSED(pos))
{ {
if (*size > rule->params.losttorn.lead) if (*size > rule->params.losttorn.lead)
@@ -213,7 +213,7 @@ PRIVATE void action_pre_losttorn(struct fbd_rule *rule, iovec_t *iov,
/*===========================================================================* /*===========================================================================*
* action_post_losttorn * * action_post_losttorn *
*===========================================================================*/ *===========================================================================*/
PRIVATE void action_post_losttorn(struct fbd_rule *UNUSED(rule), size_t osize, static void action_post_losttorn(struct fbd_rule *UNUSED(rule), size_t osize,
int *result) int *result)
{ {
/* On success, pretend full completion. */ /* On success, pretend full completion. */
@@ -226,7 +226,7 @@ PRIVATE void action_post_losttorn(struct fbd_rule *UNUSED(rule), size_t osize,
/*===========================================================================* /*===========================================================================*
* action_mask * * action_mask *
*===========================================================================*/ *===========================================================================*/
PUBLIC int action_mask(struct fbd_rule *rule) int action_mask(struct fbd_rule *rule)
{ {
/* Return the hook mask for the given rule's action type. */ /* Return the hook mask for the given rule's action type. */
@@ -244,7 +244,7 @@ PUBLIC int action_mask(struct fbd_rule *rule)
/*===========================================================================* /*===========================================================================*
* action_pre_hook * * action_pre_hook *
*===========================================================================*/ *===========================================================================*/
PUBLIC void action_pre_hook(struct fbd_rule *rule, iovec_t *iov, void action_pre_hook(struct fbd_rule *rule, iovec_t *iov,
unsigned *count, size_t *size, u64_t *pos) unsigned *count, size_t *size, u64_t *pos)
{ {
switch (rule->action) { switch (rule->action) {
@@ -268,7 +268,7 @@ PUBLIC void action_pre_hook(struct fbd_rule *rule, iovec_t *iov,
/*===========================================================================* /*===========================================================================*
* action_io_hook * * action_io_hook *
*===========================================================================*/ *===========================================================================*/
PUBLIC void action_io_hook(struct fbd_rule *rule, char *buf, size_t size, void action_io_hook(struct fbd_rule *rule, char *buf, size_t size,
u64_t pos, int flag) u64_t pos, int flag)
{ {
switch (rule->action) { switch (rule->action) {
@@ -284,7 +284,7 @@ PUBLIC void action_io_hook(struct fbd_rule *rule, char *buf, size_t size,
/*===========================================================================* /*===========================================================================*
* action_post_hook * * action_post_hook *
*===========================================================================*/ *===========================================================================*/
PUBLIC void action_post_hook(struct fbd_rule *rule, size_t osize, int *result) void action_post_hook(struct fbd_rule *rule, size_t osize, int *result)
{ {
switch (rule->action) { switch (rule->action) {
case FBD_ACTION_ERROR: case FBD_ACTION_ERROR:

View File

@@ -15,22 +15,22 @@
#define BUF_SIZE (NR_IOREQS * CLICK_SIZE) /* 256k */ #define BUF_SIZE (NR_IOREQS * CLICK_SIZE) /* 256k */
/* Function declarations. */ /* Function declarations. */
PRIVATE int fbd_open(dev_t minor, int access); static int fbd_open(dev_t minor, int access);
PRIVATE int fbd_close(dev_t minor); static int fbd_close(dev_t minor);
PRIVATE int fbd_transfer(dev_t minor, int do_write, u64_t position, static int fbd_transfer(dev_t minor, int do_write, u64_t position,
endpoint_t endpt, iovec_t *iov, unsigned int nr_req, int flags); endpoint_t endpt, iovec_t *iov, unsigned int nr_req, int flags);
PRIVATE int fbd_ioctl(dev_t minor, unsigned int request, endpoint_t endpt, static int fbd_ioctl(dev_t minor, unsigned int request, endpoint_t endpt,
cp_grant_id_t grant); cp_grant_id_t grant);
/* Variables. */ /* Variables. */
PRIVATE char *fbd_buf; /* scratch buffer */ static char *fbd_buf; /* scratch buffer */
PRIVATE char driver_label[32] = ""; /* driver DS label */ static char driver_label[32] = ""; /* driver DS label */
PRIVATE dev_t driver_minor = -1; /* driver's partition minor to use */ static dev_t driver_minor = -1; /* driver's partition minor to use */
PRIVATE endpoint_t driver_endpt; /* driver endpoint */ static endpoint_t driver_endpt; /* driver endpoint */
/* Entry points to this driver. */ /* Entry points to this driver. */
PRIVATE struct blockdriver fbd_dtab = { static struct blockdriver fbd_dtab = {
BLOCKDRIVER_TYPE_OTHER, /* do not handle partition requests */ BLOCKDRIVER_TYPE_OTHER, /* do not handle partition requests */
fbd_open, /* open or mount request, initialize device */ fbd_open, /* open or mount request, initialize device */
fbd_close, /* release device */ fbd_close, /* release device */
@@ -46,7 +46,7 @@ PRIVATE struct blockdriver fbd_dtab = {
}; };
/* Options supported by this driver. */ /* Options supported by this driver. */
PRIVATE struct optset optset_table[] = { static struct optset optset_table[] = {
{ "label", OPT_STRING, driver_label, sizeof(driver_label) }, { "label", OPT_STRING, driver_label, sizeof(driver_label) },
{ "minor", OPT_INT, &driver_minor, 10 }, { "minor", OPT_INT, &driver_minor, 10 },
{ NULL, 0, NULL, 0 } { NULL, 0, NULL, 0 }
@@ -55,7 +55,7 @@ PRIVATE struct optset optset_table[] = {
/*===========================================================================* /*===========================================================================*
* sef_cb_init_fresh * * sef_cb_init_fresh *
*===========================================================================*/ *===========================================================================*/
PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info)) static int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
{ {
clock_t uptime; clock_t uptime;
int r; int r;
@@ -97,7 +97,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
/*===========================================================================* /*===========================================================================*
* sef_cb_signal_handler * * sef_cb_signal_handler *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_cb_signal_handler(int signo) static void sef_cb_signal_handler(int signo)
{ {
/* Terminate immediately upon receiving a SIGTERM. */ /* Terminate immediately upon receiving a SIGTERM. */
if (signo != SIGTERM) return; if (signo != SIGTERM) return;
@@ -115,7 +115,7 @@ PRIVATE void sef_cb_signal_handler(int signo)
/*===========================================================================* /*===========================================================================*
* sef_local_startup * * sef_local_startup *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_local_startup(void) static void sef_local_startup(void)
{ {
/* Register init callbacks. */ /* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh); sef_setcb_init_fresh(sef_cb_init_fresh);
@@ -132,7 +132,7 @@ PRIVATE void sef_local_startup(void)
/*===========================================================================* /*===========================================================================*
* main * * main *
*===========================================================================*/ *===========================================================================*/
PUBLIC int main(int argc, char **argv) int main(int argc, char **argv)
{ {
/* SEF local startup. */ /* SEF local startup. */
env_setargs(argc, argv); env_setargs(argc, argv);
@@ -147,7 +147,7 @@ PUBLIC int main(int argc, char **argv)
/*===========================================================================* /*===========================================================================*
* fbd_open * * fbd_open *
*===========================================================================*/ *===========================================================================*/
PRIVATE int fbd_open(dev_t UNUSED(minor), int access) static int fbd_open(dev_t UNUSED(minor), int access)
{ {
/* Open a device. */ /* Open a device. */
message m; message m;
@@ -172,7 +172,7 @@ PRIVATE int fbd_open(dev_t UNUSED(minor), int access)
/*===========================================================================* /*===========================================================================*
* fbd_close * * fbd_close *
*===========================================================================*/ *===========================================================================*/
PRIVATE int fbd_close(dev_t UNUSED(minor)) static int fbd_close(dev_t UNUSED(minor))
{ {
/* Close a device. */ /* Close a device. */
message m; message m;
@@ -196,7 +196,7 @@ PRIVATE int fbd_close(dev_t UNUSED(minor))
/*===========================================================================* /*===========================================================================*
* fbd_ioctl * * fbd_ioctl *
*===========================================================================*/ *===========================================================================*/
PRIVATE int fbd_ioctl(dev_t UNUSED(minor), unsigned int request, static int fbd_ioctl(dev_t UNUSED(minor), unsigned int request,
endpoint_t endpt, cp_grant_id_t grant) endpoint_t endpt, cp_grant_id_t grant)
{ {
/* Handle an I/O control request. */ /* Handle an I/O control request. */
@@ -238,7 +238,7 @@ PRIVATE int fbd_ioctl(dev_t UNUSED(minor), unsigned int request,
/*===========================================================================* /*===========================================================================*
* fbd_transfer_direct * * fbd_transfer_direct *
*===========================================================================*/ *===========================================================================*/
PRIVATE ssize_t fbd_transfer_direct(int do_write, u64_t position, static ssize_t fbd_transfer_direct(int do_write, u64_t position,
endpoint_t endpt, iovec_t *iov, unsigned int count, int flags) endpoint_t endpt, iovec_t *iov, unsigned int count, int flags)
{ {
/* Forward the entire transfer request, without any intervention. */ /* Forward the entire transfer request, without any intervention. */
@@ -284,7 +284,7 @@ PRIVATE ssize_t fbd_transfer_direct(int do_write, u64_t position,
/*===========================================================================* /*===========================================================================*
* fbd_transfer_copy * * fbd_transfer_copy *
*===========================================================================*/ *===========================================================================*/
PRIVATE ssize_t fbd_transfer_copy(int do_write, u64_t position, static ssize_t fbd_transfer_copy(int do_write, u64_t position,
endpoint_t endpt, iovec_t *iov, unsigned int count, size_t size, endpoint_t endpt, iovec_t *iov, unsigned int count, size_t size,
int flags) int flags)
{ {
@@ -406,7 +406,7 @@ PRIVATE ssize_t fbd_transfer_copy(int do_write, u64_t position,
/*===========================================================================* /*===========================================================================*
* fbd_transfer * * fbd_transfer *
*===========================================================================*/ *===========================================================================*/
PRIVATE int fbd_transfer(dev_t UNUSED(minor), int do_write, u64_t position, static int fbd_transfer(dev_t UNUSED(minor), int do_write, u64_t position,
endpoint_t endpt, iovec_t *iov, unsigned int nr_req, int flags) endpoint_t endpt, iovec_t *iov, unsigned int nr_req, int flags)
{ {
/* Transfer data from or to the device. */ /* Transfer data from or to the device. */

View File

@@ -5,14 +5,14 @@
#include "action.h" #include "action.h"
#include "rule.h" #include "rule.h"
PRIVATE struct fbd_rule rules[MAX_RULES]; static struct fbd_rule rules[MAX_RULES];
PRIVATE struct fbd_rule *matches[MAX_RULES]; static struct fbd_rule *matches[MAX_RULES];
PRIVATE int nr_matches; static int nr_matches;
/*===========================================================================* /*===========================================================================*
* rule_ctl * * rule_ctl *
*===========================================================================*/ *===========================================================================*/
PUBLIC int rule_ctl(int request, endpoint_t endpt, cp_grant_id_t grant) int rule_ctl(int request, endpoint_t endpt, cp_grant_id_t grant)
{ {
/* Handle an I/O control request regarding rules. */ /* Handle an I/O control request regarding rules. */
fbd_rulenum_t i; fbd_rulenum_t i;
@@ -86,7 +86,7 @@ PUBLIC int rule_ctl(int request, endpoint_t endpt, cp_grant_id_t grant)
/*===========================================================================* /*===========================================================================*
* rule_match * * rule_match *
*===========================================================================*/ *===========================================================================*/
PRIVATE int rule_match(struct fbd_rule *rule, u64_t pos, size_t size, int flag) static int rule_match(struct fbd_rule *rule, u64_t pos, size_t size, int flag)
{ {
/* Check whether the given rule matches the given parameters. As side /* Check whether the given rule matches the given parameters. As side
* effect, update counters in the rule as appropriate. * effect, update counters in the rule as appropriate.
@@ -113,7 +113,7 @@ PRIVATE int rule_match(struct fbd_rule *rule, u64_t pos, size_t size, int flag)
/*===========================================================================* /*===========================================================================*
* rule_find * * rule_find *
*===========================================================================*/ *===========================================================================*/
PUBLIC int rule_find(u64_t pos, size_t size, int flag) int rule_find(u64_t pos, size_t size, int flag)
{ {
/* Find all matching rules, and return a hook mask. */ /* Find all matching rules, and return a hook mask. */
struct fbd_rule *rule; struct fbd_rule *rule;
@@ -150,7 +150,7 @@ PUBLIC int rule_find(u64_t pos, size_t size, int flag)
/*===========================================================================* /*===========================================================================*
* rule_pre_hook * * rule_pre_hook *
*===========================================================================*/ *===========================================================================*/
PUBLIC void rule_pre_hook(iovec_t *iov, unsigned *count, size_t *size, void rule_pre_hook(iovec_t *iov, unsigned *count, size_t *size,
u64_t *pos) u64_t *pos)
{ {
int i; int i;
@@ -163,7 +163,7 @@ PUBLIC void rule_pre_hook(iovec_t *iov, unsigned *count, size_t *size,
/*===========================================================================* /*===========================================================================*
* rule_io_hook * * rule_io_hook *
*===========================================================================*/ *===========================================================================*/
PUBLIC void rule_io_hook(char *buf, size_t size, u64_t pos, int flag) void rule_io_hook(char *buf, size_t size, u64_t pos, int flag)
{ {
int i; int i;
@@ -175,7 +175,7 @@ PUBLIC void rule_io_hook(char *buf, size_t size, u64_t pos, int flag)
/*===========================================================================* /*===========================================================================*
* rule_post_hook * * rule_post_hook *
*===========================================================================*/ *===========================================================================*/
PUBLIC void rule_post_hook(size_t osize, int *result) void rule_post_hook(size_t osize, int *result)
{ {
int i; int i;

View File

@@ -864,7 +864,7 @@ static int paired_grant(char *buf1, char *buf2, int request,
/*===========================================================================* /*===========================================================================*
* single_revoke * * single_revoke *
*===========================================================================*/ *===========================================================================*/
PRIVATE void single_revoke(cp_grant_id_t gid, static void single_revoke(cp_grant_id_t gid,
const iovec_s_t vector[NR_IOREQS], int count) const iovec_s_t vector[NR_IOREQS], int count)
{ {
/* Revoke all grants associated with a request to a single driver. /* Revoke all grants associated with a request to a single driver.

View File

@@ -35,7 +35,7 @@ char BACKUP_LABEL[LABEL_SIZE] = ""; /* backup disk driver label */
int MAIN_MINOR = -1; /* main partition minor nr */ int MAIN_MINOR = -1; /* main partition minor nr */
int BACKUP_MINOR = -1; /* backup partition minor nr */ int BACKUP_MINOR = -1; /* backup partition minor nr */
PRIVATE struct optset optset_table[] = { static struct optset optset_table[] = {
{ "label0", OPT_STRING, MAIN_LABEL, LABEL_SIZE }, { "label0", OPT_STRING, MAIN_LABEL, LABEL_SIZE },
{ "label1", OPT_STRING, BACKUP_LABEL, LABEL_SIZE }, { "label1", OPT_STRING, BACKUP_LABEL, LABEL_SIZE },
{ "minor0", OPT_INT, &MAIN_MINOR, 10 }, { "minor0", OPT_INT, &MAIN_MINOR, 10 },
@@ -73,9 +73,9 @@ static cp_grant_id_t grant_id; /* BDEV_GRANT */
static char *buf_array, *buffer; /* contiguous buffer */ static char *buf_array, *buffer; /* contiguous buffer */
/* SEF functions and variables. */ /* SEF functions and variables. */
FORWARD void sef_local_startup(void); static void sef_local_startup(void);
FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info); static int sef_cb_init_fresh(int type, sef_init_info_t *info);
FORWARD void sef_cb_signal_handler(int signo); static void sef_cb_signal_handler(int signo);
/*===========================================================================* /*===========================================================================*
* carry * * carry *
@@ -425,7 +425,7 @@ int main(int argc, char *argv[])
/*===========================================================================* /*===========================================================================*
* sef_local_startup * * sef_local_startup *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_local_startup(void) static void sef_local_startup(void)
{ {
/* Register init callbacks. */ /* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh); sef_setcb_init_fresh(sef_cb_init_fresh);
@@ -443,7 +443,7 @@ PRIVATE void sef_local_startup(void)
/*===========================================================================* /*===========================================================================*
* sef_cb_init_fresh * * sef_cb_init_fresh *
*===========================================================================*/ *===========================================================================*/
PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info)) static int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
{ {
/* Initialize the filter driver. */ /* Initialize the filter driver. */
int r; int r;
@@ -476,7 +476,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
/*===========================================================================* /*===========================================================================*
* sef_cb_signal_handler * * sef_cb_signal_handler *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_cb_signal_handler(int signo) static void sef_cb_signal_handler(int signo)
{ {
/* Only check for termination signal, ignore anything else. */ /* Only check for termination signal, ignore anything else. */
if (signo != SIGTERM) return; if (signo != SIGTERM) return;

View File

@@ -158,7 +158,7 @@
* *
* 3 720K 1.44M 9 80 300 RPM 250 kbps PS/2, et al. * 3 720K 1.44M 9 80 300 RPM 250 kbps PS/2, et al.
*/ */
PRIVATE struct density { static struct density {
u8_t secpt; /* sectors per track */ u8_t secpt; /* sectors per track */
u8_t cyls; /* tracks per side */ u8_t cyls; /* tracks per side */
u8_t steps; /* steps per cylinder (2 = double step) */ u8_t steps; /* steps per cylinder (2 = double step) */
@@ -187,7 +187,7 @@ PRIVATE struct density {
#define b(d) (1 << (d)) /* bit for density d. */ #define b(d) (1 << (d)) /* bit for density d. */
PRIVATE struct test_order { static struct test_order {
u8_t t_density; /* floppy/drive type */ u8_t t_density; /* floppy/drive type */
u8_t t_class; /* limit drive to this class of densities */ u8_t t_class; /* limit drive to this class of densities */
} test_order[NT-1] = { } test_order[NT-1] = {
@@ -203,7 +203,7 @@ PRIVATE struct test_order {
}; };
/* Variables. */ /* Variables. */
PRIVATE struct floppy { /* main drive struct, one entry per drive */ static struct floppy { /* main drive struct, one entry per drive */
unsigned fl_curcyl; /* current cylinder */ unsigned fl_curcyl; /* current cylinder */
unsigned fl_hardcyl; /* hardware cylinder, as opposed to: */ unsigned fl_hardcyl; /* hardware cylinder, as opposed to: */
unsigned fl_cylinder; /* cylinder number addressed */ unsigned fl_cylinder; /* cylinder number addressed */
@@ -217,54 +217,54 @@ PRIVATE struct floppy { /* main drive struct, one entry per drive */
struct device fl_part[NR_PARTITIONS]; /* partition's base & size */ struct device fl_part[NR_PARTITIONS]; /* partition's base & size */
} floppy[NR_DRIVES]; } floppy[NR_DRIVES];
PRIVATE int irq_hook_id; /* id of irq hook at the kernel */ static int irq_hook_id; /* id of irq hook at the kernel */
PUBLIC int motor_status; /* bitmap of current motor status */ int motor_status; /* bitmap of current motor status */
PRIVATE int need_reset; /* set to 1 when controller must be reset */ static int need_reset; /* set to 1 when controller must be reset */
PUBLIC unsigned f_drive; /* selected drive */ unsigned f_drive; /* selected drive */
PRIVATE unsigned f_device; /* selected minor device */ static unsigned f_device; /* selected minor device */
PRIVATE struct floppy *f_fp; /* current drive */ static struct floppy *f_fp; /* current drive */
PRIVATE struct density *f_dp; /* current density parameters */ static struct density *f_dp; /* current density parameters */
PRIVATE struct density *prev_dp;/* previous density parameters */ static struct density *prev_dp;/* previous density parameters */
PRIVATE unsigned f_sectors; /* equal to f_dp->secpt (needed a lot) */ static unsigned f_sectors; /* equal to f_dp->secpt (needed a lot) */
PUBLIC u16_t f_busy; /* BSY_IDLE, BSY_IO, BSY_WAKEN */ u16_t f_busy; /* BSY_IDLE, BSY_IO, BSY_WAKEN */
PRIVATE struct device *f_dv; /* device's base and size */ static struct device *f_dv; /* device's base and size */
PRIVATE struct disk_parameter_s fmt_param; /* parameters for format */ static struct disk_parameter_s fmt_param; /* parameters for format */
PRIVATE u8_t f_results[MAX_RESULTS];/* the controller can give lots of output */ static u8_t f_results[MAX_RESULTS];/* the controller can give lots of output */
/* The floppy uses various timers. These are managed by the floppy driver /* The floppy uses various timers. These are managed by the floppy driver
* itself, because only a single synchronous alarm is available per process. * itself, because only a single synchronous alarm is available per process.
* Besides the 'f_tmr_timeout' timer below, the floppy structure for each * Besides the 'f_tmr_timeout' timer below, the floppy structure for each
* floppy disk drive contains a 'fl_tmr_stop' timer. * floppy disk drive contains a 'fl_tmr_stop' timer.
*/ */
PRIVATE timer_t f_tmr_timeout; /* timer for various timeouts */ static timer_t f_tmr_timeout; /* timer for various timeouts */
PRIVATE u32_t system_hz; /* system clock frequency */ static u32_t system_hz; /* system clock frequency */
FORWARD void f_expire_tmrs(clock_t stamp); static void f_expire_tmrs(clock_t stamp);
FORWARD void stop_motor(timer_t *tp); static void stop_motor(timer_t *tp);
FORWARD void f_timeout(timer_t *tp); static void f_timeout(timer_t *tp);
FORWARD struct device *f_prepare(dev_t device); static struct device *f_prepare(dev_t device);
FORWARD struct device *f_part(dev_t minor); static struct device *f_part(dev_t minor);
FORWARD void f_cleanup(void); static void f_cleanup(void);
FORWARD ssize_t f_transfer(dev_t minor, int do_write, u64_t position, static ssize_t f_transfer(dev_t minor, int do_write, u64_t position,
endpoint_t proc_nr, iovec_t *iov, unsigned int nr_req, int flags); endpoint_t proc_nr, iovec_t *iov, unsigned int nr_req, int flags);
FORWARD int dma_setup(int do_write); static int dma_setup(int do_write);
FORWARD void start_motor(void); static void start_motor(void);
FORWARD int seek(void); static int seek(void);
FORWARD int fdc_transfer(int do_write); static int fdc_transfer(int do_write);
FORWARD int fdc_results(void); static int fdc_results(void);
FORWARD int fdc_command(const u8_t *cmd, int len); static int fdc_command(const u8_t *cmd, int len);
FORWARD void fdc_out(int val); static void fdc_out(int val);
FORWARD int recalibrate(void); static int recalibrate(void);
FORWARD void f_reset(void); static void f_reset(void);
FORWARD int f_intr_wait(void); static int f_intr_wait(void);
FORWARD int read_id(void); static int read_id(void);
FORWARD int f_do_open(dev_t minor, int access); static int f_do_open(dev_t minor, int access);
FORWARD int f_do_close(dev_t minor); static int f_do_close(dev_t minor);
FORWARD int test_read(int density); static int test_read(int density);
FORWARD void f_geometry(dev_t minor, struct partition *entry); static void f_geometry(dev_t minor, struct partition *entry);
/* Entry points to this driver. */ /* Entry points to this driver. */
PRIVATE struct blockdriver f_dtab = { static struct blockdriver f_dtab = {
BLOCKDRIVER_TYPE_DISK, /* handle partition requests */ BLOCKDRIVER_TYPE_DISK, /* handle partition requests */
f_do_open, /* open or mount request, sense type of diskette */ f_do_open, /* open or mount request, sense type of diskette */
f_do_close, /* nothing on a close */ f_do_close, /* nothing on a close */
@@ -283,18 +283,18 @@ static char *floppy_buf;
static phys_bytes floppy_buf_phys; static phys_bytes floppy_buf_phys;
/* SEF functions and variables. */ /* SEF functions and variables. */
FORWARD void sef_local_startup(void); static void sef_local_startup(void);
FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info); static int sef_cb_init_fresh(int type, sef_init_info_t *info);
FORWARD void sef_cb_signal_handler(int signo); static void sef_cb_signal_handler(int signo);
EXTERN int sef_cb_lu_prepare(int state); EXTERN int sef_cb_lu_prepare(int state);
EXTERN int sef_cb_lu_state_isvalid(int state); EXTERN int sef_cb_lu_state_isvalid(int state);
EXTERN void sef_cb_lu_state_dump(int state); EXTERN void sef_cb_lu_state_dump(int state);
PUBLIC int last_was_write; int last_was_write;
/*===========================================================================* /*===========================================================================*
* floppy_task * * floppy_task *
*===========================================================================*/ *===========================================================================*/
PUBLIC int main(void) int main(void)
{ {
/* SEF local startup. */ /* SEF local startup. */
sef_local_startup(); sef_local_startup();
@@ -308,7 +308,7 @@ PUBLIC int main(void)
/*===========================================================================* /*===========================================================================*
* sef_local_startup * * sef_local_startup *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_local_startup(void) static void sef_local_startup(void)
{ {
/* Register init callbacks. */ /* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh); sef_setcb_init_fresh(sef_cb_init_fresh);
@@ -329,7 +329,7 @@ PRIVATE void sef_local_startup(void)
/*===========================================================================* /*===========================================================================*
* sef_cb_init_fresh * * sef_cb_init_fresh *
*===========================================================================*/ *===========================================================================*/
PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info)) static int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
{ {
/* Initialize the floppy driver. */ /* Initialize the floppy driver. */
struct floppy *fp; struct floppy *fp;
@@ -369,7 +369,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
/*===========================================================================* /*===========================================================================*
* sef_cb_signal_handler * * sef_cb_signal_handler *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_cb_signal_handler(int signo) static void sef_cb_signal_handler(int signo)
{ {
int s; int s;
@@ -385,7 +385,7 @@ PRIVATE void sef_cb_signal_handler(int signo)
/*===========================================================================* /*===========================================================================*
* f_expire_tmrs * * f_expire_tmrs *
*===========================================================================*/ *===========================================================================*/
PRIVATE void f_expire_tmrs(clock_t stamp) static void f_expire_tmrs(clock_t stamp)
{ {
/* A synchronous alarm message was received. Call the watchdog function for /* A synchronous alarm message was received. Call the watchdog function for
* each expired timer, if any. * each expired timer, if any.
@@ -397,7 +397,7 @@ PRIVATE void f_expire_tmrs(clock_t stamp)
/*===========================================================================* /*===========================================================================*
* f_prepare * * f_prepare *
*===========================================================================*/ *===========================================================================*/
PRIVATE struct device *f_prepare(dev_t device) static struct device *f_prepare(dev_t device)
{ {
/* Prepare for I/O on a device. */ /* Prepare for I/O on a device. */
@@ -424,7 +424,7 @@ PRIVATE struct device *f_prepare(dev_t device)
/*===========================================================================* /*===========================================================================*
* f_part * * f_part *
*===========================================================================*/ *===========================================================================*/
PRIVATE struct device *f_part(dev_t minor) static struct device *f_part(dev_t minor)
{ {
/* Return a pointer to the partition information of the given minor device. */ /* Return a pointer to the partition information of the given minor device. */
@@ -434,7 +434,7 @@ PRIVATE struct device *f_part(dev_t minor)
/*===========================================================================* /*===========================================================================*
* f_cleanup * * f_cleanup *
*===========================================================================*/ *===========================================================================*/
PRIVATE void f_cleanup(void) static void f_cleanup(void)
{ {
/* Start a timer to turn the motor off in a few seconds. */ /* Start a timer to turn the motor off in a few seconds. */
set_timer(&f_fp->fl_tmr_stop, MOTOR_OFF, stop_motor, f_drive); set_timer(&f_fp->fl_tmr_stop, MOTOR_OFF, stop_motor, f_drive);
@@ -446,7 +446,7 @@ PRIVATE void f_cleanup(void)
/*===========================================================================* /*===========================================================================*
* f_transfer * * f_transfer *
*===========================================================================*/ *===========================================================================*/
PRIVATE ssize_t f_transfer( static ssize_t f_transfer(
dev_t minor, /* minor device number */ dev_t minor, /* minor device number */
int do_write, /* read or write? */ int do_write, /* read or write? */
u64_t pos64, /* offset on device to read or write */ u64_t pos64, /* offset on device to read or write */
@@ -690,7 +690,7 @@ PRIVATE ssize_t f_transfer(
/*===========================================================================* /*===========================================================================*
* dma_setup * * dma_setup *
*===========================================================================*/ *===========================================================================*/
PRIVATE int dma_setup(int do_write) static int dma_setup(int do_write)
{ {
/* The IBM PC can perform DMA operations by using the DMA chip. To use it, /* The IBM PC can perform DMA operations by using the DMA chip. To use it,
* the DMA (Direct Memory Access) chip is loaded with the 20-bit memory address * the DMA (Direct Memory Access) chip is loaded with the 20-bit memory address
@@ -734,7 +734,7 @@ PRIVATE int dma_setup(int do_write)
/*===========================================================================* /*===========================================================================*
* start_motor * * start_motor *
*===========================================================================*/ *===========================================================================*/
PRIVATE void start_motor(void) static void start_motor(void)
{ {
/* Control of the floppy disk motors is a big pain. If a motor is off, you /* Control of the floppy disk motors is a big pain. If a motor is off, you
* have to turn it on first, which takes 1/2 second. You can't leave it on * have to turn it on first, which takes 1/2 second. You can't leave it on
@@ -788,7 +788,7 @@ PRIVATE void start_motor(void)
/*===========================================================================* /*===========================================================================*
* stop_motor * * stop_motor *
*===========================================================================*/ *===========================================================================*/
PRIVATE void stop_motor(timer_t *tp) static void stop_motor(timer_t *tp)
{ {
/* This routine is called from an alarm timer after several seconds have /* This routine is called from an alarm timer after several seconds have
* elapsed with no floppy disk activity. It turns the drive motor off. * elapsed with no floppy disk activity. It turns the drive motor off.
@@ -802,7 +802,7 @@ PRIVATE void stop_motor(timer_t *tp)
/*===========================================================================* /*===========================================================================*
* seek * * seek *
*===========================================================================*/ *===========================================================================*/
PRIVATE int seek(void) static int seek(void)
{ {
/* Issue a SEEK command on the indicated drive unless the arm is already /* Issue a SEEK command on the indicated drive unless the arm is already
* positioned on the correct cylinder. * positioned on the correct cylinder.
@@ -866,7 +866,7 @@ PRIVATE int seek(void)
/*===========================================================================* /*===========================================================================*
* fdc_transfer * * fdc_transfer *
*===========================================================================*/ *===========================================================================*/
PRIVATE int fdc_transfer(int do_write) static int fdc_transfer(int do_write)
{ {
/* The drive is now on the proper cylinder. Read, write or format 1 block. */ /* The drive is now on the proper cylinder. Read, write or format 1 block. */
@@ -938,7 +938,7 @@ PRIVATE int fdc_transfer(int do_write)
/*===========================================================================* /*===========================================================================*
* fdc_results * * fdc_results *
*===========================================================================*/ *===========================================================================*/
PRIVATE int fdc_results(void) static int fdc_results(void)
{ {
/* Extract results from the controller after an operation, then allow floppy /* Extract results from the controller after an operation, then allow floppy
* interrupts again. * interrupts again.
@@ -987,7 +987,7 @@ PRIVATE int fdc_results(void)
/*===========================================================================* /*===========================================================================*
* fdc_command * * fdc_command *
*===========================================================================*/ *===========================================================================*/
PRIVATE int fdc_command( static int fdc_command(
const u8_t *cmd, /* command bytes */ const u8_t *cmd, /* command bytes */
int len /* command length */ int len /* command length */
) )
@@ -1012,7 +1012,7 @@ PRIVATE int fdc_command(
/*===========================================================================* /*===========================================================================*
* fdc_out * * fdc_out *
*===========================================================================*/ *===========================================================================*/
PRIVATE void fdc_out( static void fdc_out(
int val /* write this byte to floppy disk controller */ int val /* write this byte to floppy disk controller */
) )
{ {
@@ -1045,7 +1045,7 @@ PRIVATE void fdc_out(
/*===========================================================================* /*===========================================================================*
* recalibrate * * recalibrate *
*===========================================================================*/ *===========================================================================*/
PRIVATE int recalibrate(void) static int recalibrate(void)
{ {
/* The floppy disk controller has no way of determining its absolute arm /* The floppy disk controller has no way of determining its absolute arm
* position (cylinder). Instead, it steps the arm a cylinder at a time and * position (cylinder). Instead, it steps the arm a cylinder at a time and
@@ -1087,7 +1087,7 @@ PRIVATE int recalibrate(void)
/*===========================================================================* /*===========================================================================*
* f_reset * * f_reset *
*===========================================================================*/ *===========================================================================*/
PRIVATE void f_reset(void) static void f_reset(void)
{ {
/* Issue a reset to the controller. This is done after any catastrophe, /* Issue a reset to the controller. This is done after any catastrophe,
* like the controller refusing to respond. * like the controller refusing to respond.
@@ -1160,7 +1160,7 @@ PRIVATE void f_reset(void)
/*===========================================================================* /*===========================================================================*
* f_intr_wait * * f_intr_wait *
*===========================================================================*/ *===========================================================================*/
PRIVATE int f_intr_wait(void) static int f_intr_wait(void)
{ {
/* Wait for an interrupt, but not forever. The FDC may have all the time of /* Wait for an interrupt, but not forever. The FDC may have all the time of
* the world, but we humans do not. * the world, but we humans do not.
@@ -1199,7 +1199,7 @@ PRIVATE int f_intr_wait(void)
/*===========================================================================* /*===========================================================================*
* f_timeout * * f_timeout *
*===========================================================================*/ *===========================================================================*/
PRIVATE void f_timeout(timer_t *UNUSED(tp)) static void f_timeout(timer_t *UNUSED(tp))
{ {
/* This routine is called when a timer expires. Usually to tell that a /* This routine is called when a timer expires. Usually to tell that a
* motor has spun up, but also to forge an interrupt when it takes too long * motor has spun up, but also to forge an interrupt when it takes too long
@@ -1214,7 +1214,7 @@ PRIVATE void f_timeout(timer_t *UNUSED(tp))
/*===========================================================================* /*===========================================================================*
* read_id * * read_id *
*===========================================================================*/ *===========================================================================*/
PRIVATE int read_id(void) static int read_id(void)
{ {
/* Determine current cylinder and sector. */ /* Determine current cylinder and sector. */
@@ -1247,7 +1247,7 @@ PRIVATE int read_id(void)
/*===========================================================================* /*===========================================================================*
* f_do_open * * f_do_open *
*===========================================================================*/ *===========================================================================*/
PRIVATE int f_do_open(dev_t minor, int UNUSED(access)) static int f_do_open(dev_t minor, int UNUSED(access))
{ {
/* Handle an open on a floppy. Determine diskette type if need be. */ /* Handle an open on a floppy. Determine diskette type if need be. */
@@ -1306,7 +1306,7 @@ PRIVATE int f_do_open(dev_t minor, int UNUSED(access))
/*===========================================================================* /*===========================================================================*
* f_do_close * * f_do_close *
*===========================================================================*/ *===========================================================================*/
PRIVATE int f_do_close(dev_t UNUSED(minor)) static int f_do_close(dev_t UNUSED(minor))
{ {
/* Handle a close on a floppy. Nothing to do here. */ /* Handle a close on a floppy. Nothing to do here. */
@@ -1316,7 +1316,7 @@ PRIVATE int f_do_close(dev_t UNUSED(minor))
/*===========================================================================* /*===========================================================================*
* test_read * * test_read *
*===========================================================================*/ *===========================================================================*/
PRIVATE int test_read(int density) static int test_read(int density)
{ {
/* Try to read the highest numbered sector on cylinder 2. Not all floppy /* Try to read the highest numbered sector on cylinder 2. Not all floppy
* types have as many sectors per track, and trying cylinder 2 finds the * types have as many sectors per track, and trying cylinder 2 finds the
@@ -1346,7 +1346,7 @@ PRIVATE int test_read(int density)
/*===========================================================================* /*===========================================================================*
* f_geometry * * f_geometry *
*===========================================================================*/ *===========================================================================*/
PRIVATE void f_geometry(dev_t minor, struct partition *entry) static void f_geometry(dev_t minor, struct partition *entry)
{ {
if (f_prepare(minor) == NULL) return; if (f_prepare(minor) == NULL) return;

View File

@@ -22,7 +22,7 @@ EXTERN int last_was_write;
/*===========================================================================* /*===========================================================================*
* sef_cb_lu_prepare * * sef_cb_lu_prepare *
*===========================================================================*/ *===========================================================================*/
PUBLIC int sef_cb_lu_prepare(int state) int sef_cb_lu_prepare(int state)
{ {
int is_ready; int is_ready;
@@ -49,7 +49,7 @@ PUBLIC int sef_cb_lu_prepare(int state)
/*===========================================================================* /*===========================================================================*
* sef_cb_lu_state_isvalid * * sef_cb_lu_state_isvalid *
*===========================================================================*/ *===========================================================================*/
PUBLIC int sef_cb_lu_state_isvalid(int state) int sef_cb_lu_state_isvalid(int state)
{ {
return SEF_LU_STATE_IS_STANDARD(state) || FL_STATE_IS_CUSTOM(state); return SEF_LU_STATE_IS_STANDARD(state) || FL_STATE_IS_CUSTOM(state);
} }
@@ -57,7 +57,7 @@ PUBLIC int sef_cb_lu_state_isvalid(int state)
/*===========================================================================* /*===========================================================================*
* sef_cb_lu_state_dump * * sef_cb_lu_state_dump *
*===========================================================================*/ *===========================================================================*/
PUBLIC void sef_cb_lu_state_dump(int state) void sef_cb_lu_state_dump(int state)
{ {
sef_lu_dprint("floppy: live update state = %d\n", state); sef_lu_dprint("floppy: live update state = %d\n", state);
sef_lu_dprint("floppy: f_busy = %d\n", f_busy); sef_lu_dprint("floppy: f_busy = %d\n", f_busy);

View File

@@ -45,7 +45,7 @@ typedef int irq_hook_t;
/* ignore interrupt for the moment */ /* ignore interrupt for the moment */
#define interrupt(x) do { } while(0) #define interrupt(x) do { } while(0)
PRIVATE union tmpbuf static union tmpbuf
{ {
char pad[4096]; char pad[4096];
struct cbl_conf cc; struct cbl_conf cc;
@@ -136,13 +136,13 @@ fxp_t;
#define FT_82559 0x4 #define FT_82559 0x4
#define FT_82801 0x8 #define FT_82801 0x8
PRIVATE int fxp_instance; static int fxp_instance;
PRIVATE fxp_t *fxp_state; static fxp_t *fxp_state;
PRIVATE timer_t fxp_watchdog; static timer_t fxp_watchdog;
PRIVATE u32_t system_hz; static u32_t system_hz;
#define fxp_inb(port, offset) (do_inb((port) + (offset))) #define fxp_inb(port, offset) (do_inb((port) + (offset)))
#define fxp_inl(port, offset) (do_inl((port) + (offset))) #define fxp_inl(port, offset) (do_inl((port) + (offset)))
@@ -184,7 +184,7 @@ static void do_outl(port_t port, u32_t v);
static void tell_dev(vir_bytes start, size_t size, int pci_bus, int static void tell_dev(vir_bytes start, size_t size, int pci_bus, int
pci_dev, int pci_func); pci_dev, int pci_func);
PRIVATE void handle_hw_intr(void) static void handle_hw_intr(void)
{ {
int r; int r;
fxp_t *fp; fxp_t *fp;
@@ -208,9 +208,9 @@ PRIVATE void handle_hw_intr(void)
} }
/* SEF functions and variables. */ /* SEF functions and variables. */
FORWARD void sef_local_startup(void); static void sef_local_startup(void);
FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info); static int sef_cb_init_fresh(int type, sef_init_info_t *info);
FORWARD void sef_cb_signal_handler(int signo); static void sef_cb_signal_handler(int signo);
/*===========================================================================* /*===========================================================================*
* main * * main *
@@ -261,7 +261,7 @@ int main(int argc, char *argv[])
/*===========================================================================* /*===========================================================================*
* sef_local_startup * * sef_local_startup *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_local_startup() static void sef_local_startup()
{ {
/* Register init callbacks. */ /* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh); sef_setcb_init_fresh(sef_cb_init_fresh);
@@ -282,7 +282,7 @@ PRIVATE void sef_local_startup()
/*===========================================================================* /*===========================================================================*
* sef_cb_init_fresh * * sef_cb_init_fresh *
*===========================================================================*/ *===========================================================================*/
PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info)) static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{ {
/* Initialize the fxp driver. */ /* Initialize the fxp driver. */
long v; long v;
@@ -314,7 +314,7 @@ PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
/*===========================================================================* /*===========================================================================*
* sef_cb_signal_handler * * sef_cb_signal_handler *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_cb_signal_handler(int signo) static void sef_cb_signal_handler(int signo)
{ {
port_t port; port_t port;
fxp_t *fp; fxp_t *fp;
@@ -1986,7 +1986,7 @@ message *reply_mess;
/*===========================================================================* /*===========================================================================*
* eeprom_read * * eeprom_read *
*===========================================================================*/ *===========================================================================*/
PRIVATE u16_t eeprom_read(fp, reg) static u16_t eeprom_read(fp, reg)
fxp_t *fp; fxp_t *fp;
int reg; int reg;
{ {
@@ -2046,7 +2046,7 @@ int reg;
/*===========================================================================* /*===========================================================================*
* eeprom_addrsize * * eeprom_addrsize *
*===========================================================================*/ *===========================================================================*/
PRIVATE void eeprom_addrsize(fp) static void eeprom_addrsize(fp)
fxp_t *fp; fxp_t *fp;
{ {
port_t port; port_t port;
@@ -2104,7 +2104,7 @@ fxp_t *fp;
/*===========================================================================* /*===========================================================================*
* mii_read * * mii_read *
*===========================================================================*/ *===========================================================================*/
PRIVATE u16_t mii_read(fp, reg) static u16_t mii_read(fp, reg)
fxp_t *fp; fxp_t *fp;
int reg; int reg;
{ {
@@ -2178,7 +2178,7 @@ static void do_outl(port_t port, u32_t value)
panic("sys_outl failed: %d", r); panic("sys_outl failed: %d", r);
} }
PRIVATE void tell_dev(buf, size, pci_bus, pci_dev, pci_func) static void tell_dev(buf, size, pci_bus, pci_dev, pci_func)
vir_bytes buf; vir_bytes buf;
size_t size; size_t size;
int pci_bus; int pci_bus;

View File

@@ -16,7 +16,7 @@ Media Independent (Ethernet) Interface functions
/*===========================================================================* /*===========================================================================*
* mii_print_stat_speed * * mii_print_stat_speed *
*===========================================================================*/ *===========================================================================*/
PUBLIC void mii_print_stat_speed(u16_t stat, u16_t extstat) void mii_print_stat_speed(u16_t stat, u16_t extstat)
{ {
int fs, ft; int fs, ft;
@@ -117,7 +117,7 @@ PUBLIC void mii_print_stat_speed(u16_t stat, u16_t extstat)
/*===========================================================================* /*===========================================================================*
* mii_print_techab * * mii_print_techab *
*===========================================================================*/ *===========================================================================*/
PUBLIC void mii_print_techab(u16_t techab) void mii_print_techab(u16_t techab)
{ {
int fs, ft; int fs, ft;

View File

@@ -8,21 +8,21 @@
/* /*
* Function prototypes for the hello driver. * Function prototypes for the hello driver.
*/ */
FORWARD int hello_open(message *m); static int hello_open(message *m);
FORWARD int hello_close(message *m); static int hello_close(message *m);
FORWARD struct device * hello_prepare(dev_t device); static struct device * hello_prepare(dev_t device);
FORWARD int hello_transfer(endpoint_t endpt, int opcode, u64_t position, static int hello_transfer(endpoint_t endpt, int opcode, u64_t position,
iovec_t *iov, unsigned int nr_req, endpoint_t user_endpt, unsigned int iovec_t *iov, unsigned int nr_req, endpoint_t user_endpt, unsigned int
flags); flags);
/* SEF functions and variables. */ /* SEF functions and variables. */
FORWARD void sef_local_startup(void); static void sef_local_startup(void);
FORWARD int sef_cb_init(int type, sef_init_info_t *info); static int sef_cb_init(int type, sef_init_info_t *info);
FORWARD int sef_cb_lu_state_save(int); static int sef_cb_lu_state_save(int);
FORWARD int lu_state_restore(void); static int lu_state_restore(void);
/* Entry points to the hello driver. */ /* Entry points to the hello driver. */
PRIVATE struct chardriver hello_tab = static struct chardriver hello_tab =
{ {
hello_open, hello_open,
hello_close, hello_close,
@@ -37,31 +37,31 @@ PRIVATE struct chardriver hello_tab =
}; };
/** Represents the /dev/hello device. */ /** Represents the /dev/hello device. */
PRIVATE struct device hello_device; static struct device hello_device;
/** State variable to count the number of times the device has been opened. */ /** State variable to count the number of times the device has been opened. */
PRIVATE int open_counter; static int open_counter;
PRIVATE int hello_open(message *UNUSED(m)) static int hello_open(message *UNUSED(m))
{ {
printf("hello_open(). Called %d time(s).\n", ++open_counter); printf("hello_open(). Called %d time(s).\n", ++open_counter);
return OK; return OK;
} }
PRIVATE int hello_close(message *UNUSED(m)) static int hello_close(message *UNUSED(m))
{ {
printf("hello_close()\n"); printf("hello_close()\n");
return OK; return OK;
} }
PRIVATE struct device * hello_prepare(dev_t UNUSED(dev)) static struct device * hello_prepare(dev_t UNUSED(dev))
{ {
hello_device.dv_base = make64(0, 0); hello_device.dv_base = make64(0, 0);
hello_device.dv_size = make64(strlen(HELLO_MESSAGE), 0); hello_device.dv_size = make64(strlen(HELLO_MESSAGE), 0);
return &hello_device; return &hello_device;
} }
PRIVATE int hello_transfer(endpoint_t endpt, int opcode, u64_t position, static int hello_transfer(endpoint_t endpt, int opcode, u64_t position,
iovec_t *iov, unsigned nr_req, endpoint_t UNUSED(user_endpt), iovec_t *iov, unsigned nr_req, endpoint_t UNUSED(user_endpt),
unsigned int UNUSED(flags)) unsigned int UNUSED(flags))
{ {
@@ -97,14 +97,14 @@ PRIVATE int hello_transfer(endpoint_t endpt, int opcode, u64_t position,
return ret; return ret;
} }
PRIVATE int sef_cb_lu_state_save(int UNUSED(state)) { static int sef_cb_lu_state_save(int UNUSED(state)) {
/* Save the state. */ /* Save the state. */
ds_publish_u32("open_counter", open_counter, DSF_OVERWRITE); ds_publish_u32("open_counter", open_counter, DSF_OVERWRITE);
return OK; return OK;
} }
PRIVATE int lu_state_restore() { static int lu_state_restore() {
/* Restore the state. */ /* Restore the state. */
u32_t value; u32_t value;
@@ -115,7 +115,7 @@ PRIVATE int lu_state_restore() {
return OK; return OK;
} }
PRIVATE void sef_local_startup() static void sef_local_startup()
{ {
/* /*
* Register init callbacks. Use the same function for all event types * Register init callbacks. Use the same function for all event types
@@ -138,7 +138,7 @@ PRIVATE void sef_local_startup()
sef_startup(); sef_startup();
} }
PRIVATE int sef_cb_init(int type, sef_init_info_t *UNUSED(info)) static int sef_cb_init(int type, sef_init_info_t *UNUSED(info))
{ {
/* Initialize the hello driver. */ /* Initialize the hello driver. */
int do_announce_driver = TRUE; int do_announce_driver = TRUE;
@@ -171,7 +171,7 @@ PRIVATE int sef_cb_init(int type, sef_init_info_t *UNUSED(info))
return OK; return OK;
} }
PUBLIC int main(void) int main(void)
{ {
/* /*
* Perform initialization. * Perform initialization.

View File

@@ -245,9 +245,9 @@ static char isstored[TX_RING_SIZE]; /* Tx-slot in-use */
phys_bytes lance_buf_phys; phys_bytes lance_buf_phys;
/* SEF functions and variables. */ /* SEF functions and variables. */
FORWARD void sef_local_startup(void); static void sef_local_startup(void);
FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info); static int sef_cb_init_fresh(int type, sef_init_info_t *info);
FORWARD void sef_cb_signal_handler(int signo); static void sef_cb_signal_handler(int signo);
/*===========================================================================* /*===========================================================================*
* main * * main *
@@ -322,7 +322,7 @@ int main( int argc, char **argv )
/*===========================================================================* /*===========================================================================*
* sef_local_startup * * sef_local_startup *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_local_startup() static void sef_local_startup()
{ {
/* Register init callbacks. */ /* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh); sef_setcb_init_fresh(sef_cb_init_fresh);
@@ -343,7 +343,7 @@ PRIVATE void sef_local_startup()
/*===========================================================================* /*===========================================================================*
* sef_cb_init_fresh * * sef_cb_init_fresh *
*===========================================================================*/ *===========================================================================*/
PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info)) static int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
{ {
/* Initialize the lance driver. */ /* Initialize the lance driver. */
long v; long v;
@@ -371,7 +371,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
/*===========================================================================* /*===========================================================================*
* sef_cb_signal_handler * * sef_cb_signal_handler *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_cb_signal_handler(int signo) static void sef_cb_signal_handler(int signo)
{ {
/* Only check for termination signal, ignore anything else. */ /* Only check for termination signal, ignore anything else. */

View File

@@ -12,7 +12,7 @@
/*==========================================================================* /*==========================================================================*
* do_new_kmess * * do_new_kmess *
*==========================================================================*/ *==========================================================================*/
PUBLIC void do_new_kmess(void) void do_new_kmess(void)
{ {
/* Notification for a new kernel message. */ /* Notification for a new kernel message. */
static struct kmessages kmess; /* entire kmess structure */ static struct kmessages kmess; /* entire kmess structure */

View File

@@ -5,9 +5,9 @@
EXTERN struct logdevice logdevices[NR_DEVS]; EXTERN struct logdevice logdevices[NR_DEVS];
/* State management helpers. */ /* State management helpers. */
PRIVATE int is_read_pending; static int is_read_pending;
PRIVATE int is_select_callback_pending; static int is_select_callback_pending;
PRIVATE void load_state_info(void) static void load_state_info(void)
{ {
int i, found_pending; int i, found_pending;
struct logdevice *log; struct logdevice *log;
@@ -36,7 +36,7 @@ PRIVATE void load_state_info(void)
/*===========================================================================* /*===========================================================================*
* sef_cb_lu_prepare * * sef_cb_lu_prepare *
*===========================================================================*/ *===========================================================================*/
PUBLIC int sef_cb_lu_prepare(int state) int sef_cb_lu_prepare(int state)
{ {
int is_ready; int is_ready;
@@ -68,7 +68,7 @@ PUBLIC int sef_cb_lu_prepare(int state)
/*===========================================================================* /*===========================================================================*
* sef_cb_lu_state_isvalid * * sef_cb_lu_state_isvalid *
*===========================================================================*/ *===========================================================================*/
PUBLIC int sef_cb_lu_state_isvalid(int state) int sef_cb_lu_state_isvalid(int state)
{ {
return SEF_LU_STATE_IS_STANDARD(state) || LOG_STATE_IS_CUSTOM(state); return SEF_LU_STATE_IS_STANDARD(state) || LOG_STATE_IS_CUSTOM(state);
} }
@@ -76,7 +76,7 @@ PUBLIC int sef_cb_lu_state_isvalid(int state)
/*===========================================================================* /*===========================================================================*
* sef_cb_lu_state_dump * * sef_cb_lu_state_dump *
*===========================================================================*/ *===========================================================================*/
PUBLIC void sef_cb_lu_state_dump(int state) void sef_cb_lu_state_dump(int state)
{ {
/* Load state information. */ /* Load state information. */
load_state_info(); load_state_info();

View File

@@ -18,23 +18,23 @@
#define LOGINC(n, i) do { (n) = (((n) + (i)) % LOG_SIZE); } while(0) #define LOGINC(n, i) do { (n) = (((n) + (i)) % LOG_SIZE); } while(0)
PUBLIC struct logdevice logdevices[NR_DEVS]; struct logdevice logdevices[NR_DEVS];
PRIVATE struct device log_geom[NR_DEVS]; /* base and size of devices */ static struct device log_geom[NR_DEVS]; /* base and size of devices */
PRIVATE int log_device = -1; /* current device */ static int log_device = -1; /* current device */
FORWARD struct device *log_prepare(dev_t device); static struct device *log_prepare(dev_t device);
FORWARD int log_transfer(endpoint_t endpt, int opcode, u64_t position, static int log_transfer(endpoint_t endpt, int opcode, u64_t position,
iovec_t *iov, unsigned int nr_req, endpoint_t user_endpt, unsigned int iovec_t *iov, unsigned int nr_req, endpoint_t user_endpt, unsigned int
flags); flags);
FORWARD int log_do_open(message *m_ptr); static int log_do_open(message *m_ptr);
FORWARD int log_cancel(message *m_ptr); static int log_cancel(message *m_ptr);
FORWARD int log_select(message *m_ptr); static int log_select(message *m_ptr);
FORWARD int log_other(message *m_ptr); static int log_other(message *m_ptr);
FORWARD int subread(struct logdevice *log, int count, endpoint_t endpt, static int subread(struct logdevice *log, int count, endpoint_t endpt,
cp_grant_id_t grant, size_t); cp_grant_id_t grant, size_t);
/* Entry points to this driver. */ /* Entry points to this driver. */
PRIVATE struct chardriver log_dtab = { static struct chardriver log_dtab = {
log_do_open, /* open or mount */ log_do_open, /* open or mount */
do_nop, /* nothing on a close */ do_nop, /* nothing on a close */
nop_ioctl, /* ioctl nop */ nop_ioctl, /* ioctl nop */
@@ -48,17 +48,17 @@ PRIVATE struct chardriver log_dtab = {
}; };
/* SEF functions and variables. */ /* SEF functions and variables. */
FORWARD void sef_local_startup(void); static void sef_local_startup(void);
FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info); static int sef_cb_init_fresh(int type, sef_init_info_t *info);
EXTERN int sef_cb_lu_prepare(int state); EXTERN int sef_cb_lu_prepare(int state);
EXTERN int sef_cb_lu_state_isvalid(int state); EXTERN int sef_cb_lu_state_isvalid(int state);
EXTERN void sef_cb_lu_state_dump(int state); EXTERN void sef_cb_lu_state_dump(int state);
FORWARD void sef_cb_signal_handler(int signo); static void sef_cb_signal_handler(int signo);
/*===========================================================================* /*===========================================================================*
* main * * main *
*===========================================================================*/ *===========================================================================*/
PUBLIC int main(void) int main(void)
{ {
/* SEF local startup. */ /* SEF local startup. */
sef_local_startup(); sef_local_startup();
@@ -72,7 +72,7 @@ PUBLIC int main(void)
/*===========================================================================* /*===========================================================================*
* sef_local_startup * * sef_local_startup *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_local_startup() static void sef_local_startup()
{ {
/* Register init callbacks. */ /* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh); sef_setcb_init_fresh(sef_cb_init_fresh);
@@ -94,7 +94,7 @@ PRIVATE void sef_local_startup()
/*===========================================================================* /*===========================================================================*
* sef_cb_init_fresh * * sef_cb_init_fresh *
*===========================================================================*/ *===========================================================================*/
PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info)) static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{ {
/* Initialize the log driver. */ /* Initialize the log driver. */
int i; int i;
@@ -118,7 +118,7 @@ PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
/*===========================================================================* /*===========================================================================*
* sef_cb_signal_handler * * sef_cb_signal_handler *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_cb_signal_handler(int signo) static void sef_cb_signal_handler(int signo)
{ {
/* Only check for a pending message from the kernel, ignore anything else. */ /* Only check for a pending message from the kernel, ignore anything else. */
if (signo != SIGKMESS) return; if (signo != SIGKMESS) return;
@@ -129,7 +129,7 @@ PRIVATE void sef_cb_signal_handler(int signo)
/*===========================================================================* /*===========================================================================*
* log_prepare * * log_prepare *
*===========================================================================*/ *===========================================================================*/
PRIVATE struct device *log_prepare(dev_t device) static struct device *log_prepare(dev_t device)
{ {
/* Prepare for I/O on a device: check if the minor device number is ok. */ /* Prepare for I/O on a device: check if the minor device number is ok. */
@@ -142,7 +142,7 @@ PRIVATE struct device *log_prepare(dev_t device)
/*===========================================================================* /*===========================================================================*
* subwrite * * subwrite *
*===========================================================================*/ *===========================================================================*/
PRIVATE int static int
subwrite(struct logdevice *log, int count, endpoint_t endpt, subwrite(struct logdevice *log, int count, endpoint_t endpt,
cp_grant_id_t grant, size_t offset, char *localbuf) cp_grant_id_t grant, size_t offset, char *localbuf)
{ {
@@ -230,7 +230,7 @@ subwrite(struct logdevice *log, int count, endpoint_t endpt,
/*===========================================================================* /*===========================================================================*
* log_append * * log_append *
*===========================================================================*/ *===========================================================================*/
PUBLIC void void
log_append(char *buf, int count) log_append(char *buf, int count)
{ {
int w = 0, skip = 0; int w = 0, skip = 0;
@@ -250,7 +250,7 @@ log_append(char *buf, int count)
/*===========================================================================* /*===========================================================================*
* subread * * subread *
*===========================================================================*/ *===========================================================================*/
PRIVATE int static int
subread(struct logdevice *log, int count, endpoint_t endpt, subread(struct logdevice *log, int count, endpoint_t endpt,
cp_grant_id_t grant, size_t offset) cp_grant_id_t grant, size_t offset)
{ {
@@ -275,7 +275,7 @@ subread(struct logdevice *log, int count, endpoint_t endpt,
/*===========================================================================* /*===========================================================================*
* log_transfer * * log_transfer *
*===========================================================================*/ *===========================================================================*/
PRIVATE int log_transfer( static int log_transfer(
endpoint_t endpt, /* endpoint of grant owner */ endpoint_t endpt, /* endpoint of grant owner */
int opcode, /* DEV_GATHER_S or DEV_SCATTER_S */ int opcode, /* DEV_GATHER_S or DEV_SCATTER_S */
u64_t UNUSED(position), /* offset on device to read or write */ u64_t UNUSED(position), /* offset on device to read or write */
@@ -356,7 +356,7 @@ PRIVATE int log_transfer(
/*============================================================================* /*============================================================================*
* log_do_open * * log_do_open *
*============================================================================*/ *============================================================================*/
PRIVATE int log_do_open(message *m_ptr) static int log_do_open(message *m_ptr)
{ {
if (log_prepare(m_ptr->DEVICE) == NULL) return(ENXIO); if (log_prepare(m_ptr->DEVICE) == NULL) return(ENXIO);
return(OK); return(OK);
@@ -365,7 +365,7 @@ PRIVATE int log_do_open(message *m_ptr)
/*============================================================================* /*============================================================================*
* log_cancel * * log_cancel *
*============================================================================*/ *============================================================================*/
PRIVATE int log_cancel(message *m_ptr) static int log_cancel(message *m_ptr)
{ {
int d; int d;
d = m_ptr->TTY_LINE; d = m_ptr->TTY_LINE;
@@ -379,7 +379,7 @@ PRIVATE int log_cancel(message *m_ptr)
/*============================================================================* /*============================================================================*
* log_other * * log_other *
*============================================================================*/ *============================================================================*/
PRIVATE int log_other(message *m_ptr) static int log_other(message *m_ptr)
{ {
int r; int r;
@@ -406,7 +406,7 @@ PRIVATE int log_other(message *m_ptr)
/*============================================================================* /*============================================================================*
* log_select * * log_select *
*============================================================================*/ *============================================================================*/
PRIVATE int log_select(message *m_ptr) static int log_select(message *m_ptr)
{ {
int d, ready_ops = 0, ops = 0; int d, ready_ops = 0, ops = 0;
d = m_ptr->TTY_LINE; d = m_ptr->TTY_LINE;

View File

@@ -38,29 +38,29 @@
#define NR_DEVS (7+RAMDISKS) /* number of minor devices */ #define NR_DEVS (7+RAMDISKS) /* number of minor devices */
PRIVATE struct device m_geom[NR_DEVS]; /* base and size of each device */ static struct device m_geom[NR_DEVS]; /* base and size of each device */
PRIVATE vir_bytes m_vaddrs[NR_DEVS]; static vir_bytes m_vaddrs[NR_DEVS];
PRIVATE dev_t m_device; /* current minor character device */ static dev_t m_device; /* current minor character device */
PRIVATE int openct[NR_DEVS]; static int openct[NR_DEVS];
FORWARD struct device *m_prepare(dev_t device); static struct device *m_prepare(dev_t device);
FORWARD int m_transfer(endpoint_t endpt, int opcode, u64_t position, static int m_transfer(endpoint_t endpt, int opcode, u64_t position,
iovec_t *iov, unsigned int nr_req, endpoint_t user_endpt, unsigned int iovec_t *iov, unsigned int nr_req, endpoint_t user_endpt, unsigned int
flags); flags);
FORWARD int m_do_open(message *m_ptr); static int m_do_open(message *m_ptr);
FORWARD int m_do_close(message *m_ptr); static int m_do_close(message *m_ptr);
FORWARD struct device *m_block_part(dev_t minor); static struct device *m_block_part(dev_t minor);
FORWARD int m_block_transfer(dev_t minor, int do_write, u64_t position, static int m_block_transfer(dev_t minor, int do_write, u64_t position,
endpoint_t endpt, iovec_t *iov, unsigned int nr_req, int flags); endpoint_t endpt, iovec_t *iov, unsigned int nr_req, int flags);
FORWARD int m_block_open(dev_t minor, int access); static int m_block_open(dev_t minor, int access);
FORWARD int m_block_close(dev_t minor); static int m_block_close(dev_t minor);
FORWARD int m_block_ioctl(dev_t minor, unsigned int request, endpoint_t static int m_block_ioctl(dev_t minor, unsigned int request, endpoint_t
endpt, cp_grant_id_t grant); endpt, cp_grant_id_t grant);
/* Entry points to the CHARACTER part of this driver. */ /* Entry points to the CHARACTER part of this driver. */
PRIVATE struct chardriver m_cdtab = { static struct chardriver m_cdtab = {
m_do_open, /* open or mount */ m_do_open, /* open or mount */
m_do_close, /* nothing on a close */ m_do_close, /* nothing on a close */
nop_ioctl, /* no I/O control */ nop_ioctl, /* no I/O control */
@@ -74,7 +74,7 @@ PRIVATE struct chardriver m_cdtab = {
}; };
/* Entry points to the BLOCK part of this driver. */ /* Entry points to the BLOCK part of this driver. */
PRIVATE struct blockdriver m_bdtab = { static struct blockdriver m_bdtab = {
BLOCKDRIVER_TYPE_DISK,/* handle partition requests */ BLOCKDRIVER_TYPE_DISK,/* handle partition requests */
m_block_open, /* open or mount */ m_block_open, /* open or mount */
m_block_close, /* nothing on a close */ m_block_close, /* nothing on a close */
@@ -91,19 +91,19 @@ PRIVATE struct blockdriver m_bdtab = {
/* Buffer for the /dev/zero null byte feed. */ /* Buffer for the /dev/zero null byte feed. */
#define ZERO_BUF_SIZE 1024 #define ZERO_BUF_SIZE 1024
PRIVATE char dev_zero[ZERO_BUF_SIZE]; static char dev_zero[ZERO_BUF_SIZE];
#define click_to_round_k(n) \ #define click_to_round_k(n) \
((unsigned) ((((unsigned long) (n) << CLICK_SHIFT) + 512) / 1024)) ((unsigned) ((((unsigned long) (n) << CLICK_SHIFT) + 512) / 1024))
/* SEF functions and variables. */ /* SEF functions and variables. */
FORWARD void sef_local_startup(void); static void sef_local_startup(void);
FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info); static int sef_cb_init_fresh(int type, sef_init_info_t *info);
/*===========================================================================* /*===========================================================================*
* main * * main *
*===========================================================================*/ *===========================================================================*/
PUBLIC int main(void) int main(void)
{ {
message msg; message msg;
int r, ipc_status; int r, ipc_status;
@@ -129,7 +129,7 @@ PUBLIC int main(void)
/*===========================================================================* /*===========================================================================*
* sef_local_startup * * sef_local_startup *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_local_startup() static void sef_local_startup()
{ {
/* Register init callbacks. */ /* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh); sef_setcb_init_fresh(sef_cb_init_fresh);
@@ -147,7 +147,7 @@ PRIVATE void sef_local_startup()
/*===========================================================================* /*===========================================================================*
* sef_cb_init_fresh * * sef_cb_init_fresh *
*===========================================================================*/ *===========================================================================*/
PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info)) static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{ {
/* Initialize the memory driver. */ /* Initialize the memory driver. */
int i; int i;
@@ -193,7 +193,7 @@ PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
/*===========================================================================* /*===========================================================================*
* m_is_block * * m_is_block *
*===========================================================================*/ *===========================================================================*/
PRIVATE int m_is_block(dev_t minor) static int m_is_block(dev_t minor)
{ {
/* Return TRUE iff the given minor device number is for a block device. */ /* Return TRUE iff the given minor device number is for a block device. */
@@ -212,7 +212,7 @@ PRIVATE int m_is_block(dev_t minor)
/*===========================================================================* /*===========================================================================*
* m_prepare * * m_prepare *
*===========================================================================*/ *===========================================================================*/
PRIVATE struct device *m_prepare(dev_t device) static struct device *m_prepare(dev_t device)
{ {
/* Prepare for I/O on a device: check if the minor device number is ok. */ /* Prepare for I/O on a device: check if the minor device number is ok. */
if (device >= NR_DEVS || m_is_block(device)) return(NULL); if (device >= NR_DEVS || m_is_block(device)) return(NULL);
@@ -224,7 +224,7 @@ PRIVATE struct device *m_prepare(dev_t device)
/*===========================================================================* /*===========================================================================*
* m_transfer * * m_transfer *
*===========================================================================*/ *===========================================================================*/
PRIVATE int m_transfer( static int m_transfer(
endpoint_t endpt, /* endpoint of grant owner */ endpoint_t endpt, /* endpoint of grant owner */
int opcode, /* DEV_GATHER_S or DEV_SCATTER_S */ int opcode, /* DEV_GATHER_S or DEV_SCATTER_S */
u64_t pos64, /* offset on device to read or write */ u64_t pos64, /* offset on device to read or write */
@@ -381,7 +381,7 @@ PRIVATE int m_transfer(
/*===========================================================================* /*===========================================================================*
* m_do_open * * m_do_open *
*===========================================================================*/ *===========================================================================*/
PRIVATE int m_do_open(message *m_ptr) static int m_do_open(message *m_ptr)
{ {
/* Open a memory character device. */ /* Open a memory character device. */
int r; int r;
@@ -407,7 +407,7 @@ PRIVATE int m_do_open(message *m_ptr)
/*===========================================================================* /*===========================================================================*
* m_do_close * * m_do_close *
*===========================================================================*/ *===========================================================================*/
PRIVATE int m_do_close(message *m_ptr) static int m_do_close(message *m_ptr)
{ {
/* Close a memory character device. */ /* Close a memory character device. */
if (m_prepare(m_ptr->DEVICE) == NULL) return(ENXIO); if (m_prepare(m_ptr->DEVICE) == NULL) return(ENXIO);
@@ -424,7 +424,7 @@ PRIVATE int m_do_close(message *m_ptr)
/*===========================================================================* /*===========================================================================*
* m_block_part * * m_block_part *
*===========================================================================*/ *===========================================================================*/
PRIVATE struct device *m_block_part(dev_t minor) static struct device *m_block_part(dev_t minor)
{ {
/* Prepare for I/O on a device: check if the minor device number is ok. */ /* Prepare for I/O on a device: check if the minor device number is ok. */
if (minor >= NR_DEVS || !m_is_block(minor)) return(NULL); if (minor >= NR_DEVS || !m_is_block(minor)) return(NULL);
@@ -435,7 +435,7 @@ PRIVATE struct device *m_block_part(dev_t minor)
/*===========================================================================* /*===========================================================================*
* m_block_transfer * * m_block_transfer *
*===========================================================================*/ *===========================================================================*/
PRIVATE int m_block_transfer( static int m_block_transfer(
dev_t minor, /* minor device number */ dev_t minor, /* minor device number */
int do_write, /* read or write? */ int do_write, /* read or write? */
u64_t pos64, /* offset on device to read or write */ u64_t pos64, /* offset on device to read or write */
@@ -502,7 +502,7 @@ PRIVATE int m_block_transfer(
/*===========================================================================* /*===========================================================================*
* m_block_open * * m_block_open *
*===========================================================================*/ *===========================================================================*/
PRIVATE int m_block_open(dev_t minor, int UNUSED(access)) static int m_block_open(dev_t minor, int UNUSED(access))
{ {
/* Open a memory block device. */ /* Open a memory block device. */
if (m_block_part(minor) == NULL) return(ENXIO); if (m_block_part(minor) == NULL) return(ENXIO);
@@ -515,7 +515,7 @@ PRIVATE int m_block_open(dev_t minor, int UNUSED(access))
/*===========================================================================* /*===========================================================================*
* m_block_close * * m_block_close *
*===========================================================================*/ *===========================================================================*/
PRIVATE int m_block_close(dev_t minor) static int m_block_close(dev_t minor)
{ {
/* Close a memory block device. */ /* Close a memory block device. */
if (m_block_part(minor) == NULL) return(ENXIO); if (m_block_part(minor) == NULL) return(ENXIO);
@@ -556,7 +556,7 @@ PRIVATE int m_block_close(dev_t minor)
/*===========================================================================* /*===========================================================================*
* m_block_ioctl * * m_block_ioctl *
*===========================================================================*/ *===========================================================================*/
PRIVATE int m_block_ioctl(dev_t minor, unsigned int request, endpoint_t endpt, static int m_block_ioctl(dev_t minor, unsigned int request, endpoint_t endpt,
cp_grant_id_t grant) cp_grant_id_t grant)
{ {
/* I/O controls for the block devices of the memory driver. Currently there is /* I/O controls for the block devices of the memory driver. Currently there is

View File

@@ -43,7 +43,7 @@
* * * *
* Wait msecs milli seconds * * Wait msecs milli seconds *
*****************************************************************************/ *****************************************************************************/
PRIVATE void milli_delay(unsigned int msecs) static void milli_delay(unsigned int msecs)
{ {
micro_delay((long)msecs * 1000); micro_delay((long)msecs * 1000);
} }
@@ -141,7 +141,7 @@ int hermes_cor_reset (hermes_t *hw) {
* Check whether we have access to the card. Does the SWSUPPORT0 contain the * * Check whether we have access to the card. Does the SWSUPPORT0 contain the *
* value we put in it earlier? * * value we put in it earlier? *
*****************************************************************************/ *****************************************************************************/
PRIVATE int hermes_present (hermes_t * hw) { static int hermes_present (hermes_t * hw) {
int i = hermes_read_reg (hw, HERMES_SWSUPPORT0) == HERMES_MAGIC; int i = hermes_read_reg (hw, HERMES_SWSUPPORT0) == HERMES_MAGIC;
if (!i) if (!i)
printf("Hermes: Error, card not present?\n"); printf("Hermes: Error, card not present?\n");

View File

@@ -69,8 +69,8 @@
#define IRQ_BAP 1 #define IRQ_BAP 1
#define ETH_HLEN 14 #define ETH_HLEN 14
PRIVATE t_or or_state; static t_or or_state;
PRIVATE int or_instance; static int or_instance;
struct ethhdr { struct ethhdr {
u8_t h_dest[ETH_ALEN]; u8_t h_dest[ETH_ALEN];
@@ -102,7 +102,7 @@ u8_t encaps_hdr[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 };
********************************************************************/ ********************************************************************/
/* The frequency of each channel in MHz */ /* The frequency of each channel in MHz */
PRIVATE const long channel_frequency[] = { static const long channel_frequency[] = {
2412, 2417, 2422, 2427, 2432, 2437, 2442, 2412, 2417, 2422, 2427, 2432, 2437, 2442,
2447, 2452, 2457, 2462, 2467, 2472, 2484 2447, 2452, 2457, 2462, 2467, 2472, 2484
}; };
@@ -159,15 +159,15 @@ static void or_dump(message *m);
/* The message used in the main loop is made global, so that rl_watchdog_f() /* The message used in the main loop is made global, so that rl_watchdog_f()
* can change its message type to fake an interrupt message. * can change its message type to fake an interrupt message.
*/ */
PRIVATE message m; static message m;
PRIVATE int int_event_check; /* set to TRUE if events arrived */ static int int_event_check; /* set to TRUE if events arrived */
PRIVATE u32_t system_hz; static u32_t system_hz;
/* SEF functions and variables. */ /* SEF functions and variables. */
FORWARD void sef_local_startup(void); static void sef_local_startup(void);
FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info); static int sef_cb_init_fresh(int type, sef_init_info_t *info);
FORWARD void sef_cb_signal_handler(int signo); static void sef_cb_signal_handler(int signo);
/***************************************************************************** /*****************************************************************************
* main * * main *
@@ -231,7 +231,7 @@ int main(int argc, char *argv[]) {
/*===========================================================================* /*===========================================================================*
* sef_local_startup * * sef_local_startup *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_local_startup() static void sef_local_startup()
{ {
/* Register init callbacks. */ /* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh); sef_setcb_init_fresh(sef_cb_init_fresh);
@@ -252,7 +252,7 @@ PRIVATE void sef_local_startup()
/*===========================================================================* /*===========================================================================*
* sef_cb_init_fresh * * sef_cb_init_fresh *
*===========================================================================*/ *===========================================================================*/
PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) static int sef_cb_init_fresh(int type, sef_init_info_t *info)
{ {
/* Initialize the orinoco driver. */ /* Initialize the orinoco driver. */
long v; long v;
@@ -278,7 +278,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info)
/*===========================================================================* /*===========================================================================*
* sef_cb_signal_handler * * sef_cb_signal_handler *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_cb_signal_handler(int signo) static void sef_cb_signal_handler(int signo)
{ {
t_or *orp; t_or *orp;

View File

@@ -4,33 +4,33 @@ main.c
#include "pci.h" #include "pci.h"
PUBLIC struct pci_acl pci_acl[NR_DRIVERS]; struct pci_acl pci_acl[NR_DRIVERS];
FORWARD void do_init(message *mp); static void do_init(message *mp);
FORWARD void do_first_dev(message *mp); static void do_first_dev(message *mp);
FORWARD void do_next_dev(message *mp); static void do_next_dev(message *mp);
FORWARD void do_find_dev(message *mp); static void do_find_dev(message *mp);
FORWARD void do_ids(message *mp); static void do_ids(message *mp);
FORWARD void do_dev_name_s(message *mp); static void do_dev_name_s(message *mp);
FORWARD void do_slot_name_s(message *mp); static void do_slot_name_s(message *mp);
FORWARD void do_set_acl(message *mp); static void do_set_acl(message *mp);
FORWARD void do_del_acl(message *mp); static void do_del_acl(message *mp);
FORWARD void do_reserve(message *mp); static void do_reserve(message *mp);
FORWARD void do_attr_r8(message *mp); static void do_attr_r8(message *mp);
FORWARD void do_attr_r16(message *mp); static void do_attr_r16(message *mp);
FORWARD void do_attr_r32(message *mp); static void do_attr_r32(message *mp);
FORWARD void do_attr_w8(message *mp); static void do_attr_w8(message *mp);
FORWARD void do_attr_w16(message *mp); static void do_attr_w16(message *mp);
FORWARD void do_attr_w32(message *mp); static void do_attr_w32(message *mp);
FORWARD void do_get_bar(message *mp); static void do_get_bar(message *mp);
FORWARD void do_rescan_bus(message *mp); static void do_rescan_bus(message *mp);
FORWARD void reply(message *mp, int result); static void reply(message *mp, int result);
FORWARD struct rs_pci *find_acl(int endpoint); static struct rs_pci *find_acl(int endpoint);
extern int debug; extern int debug;
/* SEF functions and variables. */ /* SEF functions and variables. */
FORWARD void sef_local_startup(void); static void sef_local_startup(void);
int main(void) int main(void)
{ {
@@ -90,7 +90,7 @@ int main(void)
/*===========================================================================* /*===========================================================================*
* sef_local_startup * * sef_local_startup *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_local_startup() static void sef_local_startup()
{ {
/* Register init callbacks. */ /* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh); sef_setcb_init_fresh(sef_cb_init_fresh);
@@ -105,7 +105,7 @@ PRIVATE void sef_local_startup()
sef_startup(); sef_startup();
} }
PRIVATE void do_init(mp) static void do_init(mp)
message *mp; message *mp;
{ {
int r; int r;
@@ -121,7 +121,7 @@ message *mp;
mp->m_source, r); mp->m_source, r);
} }
PRIVATE void do_first_dev(message *mp) static void do_first_dev(message *mp)
{ {
int r, devind; int r, devind;
u16_t vid, did; u16_t vid, did;
@@ -149,7 +149,7 @@ PRIVATE void do_first_dev(message *mp)
} }
} }
PRIVATE void do_next_dev(message *mp) static void do_next_dev(message *mp)
{ {
int r, devind; int r, devind;
u16_t vid, did; u16_t vid, did;
@@ -174,7 +174,7 @@ PRIVATE void do_next_dev(message *mp)
} }
} }
PRIVATE void do_find_dev(mp) static void do_find_dev(mp)
message *mp; message *mp;
{ {
int r, devind; int r, devind;
@@ -196,7 +196,7 @@ message *mp;
} }
} }
PRIVATE void do_ids(mp) static void do_ids(mp)
message *mp; message *mp;
{ {
int r, devind; int r, devind;
@@ -222,7 +222,7 @@ message *mp;
} }
} }
PRIVATE void do_dev_name_s(mp) static void do_dev_name_s(mp)
message *mp; message *mp;
{ {
int r, name_len, len; int r, name_len, len;
@@ -259,7 +259,7 @@ message *mp;
} }
} }
PRIVATE void do_slot_name_s(mp) static void do_slot_name_s(mp)
message *mp; message *mp;
{ {
int r, devind, name_len, len; int r, devind, name_len, len;
@@ -295,7 +295,7 @@ message *mp;
} }
} }
PRIVATE void do_set_acl(mp) static void do_set_acl(mp)
message *mp; message *mp;
{ {
int i, r, gid; int i, r, gid;
@@ -338,7 +338,7 @@ message *mp;
reply(mp, OK); reply(mp, OK);
} }
PRIVATE void do_del_acl(message *mp) static void do_del_acl(message *mp)
{ {
int i, proc_nr; int i, proc_nr;
@@ -378,7 +378,7 @@ PRIVATE void do_del_acl(message *mp)
reply(mp, OK); reply(mp, OK);
} }
PRIVATE void do_reserve(message *mp) static void do_reserve(message *mp)
{ {
struct rs_pci *aclp; struct rs_pci *aclp;
int r, devind; int r, devind;
@@ -396,7 +396,7 @@ PRIVATE void do_reserve(message *mp)
} }
} }
PRIVATE void do_attr_r8(mp) static void do_attr_r8(mp)
message *mp; message *mp;
{ {
int r, devind, port; int r, devind, port;
@@ -422,7 +422,7 @@ message *mp;
} }
} }
PRIVATE void do_attr_r16(mp) static void do_attr_r16(mp)
message *mp; message *mp;
{ {
int r, devind, port; int r, devind, port;
@@ -442,7 +442,7 @@ message *mp;
} }
} }
PRIVATE void do_attr_r32(mp) static void do_attr_r32(mp)
message *mp; message *mp;
{ {
int r, devind, port; int r, devind, port;
@@ -468,7 +468,7 @@ message *mp;
} }
} }
PRIVATE void do_attr_w8(mp) static void do_attr_w8(mp)
message *mp; message *mp;
{ {
int r, devind, port; int r, devind, port;
@@ -488,7 +488,7 @@ message *mp;
} }
} }
PRIVATE void do_attr_w16(mp) static void do_attr_w16(mp)
message *mp; message *mp;
{ {
int r, devind, port; int r, devind, port;
@@ -508,7 +508,7 @@ message *mp;
} }
} }
PRIVATE void do_attr_w32(mp) static void do_attr_w32(mp)
message *mp; message *mp;
{ {
int r, devind, port; int r, devind, port;
@@ -528,7 +528,7 @@ message *mp;
} }
} }
PRIVATE void do_get_bar(mp) static void do_get_bar(mp)
message *mp; message *mp;
{ {
int r, devind, port, ioflag; int r, devind, port, ioflag;
@@ -554,7 +554,7 @@ message *mp;
} }
} }
PRIVATE void do_rescan_bus(mp) static void do_rescan_bus(mp)
message *mp; message *mp;
{ {
int r, busnr; int r, busnr;
@@ -572,7 +572,7 @@ message *mp;
} }
PRIVATE void reply(mp, result) static void reply(mp, result)
message *mp; message *mp;
int result; int result;
{ {
@@ -586,7 +586,7 @@ int result;
} }
PRIVATE struct rs_pci *find_acl(endpoint) static struct rs_pci *find_acl(endpoint)
int endpoint; int endpoint;
{ {
int i; int i;

View File

@@ -39,7 +39,7 @@ Created: Jan 2000 by Philip Homburg <philip@cs.vu.nl>
int debug= 0; int debug= 0;
PRIVATE struct pcibus static struct pcibus
{ {
int pb_type; int pb_type;
int pb_needinit; int pb_needinit;
@@ -57,9 +57,9 @@ PRIVATE struct pcibus
u16_t (*pb_rsts)(int busind); u16_t (*pb_rsts)(int busind);
void (*pb_wsts)(int busind, u16_t value); void (*pb_wsts)(int busind, u16_t value);
} pcibus[NR_PCIBUS]; } pcibus[NR_PCIBUS];
PRIVATE int nr_pcibus= 0; static int nr_pcibus= 0;
PRIVATE struct pcidev static struct pcidev
{ {
u8_t pd_busnr; u8_t pd_busnr;
u8_t pd_dev; u8_t pd_dev;
@@ -90,68 +90,68 @@ EXTERN struct pci_acl pci_acl[NR_DRIVERS];
#define PBF_IO 1 /* I/O else memory */ #define PBF_IO 1 /* I/O else memory */
#define PBF_INCOMPLETE 2 /* not allocated */ #define PBF_INCOMPLETE 2 /* not allocated */
PRIVATE int nr_pcidev= 0; static int nr_pcidev= 0;
FORWARD void pci_intel_init(void); static void pci_intel_init(void);
FORWARD void probe_bus(int busind); static void probe_bus(int busind);
FORWARD int is_duplicate(u8_t busnr, u8_t dev, u8_t func); static int is_duplicate(u8_t busnr, u8_t dev, u8_t func);
FORWARD void record_irq(int devind); static void record_irq(int devind);
FORWARD void record_bars_normal(int devind); static void record_bars_normal(int devind);
FORWARD void record_bars_bridge(int devind); static void record_bars_bridge(int devind);
FORWARD void record_bars_cardbus(int devind); static void record_bars_cardbus(int devind);
FORWARD void record_bars(int devind, int last_reg); static void record_bars(int devind, int last_reg);
FORWARD int record_bar(int devind, int bar_nr, int last); static int record_bar(int devind, int bar_nr, int last);
FORWARD void complete_bridges(void); static void complete_bridges(void);
FORWARD void complete_bars(void); static void complete_bars(void);
FORWARD void update_bridge4dev_io(int devind, u32_t io_base, u32_t static void update_bridge4dev_io(int devind, u32_t io_base, u32_t
io_size); io_size);
FORWARD int get_freebus(void); static int get_freebus(void);
FORWARD int do_isabridge(int busind); static int do_isabridge(int busind);
FORWARD void do_pcibridge(int busind); static void do_pcibridge(int busind);
FORWARD int get_busind(int busnr); static int get_busind(int busnr);
FORWARD int do_piix(int devind); static int do_piix(int devind);
FORWARD int do_amd_isabr(int devind); static int do_amd_isabr(int devind);
FORWARD int do_sis_isabr(int devind); static int do_sis_isabr(int devind);
FORWARD int do_via_isabr(int devind); static int do_via_isabr(int devind);
#if 0 #if 0
FORWARD void report_vga(int devind); static void report_vga(int devind);
#endif #endif
FORWARD char *pci_vid_name(u16_t vid); static char *pci_vid_name(u16_t vid);
FORWARD char *pci_baseclass_name(u8_t baseclass); static char *pci_baseclass_name(u8_t baseclass);
FORWARD char *pci_subclass_name(u8_t baseclass, u8_t subclass, u8_t static char *pci_subclass_name(u8_t baseclass, u8_t subclass, u8_t
infclass); infclass);
FORWARD void ntostr(unsigned n, char **str, char *end); static void ntostr(unsigned n, char **str, char *end);
FORWARD u8_t pci_attr_r8_u(int devind, int port); static u8_t pci_attr_r8_u(int devind, int port);
FORWARD u32_t pci_attr_r32_u(int devind, int port); static u32_t pci_attr_r32_u(int devind, int port);
FORWARD u16_t pci_attr_rsts(int devind); static u16_t pci_attr_rsts(int devind);
FORWARD void pci_attr_wsts(int devind, u16_t value); static void pci_attr_wsts(int devind, u16_t value);
FORWARD u16_t pcibr_std_rsts(int busind); static u16_t pcibr_std_rsts(int busind);
FORWARD void pcibr_std_wsts(int busind, u16_t value); static void pcibr_std_wsts(int busind, u16_t value);
FORWARD u16_t pcibr_cb_rsts(int busind); static u16_t pcibr_cb_rsts(int busind);
FORWARD void pcibr_cb_wsts(int busind, u16_t value); static void pcibr_cb_wsts(int busind, u16_t value);
FORWARD u16_t pcibr_via_rsts(int busind); static u16_t pcibr_via_rsts(int busind);
FORWARD void pcibr_via_wsts(int busind, u16_t value); static void pcibr_via_wsts(int busind, u16_t value);
FORWARD u8_t pcii_rreg8(int busind, int devind, int port); static u8_t pcii_rreg8(int busind, int devind, int port);
FORWARD u16_t pcii_rreg16(int busind, int devind, int port); static u16_t pcii_rreg16(int busind, int devind, int port);
FORWARD u32_t pcii_rreg32(int busind, int devind, int port); static u32_t pcii_rreg32(int busind, int devind, int port);
FORWARD void pcii_wreg8(int busind, int devind, int port, u8_t value); static void pcii_wreg8(int busind, int devind, int port, u8_t value);
FORWARD void pcii_wreg16(int busind, int devind, int port, u16_t value); static void pcii_wreg16(int busind, int devind, int port, u16_t value);
FORWARD void pcii_wreg32(int busind, int devind, int port, u32_t value); static void pcii_wreg32(int busind, int devind, int port, u32_t value);
FORWARD u16_t pcii_rsts(int busind); static u16_t pcii_rsts(int busind);
FORWARD void pcii_wsts(int busind, u16_t value); static void pcii_wsts(int busind, u16_t value);
FORWARD void print_capabilities(int devind); static void print_capabilities(int devind);
FORWARD int visible(struct rs_pci *aclp, int devind); static int visible(struct rs_pci *aclp, int devind);
FORWARD void print_hyper_cap(int devind, u8_t capptr); static void print_hyper_cap(int devind, u8_t capptr);
PRIVATE struct machine machine; static struct machine machine;
PRIVATE endpoint_t acpi_ep; static endpoint_t acpi_ep;
/*===========================================================================* /*===========================================================================*
* sef_cb_init_fresh * * sef_cb_init_fresh *
*===========================================================================*/ *===========================================================================*/
PUBLIC int sef_cb_init_fresh(int type, sef_init_info_t *info) int sef_cb_init_fresh(int type, sef_init_info_t *info)
{ {
/* Initialize the pci driver. */ /* Initialize the pci driver. */
long v; long v;
@@ -195,7 +195,7 @@ PUBLIC int sef_cb_init_fresh(int type, sef_init_info_t *info)
/*===========================================================================* /*===========================================================================*
* map_service * * map_service *
*===========================================================================*/ *===========================================================================*/
PUBLIC int map_service(rpub) int map_service(rpub)
struct rprocpub *rpub; struct rprocpub *rpub;
{ {
/* Map a new service by registering a new acl entry if required. */ /* Map a new service by registering a new acl entry if required. */
@@ -229,38 +229,38 @@ struct rprocpub *rpub;
/*===========================================================================* /*===========================================================================*
* helper functions for I/O * * helper functions for I/O *
*===========================================================================*/ *===========================================================================*/
PUBLIC unsigned pci_inb(u16_t port) { unsigned pci_inb(u16_t port) {
u32_t value; u32_t value;
int s; int s;
if ((s=sys_inb(port, &value)) !=OK) if ((s=sys_inb(port, &value)) !=OK)
printf("PCI: warning, sys_inb failed: %d\n", s); printf("PCI: warning, sys_inb failed: %d\n", s);
return value; return value;
} }
PUBLIC unsigned pci_inw(u16_t port) { unsigned pci_inw(u16_t port) {
u32_t value; u32_t value;
int s; int s;
if ((s=sys_inw(port, &value)) !=OK) if ((s=sys_inw(port, &value)) !=OK)
printf("PCI: warning, sys_inw failed: %d\n", s); printf("PCI: warning, sys_inw failed: %d\n", s);
return value; return value;
} }
PUBLIC unsigned pci_inl(u16_t port) { unsigned pci_inl(u16_t port) {
u32_t value; u32_t value;
int s; int s;
if ((s=sys_inl(port, &value)) !=OK) if ((s=sys_inl(port, &value)) !=OK)
printf("PCI: warning, sys_inl failed: %d\n", s); printf("PCI: warning, sys_inl failed: %d\n", s);
return value; return value;
} }
PUBLIC void pci_outb(u16_t port, u8_t value) { void pci_outb(u16_t port, u8_t value) {
int s; int s;
if ((s=sys_outb(port, value)) !=OK) if ((s=sys_outb(port, value)) !=OK)
printf("PCI: warning, sys_outb failed: %d\n", s); printf("PCI: warning, sys_outb failed: %d\n", s);
} }
PUBLIC void pci_outw(u16_t port, u16_t value) { void pci_outw(u16_t port, u16_t value) {
int s; int s;
if ((s=sys_outw(port, value)) !=OK) if ((s=sys_outw(port, value)) !=OK)
printf("PCI: warning, sys_outw failed: %d\n", s); printf("PCI: warning, sys_outw failed: %d\n", s);
} }
PUBLIC void pci_outl(u16_t port, u32_t value) { void pci_outl(u16_t port, u32_t value) {
int s; int s;
if ((s=sys_outl(port, value)) !=OK) if ((s=sys_outl(port, value)) !=OK)
printf("PCI: warning, sys_outl failed: %d\n", s); printf("PCI: warning, sys_outl failed: %d\n", s);
@@ -269,7 +269,7 @@ PUBLIC void pci_outl(u16_t port, u32_t value) {
/*===========================================================================* /*===========================================================================*
* pci_find_dev * * pci_find_dev *
*===========================================================================*/ *===========================================================================*/
PUBLIC int pci_find_dev(u8_t bus, u8_t dev, u8_t func, int *devindp) int pci_find_dev(u8_t bus, u8_t dev, u8_t func, int *devindp)
{ {
int devind; int devind;
@@ -295,7 +295,7 @@ PUBLIC int pci_find_dev(u8_t bus, u8_t dev, u8_t func, int *devindp)
/*===========================================================================* /*===========================================================================*
* pci_first_dev_a * * pci_first_dev_a *
*===========================================================================*/ *===========================================================================*/
PUBLIC int pci_first_dev_a( int pci_first_dev_a(
struct rs_pci *aclp, struct rs_pci *aclp,
int *devindp, int *devindp,
u16_t *vidp, u16_t *vidp,
@@ -325,7 +325,7 @@ PUBLIC int pci_first_dev_a(
/*===========================================================================* /*===========================================================================*
* pci_next_dev * * pci_next_dev *
*===========================================================================*/ *===========================================================================*/
PUBLIC int pci_next_dev_a( int pci_next_dev_a(
struct rs_pci *aclp, struct rs_pci *aclp,
int *devindp, int *devindp,
u16_t *vidp, u16_t *vidp,
@@ -355,7 +355,7 @@ PUBLIC int pci_next_dev_a(
/*===========================================================================* /*===========================================================================*
* pci_reserve_a * * pci_reserve_a *
*===========================================================================*/ *===========================================================================*/
PUBLIC int pci_reserve_a(devind, proc, aclp) int pci_reserve_a(devind, proc, aclp)
int devind; int devind;
endpoint_t proc; endpoint_t proc;
struct rs_pci *aclp; struct rs_pci *aclp;
@@ -439,7 +439,7 @@ struct rs_pci *aclp;
/*===========================================================================* /*===========================================================================*
* pci_release * * pci_release *
*===========================================================================*/ *===========================================================================*/
PUBLIC void pci_release(proc) void pci_release(proc)
endpoint_t proc; endpoint_t proc;
{ {
int i; int i;
@@ -457,7 +457,7 @@ endpoint_t proc;
/*===========================================================================* /*===========================================================================*
* pci_ids_s * * pci_ids_s *
*===========================================================================*/ *===========================================================================*/
PUBLIC int pci_ids_s(int devind, u16_t *vidp, u16_t *didp) int pci_ids_s(int devind, u16_t *vidp, u16_t *didp)
{ {
if (devind < 0 || devind >= nr_pcidev) if (devind < 0 || devind >= nr_pcidev)
return EINVAL; return EINVAL;
@@ -470,7 +470,7 @@ PUBLIC int pci_ids_s(int devind, u16_t *vidp, u16_t *didp)
/*===========================================================================* /*===========================================================================*
* pci_rescan_bus * * pci_rescan_bus *
*===========================================================================*/ *===========================================================================*/
PUBLIC void pci_rescan_bus(u8_t busnr) void pci_rescan_bus(u8_t busnr)
{ {
int busind; int busind;
@@ -487,7 +487,7 @@ PUBLIC void pci_rescan_bus(u8_t busnr)
/*===========================================================================* /*===========================================================================*
* pci_slot_name_s * * pci_slot_name_s *
*===========================================================================*/ *===========================================================================*/
PUBLIC int pci_slot_name_s(devind, cpp) int pci_slot_name_s(devind, cpp)
int devind; int devind;
char **cpp; char **cpp;
{ {
@@ -516,7 +516,7 @@ char **cpp;
/*===========================================================================* /*===========================================================================*
* pci_dev_name * * pci_dev_name *
*===========================================================================*/ *===========================================================================*/
PUBLIC char *pci_dev_name(u16_t vid, u16_t did) char *pci_dev_name(u16_t vid, u16_t did)
{ {
int i; int i;
@@ -534,7 +534,7 @@ PUBLIC char *pci_dev_name(u16_t vid, u16_t did)
/*===========================================================================* /*===========================================================================*
* pci_get_bar_s * * pci_get_bar_s *
*===========================================================================*/ *===========================================================================*/
PUBLIC int pci_get_bar_s(int devind, int port, u32_t *base, u32_t *size, int pci_get_bar_s(int devind, int port, u32_t *base, u32_t *size,
int *ioflag) int *ioflag)
{ {
int i, reg; int i, reg;
@@ -564,7 +564,7 @@ PUBLIC int pci_get_bar_s(int devind, int port, u32_t *base, u32_t *size,
/*===========================================================================* /*===========================================================================*
* pci_attr_r8_s * * pci_attr_r8_s *
*===========================================================================*/ *===========================================================================*/
PUBLIC int pci_attr_r8_s(int devind, int port, u8_t *vp) int pci_attr_r8_s(int devind, int port, u8_t *vp)
{ {
if (devind < 0 || devind >= nr_pcidev) if (devind < 0 || devind >= nr_pcidev)
return EINVAL; return EINVAL;
@@ -578,7 +578,7 @@ PUBLIC int pci_attr_r8_s(int devind, int port, u8_t *vp)
/*===========================================================================* /*===========================================================================*
* pci_attr_r8_u * * pci_attr_r8_u *
*===========================================================================*/ *===========================================================================*/
PRIVATE u8_t pci_attr_r8_u(devind, port) static u8_t pci_attr_r8_u(devind, port)
int devind; int devind;
int port; int port;
{ {
@@ -592,7 +592,7 @@ int port;
/*===========================================================================* /*===========================================================================*
* pci_attr_r16 * * pci_attr_r16 *
*===========================================================================*/ *===========================================================================*/
PUBLIC u16_t pci_attr_r16(devind, port) u16_t pci_attr_r16(devind, port)
int devind; int devind;
int port; int port;
{ {
@@ -606,7 +606,7 @@ int port;
/*===========================================================================* /*===========================================================================*
* pci_attr_r32_s * * pci_attr_r32_s *
*===========================================================================*/ *===========================================================================*/
PUBLIC int pci_attr_r32_s(int devind, int port, u32_t *vp) int pci_attr_r32_s(int devind, int port, u32_t *vp)
{ {
if (devind < 0 || devind >= nr_pcidev) if (devind < 0 || devind >= nr_pcidev)
return EINVAL; return EINVAL;
@@ -620,7 +620,7 @@ PUBLIC int pci_attr_r32_s(int devind, int port, u32_t *vp)
/*===========================================================================* /*===========================================================================*
* pci_attr_r32_u * * pci_attr_r32_u *
*===========================================================================*/ *===========================================================================*/
PRIVATE u32_t pci_attr_r32_u(devind, port) static u32_t pci_attr_r32_u(devind, port)
int devind; int devind;
int port; int port;
{ {
@@ -634,7 +634,7 @@ int port;
/*===========================================================================* /*===========================================================================*
* pci_attr_w8 * * pci_attr_w8 *
*===========================================================================*/ *===========================================================================*/
PUBLIC void pci_attr_w8(int devind, int port, u8_t value) void pci_attr_w8(int devind, int port, u8_t value)
{ {
int busnr, busind; int busnr, busind;
@@ -646,7 +646,7 @@ PUBLIC void pci_attr_w8(int devind, int port, u8_t value)
/*===========================================================================* /*===========================================================================*
* pci_attr_w16 * * pci_attr_w16 *
*===========================================================================*/ *===========================================================================*/
PUBLIC void pci_attr_w16(int devind, int port, u16_t value) void pci_attr_w16(int devind, int port, u16_t value)
{ {
int busnr, busind; int busnr, busind;
@@ -658,7 +658,7 @@ PUBLIC void pci_attr_w16(int devind, int port, u16_t value)
/*===========================================================================* /*===========================================================================*
* pci_attr_w32 * * pci_attr_w32 *
*===========================================================================*/ *===========================================================================*/
PUBLIC void pci_attr_w32(int devind, int port, u32_t value) void pci_attr_w32(int devind, int port, u32_t value)
{ {
int busnr, busind; int busnr, busind;
@@ -670,7 +670,7 @@ PUBLIC void pci_attr_w32(int devind, int port, u32_t value)
/*===========================================================================* /*===========================================================================*
* pci_intel_init * * pci_intel_init *
*===========================================================================*/ *===========================================================================*/
PRIVATE void pci_intel_init() static void pci_intel_init()
{ {
/* Try to detect a know PCI controller. Read the Vendor ID and /* Try to detect a know PCI controller. Read the Vendor ID and
* the Device ID for function 0 of device 0. * the Device ID for function 0 of device 0.
@@ -770,7 +770,7 @@ PRIVATE void pci_intel_init()
/*===========================================================================* /*===========================================================================*
* probe_bus * * probe_bus *
*===========================================================================*/ *===========================================================================*/
PRIVATE void probe_bus(int busind) static void probe_bus(int busind)
{ {
u32_t dev, func, t3; u32_t dev, func, t3;
u16_t vid, did, sts; u16_t vid, did, sts;
@@ -927,7 +927,7 @@ PRIVATE void probe_bus(int busind)
/*===========================================================================* /*===========================================================================*
* is_duplicate * * is_duplicate *
*===========================================================================*/ *===========================================================================*/
PRIVATE int is_duplicate(u8_t busnr, u8_t dev, u8_t func) static int is_duplicate(u8_t busnr, u8_t dev, u8_t func)
{ {
int i; int i;
@@ -943,7 +943,7 @@ PRIVATE int is_duplicate(u8_t busnr, u8_t dev, u8_t func)
return 0; return 0;
} }
PRIVATE int acpi_get_irq(unsigned bus, unsigned dev, unsigned pin) static int acpi_get_irq(unsigned bus, unsigned dev, unsigned pin)
{ {
int err; int err;
message m; message m;
@@ -959,7 +959,7 @@ PRIVATE int acpi_get_irq(unsigned bus, unsigned dev, unsigned pin)
return ((struct acpi_get_irq_resp *)&m)->irq; return ((struct acpi_get_irq_resp *)&m)->irq;
} }
PRIVATE int derive_irq(struct pcidev * dev, int pin) static int derive_irq(struct pcidev * dev, int pin)
{ {
struct pcidev * parent_bridge; struct pcidev * parent_bridge;
int slot; int slot;
@@ -979,7 +979,7 @@ PRIVATE int derive_irq(struct pcidev * dev, int pin)
/*===========================================================================* /*===========================================================================*
* record_irq * * record_irq *
*===========================================================================*/ *===========================================================================*/
PRIVATE void record_irq(devind) static void record_irq(devind)
int devind; int devind;
{ {
int ilr, ipr, busnr, busind, cb_devind; int ilr, ipr, busnr, busind, cb_devind;
@@ -1078,7 +1078,7 @@ int devind;
/*===========================================================================* /*===========================================================================*
* record_bars_normal * * record_bars_normal *
*===========================================================================*/ *===========================================================================*/
PRIVATE void record_bars_normal(devind) static void record_bars_normal(devind)
int devind; int devind;
{ {
int i, j, clear_01, clear_23, pb_nr; int i, j, clear_01, clear_23, pb_nr;
@@ -1142,7 +1142,7 @@ int devind;
/*===========================================================================* /*===========================================================================*
* record_bars_bridge * * record_bars_bridge *
*===========================================================================*/ *===========================================================================*/
PRIVATE void record_bars_bridge(devind) static void record_bars_bridge(devind)
int devind; int devind;
{ {
u32_t base, limit, size; u32_t base, limit, size;
@@ -1194,7 +1194,7 @@ int devind;
/*===========================================================================* /*===========================================================================*
* record_bars_cardbus * * record_bars_cardbus *
*===========================================================================*/ *===========================================================================*/
PRIVATE void record_bars_cardbus(devind) static void record_bars_cardbus(devind)
int devind; int devind;
{ {
u32_t base, limit, size; u32_t base, limit, size;
@@ -1246,7 +1246,7 @@ int devind;
/*===========================================================================* /*===========================================================================*
* record_bars * * record_bars *
*===========================================================================*/ *===========================================================================*/
PRIVATE void record_bars(int devind, int last_reg) static void record_bars(int devind, int last_reg)
{ {
int i, reg, width; int i, reg, width;
@@ -1259,7 +1259,7 @@ PRIVATE void record_bars(int devind, int last_reg)
/*===========================================================================* /*===========================================================================*
* record_bar * * record_bar *
*===========================================================================*/ *===========================================================================*/
PRIVATE int record_bar(devind, bar_nr, last) static int record_bar(devind, bar_nr, last)
int devind; int devind;
int bar_nr; int bar_nr;
int last; int last;
@@ -1405,7 +1405,7 @@ int last;
/*===========================================================================* /*===========================================================================*
* complete_bridges * * complete_bridges *
*===========================================================================*/ *===========================================================================*/
PRIVATE void complete_bridges() static void complete_bridges()
{ {
int i, freebus, devind, prim_busnr; int i, freebus, devind, prim_busnr;
@@ -1446,7 +1446,7 @@ PRIVATE void complete_bridges()
/*===========================================================================* /*===========================================================================*
* complete_bars * * complete_bars *
*===========================================================================*/ *===========================================================================*/
PRIVATE void complete_bars(void) static void complete_bars(void)
{ {
int i, j, r, bar_nr, reg; int i, j, r, bar_nr, reg;
u32_t memgap_low, memgap_high, iogap_low, iogap_high, io_high, u32_t memgap_low, memgap_high, iogap_low, iogap_high, io_high,
@@ -1670,7 +1670,7 @@ bad_mem_string:
/*===========================================================================* /*===========================================================================*
* update_bridge4dev_io * * update_bridge4dev_io *
*===========================================================================*/ *===========================================================================*/
PRIVATE void update_bridge4dev_io( static void update_bridge4dev_io(
int devind, int devind,
u32_t io_base, u32_t io_base,
u32_t io_size u32_t io_size
@@ -1710,7 +1710,7 @@ PRIVATE void update_bridge4dev_io(
/*===========================================================================* /*===========================================================================*
* get_freebus * * get_freebus *
*===========================================================================*/ *===========================================================================*/
PRIVATE int get_freebus() static int get_freebus()
{ {
int i, freebus; int i, freebus;
@@ -1731,7 +1731,7 @@ PRIVATE int get_freebus()
/*===========================================================================* /*===========================================================================*
* do_isabridge * * do_isabridge *
*===========================================================================*/ *===========================================================================*/
PRIVATE int do_isabridge(busind) static int do_isabridge(busind)
int busind; int busind;
{ {
int i, j, r, type, busnr, unknown_bridge, bridge_dev; int i, j, r, type, busnr, unknown_bridge, bridge_dev;
@@ -1840,7 +1840,7 @@ int busind;
* (pbnr) must be already known to acpi and it must map dev as the connection to * (pbnr) must be already known to acpi and it must map dev as the connection to
* the secondary (sbnr) bus * the secondary (sbnr) bus
*/ */
PRIVATE void acpi_map_bridge(unsigned pbnr, unsigned dev, unsigned sbnr) static void acpi_map_bridge(unsigned pbnr, unsigned dev, unsigned sbnr)
{ {
int err; int err;
message m; message m;
@@ -1861,7 +1861,7 @@ PRIVATE void acpi_map_bridge(unsigned pbnr, unsigned dev, unsigned sbnr)
/*===========================================================================* /*===========================================================================*
* do_pcibridge * * do_pcibridge *
*===========================================================================*/ *===========================================================================*/
PRIVATE void do_pcibridge(busind) static void do_pcibridge(busind)
int busind; int busind;
{ {
int i, devind, busnr; int i, devind, busnr;
@@ -2015,7 +2015,7 @@ int busind;
/*===========================================================================* /*===========================================================================*
* get_busind * * get_busind *
*===========================================================================*/ *===========================================================================*/
PRIVATE int get_busind(busnr) static int get_busind(busnr)
int busnr; int busnr;
{ {
int i; int i;
@@ -2031,7 +2031,7 @@ int busnr;
/*===========================================================================* /*===========================================================================*
* do_piix * * do_piix *
*===========================================================================*/ *===========================================================================*/
PRIVATE int do_piix(int devind) static int do_piix(int devind)
{ {
int i, s, irqrc, irq; int i, s, irqrc, irq;
u32_t elcr1, elcr2, elcr; u32_t elcr1, elcr2, elcr;
@@ -2075,7 +2075,7 @@ PRIVATE int do_piix(int devind)
/*===========================================================================* /*===========================================================================*
* do_amd_isabr * * do_amd_isabr *
*===========================================================================*/ *===========================================================================*/
PRIVATE int do_amd_isabr(int devind) static int do_amd_isabr(int devind)
{ {
int i, busnr, dev, func, xdevind, irq, edge; int i, busnr, dev, func, xdevind, irq, edge;
u8_t levmask; u8_t levmask;
@@ -2127,7 +2127,7 @@ PRIVATE int do_amd_isabr(int devind)
/*===========================================================================* /*===========================================================================*
* do_sis_isabr * * do_sis_isabr *
*===========================================================================*/ *===========================================================================*/
PRIVATE int do_sis_isabr(int devind) static int do_sis_isabr(int devind)
{ {
int i, irq; int i, irq;
@@ -2154,7 +2154,7 @@ PRIVATE int do_sis_isabr(int devind)
/*===========================================================================* /*===========================================================================*
* do_via_isabr * * do_via_isabr *
*===========================================================================*/ *===========================================================================*/
PRIVATE int do_via_isabr(int devind) static int do_via_isabr(int devind)
{ {
int i, irq, edge; int i, irq, edge;
u8_t levmask; u8_t levmask;
@@ -2212,7 +2212,7 @@ PRIVATE int do_via_isabr(int devind)
/*===========================================================================* /*===========================================================================*
* report_vga * * report_vga *
*===========================================================================*/ *===========================================================================*/
PRIVATE void report_vga(devind) static void report_vga(devind)
int devind; int devind;
{ {
/* Report the amount of video memory. This is needed by the X11R6 /* Report the amount of video memory. This is needed by the X11R6
@@ -2247,7 +2247,7 @@ int devind;
/*===========================================================================* /*===========================================================================*
* pci_vid_name * * pci_vid_name *
*===========================================================================*/ *===========================================================================*/
PRIVATE char *pci_vid_name(u16_t vid) static char *pci_vid_name(u16_t vid)
{ {
int i; int i;
@@ -2262,7 +2262,7 @@ PRIVATE char *pci_vid_name(u16_t vid)
/*===========================================================================* /*===========================================================================*
* pci_baseclass_name * * pci_baseclass_name *
*===========================================================================*/ *===========================================================================*/
PRIVATE char *pci_baseclass_name(u8_t baseclass) static char *pci_baseclass_name(u8_t baseclass)
{ {
int i; int i;
@@ -2277,7 +2277,7 @@ PRIVATE char *pci_baseclass_name(u8_t baseclass)
/*===========================================================================* /*===========================================================================*
* pci_subclass_name * * pci_subclass_name *
*===========================================================================*/ *===========================================================================*/
PRIVATE char *pci_subclass_name(u8_t baseclass, u8_t subclass, u8_t infclass) static char *pci_subclass_name(u8_t baseclass, u8_t subclass, u8_t infclass)
{ {
int i; int i;
@@ -2300,7 +2300,7 @@ PRIVATE char *pci_subclass_name(u8_t baseclass, u8_t subclass, u8_t infclass)
/*===========================================================================* /*===========================================================================*
* ntostr * * ntostr *
*===========================================================================*/ *===========================================================================*/
PRIVATE void ntostr(n, str, end) static void ntostr(n, str, end)
unsigned n; unsigned n;
char **str; char **str;
char *end; char *end;
@@ -2339,7 +2339,7 @@ char *end;
/*===========================================================================* /*===========================================================================*
* pci_attr_rsts * * pci_attr_rsts *
*===========================================================================*/ *===========================================================================*/
PRIVATE u16_t pci_attr_rsts(devind) static u16_t pci_attr_rsts(devind)
int devind; int devind;
{ {
int busnr, busind; int busnr, busind;
@@ -2353,7 +2353,7 @@ int devind;
/*===========================================================================* /*===========================================================================*
* pcibr_std_rsts * * pcibr_std_rsts *
*===========================================================================*/ *===========================================================================*/
PRIVATE u16_t pcibr_std_rsts(busind) static u16_t pcibr_std_rsts(busind)
int busind; int busind;
{ {
int devind; int devind;
@@ -2365,7 +2365,7 @@ int busind;
/*===========================================================================* /*===========================================================================*
* pcibr_std_wsts * * pcibr_std_wsts *
*===========================================================================*/ *===========================================================================*/
PRIVATE void pcibr_std_wsts(int busind, u16_t value) static void pcibr_std_wsts(int busind, u16_t value)
{ {
int devind; int devind;
devind= pcibus[busind].pb_devind; devind= pcibus[busind].pb_devind;
@@ -2380,7 +2380,7 @@ PRIVATE void pcibr_std_wsts(int busind, u16_t value)
/*===========================================================================* /*===========================================================================*
* pcibr_cb_rsts * * pcibr_cb_rsts *
*===========================================================================*/ *===========================================================================*/
PRIVATE u16_t pcibr_cb_rsts(busind) static u16_t pcibr_cb_rsts(busind)
int busind; int busind;
{ {
int devind; int devind;
@@ -2392,7 +2392,7 @@ int busind;
/*===========================================================================* /*===========================================================================*
* pcibr_cb_wsts * * pcibr_cb_wsts *
*===========================================================================*/ *===========================================================================*/
PRIVATE void pcibr_cb_wsts(int busind, u16_t value) static void pcibr_cb_wsts(int busind, u16_t value)
{ {
int devind; int devind;
devind= pcibus[busind].pb_devind; devind= pcibus[busind].pb_devind;
@@ -2407,7 +2407,7 @@ PRIVATE void pcibr_cb_wsts(int busind, u16_t value)
/*===========================================================================* /*===========================================================================*
* pcibr_via_rsts * * pcibr_via_rsts *
*===========================================================================*/ *===========================================================================*/
PRIVATE u16_t pcibr_via_rsts(int busind) static u16_t pcibr_via_rsts(int busind)
{ {
return 0; return 0;
} }
@@ -2415,7 +2415,7 @@ PRIVATE u16_t pcibr_via_rsts(int busind)
/*===========================================================================* /*===========================================================================*
* pcibr_via_wsts * * pcibr_via_wsts *
*===========================================================================*/ *===========================================================================*/
PRIVATE void pcibr_via_wsts(int busind, u16_t value) static void pcibr_via_wsts(int busind, u16_t value)
{ {
int devind; int devind;
devind= pcibus[busind].pb_devind; devind= pcibus[busind].pb_devind;
@@ -2429,7 +2429,7 @@ PRIVATE void pcibr_via_wsts(int busind, u16_t value)
/*===========================================================================* /*===========================================================================*
* pci_attr_wsts * * pci_attr_wsts *
*===========================================================================*/ *===========================================================================*/
PRIVATE void pci_attr_wsts(int devind, u16_t value) static void pci_attr_wsts(int devind, u16_t value)
{ {
int busnr, busind; int busnr, busind;
@@ -2442,7 +2442,7 @@ PRIVATE void pci_attr_wsts(int devind, u16_t value)
/*===========================================================================* /*===========================================================================*
* pcii_rreg8 * * pcii_rreg8 *
*===========================================================================*/ *===========================================================================*/
PRIVATE u8_t pcii_rreg8(busind, devind, port) static u8_t pcii_rreg8(busind, devind, port)
int busind; int busind;
int devind; int devind;
int port; int port;
@@ -2467,7 +2467,7 @@ int port;
/*===========================================================================* /*===========================================================================*
* pcii_rreg16 * * pcii_rreg16 *
*===========================================================================*/ *===========================================================================*/
PRIVATE u16_t pcii_rreg16(int busind, int devind, int port) static u16_t pcii_rreg16(int busind, int devind, int port)
{ {
u16_t v; u16_t v;
int s; int s;
@@ -2489,7 +2489,7 @@ PRIVATE u16_t pcii_rreg16(int busind, int devind, int port)
/*===========================================================================* /*===========================================================================*
* pcii_rreg32 * * pcii_rreg32 *
*===========================================================================*/ *===========================================================================*/
PRIVATE u32_t pcii_rreg32(int busind, int devind, int port) static u32_t pcii_rreg32(int busind, int devind, int port)
{ {
u32_t v; u32_t v;
int s; int s;
@@ -2511,7 +2511,7 @@ PRIVATE u32_t pcii_rreg32(int busind, int devind, int port)
/*===========================================================================* /*===========================================================================*
* pcii_wreg8 * * pcii_wreg8 *
*===========================================================================*/ *===========================================================================*/
PRIVATE void pcii_wreg8( static void pcii_wreg8(
int busind, int busind,
int devind, int devind,
int port, int port,
@@ -2535,7 +2535,7 @@ PRIVATE void pcii_wreg8(
/*===========================================================================* /*===========================================================================*
* pcii_wreg16 * * pcii_wreg16 *
*===========================================================================*/ *===========================================================================*/
PRIVATE void pcii_wreg16( static void pcii_wreg16(
int busind, int busind,
int devind, int devind,
int port, int port,
@@ -2559,7 +2559,7 @@ PRIVATE void pcii_wreg16(
/*===========================================================================* /*===========================================================================*
* pcii_wreg32 * * pcii_wreg32 *
*===========================================================================*/ *===========================================================================*/
PRIVATE void pcii_wreg32( static void pcii_wreg32(
int busind, int busind,
int devind, int devind,
int port, int port,
@@ -2583,7 +2583,7 @@ PRIVATE void pcii_wreg32(
/*===========================================================================* /*===========================================================================*
* pcii_rsts * * pcii_rsts *
*===========================================================================*/ *===========================================================================*/
PRIVATE u16_t pcii_rsts(int busind) static u16_t pcii_rsts(int busind)
{ {
u16_t v; u16_t v;
int s; int s;
@@ -2597,7 +2597,7 @@ PRIVATE u16_t pcii_rsts(int busind)
/*===========================================================================* /*===========================================================================*
* pcii_wsts * * pcii_wsts *
*===========================================================================*/ *===========================================================================*/
PRIVATE void pcii_wsts(int busind, u16_t value) static void pcii_wsts(int busind, u16_t value)
{ {
int s; int s;
PCII_WREG16_(pcibus[busind].pb_busnr, 0, 0, PCI_SR, value); PCII_WREG16_(pcibus[busind].pb_busnr, 0, 0, PCI_SR, value);
@@ -2609,7 +2609,7 @@ PRIVATE void pcii_wsts(int busind, u16_t value)
/*===========================================================================* /*===========================================================================*
* print_capabilities * * print_capabilities *
*===========================================================================*/ *===========================================================================*/
PRIVATE void print_capabilities(int devind) static void print_capabilities(int devind)
{ {
u8_t status, capptr, type, next, subtype; u8_t status, capptr, type, next, subtype;
char *str; char *str;
@@ -2661,7 +2661,7 @@ PRIVATE void print_capabilities(int devind)
/*===========================================================================* /*===========================================================================*
* visible * * visible *
*===========================================================================*/ *===========================================================================*/
PRIVATE int visible(aclp, devind) static int visible(aclp, devind)
struct rs_pci *aclp; struct rs_pci *aclp;
int devind; int devind;
{ {
@@ -2703,7 +2703,7 @@ int devind;
/*===========================================================================* /*===========================================================================*
* print_hyper_cap * * print_hyper_cap *
*===========================================================================*/ *===========================================================================*/
PRIVATE void print_hyper_cap(int devind, u8_t capptr) static void print_hyper_cap(int devind, u8_t capptr)
{ {
u32_t v; u32_t v;
u16_t cmd; u16_t cmd;

View File

@@ -11,7 +11,7 @@ EXTERN int is_status_msg_expected;
/*===========================================================================* /*===========================================================================*
* sef_cb_lu_prepare * * sef_cb_lu_prepare *
*===========================================================================*/ *===========================================================================*/
PUBLIC int sef_cb_lu_prepare(int state) int sef_cb_lu_prepare(int state)
{ {
int is_ready; int is_ready;
@@ -40,7 +40,7 @@ PUBLIC int sef_cb_lu_prepare(int state)
/*===========================================================================* /*===========================================================================*
* sef_cb_lu_state_isvalid * * sef_cb_lu_state_isvalid *
*===========================================================================*/ *===========================================================================*/
PUBLIC int sef_cb_lu_state_isvalid(int state) int sef_cb_lu_state_isvalid(int state)
{ {
return SEF_LU_STATE_IS_STANDARD(state) || PR_STATE_IS_CUSTOM(state); return SEF_LU_STATE_IS_STANDARD(state) || PR_STATE_IS_CUSTOM(state);
} }
@@ -48,7 +48,7 @@ PUBLIC int sef_cb_lu_state_isvalid(int state)
/*===========================================================================* /*===========================================================================*
* sef_cb_lu_state_dump * * sef_cb_lu_state_dump *
*===========================================================================*/ *===========================================================================*/
PUBLIC void sef_cb_lu_state_dump(int state) void sef_cb_lu_state_dump(int state)
{ {
sef_lu_dprint("printer: live update state = %d\n", state); sef_lu_dprint("printer: live update state = %d\n", state);
sef_lu_dprint("printer: writing = %d\n", writing); sef_lu_dprint("printer: writing = %d\n", writing);

View File

@@ -86,44 +86,44 @@
* with the sys_outb() messages exchanged. * with the sys_outb() messages exchanged.
*/ */
PRIVATE endpoint_t caller; /* process to tell when printing done (FS) */ static endpoint_t caller; /* process to tell when printing done (FS) */
PRIVATE int revive_pending; /* set to true if revive is pending */ static int revive_pending; /* set to true if revive is pending */
PRIVATE int revive_status; /* revive status */ static int revive_status; /* revive status */
PRIVATE int done_status; /* status of last output completion */ static int done_status; /* status of last output completion */
PRIVATE int oleft; /* bytes of output left in obuf */ static int oleft; /* bytes of output left in obuf */
PRIVATE unsigned char obuf[128]; /* output buffer */ static unsigned char obuf[128]; /* output buffer */
PRIVATE unsigned const char *optr; /* ptr to next char in obuf to print */ static unsigned const char *optr; /* ptr to next char in obuf to print */
PRIVATE int orig_count; /* original byte count */ static int orig_count; /* original byte count */
PRIVATE int port_base; /* I/O port for printer */ static int port_base; /* I/O port for printer */
PRIVATE endpoint_t proc_nr; /* user requesting the printing */ static endpoint_t proc_nr; /* user requesting the printing */
PRIVATE cp_grant_id_t grant_nr; /* grant on which print happens */ static cp_grant_id_t grant_nr; /* grant on which print happens */
PRIVATE int user_left; /* bytes of output left in user buf */ static int user_left; /* bytes of output left in user buf */
PRIVATE vir_bytes user_vir_d; /* offset in user buf */ static vir_bytes user_vir_d; /* offset in user buf */
PUBLIC int writing; /* nonzero while write is in progress */ int writing; /* nonzero while write is in progress */
PRIVATE int irq_hook_id; /* id of irq hook at kernel */ static int irq_hook_id; /* id of irq hook at kernel */
FORWARD void do_cancel(message *m_ptr); static void do_cancel(message *m_ptr);
FORWARD void output_done(void); static void output_done(void);
FORWARD void do_write(message *m_ptr); static void do_write(message *m_ptr);
FORWARD void do_status(message *m_ptr); static void do_status(message *m_ptr);
FORWARD void prepare_output(void); static void prepare_output(void);
FORWARD int do_probe(void); static int do_probe(void);
FORWARD void do_initialize(void); static void do_initialize(void);
FORWARD void reply(int code,int replyee,int proc,int status); static void reply(int code,int replyee,int proc,int status);
FORWARD void do_printer_output(void); static void do_printer_output(void);
/* SEF functions and variables. */ /* SEF functions and variables. */
FORWARD void sef_local_startup(void); static void sef_local_startup(void);
FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info); static int sef_cb_init_fresh(int type, sef_init_info_t *info);
EXTERN int sef_cb_lu_prepare(int state); EXTERN int sef_cb_lu_prepare(int state);
EXTERN int sef_cb_lu_state_isvalid(int state); EXTERN int sef_cb_lu_state_isvalid(int state);
EXTERN void sef_cb_lu_state_dump(int state); EXTERN void sef_cb_lu_state_dump(int state);
PUBLIC int is_status_msg_expected = FALSE; int is_status_msg_expected = FALSE;
/*===========================================================================* /*===========================================================================*
* printer_task * * printer_task *
*===========================================================================*/ *===========================================================================*/
PUBLIC int main(void) int main(void)
{ {
/* Main routine of the printer task. */ /* Main routine of the printer task. */
message pr_mess; /* buffer for all incoming messages */ message pr_mess; /* buffer for all incoming messages */
@@ -169,7 +169,7 @@ PUBLIC int main(void)
/*===========================================================================* /*===========================================================================*
* sef_local_startup * * sef_local_startup *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_local_startup() static void sef_local_startup()
{ {
/* Register init callbacks. */ /* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh); sef_setcb_init_fresh(sef_cb_init_fresh);
@@ -191,7 +191,7 @@ PRIVATE void sef_local_startup()
/*===========================================================================* /*===========================================================================*
* sef_cb_init_fresh * * sef_cb_init_fresh *
*===========================================================================*/ *===========================================================================*/
PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info)) static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{ {
/* Initialize the printer driver. */ /* Initialize the printer driver. */
@@ -208,7 +208,7 @@ PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
/*===========================================================================* /*===========================================================================*
* do_write * * do_write *
*===========================================================================*/ *===========================================================================*/
PRIVATE void do_write(m_ptr) static void do_write(m_ptr)
register message *m_ptr; /* pointer to the newly arrived message */ register message *m_ptr; /* pointer to the newly arrived message */
{ {
/* The printer is used by sending DEV_WRITE messages to it. Process one. */ /* The printer is used by sending DEV_WRITE messages to it. Process one. */
@@ -260,7 +260,7 @@ register message *m_ptr; /* pointer to the newly arrived message */
/*===========================================================================* /*===========================================================================*
* output_done * * output_done *
*===========================================================================*/ *===========================================================================*/
PRIVATE void output_done() static void output_done()
{ {
/* Previous chunk of printing is finished. Continue if OK and more. /* Previous chunk of printing is finished. Continue if OK and more.
* Otherwise, reply to caller (FS). * Otherwise, reply to caller (FS).
@@ -300,7 +300,7 @@ PRIVATE void output_done()
/*===========================================================================* /*===========================================================================*
* do_status * * do_status *
*===========================================================================*/ *===========================================================================*/
PRIVATE void do_status(m_ptr) static void do_status(m_ptr)
register message *m_ptr; /* pointer to the newly arrived message */ register message *m_ptr; /* pointer to the newly arrived message */
{ {
if (revive_pending) { if (revive_pending) {
@@ -322,7 +322,7 @@ register message *m_ptr; /* pointer to the newly arrived message */
/*===========================================================================* /*===========================================================================*
* do_cancel * * do_cancel *
*===========================================================================*/ *===========================================================================*/
PRIVATE void do_cancel(m_ptr) static void do_cancel(m_ptr)
register message *m_ptr; /* pointer to the newly arrived message */ register message *m_ptr; /* pointer to the newly arrived message */
{ {
/* Cancel a print request that has already started. Usually this means that /* Cancel a print request that has already started. Usually this means that
@@ -342,7 +342,7 @@ register message *m_ptr; /* pointer to the newly arrived message */
/*===========================================================================* /*===========================================================================*
* reply * * reply *
*===========================================================================*/ *===========================================================================*/
PRIVATE void reply(code, replyee, process, status) static void reply(code, replyee, process, status)
int code; /* TASK_REPLY or REVIVE */ int code; /* TASK_REPLY or REVIVE */
int replyee; /* destination for message (normally FS) */ int replyee; /* destination for message (normally FS) */
int process; /* which user requested the printing */ int process; /* which user requested the printing */
@@ -361,7 +361,7 @@ int status; /* number of chars printed or error code */
/*===========================================================================* /*===========================================================================*
* do_probe * * do_probe *
*===========================================================================*/ *===========================================================================*/
PRIVATE int do_probe(void) static int do_probe(void)
{ {
/* See if there is a printer at all. */ /* See if there is a printer at all. */
@@ -378,7 +378,7 @@ PRIVATE int do_probe(void)
/*===========================================================================* /*===========================================================================*
* do_initialize * * do_initialize *
*===========================================================================*/ *===========================================================================*/
PRIVATE void do_initialize() static void do_initialize()
{ {
/* Set global variables and initialize the printer. */ /* Set global variables and initialize the printer. */
static int initialized = FALSE; static int initialized = FALSE;
@@ -404,7 +404,7 @@ PRIVATE void do_initialize()
/*==========================================================================* /*==========================================================================*
* prepare_output * * prepare_output *
*==========================================================================*/ *==========================================================================*/
PRIVATE void prepare_output() static void prepare_output()
{ {
/* Start next chunk of printer output. Fetch the data from user space. */ /* Start next chunk of printer output. Fetch the data from user space. */
int s; int s;
@@ -427,7 +427,7 @@ PRIVATE void prepare_output()
/*===========================================================================* /*===========================================================================*
* do_printer_output * * do_printer_output *
*===========================================================================*/ *===========================================================================*/
PRIVATE void do_printer_output() static void do_printer_output()
{ {
/* This function does the actual output to the printer. This is called on an /* This function does the actual output to the printer. This is called on an
* interrupt message sent from the generic interrupt handler that 'forwards' * interrupt message sent from the generic interrupt handler that 'forwards'

View File

@@ -15,21 +15,21 @@
#define KRANDOM_PERIOD 1 /* ticks between krandom calls */ #define KRANDOM_PERIOD 1 /* ticks between krandom calls */
PRIVATE struct device m_geom[NR_DEVS]; /* base and size of each device */ static struct device m_geom[NR_DEVS]; /* base and size of each device */
PRIVATE dev_t m_device; /* current device */ static dev_t m_device; /* current device */
extern int errno; /* error number for PM calls */ extern int errno; /* error number for PM calls */
FORWARD struct device *r_prepare(dev_t device); static struct device *r_prepare(dev_t device);
FORWARD int r_transfer(endpoint_t endpt, int opcode, u64_t position, static int r_transfer(endpoint_t endpt, int opcode, u64_t position,
iovec_t *iov, unsigned int nr_req, endpoint_t user_endpt, unsigned int iovec_t *iov, unsigned int nr_req, endpoint_t user_endpt, unsigned int
flags); flags);
FORWARD int r_do_open(message *m_ptr); static int r_do_open(message *m_ptr);
FORWARD void r_random(message *m_ptr); static void r_random(message *m_ptr);
FORWARD void r_updatebin(int source, struct k_randomness_bin *rb); static void r_updatebin(int source, struct k_randomness_bin *rb);
/* Entry points to this driver. */ /* Entry points to this driver. */
PRIVATE struct chardriver r_dtab = { static struct chardriver r_dtab = {
r_do_open, /* open or mount */ r_do_open, /* open or mount */
do_nop, /* nothing on a close */ do_nop, /* nothing on a close */
nop_ioctl, /* no I/O controls supported */ nop_ioctl, /* no I/O controls supported */
@@ -44,16 +44,16 @@ PRIVATE struct chardriver r_dtab = {
/* Buffer for the /dev/random number generator. */ /* Buffer for the /dev/random number generator. */
#define RANDOM_BUF_SIZE 1024 #define RANDOM_BUF_SIZE 1024
PRIVATE char random_buf[RANDOM_BUF_SIZE]; static char random_buf[RANDOM_BUF_SIZE];
/* SEF functions and variables. */ /* SEF functions and variables. */
FORWARD void sef_local_startup(void); static void sef_local_startup(void);
FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info); static int sef_cb_init_fresh(int type, sef_init_info_t *info);
/*===========================================================================* /*===========================================================================*
* main * * main *
*===========================================================================*/ *===========================================================================*/
PUBLIC int main(void) int main(void)
{ {
/* SEF local startup. */ /* SEF local startup. */
sef_local_startup(); sef_local_startup();
@@ -67,7 +67,7 @@ PUBLIC int main(void)
/*===========================================================================* /*===========================================================================*
* sef_local_startup * * sef_local_startup *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_local_startup() static void sef_local_startup()
{ {
/* Register init callbacks. */ /* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh); sef_setcb_init_fresh(sef_cb_init_fresh);
@@ -85,7 +85,7 @@ PRIVATE void sef_local_startup()
/*===========================================================================* /*===========================================================================*
* sef_cb_init_fresh * * sef_cb_init_fresh *
*===========================================================================*/ *===========================================================================*/
PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info)) static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{ {
/* Initialize the random driver. */ /* Initialize the random driver. */
static struct k_randomness krandom; static struct k_randomness krandom;
@@ -122,7 +122,7 @@ PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
/*===========================================================================* /*===========================================================================*
* r_prepare * * r_prepare *
*===========================================================================*/ *===========================================================================*/
PRIVATE struct device *r_prepare(dev_t device) static struct device *r_prepare(dev_t device)
{ {
/* Prepare for I/O on a device: check if the minor device number is ok. */ /* Prepare for I/O on a device: check if the minor device number is ok. */
@@ -135,7 +135,7 @@ PRIVATE struct device *r_prepare(dev_t device)
/*===========================================================================* /*===========================================================================*
* r_transfer * * r_transfer *
*===========================================================================*/ *===========================================================================*/
PRIVATE int r_transfer( static int r_transfer(
endpoint_t endpt, /* endpoint of grant owner */ endpoint_t endpt, /* endpoint of grant owner */
int opcode, /* DEV_GATHER or DEV_SCATTER */ int opcode, /* DEV_GATHER or DEV_SCATTER */
u64_t position, /* offset on device to read or write */ u64_t position, /* offset on device to read or write */
@@ -212,7 +212,7 @@ PRIVATE int r_transfer(
/*===========================================================================* /*===========================================================================*
* r_do_open * * r_do_open *
*===========================================================================*/ *===========================================================================*/
PRIVATE int r_do_open(message *m_ptr) static int r_do_open(message *m_ptr)
{ {
/* Check device number on open. /* Check device number on open.
*/ */
@@ -239,7 +239,7 @@ PRIVATE int r_do_open(message *m_ptr)
/*===========================================================================* /*===========================================================================*
* r_updatebin * * r_updatebin *
*===========================================================================*/ *===========================================================================*/
PRIVATE void r_updatebin(int source, struct k_randomness_bin *rb) static void r_updatebin(int source, struct k_randomness_bin *rb)
{ {
int r_next, r_size, r_high; int r_next, r_size, r_high;
@@ -265,7 +265,7 @@ PRIVATE void r_updatebin(int source, struct k_randomness_bin *rb)
/*===========================================================================* /*===========================================================================*
* r_random * * r_random *
*===========================================================================*/ *===========================================================================*/
PRIVATE void r_random(message *UNUSED(m_ptr)) static void r_random(message *UNUSED(m_ptr))
{ {
/* Fetch random information from the kernel to update /dev/random. */ /* Fetch random information from the kernel to update /dev/random. */
int s; int s;

View File

@@ -25,20 +25,20 @@ that data into a seed for a psuedo random number generator.
* re-seed. * re-seed.
*/ */
PRIVATE unsigned long deriv[TOTAL_SOURCES][N_DERIV]; static unsigned long deriv[TOTAL_SOURCES][N_DERIV];
PRIVATE int pool_ind[TOTAL_SOURCES]; static int pool_ind[TOTAL_SOURCES];
PRIVATE SHA256_CTX pool_ctx[NR_POOLS]; static SHA256_CTX pool_ctx[NR_POOLS];
PRIVATE unsigned samples= 0; static unsigned samples= 0;
PRIVATE int got_seeded= 0; static int got_seeded= 0;
PRIVATE u8_t random_key[2*AES_BLOCKSIZE]; static u8_t random_key[2*AES_BLOCKSIZE];
PRIVATE u32_t count_lo, count_hi; static u32_t count_lo, count_hi;
PRIVATE u32_t reseed_count; static u32_t reseed_count;
FORWARD void add_sample(int source, unsigned long sample); static void add_sample(int source, unsigned long sample);
FORWARD void data_block(rd_keyinstance *keyp, void *data); static void data_block(rd_keyinstance *keyp, void *data);
FORWARD void reseed(void); static void reseed(void);
PUBLIC void random_init() void random_init()
{ {
int i, j; int i, j;
@@ -58,14 +58,14 @@ PUBLIC void random_init()
reseed_count= 0; reseed_count= 0;
} }
PUBLIC int random_isseeded() int random_isseeded()
{ {
if (got_seeded) if (got_seeded)
return 1; return 1;
return 0; return 0;
} }
PUBLIC void random_update(source, buf, count) void random_update(source, buf, count)
int source; int source;
rand_t *buf; rand_t *buf;
int count; int count;
@@ -82,7 +82,7 @@ int count;
reseed(); reseed();
} }
PUBLIC void random_getbytes(buf, size) void random_getbytes(buf, size)
void *buf; void *buf;
size_t size; size_t size;
{ {
@@ -116,7 +116,7 @@ size_t size;
data_block(&key, random_key+AES_BLOCKSIZE); data_block(&key, random_key+AES_BLOCKSIZE);
} }
PUBLIC void random_putbytes(buf, size) void random_putbytes(buf, size)
void *buf; void *buf;
size_t size; size_t size;
{ {
@@ -131,7 +131,7 @@ size_t size;
reseed(); reseed();
} }
PRIVATE void add_sample(source, sample) static void add_sample(source, sample)
int source; int source;
unsigned long sample; unsigned long sample;
{ {
@@ -182,7 +182,7 @@ unsigned long sample;
pool_ind[source]= pool_nr; pool_ind[source]= pool_nr;
} }
PRIVATE void data_block(keyp, data) static void data_block(keyp, data)
rd_keyinstance *keyp; rd_keyinstance *keyp;
void *data; void *data;
{ {
@@ -207,7 +207,7 @@ void *data;
count_hi++; count_hi++;
} }
PRIVATE void reseed() static void reseed()
{ {
int i; int i;
SHA256_CTX ctx; SHA256_CTX ctx;

View File

@@ -83,7 +83,7 @@ int dec_to_bcd(int n);
void usage(void); void usage(void);
/* SEF functions and variables. */ /* SEF functions and variables. */
FORWARD void sef_local_startup(void); static void sef_local_startup(void);
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
@@ -201,7 +201,7 @@ int main(int argc, char **argv)
/*===========================================================================* /*===========================================================================*
* sef_local_startup * * sef_local_startup *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_local_startup() static void sef_local_startup()
{ {
/* Let SEF perform startup. */ /* Let SEF perform startup. */
sef_startup(); sef_startup();

View File

@@ -10,10 +10,10 @@ EXTERN re_t re_state;
((s) >= RL_STATE_READ_PROTOCOL_FREE && (s) <= RL_STATE_WRITE_PROTOCOL_FREE) ((s) >= RL_STATE_READ_PROTOCOL_FREE && (s) <= RL_STATE_WRITE_PROTOCOL_FREE)
/* State management helpers. */ /* State management helpers. */
PRIVATE int is_reading; static int is_reading;
PRIVATE int is_writing; static int is_writing;
PRIVATE void load_state_info(void) static void load_state_info(void)
{ {
re_t *rep; re_t *rep;
@@ -27,7 +27,7 @@ PRIVATE void load_state_info(void)
/*===========================================================================* /*===========================================================================*
* sef_cb_lu_prepare * * sef_cb_lu_prepare *
*===========================================================================*/ *===========================================================================*/
PUBLIC int sef_cb_lu_prepare(int state) int sef_cb_lu_prepare(int state)
{ {
int is_ready; int is_ready;
@@ -63,7 +63,7 @@ PUBLIC int sef_cb_lu_prepare(int state)
/*===========================================================================* /*===========================================================================*
* sef_cb_lu_state_isvalid * * sef_cb_lu_state_isvalid *
*===========================================================================*/ *===========================================================================*/
PUBLIC int sef_cb_lu_state_isvalid(int state) int sef_cb_lu_state_isvalid(int state)
{ {
return SEF_LU_STATE_IS_STANDARD(state) || RL_STATE_IS_CUSTOM(state); return SEF_LU_STATE_IS_STANDARD(state) || RL_STATE_IS_CUSTOM(state);
} }
@@ -71,7 +71,7 @@ PUBLIC int sef_cb_lu_state_isvalid(int state)
/*===========================================================================* /*===========================================================================*
* sef_cb_lu_state_dump * * sef_cb_lu_state_dump *
*===========================================================================*/ *===========================================================================*/
PUBLIC void sef_cb_lu_state_dump(int state) void sef_cb_lu_state_dump(int state)
{ {
/* Load state information. */ /* Load state information. */
load_state_info(); load_state_info();

View File

@@ -16,7 +16,7 @@
#include "rtl8139.h" #include "rtl8139.h"
PUBLIC re_t re_state; re_t re_state;
static int re_instance; static int re_instance;
@@ -98,15 +98,15 @@ static void tell_dev(vir_bytes start, size_t size, int pci_bus, int
/* The message used in the main loop is made global, so that rl_watchdog_f() /* The message used in the main loop is made global, so that rl_watchdog_f()
* can change its message type to fake an interrupt message. * can change its message type to fake an interrupt message.
*/ */
PRIVATE message m; static message m;
PRIVATE int int_event_check; /* set to TRUE if events arrived */ static int int_event_check; /* set to TRUE if events arrived */
PRIVATE u32_t system_hz; static u32_t system_hz;
/* SEF functions and variables. */ /* SEF functions and variables. */
FORWARD void sef_local_startup(void); static void sef_local_startup(void);
FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info); static int sef_cb_init_fresh(int type, sef_init_info_t *info);
FORWARD void sef_cb_signal_handler(int signo); static void sef_cb_signal_handler(int signo);
EXTERN int sef_cb_lu_prepare(int state); EXTERN int sef_cb_lu_prepare(int state);
EXTERN int sef_cb_lu_state_isvalid(int state); EXTERN int sef_cb_lu_state_isvalid(int state);
EXTERN void sef_cb_lu_state_dump(int state); EXTERN void sef_cb_lu_state_dump(int state);
@@ -178,7 +178,7 @@ int main(int argc, char *argv[])
/*===========================================================================* /*===========================================================================*
* sef_local_startup * * sef_local_startup *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_local_startup() static void sef_local_startup()
{ {
/* Register init callbacks. */ /* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh); sef_setcb_init_fresh(sef_cb_init_fresh);
@@ -200,7 +200,7 @@ PRIVATE void sef_local_startup()
/*===========================================================================* /*===========================================================================*
* sef_cb_init_fresh * * sef_cb_init_fresh *
*===========================================================================*/ *===========================================================================*/
PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info)) static int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
{ {
/* Initialize the rtl8139 driver. */ /* Initialize the rtl8139 driver. */
long v; long v;
@@ -233,7 +233,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
/*===========================================================================* /*===========================================================================*
* sef_cb_signal_handler * * sef_cb_signal_handler *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_cb_signal_handler(int signo) static void sef_cb_signal_handler(int signo)
{ {
re_t *rep; re_t *rep;
@@ -2231,7 +2231,7 @@ dpeth_t *dep;
} }
#endif #endif
PRIVATE void tell_dev(buf, size, pci_bus, pci_dev, pci_func) static void tell_dev(buf, size, pci_bus, pci_dev, pci_func)
vir_bytes buf; vir_bytes buf;
size_t size; size_t size;
int pci_bus; int pci_bus;

View File

@@ -232,15 +232,15 @@ static void rl_watchdog_f(timer_t *tp);
* The message used in the main loop is made global, so that rl_watchdog_f() * The message used in the main loop is made global, so that rl_watchdog_f()
* can change its message type to fake an interrupt message. * can change its message type to fake an interrupt message.
*/ */
PRIVATE message m; static message m;
PRIVATE int int_event_check; /* set to TRUE if events arrived */ static int int_event_check; /* set to TRUE if events arrived */
u32_t system_hz; u32_t system_hz;
/* SEF functions and variables. */ /* SEF functions and variables. */
FORWARD void sef_local_startup(void); static void sef_local_startup(void);
FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info); static int sef_cb_init_fresh(int type, sef_init_info_t *info);
FORWARD void sef_cb_signal_handler(int signo); static void sef_cb_signal_handler(int signo);
/*===========================================================================* /*===========================================================================*
* main * * main *
@@ -303,7 +303,7 @@ int main(int argc, char *argv[])
/*===========================================================================* /*===========================================================================*
* sef_local_startup * * sef_local_startup *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_local_startup() static void sef_local_startup()
{ {
/* Register init callbacks. */ /* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh); sef_setcb_init_fresh(sef_cb_init_fresh);
@@ -324,7 +324,7 @@ PRIVATE void sef_local_startup()
/*===========================================================================* /*===========================================================================*
* sef_cb_init_fresh * * sef_cb_init_fresh *
*===========================================================================*/ *===========================================================================*/
PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info)) static int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
{ {
/* Initialize the rtl8169 driver. */ /* Initialize the rtl8169 driver. */
long v; long v;
@@ -347,7 +347,7 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info))
/*===========================================================================* /*===========================================================================*
* sef_cb_signal_handler * * sef_cb_signal_handler *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_cb_signal_handler(int signo) static void sef_cb_signal_handler(int signo)
{ {
re_t *rep; re_t *rep;

View File

@@ -16,7 +16,7 @@ Created: Dec 2005 by Philip Homburg
/* The use of interrupts is not yet ready for prime time */ /* The use of interrupts is not yet ready for prime time */
#define USE_INTS 0 #define USE_INTS 0
PRIVATE struct port static struct port
{ {
int p_devind; int p_devind;
u8_t p_cb_busnr; u8_t p_cb_busnr;
@@ -28,16 +28,16 @@ PRIVATE struct port
volatile struct csr *csr_ptr; volatile struct csr *csr_ptr;
} port; } port;
PRIVATE int instance; static int instance;
PRIVATE int debug; static int debug;
FORWARD int hw_probe(int skip); static int hw_probe(int skip);
FORWARD void hw_init(struct port *pp, int devind); static void hw_init(struct port *pp, int devind);
FORWARD void do_int(struct port *pp); static void do_int(struct port *pp);
/* SEF functions and variables. */ /* SEF functions and variables. */
FORWARD void sef_local_startup(void); static void sef_local_startup(void);
FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info); static int sef_cb_init_fresh(int type, sef_init_info_t *info);
/*===========================================================================* /*===========================================================================*
* main * * main *
@@ -66,7 +66,7 @@ int main(int argc, char *argv[])
/*===========================================================================* /*===========================================================================*
* sef_local_startup * * sef_local_startup *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_local_startup() static void sef_local_startup()
{ {
/* Register init callbacks. */ /* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh); sef_setcb_init_fresh(sef_cb_init_fresh);
@@ -84,7 +84,7 @@ PRIVATE void sef_local_startup()
/*===========================================================================* /*===========================================================================*
* sef_cb_init_fresh * * sef_cb_init_fresh *
*===========================================================================*/ *===========================================================================*/
PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info)) static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{ {
/* Initialize the ti1225 driver. */ /* Initialize the ti1225 driver. */
int r, devind; int r, devind;
@@ -114,7 +114,7 @@ PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
/*===========================================================================* /*===========================================================================*
* hw_probe * * hw_probe *
*===========================================================================*/ *===========================================================================*/
PRIVATE int hw_probe(int skip) static int hw_probe(int skip)
{ {
u16_t vid, did; u16_t vid, did;
int devind; int devind;
@@ -139,7 +139,7 @@ PRIVATE int hw_probe(int skip)
/*===========================================================================* /*===========================================================================*
* hw_init * * hw_init *
*===========================================================================*/ *===========================================================================*/
PRIVATE void hw_init(struct port *pp, int devind) static void hw_init(struct port *pp, int devind)
{ {
u8_t v8; u8_t v8;
u16_t v16; u16_t v16;
@@ -247,7 +247,7 @@ PRIVATE void hw_init(struct port *pp, int devind)
/*===========================================================================* /*===========================================================================*
* do_int * * do_int *
*===========================================================================*/ *===========================================================================*/
PRIVATE void do_int(struct port *pp) static void do_int(struct port *pp)
{ {
int devind, vcc_5v, vcc_3v, vcc_Xv, vcc_Yv, int devind, vcc_5v, vcc_3v, vcc_Xv, vcc_Yv,
socket_5v, socket_3v, socket_Xv, socket_Yv; socket_5v, socket_3v, socket_Xv, socket_Yv;

View File

@@ -38,33 +38,33 @@
#define TIMER_FREQ 1193182L /* clock frequency for timer in PC and AT */ #define TIMER_FREQ 1193182L /* clock frequency for timer in PC and AT */
/* Global variables used by the console driver and assembly support. */ /* Global variables used by the console driver and assembly support. */
PRIVATE phys_bytes vid_size; /* 0x2000 for color or 0x0800 for mono */ static phys_bytes vid_size; /* 0x2000 for color or 0x0800 for mono */
PRIVATE phys_bytes vid_base; static phys_bytes vid_base;
PRIVATE unsigned vid_mask; /* 0x1FFF for color or 0x07FF for mono */ static unsigned vid_mask; /* 0x1FFF for color or 0x07FF for mono */
PRIVATE unsigned blank_color = BLANK_COLOR; /* display code for blank */ static unsigned blank_color = BLANK_COLOR; /* display code for blank */
/* Private variables used by the console driver. */ /* Private variables used by the console driver. */
PRIVATE int vid_port; /* I/O port for accessing 6845 */ static int vid_port; /* I/O port for accessing 6845 */
PRIVATE int wrap; /* hardware can wrap? */ static int wrap; /* hardware can wrap? */
PRIVATE int softscroll; /* 1 = software scrolling, 0 = hardware */ static int softscroll; /* 1 = software scrolling, 0 = hardware */
PRIVATE int beeping; /* speaker is beeping? */ static int beeping; /* speaker is beeping? */
PRIVATE unsigned font_lines; /* font lines per character */ static unsigned font_lines; /* font lines per character */
PRIVATE unsigned scr_width; /* # characters on a line */ static unsigned scr_width; /* # characters on a line */
PRIVATE unsigned scr_lines; /* # lines on the screen */ static unsigned scr_lines; /* # lines on the screen */
PRIVATE unsigned scr_size; /* # characters on the screen */ static unsigned scr_size; /* # characters on the screen */
/* tells mem_vid_copy() to blank the screen */ /* tells mem_vid_copy() to blank the screen */
#define BLANK_MEM ((vir_bytes) 0) #define BLANK_MEM ((vir_bytes) 0)
PRIVATE int disabled_vc = -1; /* Virtual console that was active when static int disabled_vc = -1; /* Virtual console that was active when
* disable_console was called. * disable_console was called.
*/ */
PRIVATE int disabled_sm; /* Scroll mode to be restored when re-enabling static int disabled_sm; /* Scroll mode to be restored when re-enabling
* console * console
*/ */
PRIVATE char *console_memory = NULL; static char *console_memory = NULL;
PRIVATE char *font_memory = NULL; static char *font_memory = NULL;
/* Per console data. */ /* Per console data. */
typedef struct console { typedef struct console {
@@ -99,17 +99,17 @@ typedef struct console {
set_6845(VID_ORG, ccons->c_org); \ set_6845(VID_ORG, ccons->c_org); \
} }
PRIVATE int nr_cons= 1; /* actual number of consoles */ static int nr_cons= 1; /* actual number of consoles */
PRIVATE console_t cons_table[NR_CONS]; static console_t cons_table[NR_CONS];
PRIVATE console_t *curcons = NULL; /* currently visible */ static console_t *curcons = NULL; /* currently visible */
PRIVATE int shutting_down = FALSE; /* don't allow console switches */ static int shutting_down = FALSE; /* don't allow console switches */
/* Color if using a color controller. */ /* Color if using a color controller. */
#define color (vid_port == C_6845) #define color (vid_port == C_6845)
/* Map from ANSI colors to the attributes used by the PC */ /* Map from ANSI colors to the attributes used by the PC */
PRIVATE int ansi_colors[8] = {0, 4, 2, 6, 1, 5, 3, 7}; static int ansi_colors[8] = {0, 4, 2, 6, 1, 5, 3, 7};
/* Structure used for font management */ /* Structure used for font management */
struct sequence { struct sequence {
@@ -118,33 +118,33 @@ struct sequence {
unsigned char value; unsigned char value;
}; };
FORWARD int cons_write(struct tty *tp, int try); static int cons_write(struct tty *tp, int try);
FORWARD void cons_echo(tty_t *tp, int c); static void cons_echo(tty_t *tp, int c);
FORWARD void out_char(console_t *cons, int c); static void out_char(console_t *cons, int c);
FORWARD void cons_putk(int c); static void cons_putk(int c);
FORWARD void beep(void); static void beep(void);
FORWARD void do_escape(console_t *cons, int c); static void do_escape(console_t *cons, int c);
FORWARD void flush(console_t *cons); static void flush(console_t *cons);
FORWARD void parse_escape(console_t *cons, int c); static void parse_escape(console_t *cons, int c);
FORWARD void scroll_screen(console_t *cons, int dir); static void scroll_screen(console_t *cons, int dir);
FORWARD void set_6845(int reg, unsigned val); static void set_6845(int reg, unsigned val);
FORWARD void stop_beep(timer_t *tmrp); static void stop_beep(timer_t *tmrp);
FORWARD void cons_org0(void); static void cons_org0(void);
FORWARD void disable_console(void); static void disable_console(void);
FORWARD void reenable_console(void); static void reenable_console(void);
FORWARD int ga_program(struct sequence *seq); static int ga_program(struct sequence *seq);
FORWARD int cons_ioctl(tty_t *tp, int); static int cons_ioctl(tty_t *tp, int);
FORWARD void mem_vid_copy(vir_bytes src, int dst, int count); static void mem_vid_copy(vir_bytes src, int dst, int count);
FORWARD void vid_vid_copy(int src, int dst, int count); static void vid_vid_copy(int src, int dst, int count);
#if 0 #if 0
FORWARD void get_6845(int reg, unsigned *val); static void get_6845(int reg, unsigned *val);
#endif #endif
/*===========================================================================* /*===========================================================================*
* cons_write * * cons_write *
*===========================================================================*/ *===========================================================================*/
PRIVATE int cons_write(tp, try) static int cons_write(tp, try)
register struct tty *tp; /* tells which terminal is to be used */ register struct tty *tp; /* tells which terminal is to be used */
int try; int try;
{ {
@@ -222,7 +222,7 @@ int try;
/*===========================================================================* /*===========================================================================*
* cons_echo * * cons_echo *
*===========================================================================*/ *===========================================================================*/
PRIVATE void cons_echo(tp, c) static void cons_echo(tp, c)
register tty_t *tp; /* pointer to tty struct */ register tty_t *tp; /* pointer to tty struct */
int c; /* character to be echoed */ int c; /* character to be echoed */
{ {
@@ -236,7 +236,7 @@ int c; /* character to be echoed */
/*===========================================================================* /*===========================================================================*
* out_char * * out_char *
*===========================================================================*/ *===========================================================================*/
PRIVATE void out_char(cons, c) static void out_char(cons, c)
register console_t *cons; /* pointer to console struct */ register console_t *cons; /* pointer to console struct */
int c; /* character to be output */ int c; /* character to be output */
{ {
@@ -331,7 +331,7 @@ int c; /* character to be output */
/*===========================================================================* /*===========================================================================*
* scroll_screen * * scroll_screen *
*===========================================================================*/ *===========================================================================*/
PRIVATE void scroll_screen(cons, dir) static void scroll_screen(cons, dir)
register console_t *cons; /* pointer to console struct */ register console_t *cons; /* pointer to console struct */
int dir; /* SCROLL_UP or SCROLL_DOWN */ int dir; /* SCROLL_UP or SCROLL_DOWN */
{ {
@@ -383,7 +383,7 @@ int dir; /* SCROLL_UP or SCROLL_DOWN */
/*===========================================================================* /*===========================================================================*
* flush * * flush *
*===========================================================================*/ *===========================================================================*/
PRIVATE void flush(cons) static void flush(cons)
register console_t *cons; /* pointer to console struct */ register console_t *cons; /* pointer to console struct */
{ {
/* Send characters buffered in 'ramqueue' to screen memory, check the new /* Send characters buffered in 'ramqueue' to screen memory, check the new
@@ -415,7 +415,7 @@ register console_t *cons; /* pointer to console struct */
/*===========================================================================* /*===========================================================================*
* parse_escape * * parse_escape *
*===========================================================================*/ *===========================================================================*/
PRIVATE void parse_escape(cons, c) static void parse_escape(cons, c)
register console_t *cons; /* pointer to console struct */ register console_t *cons; /* pointer to console struct */
char c; /* next character in escape sequence */ char c; /* next character in escape sequence */
{ {
@@ -474,7 +474,7 @@ char c; /* next character in escape sequence */
/*===========================================================================* /*===========================================================================*
* do_escape * * do_escape *
*===========================================================================*/ *===========================================================================*/
PRIVATE void do_escape(cons, c) static void do_escape(cons, c)
register console_t *cons; /* pointer to console struct */ register console_t *cons; /* pointer to console struct */
char c; /* next character in escape sequence */ char c; /* next character in escape sequence */
{ {
@@ -716,7 +716,7 @@ char c; /* next character in escape sequence */
/*===========================================================================* /*===========================================================================*
* set_6845 * * set_6845 *
*===========================================================================*/ *===========================================================================*/
PRIVATE void set_6845(reg, val) static void set_6845(reg, val)
int reg; /* which register pair to set */ int reg; /* which register pair to set */
unsigned val; /* 16-bit value to set it to */ unsigned val; /* 16-bit value to set it to */
{ {
@@ -736,7 +736,7 @@ unsigned val; /* 16-bit value to set it to */
/*===========================================================================* /*===========================================================================*
* get_6845 * * get_6845 *
*===========================================================================*/ *===========================================================================*/
PRIVATE void get_6845(reg, val) static void get_6845(reg, val)
int reg; /* which register pair to set */ int reg; /* which register pair to set */
unsigned *val; /* 16-bit value to set it to */ unsigned *val; /* 16-bit value to set it to */
{ {
@@ -756,7 +756,7 @@ unsigned *val; /* 16-bit value to set it to */
/*===========================================================================* /*===========================================================================*
* beep * * beep *
*===========================================================================*/ *===========================================================================*/
PRIVATE void beep() static void beep()
{ {
/* Making a beeping sound on the speaker (output for CRTL-G). /* Making a beeping sound on the speaker (output for CRTL-G).
* This routine works by turning on the bits 0 and 1 in port B of the 8255 * This routine works by turning on the bits 0 and 1 in port B of the 8255
@@ -786,7 +786,7 @@ PRIVATE void beep()
/*===========================================================================* /*===========================================================================*
* do_video * * do_video *
*===========================================================================*/ *===========================================================================*/
PUBLIC void do_video(message *m) void do_video(message *m)
{ {
int r; int r;
@@ -861,7 +861,7 @@ PUBLIC void do_video(message *m)
/*===========================================================================* /*===========================================================================*
* beep_x * * beep_x *
*===========================================================================*/ *===========================================================================*/
PUBLIC void beep_x(freq, dur) void beep_x(freq, dur)
unsigned freq; unsigned freq;
clock_t dur; clock_t dur;
{ {
@@ -896,7 +896,7 @@ clock_t dur;
/*===========================================================================* /*===========================================================================*
* stop_beep * * stop_beep *
*===========================================================================*/ *===========================================================================*/
PRIVATE void stop_beep(timer_t *UNUSED(tmrp)) static void stop_beep(timer_t *UNUSED(tmrp))
{ {
/* Turn off the beeper by turning off bits 0 and 1 in PORT_B. */ /* Turn off the beeper by turning off bits 0 and 1 in PORT_B. */
u32_t port_b_val; u32_t port_b_val;
@@ -908,7 +908,7 @@ PRIVATE void stop_beep(timer_t *UNUSED(tmrp))
/*===========================================================================* /*===========================================================================*
* scr_init * * scr_init *
*===========================================================================*/ *===========================================================================*/
PUBLIC void scr_init(tp) void scr_init(tp)
tty_t *tp; tty_t *tp;
{ {
/* Initialize the screen driver. */ /* Initialize the screen driver. */
@@ -1010,7 +1010,7 @@ tty_t *tp;
/*===========================================================================* /*===========================================================================*
* do_new_kmess * * do_new_kmess *
*===========================================================================*/ *===========================================================================*/
PUBLIC void do_new_kmess() void do_new_kmess()
{ {
/* Notification for a new kernel message. */ /* Notification for a new kernel message. */
static struct kmessages kmess; /* kmessages structure */ static struct kmessages kmess; /* kmessages structure */
@@ -1057,7 +1057,7 @@ PUBLIC void do_new_kmess()
/*===========================================================================* /*===========================================================================*
* cons_putk * * cons_putk *
*===========================================================================*/ *===========================================================================*/
PRIVATE void cons_putk(c) static void cons_putk(c)
int c; /* character to print */ int c; /* character to print */
{ {
/* This procedure is used to print a character on the console. /* This procedure is used to print a character on the console.
@@ -1076,7 +1076,7 @@ int c; /* character to print */
/*===========================================================================* /*===========================================================================*
* toggle_scroll * * toggle_scroll *
*===========================================================================*/ *===========================================================================*/
PUBLIC void toggle_scroll() void toggle_scroll()
{ {
/* Toggle between hardware and software scroll. */ /* Toggle between hardware and software scroll. */
@@ -1088,7 +1088,7 @@ PUBLIC void toggle_scroll()
/*===========================================================================* /*===========================================================================*
* cons_stop * * cons_stop *
*===========================================================================*/ *===========================================================================*/
PUBLIC void cons_stop() void cons_stop()
{ {
/* Prepare for halt or reboot. */ /* Prepare for halt or reboot. */
cons_org0(); cons_org0();
@@ -1101,7 +1101,7 @@ PUBLIC void cons_stop()
/*===========================================================================* /*===========================================================================*
* cons_org0 * * cons_org0 *
*===========================================================================*/ *===========================================================================*/
PRIVATE void cons_org0() static void cons_org0()
{ {
/* Scroll video memory back to put the origin at 0. */ /* Scroll video memory back to put the origin at 0. */
int cons_line; int cons_line;
@@ -1125,7 +1125,7 @@ PRIVATE void cons_org0()
/*===========================================================================* /*===========================================================================*
* disable_console * * disable_console *
*===========================================================================*/ *===========================================================================*/
PRIVATE void disable_console() static void disable_console()
{ {
if (disabled_vc != -1) if (disabled_vc != -1)
return; return;
@@ -1143,7 +1143,7 @@ PRIVATE void disable_console()
/*===========================================================================* /*===========================================================================*
* reenable_console * * reenable_console *
*===========================================================================*/ *===========================================================================*/
PRIVATE void reenable_console() static void reenable_console()
{ {
if (disabled_vc == -1) if (disabled_vc == -1)
return; return;
@@ -1156,7 +1156,7 @@ PRIVATE void reenable_console()
/*===========================================================================* /*===========================================================================*
* select_console * * select_console *
*===========================================================================*/ *===========================================================================*/
PUBLIC void select_console(int cons_line) void select_console(int cons_line)
{ {
/* Set the current console to console number 'cons_line'. */ /* Set the current console to console number 'cons_line'. */
@@ -1174,7 +1174,7 @@ PUBLIC void select_console(int cons_line)
/*===========================================================================* /*===========================================================================*
* con_loadfont * * con_loadfont *
*===========================================================================*/ *===========================================================================*/
PUBLIC int con_loadfont(m) int con_loadfont(m)
message *m; message *m;
{ {
@@ -1217,7 +1217,7 @@ message *m;
/*===========================================================================* /*===========================================================================*
* ga_program * * ga_program *
*===========================================================================*/ *===========================================================================*/
PRIVATE int ga_program(seq) static int ga_program(seq)
struct sequence *seq; struct sequence *seq;
{ {
pvb_pair_t char_out[14]; pvb_pair_t char_out[14];
@@ -1233,7 +1233,7 @@ struct sequence *seq;
/*===========================================================================* /*===========================================================================*
* cons_ioctl * * cons_ioctl *
*===========================================================================*/ *===========================================================================*/
PRIVATE int cons_ioctl(tty_t *tp, int UNUSED(try)) static int cons_ioctl(tty_t *tp, int UNUSED(try))
{ {
/* Set the screen dimensions. */ /* Set the screen dimensions. */
@@ -1254,7 +1254,7 @@ PRIVATE int cons_ioctl(tty_t *tp, int UNUSED(try))
/*===========================================================================* /*===========================================================================*
* mem_vid_copy * * mem_vid_copy *
*===========================================================================*/ *===========================================================================*/
PRIVATE void mem_vid_copy(vir_bytes src, int dst_index, int count) static void mem_vid_copy(vir_bytes src, int dst_index, int count)
{ {
u16_t *src_mem = (u16_t *) src; u16_t *src_mem = (u16_t *) src;
while(count > 0) { while(count > 0) {
@@ -1276,7 +1276,7 @@ PRIVATE void mem_vid_copy(vir_bytes src, int dst_index, int count)
/*===========================================================================* /*===========================================================================*
* vid_vid_copy * * vid_vid_copy *
*===========================================================================*/ *===========================================================================*/
PRIVATE void vid_vid_copy(int src_index, int dst_index, int count) static void vid_vid_copy(int src_index, int dst_index, int count)
{ {
int backwards = 0; int backwards = 0;
if(src_index < dst_index) if(src_index < dst_index)

View File

@@ -25,16 +25,16 @@
#include "kernel/type.h" #include "kernel/type.h"
#include "kernel/proc.h" #include "kernel/proc.h"
PRIVATE u16_t keymap[NR_SCAN_CODES * MAP_COLS] = { static u16_t keymap[NR_SCAN_CODES * MAP_COLS] = {
#include "keymaps/us-std.src" #include "keymaps/us-std.src"
}; };
PRIVATE u16_t keymap_escaped[NR_SCAN_CODES * MAP_COLS] = { static u16_t keymap_escaped[NR_SCAN_CODES * MAP_COLS] = {
#include "keymaps/us-std-esc.src" #include "keymaps/us-std-esc.src"
}; };
PRIVATE int irq_hook_id = -1; static int irq_hook_id = -1;
PRIVATE int aux_irq_hook_id = -1; static int aux_irq_hook_id = -1;
/* Standard and AT keyboard. (PS/2 MCA implies AT throughout.) */ /* Standard and AT keyboard. (PS/2 MCA implies AT throughout.) */
#define KEYBD 0x60 /* I/O port for keyboard data */ #define KEYBD 0x60 /* I/O port for keyboard data */
@@ -76,31 +76,31 @@ PRIVATE int aux_irq_hook_id = -1;
#define CONSOLE 0 /* line number for console */ #define CONSOLE 0 /* line number for console */
#define KB_IN_BYTES 32 /* size of keyboard input buffer */ #define KB_IN_BYTES 32 /* size of keyboard input buffer */
PRIVATE char injbuf[KB_IN_BYTES]; static char injbuf[KB_IN_BYTES];
PRIVATE char *injhead = injbuf; static char *injhead = injbuf;
PRIVATE char *injtail = injbuf; static char *injtail = injbuf;
PRIVATE int injcount; static int injcount;
PRIVATE char ibuf[KB_IN_BYTES]; /* input buffer */ static char ibuf[KB_IN_BYTES]; /* input buffer */
PRIVATE char *ihead = ibuf; /* next free spot in input buffer */ static char *ihead = ibuf; /* next free spot in input buffer */
PRIVATE char *itail = ibuf; /* scan code to return to TTY */ static char *itail = ibuf; /* scan code to return to TTY */
PRIVATE int icount; /* # codes in buffer */ static int icount; /* # codes in buffer */
PRIVATE int esc; /* escape scan code detected? */ static int esc; /* escape scan code detected? */
PRIVATE int alt_l; /* left alt key state */ static int alt_l; /* left alt key state */
PRIVATE int alt_r; /* right alt key state */ static int alt_r; /* right alt key state */
PRIVATE int alt; /* either alt key */ static int alt; /* either alt key */
PRIVATE int ctrl_l; /* left control key state */ static int ctrl_l; /* left control key state */
PRIVATE int ctrl_r; /* right control key state */ static int ctrl_r; /* right control key state */
PRIVATE int ctrl; /* either control key */ static int ctrl; /* either control key */
PRIVATE int shift_l; /* left shift key state */ static int shift_l; /* left shift key state */
PRIVATE int shift_r; /* right shift key state */ static int shift_r; /* right shift key state */
PRIVATE int shift; /* either shift key */ static int shift; /* either shift key */
PRIVATE int num_down; /* num lock key depressed */ static int num_down; /* num lock key depressed */
PRIVATE int caps_down; /* caps lock key depressed */ static int caps_down; /* caps lock key depressed */
PRIVATE int scroll_down; /* scroll lock key depressed */ static int scroll_down; /* scroll lock key depressed */
PRIVATE int alt_down; /* alt key depressed */ static int alt_down; /* alt key depressed */
PRIVATE int locks[NR_CONS]; /* per console lock keys state */ static int locks[NR_CONS]; /* per console lock keys state */
/* Lock key active bits. Chosen to be equal to the keyboard LED bits. */ /* Lock key active bits. Chosen to be equal to the keyboard LED bits. */
#define SCROLL_LOCK 0x01 #define SCROLL_LOCK 0x01
@@ -108,19 +108,19 @@ PRIVATE int locks[NR_CONS]; /* per console lock keys state */
#define CAPS_LOCK 0x04 #define CAPS_LOCK 0x04
#define ALT_LOCK 0x08 #define ALT_LOCK 0x08
PRIVATE char numpad_map[12] = static char numpad_map[12] =
{'H', 'Y', 'A', 'B', 'D', 'C', 'V', 'U', 'G', 'S', 'T', '@'}; {'H', 'Y', 'A', 'B', 'D', 'C', 'V', 'U', 'G', 'S', 'T', '@'};
PRIVATE char *fkey_map[12] = static char *fkey_map[12] =
{"11", "12", "13", "14", "15", "17", /* F1-F6 */ {"11", "12", "13", "14", "15", "17", /* F1-F6 */
"18", "19", "20", "21", "23", "24"}; /* F7-F12 */ "18", "19", "20", "21", "23", "24"}; /* F7-F12 */
/* Variables and definition for observed function keys. */ /* Variables and definition for observed function keys. */
typedef struct observer { int proc_nr; int events; } obs_t; typedef struct observer { int proc_nr; int events; } obs_t;
PRIVATE obs_t fkey_obs[12]; /* observers for F1-F12 */ static obs_t fkey_obs[12]; /* observers for F1-F12 */
PRIVATE obs_t sfkey_obs[12]; /* observers for SHIFT F1-F12 */ static obs_t sfkey_obs[12]; /* observers for SHIFT F1-F12 */
PRIVATE struct kbd static struct kbd
{ {
int minor; int minor;
int nr_open; int nr_open;
@@ -139,7 +139,7 @@ PRIVATE struct kbd
/* Data that is to be sent to the keyboard. Each byte is ACKed by the /* Data that is to be sent to the keyboard. Each byte is ACKed by the
* keyboard. * keyboard.
*/ */
PRIVATE struct kbd_outack static struct kbd_outack
{ {
unsigned char buf[KBD_OUT_BUFSZ]; unsigned char buf[KBD_OUT_BUFSZ];
int offset; int offset;
@@ -147,28 +147,28 @@ PRIVATE struct kbd_outack
int expect_ack; int expect_ack;
} kbdout; } kbdout;
PRIVATE int kbd_watchdog_set= 0; static int kbd_watchdog_set= 0;
PRIVATE int kbd_alive= 1; static int kbd_alive= 1;
PRIVATE long sticky_alt_mode = 0; static long sticky_alt_mode = 0;
PRIVATE long debug_fkeys = 1; static long debug_fkeys = 1;
PRIVATE timer_t tmr_kbd_wd; static timer_t tmr_kbd_wd;
FORWARD void handle_req(struct kbd *kbdp, message *m); static void handle_req(struct kbd *kbdp, message *m);
FORWARD int handle_status(struct kbd *kbdp, message *m); static int handle_status(struct kbd *kbdp, message *m);
FORWARD void kbc_cmd0(int cmd); static void kbc_cmd0(int cmd);
FORWARD void kbc_cmd1(int cmd, int data); static void kbc_cmd1(int cmd, int data);
FORWARD int kbc_read(void); static int kbc_read(void);
FORWARD void kbd_send(void); static void kbd_send(void);
FORWARD int kb_ack(void); static int kb_ack(void);
FORWARD int kb_wait(void); static int kb_wait(void);
FORWARD int func_key(int scode); static int func_key(int scode);
FORWARD int scan_keyboard(unsigned char *bp, int *isauxp); static int scan_keyboard(unsigned char *bp, int *isauxp);
FORWARD unsigned make_break(int scode); static unsigned make_break(int scode);
FORWARD void set_leds(void); static void set_leds(void);
FORWARD void show_key_mappings(void); static void show_key_mappings(void);
FORWARD int kb_read(struct tty *tp, int try); static int kb_read(struct tty *tp, int try);
FORWARD unsigned map_key(int scode); static unsigned map_key(int scode);
FORWARD void kbd_watchdog(timer_t *tmrp); static void kbd_watchdog(timer_t *tmrp);
int micro_delay(u32_t usecs) int micro_delay(u32_t usecs)
{ {
@@ -180,7 +180,7 @@ int micro_delay(u32_t usecs)
/*===========================================================================* /*===========================================================================*
* do_kbd * * do_kbd *
*===========================================================================*/ *===========================================================================*/
PUBLIC void do_kbd(message *m) void do_kbd(message *m)
{ {
handle_req(&kbd, m); handle_req(&kbd, m);
} }
@@ -189,7 +189,7 @@ PUBLIC void do_kbd(message *m)
/*===========================================================================* /*===========================================================================*
* kbd_status * * kbd_status *
*===========================================================================*/ *===========================================================================*/
PUBLIC int kbd_status(message *m) int kbd_status(message *m)
{ {
int r; int r;
@@ -203,7 +203,7 @@ PUBLIC int kbd_status(message *m)
/*===========================================================================* /*===========================================================================*
* do_kbdaux * * do_kbdaux *
*===========================================================================*/ *===========================================================================*/
PUBLIC void do_kbdaux(message *m) void do_kbdaux(message *m)
{ {
handle_req(&kbdaux, m); handle_req(&kbdaux, m);
} }
@@ -212,7 +212,7 @@ PUBLIC void do_kbdaux(message *m)
/*===========================================================================* /*===========================================================================*
* handle_req * * handle_req *
*===========================================================================*/ *===========================================================================*/
PRIVATE void handle_req(kbdp, m) static void handle_req(kbdp, m)
struct kbd *kbdp; struct kbd *kbdp;
message *m; message *m;
{ {
@@ -393,7 +393,7 @@ message *m;
/*===========================================================================* /*===========================================================================*
* handle_status * * handle_status *
*===========================================================================*/ *===========================================================================*/
PRIVATE int handle_status(kbdp, m) static int handle_status(kbdp, m)
struct kbd *kbdp; struct kbd *kbdp;
message *m; message *m;
{ {
@@ -443,7 +443,7 @@ message *m;
/*===========================================================================* /*===========================================================================*
* map_key * * map_key *
*===========================================================================*/ *===========================================================================*/
PRIVATE unsigned map_key(scode) static unsigned map_key(scode)
int scode; int scode;
{ {
/* Map a scan code to an ASCII code. */ /* Map a scan code to an ASCII code. */
@@ -481,7 +481,7 @@ int scode;
/*===========================================================================* /*===========================================================================*
* kbd_interrupt * * kbd_interrupt *
*===========================================================================*/ *===========================================================================*/
PUBLIC void kbd_interrupt(message *UNUSED(m_ptr)) void kbd_interrupt(message *UNUSED(m_ptr))
{ {
/* A keyboard interrupt has occurred. Process it. */ /* A keyboard interrupt has occurred. Process it. */
int o, isaux; int o, isaux;
@@ -534,7 +534,7 @@ PUBLIC void kbd_interrupt(message *UNUSED(m_ptr))
} }
PUBLIC void do_kb_inject(message *msg) void do_kb_inject(message *msg)
{ {
unsigned char scode; unsigned char scode;
/* only handle keyboard events */ /* only handle keyboard events */
@@ -561,7 +561,7 @@ PUBLIC void do_kb_inject(message *msg)
/*===========================================================================* /*===========================================================================*
* kb_read * * kb_read *
*===========================================================================*/ *===========================================================================*/
PRIVATE int kb_read(tp, try) static int kb_read(tp, try)
tty_t *tp; tty_t *tp;
int try; int try;
{ {
@@ -673,7 +673,7 @@ int try;
/*===========================================================================* /*===========================================================================*
* kbd_send * * kbd_send *
*===========================================================================*/ *===========================================================================*/
PRIVATE void kbd_send() static void kbd_send()
{ {
u32_t sb; u32_t sb;
int r; int r;
@@ -725,7 +725,7 @@ PRIVATE void kbd_send()
/*===========================================================================* /*===========================================================================*
* make_break * * make_break *
*===========================================================================*/ *===========================================================================*/
PRIVATE unsigned make_break(scode) static unsigned make_break(scode)
int scode; /* scan code of key just struck or released */ int scode; /* scan code of key just struck or released */
{ {
/* This routine can handle keyboards that interrupt only on key depression, /* This routine can handle keyboards that interrupt only on key depression,
@@ -833,7 +833,7 @@ int scode; /* scan code of key just struck or released */
/*===========================================================================* /*===========================================================================*
* set_leds * * set_leds *
*===========================================================================*/ *===========================================================================*/
PRIVATE void set_leds() static void set_leds()
{ {
/* Set the LEDs on the caps, num, and scroll lock keys */ /* Set the LEDs on the caps, num, and scroll lock keys */
int s; int s;
@@ -854,7 +854,7 @@ PRIVATE void set_leds()
/*===========================================================================* /*===========================================================================*
* kbc_cmd0 * * kbc_cmd0 *
*===========================================================================*/ *===========================================================================*/
PRIVATE void kbc_cmd0(cmd) static void kbc_cmd0(cmd)
int cmd; int cmd;
{ {
kb_wait(); kb_wait();
@@ -865,7 +865,7 @@ int cmd;
/*===========================================================================* /*===========================================================================*
* kbc_cmd1 * * kbc_cmd1 *
*===========================================================================*/ *===========================================================================*/
PRIVATE void kbc_cmd1(cmd, data) static void kbc_cmd1(cmd, data)
int cmd; int cmd;
int data; int data;
{ {
@@ -881,7 +881,7 @@ int data;
/*===========================================================================* /*===========================================================================*
* kbc_read * * kbc_read *
*===========================================================================*/ *===========================================================================*/
PRIVATE int kbc_read() static int kbc_read()
{ {
int i; int i;
u32_t byte, st; u32_t byte, st;
@@ -929,7 +929,7 @@ PRIVATE int kbc_read()
/*===========================================================================* /*===========================================================================*
* kb_wait * * kb_wait *
*===========================================================================*/ *===========================================================================*/
PRIVATE int kb_wait() static int kb_wait()
{ {
/* Wait until the controller is ready; return zero if this times out. */ /* Wait until the controller is ready; return zero if this times out. */
@@ -960,7 +960,7 @@ PRIVATE int kb_wait()
/*===========================================================================* /*===========================================================================*
* kb_ack * * kb_ack *
*===========================================================================*/ *===========================================================================*/
PRIVATE int kb_ack() static int kb_ack()
{ {
/* Wait until kbd acknowledges last command; return zero if this times out. */ /* Wait until kbd acknowledges last command; return zero if this times out. */
@@ -982,7 +982,7 @@ PRIVATE int kb_ack()
/*===========================================================================* /*===========================================================================*
* kb_init * * kb_init *
*===========================================================================*/ *===========================================================================*/
PUBLIC void kb_init(tp) void kb_init(tp)
tty_t *tp; tty_t *tp;
{ {
/* Initialize the keyboard driver. */ /* Initialize the keyboard driver. */
@@ -993,7 +993,7 @@ tty_t *tp;
/*===========================================================================* /*===========================================================================*
* kb_init_once * * kb_init_once *
*===========================================================================*/ *===========================================================================*/
PUBLIC void kb_init_once(void) void kb_init_once(void)
{ {
int i; int i;
u8_t ccb; u8_t ccb;
@@ -1053,7 +1053,7 @@ PUBLIC void kb_init_once(void)
/*===========================================================================* /*===========================================================================*
* kbd_loadmap * * kbd_loadmap *
*===========================================================================*/ *===========================================================================*/
PUBLIC int kbd_loadmap(m) int kbd_loadmap(m)
message *m; message *m;
{ {
/* Load a new keymap. */ /* Load a new keymap. */
@@ -1064,7 +1064,7 @@ message *m;
/*===========================================================================* /*===========================================================================*
* do_fkey_ctl * * do_fkey_ctl *
*===========================================================================*/ *===========================================================================*/
PUBLIC void do_fkey_ctl(m_ptr) void do_fkey_ctl(m_ptr)
message *m_ptr; /* pointer to the request message */ message *m_ptr; /* pointer to the request message */
{ {
/* This procedure allows processes to register a function key to receive /* This procedure allows processes to register a function key to receive
@@ -1165,7 +1165,7 @@ message *m_ptr; /* pointer to the request message */
/*===========================================================================* /*===========================================================================*
* func_key * * func_key *
*===========================================================================*/ *===========================================================================*/
PRIVATE int func_key(scode) static int func_key(scode)
int scode; /* scan code for a function key */ int scode; /* scan code for a function key */
{ {
/* This procedure traps function keys for debugging purposes. Observers of /* This procedure traps function keys for debugging purposes. Observers of
@@ -1210,7 +1210,7 @@ int scode; /* scan code for a function key */
/*===========================================================================* /*===========================================================================*
* show_key_mappings * * show_key_mappings *
*===========================================================================*/ *===========================================================================*/
PRIVATE void show_key_mappings() static void show_key_mappings()
{ {
int i,s; int i,s;
struct proc proc; struct proc proc;
@@ -1249,7 +1249,7 @@ PRIVATE void show_key_mappings()
/*===========================================================================* /*===========================================================================*
* scan_keyboard * * scan_keyboard *
*===========================================================================*/ *===========================================================================*/
PRIVATE int scan_keyboard(bp, isauxp) static int scan_keyboard(bp, isauxp)
unsigned char *bp; unsigned char *bp;
int *isauxp; int *isauxp;
{ {
@@ -1294,7 +1294,7 @@ int *isauxp;
/*===========================================================================* /*===========================================================================*
* kbd_watchdog * * kbd_watchdog *
*===========================================================================*/ *===========================================================================*/
PRIVATE void kbd_watchdog(timer_t *UNUSED(tmrp)) static void kbd_watchdog(timer_t *UNUSED(tmrp))
{ {
kbd_watchdog_set= 0; kbd_watchdog_set= 0;

View File

@@ -65,22 +65,22 @@ typedef struct pty {
#define TTY_CLOSED 0x02 /* tty side has closed down */ #define TTY_CLOSED 0x02 /* tty side has closed down */
#define PTY_CLOSED 0x04 /* pty side has closed down */ #define PTY_CLOSED 0x04 /* pty side has closed down */
PRIVATE pty_t pty_table[NR_PTYS]; /* PTY bookkeeping */ static pty_t pty_table[NR_PTYS]; /* PTY bookkeeping */
FORWARD int pty_write(tty_t *tp, int try); static int pty_write(tty_t *tp, int try);
FORWARD void pty_echo(tty_t *tp, int c); static void pty_echo(tty_t *tp, int c);
FORWARD void pty_start(pty_t *pp); static void pty_start(pty_t *pp);
FORWARD void pty_finish(pty_t *pp); static void pty_finish(pty_t *pp);
FORWARD int pty_read(tty_t *tp, int try); static int pty_read(tty_t *tp, int try);
FORWARD int pty_close(tty_t *tp, int try); static int pty_close(tty_t *tp, int try);
FORWARD int pty_icancel(tty_t *tp, int try); static int pty_icancel(tty_t *tp, int try);
FORWARD int pty_ocancel(tty_t *tp, int try); static int pty_ocancel(tty_t *tp, int try);
FORWARD int pty_select(tty_t *tp, message *m); static int pty_select(tty_t *tp, message *m);
/*===========================================================================* /*===========================================================================*
* do_pty * * do_pty *
*===========================================================================*/ *===========================================================================*/
PUBLIC void do_pty(tty_t *tp, message *m_ptr) void do_pty(tty_t *tp, message *m_ptr)
{ {
/* Perform an open/close/read/write call on a /dev/ptypX device. */ /* Perform an open/close/read/write call on a /dev/ptypX device. */
pty_t *pp = tp->tty_priv; pty_t *pp = tp->tty_priv;
@@ -194,7 +194,7 @@ PUBLIC void do_pty(tty_t *tp, message *m_ptr)
/*===========================================================================* /*===========================================================================*
* pty_write * * pty_write *
*===========================================================================*/ *===========================================================================*/
PRIVATE int pty_write(tty_t *tp, int try) static int pty_write(tty_t *tp, int try)
{ {
/* (*dev_write)() routine for PTYs. Transfer bytes from the writer on /* (*dev_write)() routine for PTYs. Transfer bytes from the writer on
* /dev/ttypX to the output buffer. * /dev/ttypX to the output buffer.
@@ -270,7 +270,7 @@ PRIVATE int pty_write(tty_t *tp, int try)
/*===========================================================================* /*===========================================================================*
* pty_echo * * pty_echo *
*===========================================================================*/ *===========================================================================*/
PRIVATE void pty_echo(tty_t *tp, int c) static void pty_echo(tty_t *tp, int c)
{ {
/* Echo one character. (Like pty_write, but only one character, optionally.) */ /* Echo one character. (Like pty_write, but only one character, optionally.) */
@@ -293,7 +293,7 @@ PRIVATE void pty_echo(tty_t *tp, int c)
/*===========================================================================* /*===========================================================================*
* pty_start * * pty_start *
*===========================================================================*/ *===========================================================================*/
PRIVATE void pty_start(pty_t *pp) static void pty_start(pty_t *pp)
{ {
/* Transfer bytes written to the output buffer to the PTY reader. */ /* Transfer bytes written to the output buffer to the PTY reader. */
int count; int count;
@@ -324,7 +324,7 @@ PRIVATE void pty_start(pty_t *pp)
/*===========================================================================* /*===========================================================================*
* pty_finish * * pty_finish *
*===========================================================================*/ *===========================================================================*/
PRIVATE void pty_finish(pty_t *pp) static void pty_finish(pty_t *pp)
{ {
/* Finish the read request of a PTY reader if there is at least one byte /* Finish the read request of a PTY reader if there is at least one byte
* transferred. * transferred.
@@ -343,7 +343,7 @@ PRIVATE void pty_finish(pty_t *pp)
/*===========================================================================* /*===========================================================================*
* pty_read * * pty_read *
*===========================================================================*/ *===========================================================================*/
PRIVATE int pty_read(tty_t *tp, int try) static int pty_read(tty_t *tp, int try)
{ {
/* Offer bytes from the PTY writer for input on the TTY. (Do it one byte at /* Offer bytes from the PTY writer for input on the TTY. (Do it one byte at
* a time, 99% of the writes will be for one byte, so no sense in being smart.) * a time, 99% of the writes will be for one byte, so no sense in being smart.)
@@ -405,7 +405,7 @@ PRIVATE int pty_read(tty_t *tp, int try)
/*===========================================================================* /*===========================================================================*
* pty_close * * pty_close *
*===========================================================================*/ *===========================================================================*/
PRIVATE int pty_close(tty_t *tp, int UNUSED(try)) static int pty_close(tty_t *tp, int UNUSED(try))
{ {
/* The tty side has closed, so shut down the pty side. */ /* The tty side has closed, so shut down the pty side. */
pty_t *pp = tp->tty_priv; pty_t *pp = tp->tty_priv;
@@ -430,7 +430,7 @@ PRIVATE int pty_close(tty_t *tp, int UNUSED(try))
/*===========================================================================* /*===========================================================================*
* pty_icancel * * pty_icancel *
*===========================================================================*/ *===========================================================================*/
PRIVATE int pty_icancel(tty_t *tp, int UNUSED(try)) static int pty_icancel(tty_t *tp, int UNUSED(try))
{ {
/* Discard waiting input. */ /* Discard waiting input. */
pty_t *pp = tp->tty_priv; pty_t *pp = tp->tty_priv;
@@ -447,7 +447,7 @@ PRIVATE int pty_icancel(tty_t *tp, int UNUSED(try))
/*===========================================================================* /*===========================================================================*
* pty_ocancel * * pty_ocancel *
*===========================================================================*/ *===========================================================================*/
PRIVATE int pty_ocancel(tty_t *tp, int UNUSED(try)) static int pty_ocancel(tty_t *tp, int UNUSED(try))
{ {
/* Drain the output buffer. */ /* Drain the output buffer. */
pty_t *pp = tp->tty_priv; pty_t *pp = tp->tty_priv;
@@ -461,7 +461,7 @@ PRIVATE int pty_ocancel(tty_t *tp, int UNUSED(try))
/*===========================================================================* /*===========================================================================*
* pty_init * * pty_init *
*===========================================================================*/ *===========================================================================*/
PUBLIC void pty_init(tty_t *tp) void pty_init(tty_t *tp)
{ {
pty_t *pp; pty_t *pp;
int line; int line;
@@ -488,7 +488,7 @@ PUBLIC void pty_init(tty_t *tp)
/*===========================================================================* /*===========================================================================*
* pty_status * * pty_status *
*===========================================================================*/ *===========================================================================*/
PUBLIC int pty_status(message *m_ptr) int pty_status(message *m_ptr)
{ {
int i, event_found; int i, event_found;
pty_t *pp; pty_t *pp;
@@ -541,7 +541,7 @@ PUBLIC int pty_status(message *m_ptr)
/*===========================================================================* /*===========================================================================*
* select_try_pty * * select_try_pty *
*===========================================================================*/ *===========================================================================*/
PRIVATE int select_try_pty(tty_t *tp, int ops) static int select_try_pty(tty_t *tp, int ops)
{ {
pty_t *pp = tp->tty_priv; pty_t *pp = tp->tty_priv;
int r = 0; int r = 0;
@@ -566,7 +566,7 @@ PRIVATE int select_try_pty(tty_t *tp, int ops)
/*===========================================================================* /*===========================================================================*
* select_retry_pty * * select_retry_pty *
*===========================================================================*/ *===========================================================================*/
PUBLIC void select_retry_pty(tty_t *tp) void select_retry_pty(tty_t *tp)
{ {
pty_t *pp = tp->tty_priv; pty_t *pp = tp->tty_priv;
int r; int r;
@@ -582,7 +582,7 @@ PUBLIC void select_retry_pty(tty_t *tp)
/*===========================================================================* /*===========================================================================*
* pty_select * * pty_select *
*===========================================================================*/ *===========================================================================*/
PRIVATE int pty_select(tty_t *tp, message *m) static int pty_select(tty_t *tp, message *m)
{ {
pty_t *pp = tp->tty_priv; pty_t *pp = tp->tty_priv;
int ops, ready_ops = 0, watch; int ops, ready_ops = 0, watch;

View File

@@ -166,11 +166,11 @@ typedef struct rs232 {
char obuf[RS_OBUFSIZE]; /* output buffer */ char obuf[RS_OBUFSIZE]; /* output buffer */
} rs232_t; } rs232_t;
PRIVATE rs232_t rs_lines[NR_RS_LINES]; static rs232_t rs_lines[NR_RS_LINES];
#if (MACHINE == IBM_PC) #if (MACHINE == IBM_PC)
/* 8250 base addresses. */ /* 8250 base addresses. */
PRIVATE port_t addr_8250[] = { static port_t addr_8250[] = {
0x3F8, /* COM1 */ 0x3F8, /* COM1 */
0x2F8, /* COM2 */ 0x2F8, /* COM2 */
0x3E8, /* COM3 */ 0x3E8, /* COM3 */
@@ -178,27 +178,27 @@ PRIVATE port_t addr_8250[] = {
}; };
#endif #endif
FORWARD void in_int(rs232_t *rs); static void in_int(rs232_t *rs);
FORWARD void line_int(rs232_t *rs); static void line_int(rs232_t *rs);
FORWARD void modem_int(rs232_t *rs); static void modem_int(rs232_t *rs);
FORWARD int rs_write(tty_t *tp, int try); static int rs_write(tty_t *tp, int try);
FORWARD void rs_echo(tty_t *tp, int c); static void rs_echo(tty_t *tp, int c);
FORWARD int rs_ioctl(tty_t *tp, int try); static int rs_ioctl(tty_t *tp, int try);
FORWARD void rs_config(rs232_t *rs); static void rs_config(rs232_t *rs);
FORWARD int rs_read(tty_t *tp, int try); static int rs_read(tty_t *tp, int try);
FORWARD int rs_icancel(tty_t *tp, int try); static int rs_icancel(tty_t *tp, int try);
FORWARD int rs_ocancel(tty_t *tp, int try); static int rs_ocancel(tty_t *tp, int try);
FORWARD void rs_ostart(rs232_t *rs); static void rs_ostart(rs232_t *rs);
FORWARD int rs_break(tty_t *tp, int try); static int rs_break(tty_t *tp, int try);
FORWARD int rs_close(tty_t *tp, int try); static int rs_close(tty_t *tp, int try);
FORWARD void out_int(rs232_t *rs); static void out_int(rs232_t *rs);
FORWARD void rs232_handler(rs232_t *rs); static void rs232_handler(rs232_t *rs);
/* XXX */ /* XXX */
PRIVATE void lock(void) {} static void lock(void) {}
PRIVATE void unlock(void) {} static void unlock(void) {}
PRIVATE int my_inb(port_t port) static int my_inb(port_t port)
{ {
int r; int r;
u32_t v = 0; u32_t v = 0;
@@ -212,7 +212,7 @@ PRIVATE int my_inb(port_t port)
/*===========================================================================* /*===========================================================================*
* rs_write * * rs_write *
*===========================================================================*/ *===========================================================================*/
PRIVATE int rs_write(register tty_t *tp, int try) static int rs_write(register tty_t *tp, int try)
{ {
/* (*devwrite)() routine for RS232. */ /* (*devwrite)() routine for RS232. */
@@ -297,7 +297,7 @@ PRIVATE int rs_write(register tty_t *tp, int try)
/*===========================================================================* /*===========================================================================*
* rs_echo * * rs_echo *
*===========================================================================*/ *===========================================================================*/
PRIVATE void rs_echo(tp, c) static void rs_echo(tp, c)
tty_t *tp; /* which TTY */ tty_t *tp; /* which TTY */
int c; /* character to echo */ int c; /* character to echo */
{ {
@@ -324,7 +324,7 @@ int c; /* character to echo */
/*===========================================================================* /*===========================================================================*
* rs_ioctl * * rs_ioctl *
*===========================================================================*/ *===========================================================================*/
PRIVATE int rs_ioctl(tty_t *tp, int UNUSED(dummy)) static int rs_ioctl(tty_t *tp, int UNUSED(dummy))
/* tp; which TTY */ /* tp; which TTY */
{ {
/* Reconfigure the line as soon as the output has drained. */ /* Reconfigure the line as soon as the output has drained. */
@@ -337,7 +337,7 @@ PRIVATE int rs_ioctl(tty_t *tp, int UNUSED(dummy))
/*===========================================================================* /*===========================================================================*
* rs_config * * rs_config *
*===========================================================================*/ *===========================================================================*/
PRIVATE void rs_config(rs232_t *rs) static void rs_config(rs232_t *rs)
/* rs which line */ /* rs which line */
{ {
/* Set various line control parameters for RS232 I/O. /* Set various line control parameters for RS232 I/O.
@@ -423,7 +423,7 @@ PRIVATE void rs_config(rs232_t *rs)
/*===========================================================================* /*===========================================================================*
* rs_init * * rs_init *
*===========================================================================*/ *===========================================================================*/
PUBLIC void rs_init(tty_t *tp) void rs_init(tty_t *tp)
/* tp which TTY */ /* tp which TTY */
{ {
u32_t dummy; u32_t dummy;
@@ -527,7 +527,7 @@ PUBLIC void rs_init(tty_t *tp)
/*===========================================================================* /*===========================================================================*
* rs_interrupt * * rs_interrupt *
*===========================================================================*/ *===========================================================================*/
PUBLIC void rs_interrupt(message *m) void rs_interrupt(message *m)
{ {
unsigned long irq_set; unsigned long irq_set;
int i; int i;
@@ -544,7 +544,7 @@ PUBLIC void rs_interrupt(message *m)
/*===========================================================================* /*===========================================================================*
* rs_icancel * * rs_icancel *
*===========================================================================*/ *===========================================================================*/
PRIVATE int rs_icancel(tty_t *tp, int UNUSED(dummy)) static int rs_icancel(tty_t *tp, int UNUSED(dummy))
{ {
/* Cancel waiting input. */ /* Cancel waiting input. */
rs232_t *rs = tp->tty_priv; rs232_t *rs = tp->tty_priv;
@@ -561,7 +561,7 @@ PRIVATE int rs_icancel(tty_t *tp, int UNUSED(dummy))
/*===========================================================================* /*===========================================================================*
* rs_ocancel * * rs_ocancel *
*===========================================================================*/ *===========================================================================*/
PRIVATE int rs_ocancel(tty_t *tp, int UNUSED(dummy)) static int rs_ocancel(tty_t *tp, int UNUSED(dummy))
{ {
/* Cancel pending output. */ /* Cancel pending output. */
rs232_t *rs = tp->tty_priv; rs232_t *rs = tp->tty_priv;
@@ -578,7 +578,7 @@ PRIVATE int rs_ocancel(tty_t *tp, int UNUSED(dummy))
/*===========================================================================* /*===========================================================================*
* rs_read * * rs_read *
*===========================================================================*/ *===========================================================================*/
PRIVATE int rs_read(tty_t *tp, int try) static int rs_read(tty_t *tp, int try)
{ {
/* Process characters from the circular input buffer. */ /* Process characters from the circular input buffer. */
@@ -625,7 +625,7 @@ PRIVATE int rs_read(tty_t *tp, int try)
/*===========================================================================* /*===========================================================================*
* rs_ostart * * rs_ostart *
*===========================================================================*/ *===========================================================================*/
PRIVATE void rs_ostart(rs232_t *rs) static void rs_ostart(rs232_t *rs)
{ {
/* Tell RS232 there is something waiting in the output buffer. */ /* Tell RS232 there is something waiting in the output buffer. */
@@ -636,7 +636,7 @@ PRIVATE void rs_ostart(rs232_t *rs)
/*===========================================================================* /*===========================================================================*
* rs_break * * rs_break *
*===========================================================================*/ *===========================================================================*/
PRIVATE int rs_break(tty_t *tp, int UNUSED(dummy)) static int rs_break(tty_t *tp, int UNUSED(dummy))
{ {
/* Generate a break condition by setting the BREAK bit for 0.4 sec. */ /* Generate a break condition by setting the BREAK bit for 0.4 sec. */
rs232_t *rs = tp->tty_priv; rs232_t *rs = tp->tty_priv;
@@ -654,7 +654,7 @@ PRIVATE int rs_break(tty_t *tp, int UNUSED(dummy))
/*===========================================================================* /*===========================================================================*
* rs_close * * rs_close *
*===========================================================================*/ *===========================================================================*/
PRIVATE int rs_close(tty_t *tp, int UNUSED(dummy)) static int rs_close(tty_t *tp, int UNUSED(dummy))
{ {
/* The line is closed; optionally hang up. */ /* The line is closed; optionally hang up. */
rs232_t *rs = tp->tty_priv; rs232_t *rs = tp->tty_priv;
@@ -670,7 +670,7 @@ PRIVATE int rs_close(tty_t *tp, int UNUSED(dummy))
/*===========================================================================* /*===========================================================================*
* rs232_handler * * rs232_handler *
*===========================================================================*/ *===========================================================================*/
PRIVATE void rs232_handler(struct rs232 *rs) static void rs232_handler(struct rs232 *rs)
{ {
/* Interrupt hander for RS232. */ /* Interrupt hander for RS232. */
@@ -703,7 +703,7 @@ PRIVATE void rs232_handler(struct rs232 *rs)
/*===========================================================================* /*===========================================================================*
* in_int * * in_int *
*===========================================================================*/ *===========================================================================*/
PRIVATE void in_int(register rs232_t *rs) static void in_int(register rs232_t *rs)
/* rs line with input interrupt */ /* rs line with input interrupt */
{ {
/* Read the data which just arrived. /* Read the data which just arrived.
@@ -751,7 +751,7 @@ PRIVATE void in_int(register rs232_t *rs)
/*===========================================================================* /*===========================================================================*
* line_int * * line_int *
*===========================================================================*/ *===========================================================================*/
PRIVATE void line_int(register rs232_t *rs) static void line_int(register rs232_t *rs)
/* rs line with line status interrupt */ /* rs line with line status interrupt */
{ {
/* Check for and record errors. */ /* Check for and record errors. */
@@ -768,7 +768,7 @@ PRIVATE void line_int(register rs232_t *rs)
/*===========================================================================* /*===========================================================================*
* modem_int * * modem_int *
*===========================================================================*/ *===========================================================================*/
PRIVATE void modem_int(register rs232_t *rs) static void modem_int(register rs232_t *rs)
/* rs line with modem interrupt */ /* rs line with modem interrupt */
{ {
/* Get possibly new device-ready status, and clear ODEVREADY if necessary. /* Get possibly new device-ready status, and clear ODEVREADY if necessary.
@@ -792,7 +792,7 @@ PRIVATE void modem_int(register rs232_t *rs)
/*===========================================================================* /*===========================================================================*
* out_int * * out_int *
*===========================================================================*/ *===========================================================================*/
PRIVATE void out_int(register rs232_t *rs) static void out_int(register rs232_t *rs)
/* rs; line with output interrupt */ /* rs; line with output interrupt */
{ {
/* If there is output to do and everything is ready, do it (local device is /* If there is output to do and everything is ready, do it (local device is

View File

@@ -101,28 +101,28 @@ unsigned long rs_irq_set = 0;
struct kmessages kmess; struct kmessages kmess;
FORWARD void tty_timed_out(timer_t *tp); static void tty_timed_out(timer_t *tp);
FORWARD void settimer(tty_t *tty_ptr, int enable); static void settimer(tty_t *tty_ptr, int enable);
FORWARD void do_cancel(tty_t *tp, message *m_ptr); static void do_cancel(tty_t *tp, message *m_ptr);
FORWARD void do_ioctl(tty_t *tp, message *m_ptr); static void do_ioctl(tty_t *tp, message *m_ptr);
FORWARD void do_open(tty_t *tp, message *m_ptr); static void do_open(tty_t *tp, message *m_ptr);
FORWARD void do_close(tty_t *tp, message *m_ptr); static void do_close(tty_t *tp, message *m_ptr);
FORWARD void do_read(tty_t *tp, message *m_ptr); static void do_read(tty_t *tp, message *m_ptr);
FORWARD void do_write(tty_t *tp, message *m_ptr); static void do_write(tty_t *tp, message *m_ptr);
FORWARD void do_select(tty_t *tp, message *m_ptr); static void do_select(tty_t *tp, message *m_ptr);
FORWARD void do_status(message *m_ptr); static void do_status(message *m_ptr);
FORWARD void in_transfer(tty_t *tp); static void in_transfer(tty_t *tp);
FORWARD int tty_echo(tty_t *tp, int ch); static int tty_echo(tty_t *tp, int ch);
FORWARD void rawecho(tty_t *tp, int ch); static void rawecho(tty_t *tp, int ch);
FORWARD int back_over(tty_t *tp); static int back_over(tty_t *tp);
FORWARD void reprint(tty_t *tp); static void reprint(tty_t *tp);
FORWARD void dev_ioctl(tty_t *tp); static void dev_ioctl(tty_t *tp);
FORWARD void setattr(tty_t *tp); static void setattr(tty_t *tp);
FORWARD void tty_icancel(tty_t *tp); static void tty_icancel(tty_t *tp);
FORWARD void tty_init(void); static void tty_init(void);
/* Default attributes. */ /* Default attributes. */
PRIVATE struct termios termios_defaults = { static struct termios termios_defaults = {
TINPUT_DEF, TOUTPUT_DEF, TCTRL_DEF, TLOCAL_DEF, TSPEED_DEF, TSPEED_DEF, TINPUT_DEF, TOUTPUT_DEF, TCTRL_DEF, TLOCAL_DEF, TSPEED_DEF, TSPEED_DEF,
{ {
TEOF_DEF, TEOL_DEF, TERASE_DEF, TINTR_DEF, TKILL_DEF, TMIN_DEF, TEOF_DEF, TEOL_DEF, TERASE_DEF, TINTR_DEF, TKILL_DEF, TMIN_DEF,
@@ -130,23 +130,23 @@ PRIVATE struct termios termios_defaults = {
TREPRINT_DEF, TLNEXT_DEF, TDISCARD_DEF, TREPRINT_DEF, TLNEXT_DEF, TDISCARD_DEF,
}, },
}; };
PRIVATE struct winsize winsize_defaults; /* = all zeroes */ static struct winsize winsize_defaults; /* = all zeroes */
/* Global variables for the TTY task (declared extern in tty.h). */ /* Global variables for the TTY task (declared extern in tty.h). */
PUBLIC tty_t tty_table[NR_CONS+NR_RS_LINES+NR_PTYS]; tty_t tty_table[NR_CONS+NR_RS_LINES+NR_PTYS];
PUBLIC int ccurrent; /* currently active console */ int ccurrent; /* currently active console */
PUBLIC struct machine machine; /* kernel environment variables */ struct machine machine; /* kernel environment variables */
PUBLIC u32_t system_hz; u32_t system_hz;
/* SEF functions and variables. */ /* SEF functions and variables. */
FORWARD void sef_local_startup(void); static void sef_local_startup(void);
FORWARD int sef_cb_init_fresh(int type, sef_init_info_t *info); static int sef_cb_init_fresh(int type, sef_init_info_t *info);
FORWARD void sef_cb_signal_handler(int signo); static void sef_cb_signal_handler(int signo);
/*===========================================================================* /*===========================================================================*
* tty_task * * tty_task *
*===========================================================================*/ *===========================================================================*/
PUBLIC int main(void) int main(void)
{ {
/* Main routine of the terminal task. */ /* Main routine of the terminal task. */
@@ -291,7 +291,7 @@ PUBLIC int main(void)
/*===========================================================================* /*===========================================================================*
* sef_local_startup * * sef_local_startup *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_local_startup() static void sef_local_startup()
{ {
/* Register init callbacks. */ /* Register init callbacks. */
sef_setcb_init_fresh(sef_cb_init_fresh); sef_setcb_init_fresh(sef_cb_init_fresh);
@@ -309,7 +309,7 @@ PRIVATE void sef_local_startup()
/*===========================================================================* /*===========================================================================*
* sef_cb_init_fresh * * sef_cb_init_fresh *
*===========================================================================*/ *===========================================================================*/
PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info)) static int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
{ {
/* Initialize the tty driver. */ /* Initialize the tty driver. */
int r; int r;
@@ -331,7 +331,7 @@ PRIVATE int sef_cb_init_fresh(int UNUSED(type), sef_init_info_t *UNUSED(info))
/*===========================================================================* /*===========================================================================*
* sef_cb_signal_handler * * sef_cb_signal_handler *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_cb_signal_handler(int signo) static void sef_cb_signal_handler(int signo)
{ {
/* Check for known signals, ignore anything else. */ /* Check for known signals, ignore anything else. */
switch(signo) { switch(signo) {
@@ -349,7 +349,7 @@ PRIVATE void sef_cb_signal_handler(int signo)
/*===========================================================================* /*===========================================================================*
* do_status * * do_status *
*===========================================================================*/ *===========================================================================*/
PRIVATE void do_status(m_ptr) static void do_status(m_ptr)
message *m_ptr; message *m_ptr;
{ {
register struct tty *tp; register struct tty *tp;
@@ -436,7 +436,7 @@ message *m_ptr;
/*===========================================================================* /*===========================================================================*
* do_read * * do_read *
*===========================================================================*/ *===========================================================================*/
PRIVATE void do_read(tp, m_ptr) static void do_read(tp, m_ptr)
register tty_t *tp; /* pointer to tty struct */ register tty_t *tp; /* pointer to tty struct */
register message *m_ptr; /* pointer to message sent to the task */ register message *m_ptr; /* pointer to message sent to the task */
{ {
@@ -503,7 +503,7 @@ register message *m_ptr; /* pointer to message sent to the task */
/*===========================================================================* /*===========================================================================*
* do_write * * do_write *
*===========================================================================*/ *===========================================================================*/
PRIVATE void do_write(tp, m_ptr) static void do_write(tp, m_ptr)
register tty_t *tp; register tty_t *tp;
register message *m_ptr; /* pointer to message sent to the task */ register message *m_ptr; /* pointer to message sent to the task */
{ {
@@ -544,7 +544,7 @@ register message *m_ptr; /* pointer to message sent to the task */
/*===========================================================================* /*===========================================================================*
* do_ioctl * * do_ioctl *
*===========================================================================*/ *===========================================================================*/
PRIVATE void do_ioctl(tp, m_ptr) static void do_ioctl(tp, m_ptr)
register tty_t *tp; register tty_t *tp;
message *m_ptr; /* pointer to message sent to task */ message *m_ptr; /* pointer to message sent to task */
{ {
@@ -704,7 +704,7 @@ message *m_ptr; /* pointer to message sent to task */
/*===========================================================================* /*===========================================================================*
* do_open * * do_open *
*===========================================================================*/ *===========================================================================*/
PRIVATE void do_open(tp, m_ptr) static void do_open(tp, m_ptr)
register tty_t *tp; register tty_t *tp;
message *m_ptr; /* pointer to message sent to task */ message *m_ptr; /* pointer to message sent to task */
{ {
@@ -730,7 +730,7 @@ message *m_ptr; /* pointer to message sent to task */
/*===========================================================================* /*===========================================================================*
* do_close * * do_close *
*===========================================================================*/ *===========================================================================*/
PRIVATE void do_close(tp, m_ptr) static void do_close(tp, m_ptr)
register tty_t *tp; register tty_t *tp;
message *m_ptr; /* pointer to message sent to task */ message *m_ptr; /* pointer to message sent to task */
{ {
@@ -751,7 +751,7 @@ message *m_ptr; /* pointer to message sent to task */
/*===========================================================================* /*===========================================================================*
* do_cancel * * do_cancel *
*===========================================================================*/ *===========================================================================*/
PRIVATE void do_cancel(tp, m_ptr) static void do_cancel(tp, m_ptr)
register tty_t *tp; register tty_t *tp;
message *m_ptr; /* pointer to message sent to task */ message *m_ptr; /* pointer to message sent to task */
{ {
@@ -787,7 +787,7 @@ message *m_ptr; /* pointer to message sent to task */
tty_reply(TASK_REPLY, m_ptr->m_source, proc_nr, r); tty_reply(TASK_REPLY, m_ptr->m_source, proc_nr, r);
} }
PUBLIC int select_try(struct tty *tp, int ops) int select_try(struct tty *tp, int ops)
{ {
int ready_ops = 0; int ready_ops = 0;
@@ -821,7 +821,7 @@ PUBLIC int select_try(struct tty *tp, int ops)
return ready_ops; return ready_ops;
} }
PUBLIC int select_retry(struct tty *tp) int select_retry(struct tty *tp)
{ {
if (tp->tty_select_ops && select_try(tp, tp->tty_select_ops)) if (tp->tty_select_ops && select_try(tp, tp->tty_select_ops))
notify(tp->tty_select_proc); notify(tp->tty_select_proc);
@@ -831,7 +831,7 @@ PUBLIC int select_retry(struct tty *tp)
/*===========================================================================* /*===========================================================================*
* handle_events * * handle_events *
*===========================================================================*/ *===========================================================================*/
PUBLIC void handle_events(tp) void handle_events(tp)
tty_t *tp; /* TTY to check for events. */ tty_t *tp; /* TTY to check for events. */
{ {
/* Handle any events pending on a TTY. These events are usually device /* Handle any events pending on a TTY. These events are usually device
@@ -888,7 +888,7 @@ tty_t *tp; /* TTY to check for events. */
/*===========================================================================* /*===========================================================================*
* in_transfer * * in_transfer *
*===========================================================================*/ *===========================================================================*/
PRIVATE void in_transfer(tp) static void in_transfer(tp)
register tty_t *tp; /* pointer to terminal to read from */ register tty_t *tp; /* pointer to terminal to read from */
{ {
/* Transfer bytes from the input queue to a process reading from a terminal. */ /* Transfer bytes from the input queue to a process reading from a terminal. */
@@ -960,7 +960,7 @@ register tty_t *tp; /* pointer to terminal to read from */
/*===========================================================================* /*===========================================================================*
* in_process * * in_process *
*===========================================================================*/ *===========================================================================*/
PRIVATE void in_process_send_byte( static void in_process_send_byte(
tty_t *tp, /* terminal on which character has arrived */ tty_t *tp, /* terminal on which character has arrived */
int ch /* input character */ int ch /* input character */
) )
@@ -976,7 +976,7 @@ PRIVATE void in_process_send_byte(
if (tp->tty_incount == buflen(tp->tty_inbuf)) in_transfer(tp); if (tp->tty_incount == buflen(tp->tty_inbuf)) in_transfer(tp);
} }
PUBLIC int in_process(tp, buf, count, scode) int in_process(tp, buf, count, scode)
register tty_t *tp; /* terminal on which character has arrived */ register tty_t *tp; /* terminal on which character has arrived */
char *buf; /* buffer with input characters */ char *buf; /* buffer with input characters */
int count; /* number of input characters */ int count; /* number of input characters */
@@ -1137,7 +1137,7 @@ int scode; /* scan code */
/*===========================================================================* /*===========================================================================*
* echo * * echo *
*===========================================================================*/ *===========================================================================*/
PRIVATE int tty_echo(tp, ch) static int tty_echo(tp, ch)
register tty_t *tp; /* terminal on which to echo */ register tty_t *tp; /* terminal on which to echo */
register int ch; /* pointer to character to echo */ register int ch; /* pointer to character to echo */
{ {
@@ -1198,7 +1198,7 @@ register int ch; /* pointer to character to echo */
/*===========================================================================* /*===========================================================================*
* rawecho * * rawecho *
*===========================================================================*/ *===========================================================================*/
PRIVATE void rawecho(tp, ch) static void rawecho(tp, ch)
register tty_t *tp; register tty_t *tp;
int ch; int ch;
{ {
@@ -1211,7 +1211,7 @@ int ch;
/*===========================================================================* /*===========================================================================*
* back_over * * back_over *
*===========================================================================*/ *===========================================================================*/
PRIVATE int back_over(tp) static int back_over(tp)
register tty_t *tp; register tty_t *tp;
{ {
/* Backspace to previous character on screen and erase it. */ /* Backspace to previous character on screen and erase it. */
@@ -1240,7 +1240,7 @@ register tty_t *tp;
/*===========================================================================* /*===========================================================================*
* reprint * * reprint *
*===========================================================================*/ *===========================================================================*/
PRIVATE void reprint(tp) static void reprint(tp)
register tty_t *tp; /* pointer to tty struct */ register tty_t *tp; /* pointer to tty struct */
{ {
/* Restore what has been echoed to screen before if the user input has been /* Restore what has been echoed to screen before if the user input has been
@@ -1279,7 +1279,7 @@ register tty_t *tp; /* pointer to tty struct */
/*===========================================================================* /*===========================================================================*
* out_process * * out_process *
*===========================================================================*/ *===========================================================================*/
PUBLIC void out_process(tp, bstart, bpos, bend, icount, ocount) void out_process(tp, bstart, bpos, bend, icount, ocount)
tty_t *tp; tty_t *tp;
char *bstart, *bpos, *bend; /* start/pos/end of circular buffer */ char *bstart, *bpos, *bend; /* start/pos/end of circular buffer */
int *icount; /* # input chars / input chars used */ int *icount; /* # input chars / input chars used */
@@ -1364,7 +1364,7 @@ out_done:
/*===========================================================================* /*===========================================================================*
* dev_ioctl * * dev_ioctl *
*===========================================================================*/ *===========================================================================*/
PRIVATE void dev_ioctl(tp) static void dev_ioctl(tp)
tty_t *tp; tty_t *tp;
{ {
/* The ioctl's TCSETSW, TCSETSF and TCDRAIN wait for output to finish to make /* The ioctl's TCSETSW, TCSETSF and TCDRAIN wait for output to finish to make
@@ -1391,7 +1391,7 @@ tty_t *tp;
/*===========================================================================* /*===========================================================================*
* setattr * * setattr *
*===========================================================================*/ *===========================================================================*/
PRIVATE void setattr(tp) static void setattr(tp)
tty_t *tp; tty_t *tp;
{ {
/* Apply the new line attributes (raw/canonical, line speed, etc.) */ /* Apply the new line attributes (raw/canonical, line speed, etc.) */
@@ -1447,7 +1447,7 @@ tty_t *tp;
/*===========================================================================* /*===========================================================================*
* tty_reply * * tty_reply *
*===========================================================================*/ *===========================================================================*/
PUBLIC void void
tty_reply_f( tty_reply_f(
file, line, code, replyee, proc_nr, status) file, line, code, replyee, proc_nr, status)
char *file; char *file;
@@ -1481,7 +1481,7 @@ int status; /* reply code */
/*===========================================================================* /*===========================================================================*
* sigchar * * sigchar *
*===========================================================================*/ *===========================================================================*/
PUBLIC void sigchar(tp, sig, mayflush) void sigchar(tp, sig, mayflush)
register tty_t *tp; register tty_t *tp;
int sig; /* SIGINT, SIGQUIT, SIGKILL or SIGHUP */ int sig; /* SIGINT, SIGQUIT, SIGKILL or SIGHUP */
int mayflush; int mayflush;
@@ -1511,7 +1511,7 @@ int mayflush;
/*===========================================================================* /*===========================================================================*
* tty_icancel * * tty_icancel *
*===========================================================================*/ *===========================================================================*/
PRIVATE void tty_icancel(tp) static void tty_icancel(tp)
register tty_t *tp; register tty_t *tp;
{ {
/* Discard all pending input, tty buffer or device. */ /* Discard all pending input, tty buffer or device. */
@@ -1524,7 +1524,7 @@ register tty_t *tp;
/*===========================================================================* /*===========================================================================*
* tty_devnop * * tty_devnop *
*===========================================================================*/ *===========================================================================*/
PRIVATE int tty_devnop(tty_t *UNUSED(tp), int UNUSED(try)) static int tty_devnop(tty_t *UNUSED(tp), int UNUSED(try))
{ {
/* Some functions need not be implemented at the device level. */ /* Some functions need not be implemented at the device level. */
return 0; return 0;
@@ -1533,7 +1533,7 @@ PRIVATE int tty_devnop(tty_t *UNUSED(tp), int UNUSED(try))
/*===========================================================================* /*===========================================================================*
* tty_init * * tty_init *
*===========================================================================*/ *===========================================================================*/
PRIVATE void tty_init() static void tty_init()
{ {
/* Initialize tty structure and call device initialization routines. */ /* Initialize tty structure and call device initialization routines. */
@@ -1576,7 +1576,7 @@ PRIVATE void tty_init()
/*===========================================================================* /*===========================================================================*
* tty_timed_out * * tty_timed_out *
*===========================================================================*/ *===========================================================================*/
PRIVATE void tty_timed_out(timer_t *tp) static void tty_timed_out(timer_t *tp)
{ {
/* This timer has expired. Set the events flag, to force processing. */ /* This timer has expired. Set the events flag, to force processing. */
tty_t *tty_ptr; tty_t *tty_ptr;
@@ -1588,7 +1588,7 @@ PRIVATE void tty_timed_out(timer_t *tp)
/*===========================================================================* /*===========================================================================*
* settimer * * settimer *
*===========================================================================*/ *===========================================================================*/
PRIVATE void settimer(tty_ptr, enable) static void settimer(tty_ptr, enable)
tty_t *tty_ptr; /* line to set or unset a timer on */ tty_t *tty_ptr; /* line to set or unset a timer on */
int enable; /* set timer if true, otherwise unset */ int enable; /* set timer if true, otherwise unset */
{ {
@@ -1608,7 +1608,7 @@ int enable; /* set timer if true, otherwise unset */
/*===========================================================================* /*===========================================================================*
* do_select * * do_select *
*===========================================================================*/ *===========================================================================*/
PRIVATE void do_select(tp, m_ptr) static void do_select(tp, m_ptr)
register tty_t *tp; /* pointer to tty struct */ register tty_t *tp; /* pointer to tty struct */
register message *m_ptr; /* pointer to message sent to the task */ register message *m_ptr; /* pointer to message sent to the task */
{ {

View File

@@ -10,14 +10,14 @@
#define DEFAULT_INTERVAL 1 /* check host time every second */ #define DEFAULT_INTERVAL 1 /* check host time every second */
#define DEFAULT_DRIFT 2 /* update time if delta is >= 2 secs */ #define DEFAULT_DRIFT 2 /* update time if delta is >= 2 secs */
PRIVATE void *vir_ptr; static void *vir_ptr;
PRIVATE phys_bytes phys_ptr; static phys_bytes phys_ptr;
PRIVATE port_t port; static port_t port;
PRIVATE u32_t ticks; static u32_t ticks;
PRIVATE int interval; static int interval;
PRIVATE int drift; static int drift;
PRIVATE struct optset optset_table[] = { static struct optset optset_table[] = {
{ "interval", OPT_INT, &interval, 10 }, { "interval", OPT_INT, &interval, 10 },
{ "drift", OPT_INT, &drift, 10 }, { "drift", OPT_INT, &drift, 10 },
{ NULL, 0, NULL, 0 } { NULL, 0, NULL, 0 }
@@ -26,7 +26,7 @@ PRIVATE struct optset optset_table[] = {
/*===========================================================================* /*===========================================================================*
* vbox_request * * vbox_request *
*===========================================================================*/ *===========================================================================*/
PRIVATE int vbox_request(int req_nr, size_t size) static int vbox_request(int req_nr, size_t size)
{ {
/* Perform a VirtualBox backdoor request. */ /* Perform a VirtualBox backdoor request. */
struct VMMDevRequestHeader *hdr; struct VMMDevRequestHeader *hdr;
@@ -47,7 +47,7 @@ PRIVATE int vbox_request(int req_nr, size_t size)
/*===========================================================================* /*===========================================================================*
* vbox_init * * vbox_init *
*===========================================================================*/ *===========================================================================*/
PRIVATE int vbox_init(int UNUSED(type), sef_init_info_t *UNUSED(info)) static int vbox_init(int UNUSED(type), sef_init_info_t *UNUSED(info))
{ {
/* Initialize the device. */ /* Initialize the device. */
int devind; int devind;
@@ -100,7 +100,7 @@ PRIVATE int vbox_init(int UNUSED(type), sef_init_info_t *UNUSED(info))
/*===========================================================================* /*===========================================================================*
* vbox_update_time * * vbox_update_time *
*===========================================================================*/ *===========================================================================*/
PRIVATE void vbox_update_time(void) static void vbox_update_time(void)
{ {
/* Update the current time if it has drifted too far. */ /* Update the current time if it has drifted too far. */
struct VMMDevReqHostTime *req; struct VMMDevReqHostTime *req;
@@ -126,7 +126,7 @@ PRIVATE void vbox_update_time(void)
/*===========================================================================* /*===========================================================================*
* vbox_signal * * vbox_signal *
*===========================================================================*/ *===========================================================================*/
PRIVATE void vbox_signal(int signo) static void vbox_signal(int signo)
{ {
/* Process a signal. If it is a SIGTERM, terminate immediately. */ /* Process a signal. If it is a SIGTERM, terminate immediately. */
@@ -138,7 +138,7 @@ PRIVATE void vbox_signal(int signo)
/*===========================================================================* /*===========================================================================*
* sef_local_startup * * sef_local_startup *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sef_local_startup(void) static void sef_local_startup(void)
{ {
/* Perform local SEF initialization. */ /* Perform local SEF initialization. */
@@ -153,7 +153,7 @@ PRIVATE void sef_local_startup(void)
/*===========================================================================* /*===========================================================================*
* main * * main *
*===========================================================================*/ *===========================================================================*/
PUBLIC int main(int argc, char **argv) int main(int argc, char **argv)
{ {
/* The main message loop. */ /* The main message loop. */
message m; message m;

View File

@@ -33,9 +33,6 @@
#endif #endif
#define EXTERN extern /* used in *.h files */ #define EXTERN extern /* used in *.h files */
#define PRIVATE static /* PRIVATE x limits the scope of x */
#define PUBLIC /* PUBLIC is the opposite of PRIVATE */
#define FORWARD static /* some compilers require this to be 'static'*/
#define TRUE 1 /* used for turning integers into Booleans */ #define TRUE 1 /* used for turning integers into Booleans */
#define FALSE 0 /* used for turning integers into Booleans */ #define FALSE 0 /* used for turning integers into Booleans */

View File

@@ -9,23 +9,23 @@ typedef int ((* acpi_read_t)(phys_bytes addr, void * buff, size_t size));
struct acpi_rsdp acpi_rsdp; struct acpi_rsdp acpi_rsdp;
PRIVATE acpi_read_t read_func; static acpi_read_t read_func;
#define MAX_RSDT 35 /* ACPI defines 35 signatures */ #define MAX_RSDT 35 /* ACPI defines 35 signatures */
PRIVATE struct acpi_rsdt { static struct acpi_rsdt {
struct acpi_sdt_header hdr; struct acpi_sdt_header hdr;
u32_t data[MAX_RSDT]; u32_t data[MAX_RSDT];
} rsdt; } rsdt;
PRIVATE struct { static struct {
char signature [ACPI_SDT_SIGNATURE_LEN + 1]; char signature [ACPI_SDT_SIGNATURE_LEN + 1];
size_t length; size_t length;
} sdt_trans[MAX_RSDT]; } sdt_trans[MAX_RSDT];
PRIVATE int sdt_count; static int sdt_count;
PRIVATE int acpi_check_csum(struct acpi_sdt_header * tb, size_t size) static int acpi_check_csum(struct acpi_sdt_header * tb, size_t size)
{ {
u8_t total = 0; u8_t total = 0;
int i; int i;
@@ -34,12 +34,12 @@ PRIVATE int acpi_check_csum(struct acpi_sdt_header * tb, size_t size)
return total == 0 ? 0 : -1; return total == 0 ? 0 : -1;
} }
PRIVATE int acpi_check_signature(const char * orig, const char * match) static int acpi_check_signature(const char * orig, const char * match)
{ {
return strncmp(orig, match, ACPI_SDT_SIGNATURE_LEN); return strncmp(orig, match, ACPI_SDT_SIGNATURE_LEN);
} }
PRIVATE int acpi_read_sdt_at(phys_bytes addr, static int acpi_read_sdt_at(phys_bytes addr,
struct acpi_sdt_header * tb, struct acpi_sdt_header * tb,
size_t size, size_t size,
const char * name) const char * name)
@@ -84,7 +84,7 @@ PRIVATE int acpi_read_sdt_at(phys_bytes addr,
return tb->length; return tb->length;
} }
PUBLIC phys_bytes acpi_get_table_base(const char * name) phys_bytes acpi_get_table_base(const char * name)
{ {
int i; int i;
@@ -97,7 +97,7 @@ PUBLIC phys_bytes acpi_get_table_base(const char * name)
return (phys_bytes) NULL; return (phys_bytes) NULL;
} }
PUBLIC size_t acpi_get_table_length(const char * name) size_t acpi_get_table_length(const char * name)
{ {
int i; int i;
@@ -110,7 +110,7 @@ PUBLIC size_t acpi_get_table_length(const char * name)
return 0; return 0;
} }
PRIVATE void * acpi_madt_get_typed_item(struct acpi_madt_hdr * hdr, static void * acpi_madt_get_typed_item(struct acpi_madt_hdr * hdr,
unsigned char type, unsigned char type,
unsigned idx) unsigned idx)
{ {
@@ -135,7 +135,7 @@ PRIVATE void * acpi_madt_get_typed_item(struct acpi_madt_hdr * hdr,
} }
#if 0 #if 0
PRIVATE void * acpi_madt_get_item(struct acpi_madt_hdr * hdr, static void * acpi_madt_get_item(struct acpi_madt_hdr * hdr,
unsigned idx) unsigned idx)
{ {
u8_t * t, * end; u8_t * t, * end;
@@ -154,7 +154,7 @@ PRIVATE void * acpi_madt_get_item(struct acpi_madt_hdr * hdr,
} }
#endif #endif
PRIVATE int acpi_rsdp_test(void * buff) static int acpi_rsdp_test(void * buff)
{ {
struct acpi_rsdp * rsdp = (struct acpi_rsdp *) buff; struct acpi_rsdp * rsdp = (struct acpi_rsdp *) buff;
@@ -166,7 +166,7 @@ PRIVATE int acpi_rsdp_test(void * buff)
return 1; return 1;
} }
PRIVATE int get_acpi_rsdp(void) static int get_acpi_rsdp(void)
{ {
u16_t ebda; u16_t ebda;
/* /*
@@ -192,13 +192,13 @@ PRIVATE int get_acpi_rsdp(void)
return 0; return 0;
} }
PRIVATE int acpi_read_kernel(phys_bytes addr, void * buff, size_t size) static int acpi_read_kernel(phys_bytes addr, void * buff, size_t size)
{ {
phys_copy(addr, vir2phys(buff), size); phys_copy(addr, vir2phys(buff), size);
return 0; return 0;
} }
PUBLIC void acpi_init(void) void acpi_init(void)
{ {
int s, i; int s, i;
read_func = acpi_read_kernel; read_func = acpi_read_kernel;
@@ -229,7 +229,7 @@ PUBLIC void acpi_init(void)
} }
} }
PUBLIC struct acpi_madt_ioapic * acpi_get_ioapic_next(void) struct acpi_madt_ioapic * acpi_get_ioapic_next(void)
{ {
static unsigned idx = 0; static unsigned idx = 0;
static struct acpi_madt_hdr * madt_hdr; static struct acpi_madt_hdr * madt_hdr;
@@ -251,7 +251,7 @@ PUBLIC struct acpi_madt_ioapic * acpi_get_ioapic_next(void)
return ret; return ret;
} }
PUBLIC struct acpi_madt_lapic * acpi_get_lapic_next(void) struct acpi_madt_lapic * acpi_get_lapic_next(void)
{ {
static unsigned idx = 0; static unsigned idx = 0;
static struct acpi_madt_hdr * madt_hdr; static struct acpi_madt_hdr * madt_hdr;

View File

@@ -107,8 +107,8 @@
#define SPLHI 0xF #define SPLHI 0xF
PUBLIC struct io_apic io_apic[MAX_NR_IOAPICS]; struct io_apic io_apic[MAX_NR_IOAPICS];
PUBLIC unsigned nioapics; unsigned nioapics;
struct irq; struct irq;
typedef void (* eoi_method_t)(struct irq *); typedef void (* eoi_method_t)(struct irq *);
@@ -121,7 +121,7 @@ struct irq {
unsigned state; unsigned state;
}; };
PRIVATE struct irq io_apic_irq[NR_IRQ_VECTORS]; static struct irq io_apic_irq[NR_IRQ_VECTORS];
/* /*
* to make APIC work if SMP is not configured, we need to set the maximal number * to make APIC work if SMP is not configured, we need to set the maximal number
@@ -146,20 +146,20 @@ PRIVATE struct irq io_apic_irq[NR_IRQ_VECTORS];
#define VERBOSE_APIC(x) x #define VERBOSE_APIC(x) x
PUBLIC int ioapic_enabled; int ioapic_enabled;
PUBLIC u32_t lapic_addr_vaddr; u32_t lapic_addr_vaddr;
PUBLIC vir_bytes lapic_addr; vir_bytes lapic_addr;
PUBLIC vir_bytes lapic_eoi_addr; vir_bytes lapic_eoi_addr;
PUBLIC int bsp_lapic_id; int bsp_lapic_id;
PRIVATE volatile unsigned probe_ticks; static volatile unsigned probe_ticks;
PRIVATE u64_t tsc0, tsc1; static u64_t tsc0, tsc1;
PRIVATE u32_t lapic_tctr0, lapic_tctr1; static u32_t lapic_tctr0, lapic_tctr1;
PRIVATE unsigned apic_imcrp; static unsigned apic_imcrp;
PRIVATE const unsigned nlints = 0; static const unsigned nlints = 0;
PUBLIC void arch_eoi(void) void arch_eoi(void)
{ {
apic_eoi(); apic_eoi();
} }
@@ -169,20 +169,20 @@ PUBLIC void arch_eoi(void)
* arch specific cpulocals. As this variable is write-once-read-only it is ok to * arch specific cpulocals. As this variable is write-once-read-only it is ok to
* have at as an array until we resolve the cpulocals properly * have at as an array until we resolve the cpulocals properly
*/ */
PRIVATE u32_t lapic_bus_freq[CONFIG_MAX_CPUS]; static u32_t lapic_bus_freq[CONFIG_MAX_CPUS];
/* the probe period will be roughly 100ms */ /* the probe period will be roughly 100ms */
#define PROBE_TICKS (system_hz / 10) #define PROBE_TICKS (system_hz / 10)
#define IOAPIC_IOREGSEL 0x0 #define IOAPIC_IOREGSEL 0x0
#define IOAPIC_IOWIN 0x10 #define IOAPIC_IOWIN 0x10
PRIVATE u32_t ioapic_read(u32_t ioa_base, u32_t reg) static u32_t ioapic_read(u32_t ioa_base, u32_t reg)
{ {
*((u32_t *)(ioa_base + IOAPIC_IOREGSEL)) = (reg & 0xff); *((u32_t *)(ioa_base + IOAPIC_IOREGSEL)) = (reg & 0xff);
return *(u32_t *)(ioa_base + IOAPIC_IOWIN); return *(u32_t *)(ioa_base + IOAPIC_IOWIN);
} }
PRIVATE void ioapic_write(u32_t ioa_base, u8_t reg, u32_t val) static void ioapic_write(u32_t ioa_base, u8_t reg, u32_t val)
{ {
*((u32_t *)(ioa_base + IOAPIC_IOREGSEL)) = reg; *((u32_t *)(ioa_base + IOAPIC_IOREGSEL)) = reg;
*((u32_t *)(ioa_base + IOAPIC_IOWIN)) = val; *((u32_t *)(ioa_base + IOAPIC_IOWIN)) = val;
@@ -191,7 +191,7 @@ PRIVATE void ioapic_write(u32_t ioa_base, u8_t reg, u32_t val)
void lapic_microsec_sleep(unsigned count); void lapic_microsec_sleep(unsigned count);
void apic_idt_init(const int reset); void apic_idt_init(const int reset);
PRIVATE void ioapic_enable_pin(vir_bytes ioapic_addr, int pin) static void ioapic_enable_pin(vir_bytes ioapic_addr, int pin)
{ {
u32_t lo = ioapic_read(ioapic_addr, IOAPIC_REDIR_TABLE + pin * 2); u32_t lo = ioapic_read(ioapic_addr, IOAPIC_REDIR_TABLE + pin * 2);
@@ -199,7 +199,7 @@ PRIVATE void ioapic_enable_pin(vir_bytes ioapic_addr, int pin)
ioapic_write(ioapic_addr, IOAPIC_REDIR_TABLE + pin * 2, lo); ioapic_write(ioapic_addr, IOAPIC_REDIR_TABLE + pin * 2, lo);
} }
PRIVATE void ioapic_disable_pin(vir_bytes ioapic_addr, int pin) static void ioapic_disable_pin(vir_bytes ioapic_addr, int pin)
{ {
u32_t lo = ioapic_read(ioapic_addr, IOAPIC_REDIR_TABLE + pin * 2); u32_t lo = ioapic_read(ioapic_addr, IOAPIC_REDIR_TABLE + pin * 2);
@@ -208,7 +208,7 @@ PRIVATE void ioapic_disable_pin(vir_bytes ioapic_addr, int pin)
} }
#if 0 #if 0
PRIVATE void ioapic_redirt_entry_read(void * ioapic_addr, static void ioapic_redirt_entry_read(void * ioapic_addr,
int entry, int entry,
u32_t *hi, u32_t *hi,
u32_t *lo) u32_t *lo)
@@ -219,7 +219,7 @@ PRIVATE void ioapic_redirt_entry_read(void * ioapic_addr,
} }
#endif #endif
PRIVATE void ioapic_redirt_entry_write(void * ioapic_addr, static void ioapic_redirt_entry_write(void * ioapic_addr,
int entry, int entry,
u32_t hi, u32_t hi,
u32_t lo) u32_t lo)
@@ -243,7 +243,7 @@ PRIVATE void ioapic_redirt_entry_write(void * ioapic_addr,
#define lapic_test_delivery_val(val, vector) ((val) & (1 << ((vector) & 0x1f))) #define lapic_test_delivery_val(val, vector) ((val) & (1 << ((vector) & 0x1f)))
PRIVATE void ioapic_eoi_level(struct irq * irq) static void ioapic_eoi_level(struct irq * irq)
{ {
reg_t tmr; reg_t tmr;
@@ -285,12 +285,12 @@ PRIVATE void ioapic_eoi_level(struct irq * irq)
} }
} }
PRIVATE void ioapic_eoi_edge(__unused struct irq * irq) static void ioapic_eoi_edge(__unused struct irq * irq)
{ {
apic_eoi(); apic_eoi();
} }
PUBLIC void ioapic_eoi(int irq) void ioapic_eoi(int irq)
{ {
if (ioapic_enabled) { if (ioapic_enabled) {
io_apic_irq[irq].eoi(&io_apic_irq[irq]); io_apic_irq[irq].eoi(&io_apic_irq[irq]);
@@ -299,12 +299,12 @@ PUBLIC void ioapic_eoi(int irq)
irq_8259_eoi(irq); irq_8259_eoi(irq);
} }
PUBLIC void ioapic_set_id(u32_t addr, unsigned int id) void ioapic_set_id(u32_t addr, unsigned int id)
{ {
ioapic_write(addr, IOAPIC_ID, id << 24); ioapic_write(addr, IOAPIC_ID, id << 24);
} }
PUBLIC int ioapic_enable_all(void) int ioapic_enable_all(void)
{ {
i8259_disable(); i8259_disable();
@@ -318,7 +318,7 @@ PUBLIC int ioapic_enable_all(void)
} }
/* disables a single IO APIC */ /* disables a single IO APIC */
PRIVATE void ioapic_disable(struct io_apic * ioapic) static void ioapic_disable(struct io_apic * ioapic)
{ {
unsigned p; unsigned p;
@@ -340,7 +340,7 @@ PRIVATE void ioapic_disable(struct io_apic * ioapic)
} }
/* disables all IO APICs */ /* disables all IO APICs */
PUBLIC void ioapic_disable_all(void) void ioapic_disable_all(void)
{ {
unsigned ioa; unsigned ioa;
if (!ioapic_enabled) if (!ioapic_enabled)
@@ -365,7 +365,7 @@ PUBLIC void ioapic_disable_all(void)
intr_init(INTS_ORIG, 0); /* no auto eoi */ intr_init(INTS_ORIG, 0); /* no auto eoi */
} }
PRIVATE void ioapic_disable_irq(unsigned irq) static void ioapic_disable_irq(unsigned irq)
{ {
assert(io_apic_irq[irq].ioa); assert(io_apic_irq[irq].ioa);
@@ -373,7 +373,7 @@ PRIVATE void ioapic_disable_irq(unsigned irq)
io_apic_irq[irq].state |= IOAPIC_IRQ_STATE_MASKED; io_apic_irq[irq].state |= IOAPIC_IRQ_STATE_MASKED;
} }
PRIVATE void ioapic_enable_irq(unsigned irq) static void ioapic_enable_irq(unsigned irq)
{ {
assert(io_apic_irq[irq].ioa); assert(io_apic_irq[irq].ioa);
@@ -381,7 +381,7 @@ PRIVATE void ioapic_enable_irq(unsigned irq)
io_apic_irq[irq].state &= ~IOAPIC_IRQ_STATE_MASKED; io_apic_irq[irq].state &= ~IOAPIC_IRQ_STATE_MASKED;
} }
PUBLIC void ioapic_unmask_irq(unsigned irq) void ioapic_unmask_irq(unsigned irq)
{ {
if (ioapic_enabled) if (ioapic_enabled)
ioapic_enable_irq(irq); ioapic_enable_irq(irq);
@@ -390,7 +390,7 @@ PUBLIC void ioapic_unmask_irq(unsigned irq)
irq_8259_unmask(irq); irq_8259_unmask(irq);
} }
PUBLIC void ioapic_mask_irq(unsigned irq) void ioapic_mask_irq(unsigned irq)
{ {
if (ioapic_enabled) if (ioapic_enabled)
ioapic_disable_irq(irq); ioapic_disable_irq(irq);
@@ -399,12 +399,12 @@ PUBLIC void ioapic_mask_irq(unsigned irq)
irq_8259_mask(irq); irq_8259_mask(irq);
} }
PUBLIC unsigned int apicid(void) unsigned int apicid(void)
{ {
return lapic_read(LAPIC_ID) >> 24; return lapic_read(LAPIC_ID) >> 24;
} }
PRIVATE int calib_clk_handler(irq_hook_t * UNUSED(hook)) static int calib_clk_handler(irq_hook_t * UNUSED(hook))
{ {
u32_t tcrt; u32_t tcrt;
u64_t tsc; u64_t tsc;
@@ -428,7 +428,7 @@ PRIVATE int calib_clk_handler(irq_hook_t * UNUSED(hook))
return 1; return 1;
} }
PRIVATE int spurious_irq_handler(irq_hook_t * UNUSED(hook)) static int spurious_irq_handler(irq_hook_t * UNUSED(hook))
{ {
/* /*
* Do nothing, only unlock the kernel so we do not deadlock! * Do nothing, only unlock the kernel so we do not deadlock!
@@ -437,7 +437,7 @@ PRIVATE int spurious_irq_handler(irq_hook_t * UNUSED(hook))
return 1; return 1;
} }
PRIVATE void apic_calibrate_clocks(unsigned cpu) static void apic_calibrate_clocks(unsigned cpu)
{ {
u32_t lvtt, val, lapic_delta; u32_t lvtt, val, lapic_delta;
u64_t tsc_delta; u64_t tsc_delta;
@@ -520,7 +520,7 @@ PRIVATE void apic_calibrate_clocks(unsigned cpu)
BOOT_VERBOSE(cpu_print_freq(cpuid)); BOOT_VERBOSE(cpu_print_freq(cpuid));
} }
PUBLIC void lapic_set_timer_one_shot(const u32_t usec) void lapic_set_timer_one_shot(const u32_t usec)
{ {
/* sleep in micro seconds */ /* sleep in micro seconds */
u32_t lvtt; u32_t lvtt;
@@ -539,7 +539,7 @@ PUBLIC void lapic_set_timer_one_shot(const u32_t usec)
lapic_write(LAPIC_LVTTR, lvtt); lapic_write(LAPIC_LVTTR, lvtt);
} }
PUBLIC void lapic_set_timer_periodic(const unsigned freq) void lapic_set_timer_periodic(const unsigned freq)
{ {
/* sleep in micro seconds */ /* sleep in micro seconds */
u32_t lvtt; u32_t lvtt;
@@ -558,7 +558,7 @@ PUBLIC void lapic_set_timer_periodic(const unsigned freq)
lapic_write(LAPIC_TIMER_ICR, lapic_ticks_per_clock_tick); lapic_write(LAPIC_TIMER_ICR, lapic_ticks_per_clock_tick);
} }
PUBLIC void lapic_stop_timer(void) void lapic_stop_timer(void)
{ {
u32_t lvtt; u32_t lvtt;
lvtt = lapic_read(LAPIC_LVTTR); lvtt = lapic_read(LAPIC_LVTTR);
@@ -568,27 +568,27 @@ PUBLIC void lapic_stop_timer(void)
lapic_write(LAPIC_TIMER_CCR, 0); lapic_write(LAPIC_TIMER_CCR, 0);
} }
PUBLIC void lapic_restart_timer(void) void lapic_restart_timer(void)
{ {
/* restart the timer only if the counter reached zero, i.e. expired */ /* restart the timer only if the counter reached zero, i.e. expired */
if (lapic_read(LAPIC_TIMER_CCR) == 0) if (lapic_read(LAPIC_TIMER_CCR) == 0)
lapic_set_timer_one_shot(1000000/system_hz); lapic_set_timer_one_shot(1000000/system_hz);
} }
PUBLIC void lapic_microsec_sleep(unsigned count) void lapic_microsec_sleep(unsigned count)
{ {
lapic_set_timer_one_shot(count); lapic_set_timer_one_shot(count);
while (lapic_read(LAPIC_TIMER_CCR)) while (lapic_read(LAPIC_TIMER_CCR))
arch_pause(); arch_pause();
} }
PRIVATE u32_t lapic_errstatus(void) static u32_t lapic_errstatus(void)
{ {
lapic_write(LAPIC_ESR, 0); lapic_write(LAPIC_ESR, 0);
return lapic_read(LAPIC_ESR); return lapic_read(LAPIC_ESR);
} }
PRIVATE int lapic_disable_in_msr(void) static int lapic_disable_in_msr(void)
{ {
u32_t msr_hi, msr_lo; u32_t msr_hi, msr_lo;
@@ -600,7 +600,7 @@ PRIVATE int lapic_disable_in_msr(void)
return 1; return 1;
} }
PUBLIC void lapic_disable(void) void lapic_disable(void)
{ {
/* Disable current APIC and close interrupts from PIC */ /* Disable current APIC and close interrupts from PIC */
u32_t val; u32_t val;
@@ -635,7 +635,7 @@ PUBLIC void lapic_disable(void)
lapic_disable_in_msr(); lapic_disable_in_msr();
} }
PRIVATE int lapic_enable_in_msr(void) static int lapic_enable_in_msr(void)
{ {
u32_t msr_hi, msr_lo; u32_t msr_hi, msr_lo;
@@ -664,7 +664,7 @@ PRIVATE int lapic_enable_in_msr(void)
return 1; return 1;
} }
PUBLIC int lapic_enable(unsigned cpu) int lapic_enable(unsigned cpu)
{ {
u32_t val, nlvt; u32_t val, nlvt;
@@ -735,7 +735,7 @@ PUBLIC int lapic_enable(unsigned cpu)
return 1; return 1;
} }
PUBLIC void apic_spurios_intr_handler(void) void apic_spurios_intr_handler(void)
{ {
static unsigned x; static unsigned x;
@@ -744,7 +744,7 @@ PUBLIC void apic_spurios_intr_handler(void)
printf("WARNING spurious interrupt(s) %d on cpu %d\n", x, cpuid); printf("WARNING spurious interrupt(s) %d on cpu %d\n", x, cpuid);
} }
PUBLIC void apic_error_intr_handler(void) void apic_error_intr_handler(void)
{ {
static unsigned x; static unsigned x;
@@ -754,7 +754,7 @@ PUBLIC void apic_error_intr_handler(void)
lapic_errstatus(), x, cpuid); lapic_errstatus(), x, cpuid);
} }
PRIVATE struct gate_table_s gate_table_ioapic[] = { static struct gate_table_s gate_table_ioapic[] = {
{ apic_hwint0, LAPIC_VECTOR( 0), INTR_PRIVILEGE }, { apic_hwint0, LAPIC_VECTOR( 0), INTR_PRIVILEGE },
{ apic_hwint1, LAPIC_VECTOR( 1), INTR_PRIVILEGE }, { apic_hwint1, LAPIC_VECTOR( 1), INTR_PRIVILEGE },
{ apic_hwint2, LAPIC_VECTOR( 2), INTR_PRIVILEGE }, { apic_hwint2, LAPIC_VECTOR( 2), INTR_PRIVILEGE },
@@ -824,14 +824,14 @@ PRIVATE struct gate_table_s gate_table_ioapic[] = {
{ NULL, 0, 0} { NULL, 0, 0}
}; };
PRIVATE struct gate_table_s gate_table_common[] = { static struct gate_table_s gate_table_common[] = {
{ ipc_entry, IPC_VECTOR, USER_PRIVILEGE }, { ipc_entry, IPC_VECTOR, USER_PRIVILEGE },
{ kernel_call_entry, KERN_CALL_VECTOR, USER_PRIVILEGE }, { kernel_call_entry, KERN_CALL_VECTOR, USER_PRIVILEGE },
{ NULL, 0, 0} { NULL, 0, 0}
}; };
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
PRIVATE struct gate_table_s gate_table_smp[] = { static struct gate_table_s gate_table_smp[] = {
{ apic_ipi_sched_intr, APIC_SMP_SCHED_PROC_VECTOR, INTR_PRIVILEGE }, { apic_ipi_sched_intr, APIC_SMP_SCHED_PROC_VECTOR, INTR_PRIVILEGE },
{ apic_ipi_halt_intr, APIC_SMP_CPU_HALT_VECTOR, INTR_PRIVILEGE }, { apic_ipi_halt_intr, APIC_SMP_CPU_HALT_VECTOR, INTR_PRIVILEGE },
{ NULL, 0, 0} { NULL, 0, 0}
@@ -839,7 +839,7 @@ PRIVATE struct gate_table_s gate_table_smp[] = {
#endif #endif
#ifdef APIC_DEBUG #ifdef APIC_DEBUG
PRIVATE void lapic_set_dummy_handlers(void) static void lapic_set_dummy_handlers(void)
{ {
char * handler; char * handler;
int vect = 32; /* skip the reserved vectors */ int vect = 32; /* skip the reserved vectors */
@@ -856,7 +856,7 @@ PRIVATE void lapic_set_dummy_handlers(void)
#endif #endif
/* Build descriptors for interrupt gates in IDT. */ /* Build descriptors for interrupt gates in IDT. */
PUBLIC void apic_idt_init(const int reset) void apic_idt_init(const int reset)
{ {
u32_t val; u32_t val;
@@ -905,7 +905,7 @@ PUBLIC void apic_idt_init(const int reset)
} }
PRIVATE int acpi_get_ioapics(struct io_apic * ioa, unsigned * nioa, unsigned max) static int acpi_get_ioapics(struct io_apic * ioa, unsigned * nioa, unsigned max)
{ {
unsigned n = 0; unsigned n = 0;
struct acpi_madt_ioapic * acpi_ioa; struct acpi_madt_ioapic * acpi_ioa;
@@ -932,7 +932,7 @@ PRIVATE int acpi_get_ioapics(struct io_apic * ioa, unsigned * nioa, unsigned max
return n; return n;
} }
PUBLIC int detect_ioapics(void) int detect_ioapics(void)
{ {
int status; int status;
@@ -948,7 +948,7 @@ PUBLIC int detect_ioapics(void)
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
PUBLIC void apic_send_ipi(unsigned vector, unsigned cpu, int type) void apic_send_ipi(unsigned vector, unsigned cpu, int type)
{ {
u32_t icr1, icr2; u32_t icr1, icr2;
@@ -987,7 +987,7 @@ PUBLIC void apic_send_ipi(unsigned vector, unsigned cpu, int type)
} }
PUBLIC int apic_send_startup_ipi(unsigned cpu, phys_bytes trampoline) int apic_send_startup_ipi(unsigned cpu, phys_bytes trampoline)
{ {
int timeout; int timeout;
u32_t errstatus = 0; u32_t errstatus = 0;
@@ -1033,7 +1033,7 @@ PUBLIC int apic_send_startup_ipi(unsigned cpu, phys_bytes trampoline)
return 0; return 0;
} }
PUBLIC int apic_send_init_ipi(unsigned cpu, phys_bytes trampoline) int apic_send_init_ipi(unsigned cpu, phys_bytes trampoline)
{ {
u32_t ptr, errstatus = 0; u32_t ptr, errstatus = 0;
int timeout; int timeout;
@@ -1108,7 +1108,7 @@ PUBLIC int apic_send_init_ipi(unsigned cpu, phys_bytes trampoline)
#endif #endif
#ifndef CONFIG_SMP #ifndef CONFIG_SMP
PUBLIC int apic_single_cpu_init(void) int apic_single_cpu_init(void)
{ {
if (!cpu_feature_apic_on_chip()) if (!cpu_feature_apic_on_chip())
return 0; return 0;
@@ -1143,7 +1143,7 @@ PUBLIC int apic_single_cpu_init(void)
} }
#endif #endif
PRIVATE eoi_method_t set_eoi_method(unsigned irq) static eoi_method_t set_eoi_method(unsigned irq)
{ {
/* /*
* in APIC mode the lowest 16 IRQs are reserved for legacy (E)ISA edge * in APIC mode the lowest 16 IRQs are reserved for legacy (E)ISA edge
@@ -1156,7 +1156,7 @@ PRIVATE eoi_method_t set_eoi_method(unsigned irq)
return ioapic_eoi_level; return ioapic_eoi_level;
} }
PUBLIC void set_irq_redir_low(unsigned irq, u32_t * low) void set_irq_redir_low(unsigned irq, u32_t * low)
{ {
u32_t val = 0; u32_t val = 0;
@@ -1182,7 +1182,7 @@ PUBLIC void set_irq_redir_low(unsigned irq, u32_t * low)
*low = val; *low = val;
} }
PUBLIC void ioapic_set_irq(unsigned irq) void ioapic_set_irq(unsigned irq)
{ {
unsigned ioa; unsigned ioa;
@@ -1216,7 +1216,7 @@ PUBLIC void ioapic_set_irq(unsigned irq)
} }
} }
PUBLIC void ioapic_unset_irq(unsigned irq) void ioapic_unset_irq(unsigned irq)
{ {
assert(irq < NR_IRQ_VECTORS); assert(irq < NR_IRQ_VECTORS);
@@ -1225,7 +1225,7 @@ PUBLIC void ioapic_unset_irq(unsigned irq)
io_apic_irq[irq].eoi = NULL; io_apic_irq[irq].eoi = NULL;
} }
PUBLIC void ioapic_reset_pic(void) void ioapic_reset_pic(void)
{ {
apic_idt_init(TRUE); /* reset */ apic_idt_init(TRUE); /* reset */
idt_reload(); idt_reload();
@@ -1238,7 +1238,7 @@ PUBLIC void ioapic_reset_pic(void)
intr_init(INTS_ORIG, 0); /* no auto eoi */ intr_init(INTS_ORIG, 0); /* no auto eoi */
} }
PRIVATE void irq_lapic_status(int irq) static void irq_lapic_status(int irq)
{ {
u32_t lo; u32_t lo;
reg_t tmr, irr, isr; reg_t tmr, irr, isr;
@@ -1280,7 +1280,7 @@ PRIVATE void irq_lapic_status(int irq)
"masked" : "unmasked"); "masked" : "unmasked");
} }
PUBLIC void dump_apic_irq_state(void) void dump_apic_irq_state(void)
{ {
int irq; int irq;

View File

@@ -34,18 +34,18 @@
#define TIMER_FREQ 1193182 /* clock frequency for timer in PC and AT */ #define TIMER_FREQ 1193182 /* clock frequency for timer in PC and AT */
#define TIMER_COUNT(freq) (TIMER_FREQ/(freq)) /* initial value for counter*/ #define TIMER_COUNT(freq) (TIMER_FREQ/(freq)) /* initial value for counter*/
PRIVATE irq_hook_t pic_timer_hook; /* interrupt handler hook */ static irq_hook_t pic_timer_hook; /* interrupt handler hook */
PRIVATE unsigned probe_ticks; static unsigned probe_ticks;
PRIVATE u64_t tsc0, tsc1; static u64_t tsc0, tsc1;
#define PROBE_TICKS (system_hz / 10) #define PROBE_TICKS (system_hz / 10)
PRIVATE unsigned tsc_per_ms[CONFIG_MAX_CPUS]; static unsigned tsc_per_ms[CONFIG_MAX_CPUS];
/*===========================================================================* /*===========================================================================*
* init_8235A_timer * * init_8235A_timer *
*===========================================================================*/ *===========================================================================*/
PUBLIC int init_8253A_timer(const unsigned freq) int init_8253A_timer(const unsigned freq)
{ {
/* Initialize channel 0 of the 8253A timer to, e.g., 60 Hz, /* Initialize channel 0 of the 8253A timer to, e.g., 60 Hz,
* and register the CLOCK task's interrupt handler to be run * and register the CLOCK task's interrupt handler to be run
@@ -61,7 +61,7 @@ PUBLIC int init_8253A_timer(const unsigned freq)
/*===========================================================================* /*===========================================================================*
* stop_8235A_timer * * stop_8235A_timer *
*===========================================================================*/ *===========================================================================*/
PUBLIC void stop_8253A_timer(void) void stop_8253A_timer(void)
{ {
/* Reset the clock to the BIOS rate. (For rebooting.) */ /* Reset the clock to the BIOS rate. (For rebooting.) */
outb(TIMER_MODE, 0x36); outb(TIMER_MODE, 0x36);
@@ -69,7 +69,7 @@ PUBLIC void stop_8253A_timer(void)
outb(TIMER0, 0); outb(TIMER0, 0);
} }
PRIVATE int calib_cpu_handler(irq_hook_t * UNUSED(hook)) static int calib_cpu_handler(irq_hook_t * UNUSED(hook))
{ {
u64_t tsc; u64_t tsc;
@@ -89,7 +89,7 @@ PRIVATE int calib_cpu_handler(irq_hook_t * UNUSED(hook))
return 1; return 1;
} }
PRIVATE void estimate_cpu_freq(void) static void estimate_cpu_freq(void)
{ {
u64_t tsc_delta; u64_t tsc_delta;
u64_t cpu_freq; u64_t cpu_freq;
@@ -124,7 +124,7 @@ PRIVATE void estimate_cpu_freq(void)
BOOT_VERBOSE(cpu_print_freq(cpuid)); BOOT_VERBOSE(cpu_print_freq(cpuid));
} }
PUBLIC int init_local_timer(unsigned freq) int init_local_timer(unsigned freq)
{ {
#ifdef USE_APIC #ifdef USE_APIC
/* if we know the address, lapic is enabled and we should use it */ /* if we know the address, lapic is enabled and we should use it */
@@ -147,7 +147,7 @@ PUBLIC int init_local_timer(unsigned freq)
return 0; return 0;
} }
PUBLIC void stop_local_timer(void) void stop_local_timer(void)
{ {
#ifdef USE_APIC #ifdef USE_APIC
if (lapic_addr) { if (lapic_addr) {
@@ -160,7 +160,7 @@ PUBLIC void stop_local_timer(void)
} }
} }
PUBLIC void restart_local_timer(void) void restart_local_timer(void)
{ {
#ifdef USE_APIC #ifdef USE_APIC
if (lapic_addr) { if (lapic_addr) {
@@ -169,7 +169,7 @@ PUBLIC void restart_local_timer(void)
#endif #endif
} }
PUBLIC int register_local_timer_handler(const irq_handler_t handler) int register_local_timer_handler(const irq_handler_t handler)
{ {
#ifdef USE_APIC #ifdef USE_APIC
if (lapic_addr) { if (lapic_addr) {
@@ -188,7 +188,7 @@ PUBLIC int register_local_timer_handler(const irq_handler_t handler)
return 0; return 0;
} }
PUBLIC void cycles_accounting_init(void) void cycles_accounting_init(void)
{ {
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
unsigned cpu = cpuid; unsigned cpu = cpuid;
@@ -200,7 +200,7 @@ PUBLIC void cycles_accounting_init(void)
make_zero64(get_cpu_var(cpu, cpu_last_idle)); make_zero64(get_cpu_var(cpu, cpu_last_idle));
} }
PUBLIC void context_stop(struct proc * p) void context_stop(struct proc * p)
{ {
u64_t tsc, tsc_delta; u64_t tsc, tsc_delta;
u64_t * __tsc_ctr_switch = get_cpulocal_var_ptr(tsc_ctr_switch); u64_t * __tsc_ctr_switch = get_cpulocal_var_ptr(tsc_ctr_switch);
@@ -297,7 +297,7 @@ PUBLIC void context_stop(struct proc * p)
*__tsc_ctr_switch = tsc; *__tsc_ctr_switch = tsc;
} }
PUBLIC void context_stop_idle(void) void context_stop_idle(void)
{ {
int is_idle; int is_idle;
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
@@ -317,17 +317,17 @@ PUBLIC void context_stop_idle(void)
#endif #endif
} }
PUBLIC u64_t ms_2_cpu_time(unsigned ms) u64_t ms_2_cpu_time(unsigned ms)
{ {
return mul64u(tsc_per_ms[cpuid], ms); return mul64u(tsc_per_ms[cpuid], ms);
} }
PUBLIC unsigned cpu_time_2_ms(u64_t cpu_time) unsigned cpu_time_2_ms(u64_t cpu_time)
{ {
return div64u(cpu_time, tsc_per_ms[cpuid]); return div64u(cpu_time, tsc_per_ms[cpuid]);
} }
PUBLIC short cpu_load(void) short cpu_load(void)
{ {
u64_t current_tsc, *current_idle; u64_t current_tsc, *current_idle;
u64_t tsc_delta, idle_delta, busy; u64_t tsc_delta, idle_delta, busy;
@@ -365,7 +365,7 @@ PUBLIC short cpu_load(void)
return load; return load;
} }
PUBLIC void busy_delay_ms(int ms) void busy_delay_ms(int ms)
{ {
u64_t cycles = ms_2_cpu_time(ms), tsc0, tsc, tsc1; u64_t cycles = ms_2_cpu_time(ms), tsc0, tsc, tsc1;
read_tsc_64(&tsc0); read_tsc_64(&tsc0);

View File

@@ -15,7 +15,7 @@
/*===========================================================================* /*===========================================================================*
* arch_do_vmctl * * arch_do_vmctl *
*===========================================================================*/ *===========================================================================*/
PUBLIC int arch_do_vmctl(m_ptr, p) int arch_do_vmctl(m_ptr, p)
register message *m_ptr; /* pointer to request message */ register message *m_ptr; /* pointer to request message */
struct proc *p; struct proc *p;
{ {

View File

@@ -42,18 +42,18 @@ static int volatile ap_cpu_ready;
static int volatile cpu_down; static int volatile cpu_down;
/* there can be at most 255 local APIC ids, each fits in 8 bits */ /* there can be at most 255 local APIC ids, each fits in 8 bits */
PRIVATE unsigned char apicid2cpuid[255]; static unsigned char apicid2cpuid[255];
PUBLIC unsigned char cpuid2apicid[CONFIG_MAX_CPUS]; unsigned char cpuid2apicid[CONFIG_MAX_CPUS];
SPINLOCK_DEFINE(smp_cpu_lock) SPINLOCK_DEFINE(smp_cpu_lock)
SPINLOCK_DEFINE(dispq_lock) SPINLOCK_DEFINE(dispq_lock)
FORWARD void smp_reinit_vars(void); static void smp_reinit_vars(void);
/* /*
* copies the 16-bit AP trampoline code to the first 1M of memory * copies the 16-bit AP trampoline code to the first 1M of memory
*/ */
PRIVATE phys_bytes copy_trampoline(void) static phys_bytes copy_trampoline(void)
{ {
char * s, *end; char * s, *end;
phys_bytes tramp_base = 0; phys_bytes tramp_base = 0;
@@ -93,7 +93,7 @@ PRIVATE phys_bytes copy_trampoline(void)
return tramp_base; return tramp_base;
} }
PRIVATE void smp_start_aps(void) static void smp_start_aps(void)
{ {
/* /*
* Find an address and align it to a 4k boundary. * Find an address and align it to a 4k boundary.
@@ -167,12 +167,12 @@ PRIVATE void smp_start_aps(void)
NOT_REACHABLE; NOT_REACHABLE;
} }
PUBLIC void smp_halt_cpu (void) void smp_halt_cpu (void)
{ {
NOT_IMPLEMENTED; NOT_IMPLEMENTED;
} }
PUBLIC void smp_shutdown_aps(void) void smp_shutdown_aps(void)
{ {
unsigned cpu; unsigned cpu;
@@ -209,7 +209,7 @@ exit_shutdown_aps:
return; return;
} }
PRIVATE void ap_finish_booting(void) static void ap_finish_booting(void)
{ {
unsigned cpu = cpuid; unsigned cpu = cpuid;
@@ -257,13 +257,13 @@ PRIVATE void ap_finish_booting(void)
NOT_REACHABLE; NOT_REACHABLE;
} }
PUBLIC void smp_ap_boot(void) void smp_ap_boot(void)
{ {
switch_k_stack((char *)get_k_stack_top(__ap_id) - switch_k_stack((char *)get_k_stack_top(__ap_id) -
X86_STACK_TOP_RESERVED, ap_finish_booting); X86_STACK_TOP_RESERVED, ap_finish_booting);
} }
PRIVATE void smp_reinit_vars(void) static void smp_reinit_vars(void)
{ {
lapic_addr = lapic_eoi_addr = 0; lapic_addr = lapic_eoi_addr = 0;
ioapic_enabled = 0; ioapic_enabled = 0;
@@ -271,7 +271,7 @@ PRIVATE void smp_reinit_vars(void)
ncpus = 1; ncpus = 1;
} }
PRIVATE void tss_init_all(void) static void tss_init_all(void)
{ {
unsigned cpu; unsigned cpu;
@@ -279,7 +279,7 @@ PRIVATE void tss_init_all(void)
tss_init(cpu, get_k_stack_top(cpu)); tss_init(cpu, get_k_stack_top(cpu));
} }
PRIVATE int discover_cpus(void) static int discover_cpus(void)
{ {
struct acpi_madt_lapic * cpu; struct acpi_madt_lapic * cpu;
@@ -293,7 +293,7 @@ PRIVATE int discover_cpus(void)
return ncpus; return ncpus;
} }
PUBLIC void smp_init (void) void smp_init (void)
{ {
/* read the MP configuration */ /* read the MP configuration */
if (!discover_cpus()) { if (!discover_cpus()) {
@@ -351,7 +351,7 @@ uniproc_fallback:
printf("WARNING : SMP initialization failed\n"); printf("WARNING : SMP initialization failed\n");
} }
PUBLIC void arch_smp_halt_cpu(void) void arch_smp_halt_cpu(void)
{ {
/* say that we are down */ /* say that we are down */
cpu_down = cpuid; cpu_down = cpuid;
@@ -361,7 +361,7 @@ PUBLIC void arch_smp_halt_cpu(void)
for(;;); for(;;);
} }
PUBLIC void arch_send_smp_schedule_ipi(unsigned cpu) void arch_send_smp_schedule_ipi(unsigned cpu)
{ {
apic_send_ipi(APIC_SMP_SCHED_PROC_VECTOR, cpu, APIC_IPI_DEST); apic_send_ipi(APIC_SMP_SCHED_PROC_VECTOR, cpu, APIC_IPI_DEST);
} }

View File

@@ -34,7 +34,7 @@
#include "acpi.h" #include "acpi.h"
#endif #endif
PRIVATE int osfxsr_feature; /* FXSAVE/FXRSTOR instructions support (SSEx) */ static int osfxsr_feature; /* FXSAVE/FXRSTOR instructions support (SSEx) */
extern __dead void poweroff_jmp(); extern __dead void poweroff_jmp();
extern void poweroff16(); extern void poweroff16();
@@ -47,17 +47,17 @@ extern void poweroff16_end();
/* set OSXMMEXCPT[bit 10] if we provide #XM handler. */ /* set OSXMMEXCPT[bit 10] if we provide #XM handler. */
#define CR4_OSXMMEXCPT (1L<<10) #define CR4_OSXMMEXCPT (1L<<10)
PUBLIC void * k_stacks; void * k_stacks;
FORWARD void ser_debug(int c); static void ser_debug(int c);
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
FORWARD void ser_dump_proc_cpu(void); static void ser_dump_proc_cpu(void);
#endif #endif
#if !CONFIG_OXPCIE #if !CONFIG_OXPCIE
FORWARD void ser_init(void); static void ser_init(void);
#endif #endif
PUBLIC __dead void arch_monitor(void) __dead void arch_monitor(void)
{ {
monitor(); monitor();
} }
@@ -118,7 +118,7 @@ reset(void)
} }
} }
PRIVATE __dead void arch_bios_poweroff(void) static __dead void arch_bios_poweroff(void)
{ {
u32_t cr0; u32_t cr0;
@@ -134,9 +134,9 @@ PRIVATE __dead void arch_bios_poweroff(void)
poweroff_jmp(); poweroff_jmp();
} }
PUBLIC int cpu_has_tsc; int cpu_has_tsc;
PUBLIC __dead void arch_shutdown(int how) __dead void arch_shutdown(int how)
{ {
u16_t magic; u16_t magic;
vm_stop(); vm_stop();
@@ -236,7 +236,7 @@ PUBLIC __dead void arch_shutdown(int how)
NOT_REACHABLE; NOT_REACHABLE;
} }
PUBLIC void fpu_init(void) void fpu_init(void)
{ {
unsigned short cw, sw; unsigned short cw, sw;
@@ -273,7 +273,7 @@ PUBLIC void fpu_init(void)
} }
} }
PUBLIC void save_local_fpu(struct proc *pr, int retain) void save_local_fpu(struct proc *pr, int retain)
{ {
/* Save process FPU context. If the 'retain' flag is set, keep the FPU /* Save process FPU context. If the 'retain' flag is set, keep the FPU
* state as is. If the flag is not set, the state is undefined upon * state as is. If the flag is not set, the state is undefined upon
@@ -292,7 +292,7 @@ PUBLIC void save_local_fpu(struct proc *pr, int retain)
} }
} }
PUBLIC void save_fpu(struct proc *pr) void save_fpu(struct proc *pr)
{ {
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
if (cpuid != pr->p_cpu) { if (cpuid != pr->p_cpu) {
@@ -322,7 +322,7 @@ PUBLIC void save_fpu(struct proc *pr)
} }
} }
PUBLIC int restore_fpu(struct proc *pr) int restore_fpu(struct proc *pr)
{ {
int failed; int failed;
@@ -342,7 +342,7 @@ PUBLIC int restore_fpu(struct proc *pr)
return OK; return OK;
} }
PUBLIC void cpu_identify(void) void cpu_identify(void)
{ {
u32_t eax, ebx, ecx, edx; u32_t eax, ebx, ecx, edx;
unsigned cpu = cpuid; unsigned cpu = cpuid;
@@ -376,7 +376,7 @@ PUBLIC void cpu_identify(void)
cpu_info[cpu].flags[1] = edx; cpu_info[cpu].flags[1] = edx;
} }
PUBLIC void arch_init(void) void arch_init(void)
{ {
#ifdef USE_APIC #ifdef USE_APIC
/* /*
@@ -424,7 +424,7 @@ PUBLIC void arch_init(void)
} }
#ifdef DEBUG_SERIAL #ifdef DEBUG_SERIAL
PUBLIC void ser_putc(char c) void ser_putc(char c)
{ {
int i; int i;
int lsr, thr; int lsr, thr;
@@ -447,7 +447,7 @@ PUBLIC void ser_putc(char c)
/*===========================================================================* /*===========================================================================*
* do_ser_debug * * do_ser_debug *
*===========================================================================*/ *===========================================================================*/
PUBLIC void do_ser_debug() void do_ser_debug()
{ {
u8_t c, lsr; u8_t c, lsr;
@@ -466,7 +466,7 @@ PUBLIC void do_ser_debug()
ser_debug(c); ser_debug(c);
} }
PRIVATE void ser_dump_queue_cpu(unsigned cpu) static void ser_dump_queue_cpu(unsigned cpu)
{ {
int q; int q;
struct proc ** rdy_head; struct proc ** rdy_head;
@@ -485,7 +485,7 @@ PRIVATE void ser_dump_queue_cpu(unsigned cpu)
} }
} }
PRIVATE void ser_dump_queues(void) static void ser_dump_queues(void)
{ {
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
unsigned cpu; unsigned cpu;
@@ -500,7 +500,7 @@ PRIVATE void ser_dump_queues(void)
#endif #endif
} }
PRIVATE void ser_dump_segs(void) static void ser_dump_segs(void)
{ {
struct proc *pp; struct proc *pp;
for (pp= BEG_PROC_ADDR; pp < END_PROC_ADDR; pp++) for (pp= BEG_PROC_ADDR; pp < END_PROC_ADDR; pp++)
@@ -517,7 +517,7 @@ PRIVATE void ser_dump_segs(void)
} }
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
PRIVATE void dump_bkl_usage(void) static void dump_bkl_usage(void)
{ {
unsigned cpu; unsigned cpu;
@@ -532,7 +532,7 @@ PRIVATE void dump_bkl_usage(void)
} }
} }
PRIVATE void reset_bkl_usage(void) static void reset_bkl_usage(void)
{ {
memset(kernel_ticks, 0, sizeof(kernel_ticks)); memset(kernel_ticks, 0, sizeof(kernel_ticks));
memset(bkl_ticks, 0, sizeof(bkl_ticks)); memset(bkl_ticks, 0, sizeof(bkl_ticks));
@@ -541,7 +541,7 @@ PRIVATE void reset_bkl_usage(void)
} }
#endif #endif
PRIVATE void ser_debug(const int c) static void ser_debug(const int c)
{ {
serial_debug_active = 1; serial_debug_active = 1;
@@ -596,7 +596,7 @@ PRIVATE void ser_debug(const int c)
serial_debug_active = 0; serial_debug_active = 0;
} }
PUBLIC void ser_dump_proc() void ser_dump_proc()
{ {
struct proc *pp; struct proc *pp;
@@ -609,7 +609,7 @@ PUBLIC void ser_dump_proc()
} }
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
PRIVATE void ser_dump_proc_cpu(void) static void ser_dump_proc_cpu(void)
{ {
struct proc *pp; struct proc *pp;
unsigned cpu; unsigned cpu;
@@ -629,7 +629,7 @@ PRIVATE void ser_dump_proc_cpu(void)
#if SPROFILE #if SPROFILE
PUBLIC int arch_init_profile_clock(const u32_t freq) int arch_init_profile_clock(const u32_t freq)
{ {
int r; int r;
/* Set CMOS timer frequency. */ /* Set CMOS timer frequency. */
@@ -647,7 +647,7 @@ PUBLIC int arch_init_profile_clock(const u32_t freq)
return CMOS_CLOCK_IRQ; return CMOS_CLOCK_IRQ;
} }
PUBLIC void arch_stop_profile_clock(void) void arch_stop_profile_clock(void)
{ {
int r; int r;
/* Disable CMOS timer interrupts. */ /* Disable CMOS timer interrupts. */
@@ -657,7 +657,7 @@ PUBLIC void arch_stop_profile_clock(void)
outb(RTC_IO, r & ~RTC_B_PIE); outb(RTC_IO, r & ~RTC_B_PIE);
} }
PUBLIC void arch_ack_profile_clock(void) void arch_ack_profile_clock(void)
{ {
/* Mandatory read of CMOS register to re-enable timer interrupts. */ /* Mandatory read of CMOS register to re-enable timer interrupts. */
outb(RTC_INDEX, RTC_REG_C); outb(RTC_INDEX, RTC_REG_C);
@@ -669,7 +669,7 @@ PUBLIC void arch_ack_profile_clock(void)
/* Saved by mpx386.s into these variables. */ /* Saved by mpx386.s into these variables. */
u32_t params_size, params_offset, mon_ds; u32_t params_size, params_offset, mon_ds;
PUBLIC int arch_get_params(char *params, int maxsize) int arch_get_params(char *params, int maxsize)
{ {
phys_copy(seg2phys(mon_ds) + params_offset, vir2phys(params), phys_copy(seg2phys(mon_ds) + params_offset, vir2phys(params),
MIN(maxsize, params_size)); MIN(maxsize, params_size));
@@ -677,7 +677,7 @@ PUBLIC int arch_get_params(char *params, int maxsize)
return OK; return OK;
} }
PUBLIC int arch_set_params(char *params, int size) int arch_set_params(char *params, int size)
{ {
if(size > params_size) if(size > params_size)
return E2BIG; return E2BIG;
@@ -685,7 +685,7 @@ PUBLIC int arch_set_params(char *params, int size)
return OK; return OK;
} }
PUBLIC void arch_do_syscall(struct proc *proc) void arch_do_syscall(struct proc *proc)
{ {
/* do_ipc assumes that it's running because of the current process */ /* do_ipc assumes that it's running because of the current process */
assert(proc == get_cpulocal_var(proc_ptr)); assert(proc == get_cpulocal_var(proc_ptr));
@@ -694,7 +694,7 @@ PUBLIC void arch_do_syscall(struct proc *proc)
do_ipc(proc->p_reg.cx, proc->p_reg.retreg, proc->p_reg.bx); do_ipc(proc->p_reg.cx, proc->p_reg.retreg, proc->p_reg.bx);
} }
PUBLIC struct proc * arch_finish_switch_to_user(void) struct proc * arch_finish_switch_to_user(void)
{ {
char * stk; char * stk;
struct proc * p; struct proc * p;
@@ -710,7 +710,7 @@ PUBLIC struct proc * arch_finish_switch_to_user(void)
return p; return p;
} }
PUBLIC void fpu_sigcontext(struct proc *pr, struct sigframe *fr, struct sigcontext *sc) void fpu_sigcontext(struct proc *pr, struct sigframe *fr, struct sigcontext *sc)
{ {
int fp_error; int fp_error;
@@ -744,7 +744,7 @@ PUBLIC void fpu_sigcontext(struct proc *pr, struct sigframe *fr, struct sigconte
} }
#if !CONFIG_OXPCIE #if !CONFIG_OXPCIE
PRIVATE void ser_init(void) static void ser_init(void)
{ {
unsigned char lcr; unsigned char lcr;
unsigned divisor; unsigned divisor;

View File

@@ -18,10 +18,10 @@
* Intel architecture performance counters watchdog * Intel architecture performance counters watchdog
*/ */
PRIVATE struct arch_watchdog intel_arch_watchdog; static struct arch_watchdog intel_arch_watchdog;
PRIVATE struct arch_watchdog amd_watchdog; static struct arch_watchdog amd_watchdog;
PRIVATE void intel_arch_watchdog_init(const unsigned cpu) static void intel_arch_watchdog_init(const unsigned cpu)
{ {
u64_t cpuf; u64_t cpuf;
u32_t val; u32_t val;
@@ -51,13 +51,13 @@ PRIVATE void intel_arch_watchdog_init(const unsigned cpu)
lapic_write(LAPIC_LVTPCR, APIC_ICR_DM_NMI); lapic_write(LAPIC_LVTPCR, APIC_ICR_DM_NMI);
} }
PRIVATE void intel_arch_watchdog_reinit(const unsigned cpu) static void intel_arch_watchdog_reinit(const unsigned cpu)
{ {
lapic_write(LAPIC_LVTPCR, APIC_ICR_DM_NMI); lapic_write(LAPIC_LVTPCR, APIC_ICR_DM_NMI);
ia32_msr_write(INTEL_MSR_PERFMON_CRT0, 0, ex64lo(watchdog->resetval)); ia32_msr_write(INTEL_MSR_PERFMON_CRT0, 0, ex64lo(watchdog->resetval));
} }
PUBLIC int arch_watchdog_init(void) int arch_watchdog_init(void)
{ {
u32_t eax, ebx, ecx, edx; u32_t eax, ebx, ecx, edx;
unsigned cpu = cpuid; unsigned cpu = cpuid;
@@ -105,11 +105,11 @@ PUBLIC int arch_watchdog_init(void)
return 0; return 0;
} }
PUBLIC void arch_watchdog_stop(void) void arch_watchdog_stop(void)
{ {
} }
PUBLIC void arch_watchdog_lockup(const struct nmi_frame * frame) void arch_watchdog_lockup(const struct nmi_frame * frame)
{ {
printf("KERNEL LOCK UP\n" printf("KERNEL LOCK UP\n"
"eax 0x%08x\n" "eax 0x%08x\n"
@@ -144,7 +144,7 @@ PUBLIC void arch_watchdog_lockup(const struct nmi_frame * frame)
panic("Kernel lockup"); panic("Kernel lockup");
} }
PUBLIC int i386_watchdog_start(void) int i386_watchdog_start(void)
{ {
if (arch_watchdog_init()) { if (arch_watchdog_init()) {
printf("WARNING watchdog initialization " printf("WARNING watchdog initialization "
@@ -158,7 +158,7 @@ PUBLIC int i386_watchdog_start(void)
return 0; return 0;
} }
PRIVATE int intel_arch_watchdog_profile_init(const unsigned freq) static int intel_arch_watchdog_profile_init(const unsigned freq)
{ {
u64_t cpuf; u64_t cpuf;
@@ -181,7 +181,7 @@ PRIVATE int intel_arch_watchdog_profile_init(const unsigned freq)
return OK; return OK;
} }
PRIVATE struct arch_watchdog intel_arch_watchdog = { static struct arch_watchdog intel_arch_watchdog = {
/*.init = */ intel_arch_watchdog_init, /*.init = */ intel_arch_watchdog_init,
/*.reinit = */ intel_arch_watchdog_reinit, /*.reinit = */ intel_arch_watchdog_reinit,
/*.profile_init = */ intel_arch_watchdog_profile_init /*.profile_init = */ intel_arch_watchdog_profile_init
@@ -191,7 +191,7 @@ PRIVATE struct arch_watchdog intel_arch_watchdog = {
#define AMD_MSR_EVENT_CTR0 0xc0010004 #define AMD_MSR_EVENT_CTR0 0xc0010004
#define AMD_MSR_EVENT_SEL0_ENABLE (1 << 22) #define AMD_MSR_EVENT_SEL0_ENABLE (1 << 22)
PRIVATE void amd_watchdog_init(const unsigned cpu) static void amd_watchdog_init(const unsigned cpu)
{ {
u64_t cpuf; u64_t cpuf;
u32_t val; u32_t val;
@@ -216,14 +216,14 @@ PRIVATE void amd_watchdog_init(const unsigned cpu)
lapic_write(LAPIC_LVTPCR, APIC_ICR_DM_NMI); lapic_write(LAPIC_LVTPCR, APIC_ICR_DM_NMI);
} }
PRIVATE void amd_watchdog_reinit(const unsigned cpu) static void amd_watchdog_reinit(const unsigned cpu)
{ {
lapic_write(LAPIC_LVTPCR, APIC_ICR_DM_NMI); lapic_write(LAPIC_LVTPCR, APIC_ICR_DM_NMI);
ia32_msr_write(AMD_MSR_EVENT_CTR0, ia32_msr_write(AMD_MSR_EVENT_CTR0,
ex64hi(watchdog->resetval), ex64lo(watchdog->resetval)); ex64hi(watchdog->resetval), ex64lo(watchdog->resetval));
} }
PRIVATE int amd_watchdog_profile_init(const unsigned freq) static int amd_watchdog_profile_init(const unsigned freq)
{ {
u64_t cpuf; u64_t cpuf;
@@ -237,7 +237,7 @@ PRIVATE int amd_watchdog_profile_init(const unsigned freq)
return OK; return OK;
} }
PRIVATE struct arch_watchdog amd_watchdog = { static struct arch_watchdog amd_watchdog = {
/*.init = */ amd_watchdog_init, /*.init = */ amd_watchdog_init,
/*.reinit = */ amd_watchdog_reinit, /*.reinit = */ amd_watchdog_reinit,
/*.profile_init = */ amd_watchdog_profile_init /*.profile_init = */ amd_watchdog_profile_init

View File

@@ -3,7 +3,7 @@
#include "debugreg.h" #include "debugreg.h"
PUBLIC int breakpoint_set(phys_bytes linaddr, int bp, const int flags) int breakpoint_set(phys_bytes linaddr, int bp, const int flags)
{ {
unsigned long dr7, dr7flags; unsigned long dr7, dr7flags;

View File

@@ -17,7 +17,7 @@ struct reg86u reg86;
/*===========================================================================* /*===========================================================================*
* do_int86 * * do_int86 *
*===========================================================================*/ *===========================================================================*/
PUBLIC int do_int86(struct proc * caller, message * m_ptr) int do_int86(struct proc * caller, message * m_ptr)
{ {
data_copy(caller->p_endpoint, (vir_bytes) m_ptr->INT86_REG86, data_copy(caller->p_endpoint, (vir_bytes) m_ptr->INT86_REG86,
KERNEL, (vir_bytes) &reg86, sizeof(reg86)); KERNEL, (vir_bytes) &reg86, sizeof(reg86));

View File

@@ -17,7 +17,7 @@
/*===========================================================================* /*===========================================================================*
* do_iopenable * * do_iopenable *
*===========================================================================*/ *===========================================================================*/
PUBLIC int do_iopenable(struct proc * caller, message * m_ptr) int do_iopenable(struct proc * caller, message * m_ptr)
{ {
int proc_nr; int proc_nr;

View File

@@ -13,7 +13,7 @@
/*===========================================================================* /*===========================================================================*
* do_readbios * * do_readbios *
*===========================================================================*/ *===========================================================================*/
PUBLIC int do_readbios(struct proc * caller, message * m_ptr) int do_readbios(struct proc * caller, message * m_ptr)
{ {
struct vir_addr src, dst; struct vir_addr src, dst;

View File

@@ -21,7 +21,7 @@
/*===========================================================================* /*===========================================================================*
* do_sdevio * * do_sdevio *
*===========================================================================*/ *===========================================================================*/
PUBLIC int do_sdevio(struct proc * caller, message *m_ptr) int do_sdevio(struct proc * caller, message *m_ptr)
{ {
vir_bytes newoffset; vir_bytes newoffset;
endpoint_t newep; endpoint_t newep;

View File

@@ -41,14 +41,14 @@ static struct ex_s ex_data[] = {
{ "SIMD exception", SIGFPE, 386 }, { "SIMD exception", SIGFPE, 386 },
}; };
PRIVATE void inkernel_disaster(struct proc *saved_proc, static void inkernel_disaster(struct proc *saved_proc,
struct exception_frame *frame, struct ex_s *ep, int is_nested); struct exception_frame *frame, struct ex_s *ep, int is_nested);
extern int catch_pagefaults; extern int catch_pagefaults;
PRIVATE void proc_stacktrace_execute(struct proc *whichproc, reg_t v_bp, reg_t pc); static void proc_stacktrace_execute(struct proc *whichproc, reg_t v_bp, reg_t pc);
PRIVATE void pagefault( struct proc *pr, static void pagefault( struct proc *pr,
struct exception_frame * frame, struct exception_frame * frame,
int is_nested) int is_nested)
{ {
@@ -132,7 +132,7 @@ PRIVATE void pagefault( struct proc *pr,
return; return;
} }
PRIVATE void inkernel_disaster(struct proc *saved_proc, static void inkernel_disaster(struct proc *saved_proc,
struct exception_frame * frame, struct ex_s *ep, struct exception_frame * frame, struct ex_s *ep,
int is_nested) int is_nested)
{ {
@@ -184,7 +184,7 @@ PRIVATE void inkernel_disaster(struct proc *saved_proc,
/*===========================================================================* /*===========================================================================*
* exception * * exception *
*===========================================================================*/ *===========================================================================*/
PUBLIC void exception_handler(int is_nested, struct exception_frame * frame) void exception_handler(int is_nested, struct exception_frame * frame)
{ {
/* An exception or unexpected interrupt has occurred. */ /* An exception or unexpected interrupt has occurred. */
register struct ex_s *ep; register struct ex_s *ep;
@@ -278,7 +278,7 @@ PUBLIC void exception_handler(int is_nested, struct exception_frame * frame)
/*===========================================================================* /*===========================================================================*
* proc_stacktrace_execute * * proc_stacktrace_execute *
*===========================================================================*/ *===========================================================================*/
PRIVATE void proc_stacktrace_execute(struct proc *whichproc, reg_t v_bp, reg_t pc) static void proc_stacktrace_execute(struct proc *whichproc, reg_t v_bp, reg_t pc)
{ {
reg_t v_hbp; reg_t v_hbp;
int iskernel; int iskernel;
@@ -322,21 +322,21 @@ PRIVATE void proc_stacktrace_execute(struct proc *whichproc, reg_t v_bp, reg_t p
/*===========================================================================* /*===========================================================================*
* proc_stacktrace * * proc_stacktrace *
*===========================================================================*/ *===========================================================================*/
PUBLIC void proc_stacktrace(struct proc *whichproc) void proc_stacktrace(struct proc *whichproc)
{ {
#if USE_SYSDEBUG #if USE_SYSDEBUG
proc_stacktrace_execute(whichproc, whichproc->p_reg.fp, whichproc->p_reg.pc); proc_stacktrace_execute(whichproc, whichproc->p_reg.fp, whichproc->p_reg.pc);
#endif /* USE_SYSDEBUG */ #endif /* USE_SYSDEBUG */
} }
PUBLIC void enable_fpu_exception(void) void enable_fpu_exception(void)
{ {
u32_t cr0 = read_cr0(); u32_t cr0 = read_cr0();
if(!(cr0 & I386_CR0_TS)) if(!(cr0 & I386_CR0_TS))
write_cr0(cr0 | I386_CR0_TS); write_cr0(cr0 | I386_CR0_TS);
} }
PUBLIC void disable_fpu_exception(void) void disable_fpu_exception(void)
{ {
clts(); clts();
} }

View File

@@ -27,7 +27,7 @@
/*===========================================================================* /*===========================================================================*
* intr_init * * intr_init *
*===========================================================================*/ *===========================================================================*/
PUBLIC int intr_init(const int mine, const int auto_eoi) int intr_init(const int mine, const int auto_eoi)
{ {
/* Initialize the 8259s, finishing with all interrupts disabled. This is /* Initialize the 8259s, finishing with all interrupts disabled. This is
* only done in protected mode, in real mode we don't touch the 8259s, but * only done in protected mode, in real mode we don't touch the 8259s, but
@@ -72,27 +72,27 @@ PUBLIC int intr_init(const int mine, const int auto_eoi)
return OK; return OK;
} }
PUBLIC void irq_8259_unmask(const int irq) void irq_8259_unmask(const int irq)
{ {
const unsigned ctl_mask = irq < 8 ? INT_CTLMASK : INT2_CTLMASK; const unsigned ctl_mask = irq < 8 ? INT_CTLMASK : INT2_CTLMASK;
outb(ctl_mask, inb(ctl_mask) & ~(1 << (irq & 0x7))); outb(ctl_mask, inb(ctl_mask) & ~(1 << (irq & 0x7)));
} }
PUBLIC void irq_8259_mask(const int irq) void irq_8259_mask(const int irq)
{ {
const unsigned ctl_mask = irq < 8 ? INT_CTLMASK : INT2_CTLMASK; const unsigned ctl_mask = irq < 8 ? INT_CTLMASK : INT2_CTLMASK;
outb(ctl_mask, inb(ctl_mask) | (1 << (irq & 0x7))); outb(ctl_mask, inb(ctl_mask) | (1 << (irq & 0x7)));
} }
/* Disable 8259 - write 0xFF in OCW1 master and slave. */ /* Disable 8259 - write 0xFF in OCW1 master and slave. */
PUBLIC void i8259_disable(void) void i8259_disable(void)
{ {
outb(INT2_CTLMASK, 0xFF); outb(INT2_CTLMASK, 0xFF);
outb(INT_CTLMASK, 0xFF); outb(INT_CTLMASK, 0xFF);
inb(INT_CTLMASK); inb(INT_CTLMASK);
} }
PUBLIC void irq_8259_eoi(int irq) void irq_8259_eoi(int irq)
{ {
if (irq < 8) if (irq < 8)
eoi_8259_master(); eoi_8259_master();

View File

@@ -27,20 +27,20 @@
#endif #endif
#endif #endif
PUBLIC int i386_paging_enabled = 0; int i386_paging_enabled = 0;
PRIVATE int psok = 0; static int psok = 0;
#define MAX_FREEPDES 2 #define MAX_FREEPDES 2
PRIVATE int nfreepdes = 0, freepdes[MAX_FREEPDES]; static int nfreepdes = 0, freepdes[MAX_FREEPDES];
#define HASPT(procptr) ((procptr)->p_seg.p_cr3 != 0) #define HASPT(procptr) ((procptr)->p_seg.p_cr3 != 0)
FORWARD u32_t phys_get32(phys_bytes v); static u32_t phys_get32(phys_bytes v);
FORWARD void vm_enable_paging(void); static void vm_enable_paging(void);
PUBLIC void segmentation2paging(struct proc * current) void segmentation2paging(struct proc * current)
{ {
/* switch to the current process page tables before turning paging on */ /* switch to the current process page tables before turning paging on */
switch_address_space(current); switch_address_space(current);
@@ -67,7 +67,7 @@ PUBLIC void segmentation2paging(struct proc * current)
* pde number to be used, and a pointer to it (linear address) is returned * pde number to be used, and a pointer to it (linear address) is returned
* for actual use by phys_copy or phys_memset. * for actual use by phys_copy or phys_memset.
*/ */
PRIVATE phys_bytes createpde( static phys_bytes createpde(
const struct proc *pr, /* Requested process, NULL for physical. */ const struct proc *pr, /* Requested process, NULL for physical. */
const phys_bytes linaddr,/* Address after segment translation. */ const phys_bytes linaddr,/* Address after segment translation. */
phys_bytes *bytes, /* Size of chunk, function may truncate it. */ phys_bytes *bytes, /* Size of chunk, function may truncate it. */
@@ -132,7 +132,7 @@ PRIVATE phys_bytes createpde(
/*===========================================================================* /*===========================================================================*
* lin_lin_copy * * lin_lin_copy *
*===========================================================================*/ *===========================================================================*/
PRIVATE int lin_lin_copy(struct proc *srcproc, vir_bytes srclinaddr, static int lin_lin_copy(struct proc *srcproc, vir_bytes srclinaddr,
struct proc *dstproc, vir_bytes dstlinaddr, vir_bytes bytes) struct proc *dstproc, vir_bytes dstlinaddr, vir_bytes bytes)
{ {
u32_t addr; u32_t addr;
@@ -214,7 +214,7 @@ PRIVATE int lin_lin_copy(struct proc *srcproc, vir_bytes srclinaddr,
} }
PRIVATE u32_t phys_get32(phys_bytes addr) static u32_t phys_get32(phys_bytes addr)
{ {
const u32_t v; const u32_t v;
int r; int r;
@@ -233,7 +233,7 @@ PRIVATE u32_t phys_get32(phys_bytes addr)
} }
#if 0 #if 0
PRIVATE char *cr0_str(u32_t e) static char *cr0_str(u32_t e)
{ {
static char str[80]; static char str[80];
strcpy(str, ""); strcpy(str, "");
@@ -249,7 +249,7 @@ PRIVATE char *cr0_str(u32_t e)
return str; return str;
} }
PRIVATE char *cr4_str(u32_t e) static char *cr4_str(u32_t e)
{ {
static char str[80]; static char str[80];
strcpy(str, ""); strcpy(str, "");
@@ -266,12 +266,12 @@ PRIVATE char *cr4_str(u32_t e)
} }
#endif #endif
PUBLIC void vm_stop(void) void vm_stop(void)
{ {
write_cr0(read_cr0() & ~I386_CR0_PG); write_cr0(read_cr0() & ~I386_CR0_PG);
} }
PRIVATE void vm_enable_paging(void) static void vm_enable_paging(void)
{ {
u32_t cr0, cr4; u32_t cr0, cr4;
int pgeok; int pgeok;
@@ -311,7 +311,7 @@ PRIVATE void vm_enable_paging(void)
/*===========================================================================* /*===========================================================================*
* umap_local * * umap_local *
*===========================================================================*/ *===========================================================================*/
PUBLIC phys_bytes umap_local(rp, seg, vir_addr, bytes) phys_bytes umap_local(rp, seg, vir_addr, bytes)
register struct proc *rp; /* pointer to proc table entry for process */ register struct proc *rp; /* pointer to proc table entry for process */
int seg; /* T, D, or S segment */ int seg; /* T, D, or S segment */
vir_bytes vir_addr; /* virtual address in bytes within the seg */ vir_bytes vir_addr; /* virtual address in bytes within the seg */
@@ -350,7 +350,7 @@ vir_bytes bytes; /* # of bytes to be copied */
/*===========================================================================* /*===========================================================================*
* umap_virtual * * umap_virtual *
*===========================================================================*/ *===========================================================================*/
PUBLIC phys_bytes umap_virtual(rp, seg, vir_addr, bytes) phys_bytes umap_virtual(rp, seg, vir_addr, bytes)
register struct proc *rp; /* pointer to proc table entry for process */ register struct proc *rp; /* pointer to proc table entry for process */
int seg; /* T, D, or S segment */ int seg; /* T, D, or S segment */
vir_bytes vir_addr; /* virtual address in bytes within the seg */ vir_bytes vir_addr; /* virtual address in bytes within the seg */
@@ -399,7 +399,7 @@ vir_bytes bytes; /* # of bytes to be copied */
/*===========================================================================* /*===========================================================================*
* vm_lookup * * vm_lookup *
*===========================================================================*/ *===========================================================================*/
PUBLIC int vm_lookup(const struct proc *proc, const vir_bytes virtual, int vm_lookup(const struct proc *proc, const vir_bytes virtual,
phys_bytes *physical, u32_t *ptent) phys_bytes *physical, u32_t *ptent)
{ {
u32_t *root, *pt; u32_t *root, *pt;
@@ -455,7 +455,7 @@ PUBLIC int vm_lookup(const struct proc *proc, const vir_bytes virtual,
/*===========================================================================* /*===========================================================================*
* vm_lookup_range * * vm_lookup_range *
*===========================================================================*/ *===========================================================================*/
PUBLIC size_t vm_lookup_range(const struct proc *proc, vir_bytes vir_addr, size_t vm_lookup_range(const struct proc *proc, vir_bytes vir_addr,
phys_bytes *phys_addr, size_t bytes) phys_bytes *phys_addr, size_t bytes)
{ {
/* Look up the physical address corresponding to linear virtual address /* Look up the physical address corresponding to linear virtual address
@@ -507,7 +507,7 @@ PUBLIC size_t vm_lookup_range(const struct proc *proc, vir_bytes vir_addr,
/*===========================================================================* /*===========================================================================*
* vm_suspend * * vm_suspend *
*===========================================================================*/ *===========================================================================*/
PRIVATE void vm_suspend(struct proc *caller, const struct proc *target, static void vm_suspend(struct proc *caller, const struct proc *target,
const vir_bytes linaddr, const vir_bytes len, const int type) const vir_bytes linaddr, const vir_bytes len, const int type)
{ {
/* This range is not OK for this process. Set parameters /* This range is not OK for this process. Set parameters
@@ -534,7 +534,7 @@ PRIVATE void vm_suspend(struct proc *caller, const struct proc *target,
/*===========================================================================* /*===========================================================================*
* vm_check_range * * vm_check_range *
*===========================================================================*/ *===========================================================================*/
PUBLIC int vm_check_range(struct proc *caller, struct proc *target, int vm_check_range(struct proc *caller, struct proc *target,
vir_bytes vir_addr, size_t bytes) vir_bytes vir_addr, size_t bytes)
{ {
/* Public interface to vm_suspend(), for use by kernel calls. On behalf /* Public interface to vm_suspend(), for use by kernel calls. On behalf
@@ -562,7 +562,7 @@ PUBLIC int vm_check_range(struct proc *caller, struct proc *target,
/*===========================================================================* /*===========================================================================*
* delivermsg * * delivermsg *
*===========================================================================*/ *===========================================================================*/
PUBLIC void delivermsg(struct proc *rp) void delivermsg(struct proc *rp)
{ {
int r = OK; int r = OK;
@@ -589,7 +589,7 @@ PUBLIC void delivermsg(struct proc *rp)
} }
#if 0 #if 0
PRIVATE char *flagstr(u32_t e, const int dir) static char *flagstr(u32_t e, const int dir)
{ {
static char str[80]; static char str[80];
strcpy(str, ""); strcpy(str, "");
@@ -606,7 +606,7 @@ PRIVATE char *flagstr(u32_t e, const int dir)
return str; return str;
} }
PRIVATE void vm_pt_print(u32_t *pagetable, const u32_t v) static void vm_pt_print(u32_t *pagetable, const u32_t v)
{ {
int pte; int pte;
int col = 0; int col = 0;
@@ -630,7 +630,7 @@ PRIVATE void vm_pt_print(u32_t *pagetable, const u32_t v)
return; return;
} }
PRIVATE void vm_print(u32_t *root) static void vm_print(u32_t *root)
{ {
int pde; int pde;
@@ -705,7 +705,7 @@ int vm_phys_memset(phys_bytes ph, const u8_t c, phys_bytes bytes)
/*===========================================================================* /*===========================================================================*
* virtual_copy_f * * virtual_copy_f *
*===========================================================================*/ *===========================================================================*/
PUBLIC int virtual_copy_f(caller, src_addr, dst_addr, bytes, vmcheck) int virtual_copy_f(caller, src_addr, dst_addr, bytes, vmcheck)
struct proc * caller; struct proc * caller;
struct vir_addr *src_addr; /* source virtual address */ struct vir_addr *src_addr; /* source virtual address */
struct vir_addr *dst_addr; /* destination virtual address */ struct vir_addr *dst_addr; /* destination virtual address */
@@ -848,7 +848,7 @@ int vmcheck; /* if nonzero, can return VMSUSPEND */
/*===========================================================================* /*===========================================================================*
* data_copy * * data_copy *
*===========================================================================*/ *===========================================================================*/
PUBLIC int data_copy(const endpoint_t from_proc, const vir_bytes from_addr, int data_copy(const endpoint_t from_proc, const vir_bytes from_addr,
const endpoint_t to_proc, const vir_bytes to_addr, const endpoint_t to_proc, const vir_bytes to_addr,
size_t bytes) size_t bytes)
{ {
@@ -866,7 +866,7 @@ PUBLIC int data_copy(const endpoint_t from_proc, const vir_bytes from_addr,
/*===========================================================================* /*===========================================================================*
* data_copy_vmcheck * * data_copy_vmcheck *
*===========================================================================*/ *===========================================================================*/
PUBLIC int data_copy_vmcheck(struct proc * caller, int data_copy_vmcheck(struct proc * caller,
const endpoint_t from_proc, const vir_bytes from_addr, const endpoint_t from_proc, const vir_bytes from_addr,
const endpoint_t to_proc, const vir_bytes to_addr, const endpoint_t to_proc, const vir_bytes to_addr,
size_t bytes) size_t bytes)
@@ -885,7 +885,7 @@ PUBLIC int data_copy_vmcheck(struct proc * caller,
/*===========================================================================* /*===========================================================================*
* arch_pre_exec * * arch_pre_exec *
*===========================================================================*/ *===========================================================================*/
PUBLIC void arch_pre_exec(struct proc *pr, const u32_t ip, const u32_t sp) void arch_pre_exec(struct proc *pr, const u32_t ip, const u32_t sp)
{ {
/* set program counter and stack pointer. */ /* set program counter and stack pointer. */
pr->p_reg.pc = ip; pr->p_reg.pc = ip;
@@ -895,7 +895,7 @@ PUBLIC void arch_pre_exec(struct proc *pr, const u32_t ip, const u32_t sp)
/*===========================================================================* /*===========================================================================*
* arch_umap * * arch_umap *
*===========================================================================*/ *===========================================================================*/
PUBLIC int arch_umap(const struct proc *pr, vir_bytes offset, vir_bytes count, int arch_umap(const struct proc *pr, vir_bytes offset, vir_bytes count,
int seg, phys_bytes *addr) int seg, phys_bytes *addr)
{ {
switch(seg) { switch(seg) {
@@ -919,12 +919,12 @@ void i386_freepde(const int pde)
freepdes[nfreepdes++] = pde; freepdes[nfreepdes++] = pde;
} }
PRIVATE int oxpcie_mapping_index = -1, static int oxpcie_mapping_index = -1,
lapic_mapping_index = -1, lapic_mapping_index = -1,
ioapic_first_index = -1, ioapic_first_index = -1,
ioapic_last_index = -1; ioapic_last_index = -1;
PUBLIC int arch_phys_map(const int index, int arch_phys_map(const int index,
phys_bytes *addr, phys_bytes *addr,
phys_bytes *len, phys_bytes *len,
int *flags) int *flags)
@@ -988,7 +988,7 @@ PUBLIC int arch_phys_map(const int index,
return EINVAL; return EINVAL;
} }
PUBLIC int arch_phys_map_reply(const int index, const vir_bytes addr) int arch_phys_map_reply(const int index, const vir_bytes addr)
{ {
#ifdef USE_APIC #ifdef USE_APIC
/* if local APIC is enabled */ /* if local APIC is enabled */
@@ -1013,7 +1013,7 @@ PUBLIC int arch_phys_map_reply(const int index, const vir_bytes addr)
return EINVAL; return EINVAL;
} }
PUBLIC int arch_enable_paging(struct proc * caller, const message * m_ptr) int arch_enable_paging(struct proc * caller, const message * m_ptr)
{ {
struct vm_ep_data ep_data; struct vm_ep_data ep_data;
int r; int r;
@@ -1099,13 +1099,13 @@ PUBLIC int arch_enable_paging(struct proc * caller, const message * m_ptr)
return OK; return OK;
} }
PUBLIC void release_address_space(struct proc *pr) void release_address_space(struct proc *pr)
{ {
pr->p_seg.p_cr3_v = NULL; pr->p_seg.p_cr3_v = NULL;
} }
/* computes a checksum of a buffer of a given length. The byte sum must be zero */ /* computes a checksum of a buffer of a given length. The byte sum must be zero */
PUBLIC int platform_tbl_checksum_ok(void *ptr, unsigned int length) int platform_tbl_checksum_ok(void *ptr, unsigned int length)
{ {
u8_t total = 0; u8_t total = 0;
unsigned int i; unsigned int i;
@@ -1114,7 +1114,7 @@ PUBLIC int platform_tbl_checksum_ok(void *ptr, unsigned int length)
return !total; return !total;
} }
PUBLIC int platform_tbl_ptr(phys_bytes start, int platform_tbl_ptr(phys_bytes start,
phys_bytes end, phys_bytes end,
unsigned increment, unsigned increment,
void * buff, void * buff,

View File

@@ -8,14 +8,14 @@
#include "oxpcie.h" #include "oxpcie.h"
#include "serial.h" #include "serial.h"
PRIVATE unsigned char *oxpcie_vaddr = NULL; static unsigned char *oxpcie_vaddr = NULL;
PUBLIC void oxpcie_set_vaddr(unsigned char *vaddr) void oxpcie_set_vaddr(unsigned char *vaddr)
{ {
oxpcie_vaddr = vaddr; oxpcie_vaddr = vaddr;
} }
PRIVATE void oxpcie_init(void) static void oxpcie_init(void)
{ {
printf("oxpcie_init\n"); printf("oxpcie_init\n");
/* Enable access to EFR and DLM+DLL */ /* Enable access to EFR and DLM+DLL */
@@ -45,7 +45,7 @@ PRIVATE void oxpcie_init(void)
OXPCIE_CPR2 = 0; OXPCIE_CPR2 = 0;
} }
PUBLIC void oxpcie_putc(char c) void oxpcie_putc(char c)
{ {
static int inuse = 0; static int inuse = 0;
@@ -68,7 +68,7 @@ PUBLIC void oxpcie_putc(char c)
} }
} }
PUBLIC int oxpcie_in(void) int oxpcie_in(void)
{ {
if(vm_running && oxpcie_vaddr) { if(vm_running && oxpcie_vaddr) {
int lsr; int lsr;

View File

@@ -43,7 +43,7 @@
#define mb_clear_memrange(start, end) \ #define mb_clear_memrange(start, end) \
phys_memset((start), 0, (end)-(start)) phys_memset((start), 0, (end)-(start))
PRIVATE void mb_itoa(u32_t val, char * out) static void mb_itoa(u32_t val, char * out)
{ {
char ret[ITOA_BUFFER_SIZE]; char ret[ITOA_BUFFER_SIZE];
int i = ITOA_BUFFER_SIZE - 2; int i = ITOA_BUFFER_SIZE - 2;
@@ -67,7 +67,7 @@ PRIVATE void mb_itoa(u32_t val, char * out)
strcpy(out, ret + i + 1); strcpy(out, ret + i + 1);
} }
PRIVATE void mb_itox(u32_t val, char *out) static void mb_itox(u32_t val, char *out)
{ {
char ret[9]; char ret[9];
int i = 7; int i = 7;
@@ -92,7 +92,7 @@ PRIVATE void mb_itox(u32_t val, char *out)
strcpy(out, ret + i + 1); strcpy(out, ret + i + 1);
} }
PRIVATE void mb_put_char(char c, int line, int col) static void mb_put_char(char c, int line, int col)
{ {
/* Write a char to vga display buffer. */ /* Write a char to vga display buffer. */
if (line<MULTIBOOT_CONSOLE_LINES&&col<MULTIBOOT_CONSOLE_COLS) if (line<MULTIBOOT_CONSOLE_LINES&&col<MULTIBOOT_CONSOLE_COLS)
@@ -104,7 +104,7 @@ PRIVATE void mb_put_char(char c, int line, int col)
1); 1);
} }
PRIVATE char mb_get_char(int line, int col) static char mb_get_char(int line, int col)
{ {
char c; char c;
/* Read a char to from display buffer. */ /* Read a char to from display buffer. */
@@ -119,11 +119,11 @@ PRIVATE char mb_get_char(int line, int col)
} }
/* Give non-zero values to avoid them in BSS */ /* Give non-zero values to avoid them in BSS */
PRIVATE int print_line = 1, print_col = 1; static int print_line = 1, print_col = 1;
#include <sys/video.h> #include <sys/video.h>
PUBLIC void mb_cls(void) void mb_cls(void)
{ {
int i, j; int i, j;
/* Clear screen */ /* Clear screen */
@@ -139,7 +139,7 @@ PUBLIC void mb_cls(void)
outb(C_6845+DATA, 0); outb(C_6845+DATA, 0);
} }
PRIVATE void mb_scroll_up(int lines) static void mb_scroll_up(int lines)
{ {
int i, j; int i, j;
for (i = 0; i < MULTIBOOT_CONSOLE_LINES; i++ ) { for (i = 0; i < MULTIBOOT_CONSOLE_LINES; i++ ) {
@@ -153,7 +153,7 @@ PRIVATE void mb_scroll_up(int lines)
print_line-= lines; print_line-= lines;
} }
PUBLIC void mb_print_char(char c) void mb_print_char(char c)
{ {
while (print_line >= MULTIBOOT_CONSOLE_LINES) while (print_line >= MULTIBOOT_CONSOLE_LINES)
mb_scroll_up(1); mb_scroll_up(1);
@@ -177,7 +177,7 @@ PUBLIC void mb_print_char(char c)
mb_scroll_up(1); mb_scroll_up(1);
} }
PUBLIC void mb_print(char *str) void mb_print(char *str)
{ {
while (*str) { while (*str) {
mb_print_char(*str); mb_print_char(*str);
@@ -191,7 +191,7 @@ PUBLIC void mb_print(char *str)
#define KB_OUT_FULL 0x01 /* status bit set when keypress char pending */ #define KB_OUT_FULL 0x01 /* status bit set when keypress char pending */
#define KB_AUX_BYTE 0x20 /* Auxiliary Device Output Buffer Full */ #define KB_AUX_BYTE 0x20 /* Auxiliary Device Output Buffer Full */
PUBLIC int mb_read_char(unsigned char *ch) int mb_read_char(unsigned char *ch)
{ {
unsigned long b, sb; unsigned long b, sb;
#ifdef DEBUG_SERIAL #ifdef DEBUG_SERIAL
@@ -220,7 +220,7 @@ PUBLIC int mb_read_char(unsigned char *ch)
return 0; return 0;
} }
PRIVATE void mb_print_hex(u32_t value) static void mb_print_hex(u32_t value)
{ {
int i; int i;
char c; char c;
@@ -238,7 +238,7 @@ PRIVATE void mb_print_hex(u32_t value)
mb_print(out); mb_print(out);
} }
PRIVATE int mb_set_param(char *name, char *value) static int mb_set_param(char *name, char *value)
{ {
char *p = multiboot_param_buf; char *p = multiboot_param_buf;
char *q; char *q;
@@ -281,7 +281,7 @@ PRIVATE int mb_set_param(char *name, char *value)
return 0; return 0;
} }
PRIVATE void get_parameters(multiboot_info_t *mbi) static void get_parameters(multiboot_info_t *mbi)
{ {
char mem_value[40], temp[ITOA_BUFFER_SIZE]; char mem_value[40], temp[ITOA_BUFFER_SIZE];
int i; int i;
@@ -354,7 +354,7 @@ PRIVATE void get_parameters(multiboot_info_t *mbi)
} }
} }
PRIVATE void mb_extract_image(multiboot_info_t mbi) static void mb_extract_image(multiboot_info_t mbi)
{ {
multiboot_module_t *mb_module_info; multiboot_module_t *mb_module_info;
multiboot_module_t *module; multiboot_module_t *module;
@@ -458,7 +458,7 @@ PRIVATE void mb_extract_image(multiboot_info_t mbi)
return; return;
} }
PUBLIC phys_bytes pre_init(u32_t ebx) phys_bytes pre_init(u32_t ebx)
{ {
multiboot_info_t mbi; multiboot_info_t mbi;

View File

@@ -25,7 +25,7 @@ struct gatedesc_s {
u16_t offset_high; u16_t offset_high;
}; };
PUBLIC struct segdesc_s gdt[GDT_SIZE]= /* used in klib.s and mpx.s */ struct segdesc_s gdt[GDT_SIZE]= /* used in klib.s and mpx.s */
{ {0}, { {0},
{0,0,0,0}, /* GDT descriptor */ {0,0,0,0}, /* GDT descriptor */
{0,0,0,0}, /* IDT descriptor */ {0,0,0,0}, /* IDT descriptor */
@@ -35,16 +35,16 @@ PUBLIC struct segdesc_s gdt[GDT_SIZE]= /* used in klib.s and mpx.s */
{0xffff,0,0,0x9b,0xcf,0}, /* kernel CS */ {0xffff,0,0,0x9b,0xcf,0}, /* kernel CS */
{0xffff,0,0,0x9b,0xcf,0}, /* temp for BIOS (386: monitor CS at startup) */ {0xffff,0,0,0x9b,0xcf,0}, /* temp for BIOS (386: monitor CS at startup) */
}; };
PRIVATE struct gatedesc_s idt[IDT_SIZE]; /* zero-init so none present */ static struct gatedesc_s idt[IDT_SIZE]; /* zero-init so none present */
PUBLIC struct tss_s tss[CONFIG_MAX_CPUS]; /* zero init */ struct tss_s tss[CONFIG_MAX_CPUS]; /* zero init */
FORWARD void sdesc(struct segdesc_s *segdp, phys_bytes base, vir_bytes static void sdesc(struct segdesc_s *segdp, phys_bytes base, vir_bytes
size); size);
/*===========================================================================* /*===========================================================================*
* enable_iop * * enable_iop *
*===========================================================================*/ *===========================================================================*/
PUBLIC void enable_iop(struct proc *pp) void enable_iop(struct proc *pp)
{ {
/* Allow a user process to use I/O instructions. Change the I/O Permission /* Allow a user process to use I/O instructions. Change the I/O Permission
* Level bits in the psw. These specify least-privileged Current Permission * Level bits in the psw. These specify least-privileged Current Permission
@@ -57,7 +57,7 @@ PUBLIC void enable_iop(struct proc *pp)
/*===========================================================================* /*===========================================================================*
* seg2phys * * seg2phys *
*===========================================================================*/ *===========================================================================*/
PUBLIC phys_bytes seg2phys(const u16_t seg) phys_bytes seg2phys(const u16_t seg)
{ {
/* Return the base address of a segment, with seg being a /* Return the base address of a segment, with seg being a
* register, or a 286/386 segment selector. * register, or a 286/386 segment selector.
@@ -75,7 +75,7 @@ PUBLIC phys_bytes seg2phys(const u16_t seg)
/*===========================================================================* /*===========================================================================*
* init_dataseg * * init_dataseg *
*===========================================================================*/ *===========================================================================*/
PUBLIC void init_dataseg(register struct segdesc_s *segdp, void init_dataseg(register struct segdesc_s *segdp,
phys_bytes base, vir_bytes size, const int privilege) phys_bytes base, vir_bytes size, const int privilege)
{ {
/* Build descriptor for a data segment. */ /* Build descriptor for a data segment. */
@@ -88,7 +88,7 @@ PUBLIC void init_dataseg(register struct segdesc_s *segdp,
/*===========================================================================* /*===========================================================================*
* init_codeseg * * init_codeseg *
*===========================================================================*/ *===========================================================================*/
PRIVATE void init_codeseg(register struct segdesc_s *segdp, phys_bytes base, static void init_codeseg(register struct segdesc_s *segdp, phys_bytes base,
vir_bytes size, int privilege) vir_bytes size, int privilege)
{ {
/* Build descriptor for a code segment. */ /* Build descriptor for a code segment. */
@@ -98,7 +98,7 @@ PRIVATE void init_codeseg(register struct segdesc_s *segdp, phys_bytes base,
/* CONFORMING = 0, ACCESSED = 0 */ /* CONFORMING = 0, ACCESSED = 0 */
} }
PUBLIC struct gate_table_s gate_table_pic[] = { struct gate_table_s gate_table_pic[] = {
{ hwint00, VECTOR( 0), INTR_PRIVILEGE }, { hwint00, VECTOR( 0), INTR_PRIVILEGE },
{ hwint01, VECTOR( 1), INTR_PRIVILEGE }, { hwint01, VECTOR( 1), INTR_PRIVILEGE },
{ hwint02, VECTOR( 2), INTR_PRIVILEGE }, { hwint02, VECTOR( 2), INTR_PRIVILEGE },
@@ -118,7 +118,7 @@ PUBLIC struct gate_table_s gate_table_pic[] = {
{ NULL, 0, 0} { NULL, 0, 0}
}; };
PUBLIC void tss_init(unsigned cpu, void * kernel_stack) void tss_init(unsigned cpu, void * kernel_stack)
{ {
struct tss_s * t = &tss[cpu]; struct tss_s * t = &tss[cpu];
@@ -146,7 +146,7 @@ PUBLIC void tss_init(unsigned cpu, void * kernel_stack)
/*===========================================================================* /*===========================================================================*
* prot_init * * prot_init *
*===========================================================================*/ *===========================================================================*/
PUBLIC void prot_init(void) void prot_init(void)
{ {
/* Set up tables for protected mode. /* Set up tables for protected mode.
* All GDT slots are allocated at compile time. * All GDT slots are allocated at compile time.
@@ -192,7 +192,7 @@ PUBLIC void prot_init(void)
tss_init(0, &k_boot_stktop); tss_init(0, &k_boot_stktop);
} }
PUBLIC void idt_copy_vectors(struct gate_table_s * first) void idt_copy_vectors(struct gate_table_s * first)
{ {
struct gate_table_s *gtp; struct gate_table_s *gtp;
for (gtp = first; gtp->gate; gtp++) { for (gtp = first; gtp->gate; gtp++) {
@@ -203,7 +203,7 @@ PUBLIC void idt_copy_vectors(struct gate_table_s * first)
} }
/* Build descriptors for interrupt gates in IDT. */ /* Build descriptors for interrupt gates in IDT. */
PUBLIC void idt_init(void) void idt_init(void)
{ {
struct gate_table_s gate_table[] = { struct gate_table_s gate_table[] = {
{ divide_error, DIVIDE_VECTOR, INTR_PRIVILEGE }, { divide_error, DIVIDE_VECTOR, INTR_PRIVILEGE },
@@ -238,7 +238,7 @@ PUBLIC void idt_init(void)
/*===========================================================================* /*===========================================================================*
* sdesc * * sdesc *
*===========================================================================*/ *===========================================================================*/
PRIVATE void sdesc(segdp, base, size) static void sdesc(segdp, base, size)
register struct segdesc_s *segdp; register struct segdesc_s *segdp;
phys_bytes base; phys_bytes base;
vir_bytes size; vir_bytes size;
@@ -263,7 +263,7 @@ vir_bytes size;
/*===========================================================================* /*===========================================================================*
* int_gate * * int_gate *
*===========================================================================*/ *===========================================================================*/
PUBLIC void int_gate(unsigned vec_nr, vir_bytes offset, unsigned dpl_type) void int_gate(unsigned vec_nr, vir_bytes offset, unsigned dpl_type)
{ {
/* Build descriptor for an interrupt gate. */ /* Build descriptor for an interrupt gate. */
register struct gatedesc_s *idp; register struct gatedesc_s *idp;
@@ -278,7 +278,7 @@ PUBLIC void int_gate(unsigned vec_nr, vir_bytes offset, unsigned dpl_type)
/*===========================================================================* /*===========================================================================*
* alloc_segments * * alloc_segments *
*===========================================================================*/ *===========================================================================*/
PUBLIC void alloc_segments(register struct proc *rp) void alloc_segments(register struct proc *rp)
{ {
/* This is called at system initialization from main() and by do_newmap(). /* This is called at system initialization from main() and by do_newmap().
* The code has a separate function because of all hardware-dependencies. * The code has a separate function because of all hardware-dependencies.
@@ -322,7 +322,7 @@ PUBLIC void alloc_segments(register struct proc *rp)
/*===========================================================================* /*===========================================================================*
* check_segments * * check_segments *
*===========================================================================*/ *===========================================================================*/
PRIVATE void check_segments(char *File, int line) static void check_segments(char *File, int line)
{ {
int checked = 0; int checked = 0;
int fail = 0; int fail = 0;
@@ -363,7 +363,7 @@ for (rp = BEG_PROC_ADDR; rp < END_PROC_ADDR; ++rp) {
/*===========================================================================* /*===========================================================================*
* printseg * * printseg *
*===========================================================================*/ *===========================================================================*/
PUBLIC void printseg(char *banner, const int iscs, struct proc *pr, void printseg(char *banner, const int iscs, struct proc *pr,
const u32_t selector) const u32_t selector)
{ {
#if USE_SYSDEBUG #if USE_SYSDEBUG
@@ -453,7 +453,7 @@ PUBLIC void printseg(char *banner, const int iscs, struct proc *pr,
/*===========================================================================* /*===========================================================================*
* prot_set_kern_seg_limit * * prot_set_kern_seg_limit *
*===========================================================================*/ *===========================================================================*/
PUBLIC int prot_set_kern_seg_limit(const vir_bytes limit) int prot_set_kern_seg_limit(const vir_bytes limit)
{ {
struct proc *rp; struct proc *rp;
int orig_click; int orig_click;

View File

@@ -42,7 +42,7 @@
/* Function prototype for PRIVATE functions. /* Function prototype for PRIVATE functions.
*/ */
FORWARD void load_update(void); static void load_update(void);
/* The CLOCK's timers queue. The functions in <timers.h> operate on this. /* The CLOCK's timers queue. The functions in <timers.h> operate on this.
* Each system process possesses a single synchronous alarm timer. If other * Each system process possesses a single synchronous alarm timer. If other
@@ -51,18 +51,18 @@ FORWARD void load_update(void);
* via (re)set_timer(). * via (re)set_timer().
* When a timer expires its watchdog function is run by the CLOCK task. * When a timer expires its watchdog function is run by the CLOCK task.
*/ */
PRIVATE timer_t *clock_timers; /* queue of CLOCK timers */ static timer_t *clock_timers; /* queue of CLOCK timers */
PRIVATE clock_t next_timeout; /* realtime that next timer expires */ static clock_t next_timeout; /* realtime that next timer expires */
/* The time is incremented by the interrupt handler on each clock tick. /* The time is incremented by the interrupt handler on each clock tick.
*/ */
PRIVATE clock_t realtime = 0; /* real time clock */ static clock_t realtime = 0; /* real time clock */
/* /*
* The boot processos timer interrupt handler. In addition to non-boot cpus it * The boot processos timer interrupt handler. In addition to non-boot cpus it
* keeps real time and notifies the clock task if need be * keeps real time and notifies the clock task if need be
*/ */
PUBLIC int timer_int_handler(void) int timer_int_handler(void)
{ {
/* Update user and system accounting times. Charge the current process /* Update user and system accounting times. Charge the current process
* for user time. If the current process is not billable, that is, if a * for user time. If the current process is not billable, that is, if a
@@ -153,7 +153,7 @@ PUBLIC int timer_int_handler(void)
/*===========================================================================* /*===========================================================================*
* get_uptime * * get_uptime *
*===========================================================================*/ *===========================================================================*/
PUBLIC clock_t get_uptime(void) clock_t get_uptime(void)
{ {
/* Get and return the current clock uptime in ticks. */ /* Get and return the current clock uptime in ticks. */
return(realtime); return(realtime);
@@ -162,7 +162,7 @@ PUBLIC clock_t get_uptime(void)
/*===========================================================================* /*===========================================================================*
* set_timer * * set_timer *
*===========================================================================*/ *===========================================================================*/
PUBLIC void set_timer(tp, exp_time, watchdog) void set_timer(tp, exp_time, watchdog)
struct timer *tp; /* pointer to timer structure */ struct timer *tp; /* pointer to timer structure */
clock_t exp_time; /* expiration realtime */ clock_t exp_time; /* expiration realtime */
tmr_func_t watchdog; /* watchdog to be called */ tmr_func_t watchdog; /* watchdog to be called */
@@ -177,7 +177,7 @@ tmr_func_t watchdog; /* watchdog to be called */
/*===========================================================================* /*===========================================================================*
* reset_timer * * reset_timer *
*===========================================================================*/ *===========================================================================*/
PUBLIC void reset_timer(tp) void reset_timer(tp)
struct timer *tp; /* pointer to timer structure */ struct timer *tp; /* pointer to timer structure */
{ {
/* The timer pointed to by 'tp' is no longer needed. Remove it from both the /* The timer pointed to by 'tp' is no longer needed. Remove it from both the
@@ -192,7 +192,7 @@ struct timer *tp; /* pointer to timer structure */
/*===========================================================================* /*===========================================================================*
* load_update * * load_update *
*===========================================================================*/ *===========================================================================*/
PRIVATE void load_update(void) static void load_update(void)
{ {
u16_t slot; u16_t slot;
int enqueued = 0, q; int enqueued = 0, q;
@@ -225,7 +225,7 @@ PRIVATE void load_update(void)
kloadinfo.last_clock = realtime; kloadinfo.last_clock = realtime;
} }
PUBLIC int boot_cpu_init_timer(unsigned freq) int boot_cpu_init_timer(unsigned freq)
{ {
if (init_local_timer(freq)) if (init_local_timer(freq))
return -1; return -1;
@@ -237,7 +237,7 @@ PUBLIC int boot_cpu_init_timer(unsigned freq)
return 0; return 0;
} }
PUBLIC int app_cpu_init_timer(unsigned freq) int app_cpu_init_timer(unsigned freq)
{ {
if (init_local_timer(freq)) if (init_local_timer(freq))
return -1; return -1;

Some files were not shown because too many files have changed in this diff Show More