[9] | 1 | /* Prototypes for system library functions. */
|
---|
| 2 |
|
---|
| 3 | #ifndef _SYSLIB_H
|
---|
| 4 | #define _SYSLIB_H
|
---|
| 5 |
|
---|
| 6 | #ifndef _TYPES_H
|
---|
| 7 | #include <sys/types.h>
|
---|
| 8 | #endif
|
---|
| 9 |
|
---|
| 10 | #ifndef _IPC_H
|
---|
| 11 | #include <minix/ipc.h>
|
---|
| 12 | #endif
|
---|
| 13 |
|
---|
| 14 | #ifndef _DEVIO_H
|
---|
| 15 | #include <minix/devio.h>
|
---|
| 16 | #endif
|
---|
| 17 |
|
---|
| 18 | /* Forward declaration */
|
---|
| 19 | struct reg86u;
|
---|
| 20 |
|
---|
| 21 | #define SYSTASK SYSTEM
|
---|
| 22 |
|
---|
| 23 | /*==========================================================================*
|
---|
| 24 | * Minix system library. *
|
---|
| 25 | *==========================================================================*/
|
---|
| 26 | _PROTOTYPE( int _taskcall, (int who, int syscallnr, message *msgptr));
|
---|
| 27 |
|
---|
| 28 | _PROTOTYPE( int sys_abort, (int how, ...));
|
---|
| 29 | _PROTOTYPE( int sys_enable_iop, (int proc));
|
---|
| 30 | _PROTOTYPE( int sys_exec, (int proc, char *ptr,
|
---|
| 31 | char *aout, vir_bytes initpc));
|
---|
| 32 | _PROTOTYPE( int sys_fork, (int parent, int child, int *));
|
---|
| 33 | _PROTOTYPE( int sys_newmap, (int proc, struct mem_map *ptr));
|
---|
| 34 | _PROTOTYPE( int sys_exit, (int proc));
|
---|
| 35 | _PROTOTYPE( int sys_trace, (int req, int proc, long addr, long *data_p));
|
---|
| 36 |
|
---|
| 37 | _PROTOTYPE( int sys_privctl, (int proc, int req, int i, void *p));
|
---|
| 38 | _PROTOTYPE( int sys_nice, (int proc, int priority));
|
---|
| 39 |
|
---|
| 40 | _PROTOTYPE( int sys_int86, (struct reg86u *reg86p));
|
---|
| 41 | _PROTOTYPE( int sys_vm_setbuf, (phys_bytes base, phys_bytes size,
|
---|
| 42 | phys_bytes high));
|
---|
| 43 | _PROTOTYPE( int sys_vm_map, (int proc_nr, int do_map,
|
---|
| 44 | phys_bytes base, phys_bytes size, phys_bytes offset));
|
---|
| 45 |
|
---|
| 46 | /* Shorthands for sys_sdevio() system call. */
|
---|
| 47 | #define sys_insb(port, proc_nr, buffer, count) \
|
---|
| 48 | sys_sdevio(DIO_INPUT, port, DIO_BYTE, proc_nr, buffer, count)
|
---|
| 49 | #define sys_insw(port, proc_nr, buffer, count) \
|
---|
| 50 | sys_sdevio(DIO_INPUT, port, DIO_WORD, proc_nr, buffer, count)
|
---|
| 51 | #define sys_outsb(port, proc_nr, buffer, count) \
|
---|
| 52 | sys_sdevio(DIO_OUTPUT, port, DIO_BYTE, proc_nr, buffer, count)
|
---|
| 53 | #define sys_outsw(port, proc_nr, buffer, count) \
|
---|
| 54 | sys_sdevio(DIO_OUTPUT, port, DIO_WORD, proc_nr, buffer, count)
|
---|
| 55 | _PROTOTYPE( int sys_sdevio, (int req, long port, int type, int proc_nr,
|
---|
| 56 | void *buffer, int count));
|
---|
| 57 |
|
---|
| 58 | /* Clock functionality: get system times or (un)schedule an alarm call. */
|
---|
| 59 | _PROTOTYPE( int sys_times, (int proc_nr, clock_t *ptr));
|
---|
| 60 | _PROTOTYPE(int sys_setalarm, (clock_t exp_time, int abs_time));
|
---|
| 61 |
|
---|
| 62 | /* Shorthands for sys_irqctl() system call. */
|
---|
| 63 | #define sys_irqdisable(hook_id) \
|
---|
| 64 | sys_irqctl(IRQ_DISABLE, 0, 0, hook_id)
|
---|
| 65 | #define sys_irqenable(hook_id) \
|
---|
| 66 | sys_irqctl(IRQ_ENABLE, 0, 0, hook_id)
|
---|
| 67 | #define sys_irqsetpolicy(irq_vec, policy, hook_id) \
|
---|
| 68 | sys_irqctl(IRQ_SETPOLICY, irq_vec, policy, hook_id)
|
---|
| 69 | #define sys_irqrmpolicy(irq_vec, hook_id) \
|
---|
| 70 | sys_irqctl(IRQ_RMPOLICY, irq_vec, 0, hook_id)
|
---|
| 71 | _PROTOTYPE ( int sys_irqctl, (int request, int irq_vec, int policy,
|
---|
| 72 | int *irq_hook_id) );
|
---|
| 73 |
|
---|
| 74 | /* Shorthands for sys_vircopy() and sys_physcopy() system calls. */
|
---|
| 75 | #define sys_biosin(bios_vir, dst_vir, bytes) \
|
---|
| 76 | sys_vircopy(SELF, BIOS_SEG, bios_vir, SELF, D, dst_vir, bytes)
|
---|
| 77 | #define sys_biosout(src_vir, bios_vir, bytes) \
|
---|
| 78 | sys_vircopy(SELF, D, src_vir, SELF, BIOS_SEG, bios_vir, bytes)
|
---|
| 79 | #define sys_datacopy(src_proc, src_vir, dst_proc, dst_vir, bytes) \
|
---|
| 80 | sys_vircopy(src_proc, D, src_vir, dst_proc, D, dst_vir, bytes)
|
---|
| 81 | #define sys_textcopy(src_proc, src_vir, dst_proc, dst_vir, bytes) \
|
---|
| 82 | sys_vircopy(src_proc, T, src_vir, dst_proc, T, dst_vir, bytes)
|
---|
| 83 | #define sys_stackcopy(src_proc, src_vir, dst_proc, dst_vir, bytes) \
|
---|
| 84 | sys_vircopy(src_proc, S, src_vir, dst_proc, S, dst_vir, bytes)
|
---|
| 85 | _PROTOTYPE(int sys_vircopy, (int src_proc, int src_seg, vir_bytes src_vir,
|
---|
| 86 | int dst_proc, int dst_seg, vir_bytes dst_vir, phys_bytes bytes));
|
---|
| 87 |
|
---|
| 88 | #define sys_abscopy(src_phys, dst_phys, bytes) \
|
---|
| 89 | sys_physcopy(NONE, PHYS_SEG, src_phys, NONE, PHYS_SEG, dst_phys, bytes)
|
---|
| 90 | _PROTOTYPE(int sys_physcopy, (int src_proc, int src_seg, vir_bytes src_vir,
|
---|
| 91 | int dst_proc, int dst_seg, vir_bytes dst_vir, phys_bytes bytes));
|
---|
| 92 | _PROTOTYPE(int sys_memset, (unsigned long pattern,
|
---|
| 93 | phys_bytes base, phys_bytes bytes));
|
---|
| 94 |
|
---|
| 95 | /* Vectored virtual / physical copy calls. */
|
---|
| 96 | #if DEAD_CODE /* library part not yet implemented */
|
---|
| 97 | _PROTOTYPE(int sys_virvcopy, (phys_cp_req *vec_ptr,int vec_size,int *nr_ok));
|
---|
| 98 | _PROTOTYPE(int sys_physvcopy, (phys_cp_req *vec_ptr,int vec_size,int *nr_ok));
|
---|
| 99 | #endif
|
---|
| 100 |
|
---|
| 101 | _PROTOTYPE(int sys_umap, (int proc_nr, int seg, vir_bytes vir_addr,
|
---|
| 102 | vir_bytes bytes, phys_bytes *phys_addr));
|
---|
| 103 | _PROTOTYPE(int sys_segctl, (int *index, u16_t *seg, vir_bytes *off,
|
---|
| 104 | phys_bytes phys, vir_bytes size));
|
---|
| 105 |
|
---|
| 106 | /* Shorthands for sys_getinfo() system call. */
|
---|
| 107 | #define sys_getkmessages(dst) sys_getinfo(GET_KMESSAGES, dst, 0,0,0)
|
---|
| 108 | #define sys_getkinfo(dst) sys_getinfo(GET_KINFO, dst, 0,0,0)
|
---|
| 109 | #define sys_getloadinfo(dst) sys_getinfo(GET_LOADINFO, dst, 0,0,0)
|
---|
| 110 | #define sys_getmachine(dst) sys_getinfo(GET_MACHINE, dst, 0,0,0)
|
---|
| 111 | #define sys_getproctab(dst) sys_getinfo(GET_PROCTAB, dst, 0,0,0)
|
---|
| 112 | #define sys_getprivtab(dst) sys_getinfo(GET_PRIVTAB, dst, 0,0,0)
|
---|
| 113 | #define sys_getproc(dst,nr) sys_getinfo(GET_PROC, dst, 0,0, nr)
|
---|
| 114 | #define sys_getrandomness(dst) sys_getinfo(GET_RANDOMNESS, dst, 0,0,0)
|
---|
| 115 | #define sys_getimage(dst) sys_getinfo(GET_IMAGE, dst, 0,0,0)
|
---|
| 116 | #define sys_getirqhooks(dst) sys_getinfo(GET_IRQHOOKS, dst, 0,0,0)
|
---|
| 117 | #define sys_getirqactids(dst) sys_getinfo(GET_IRQACTIDS, dst, 0,0,0)
|
---|
| 118 | #define sys_getmonparams(v,vl) sys_getinfo(GET_MONPARAMS, v,vl, 0,0)
|
---|
| 119 | #define sys_getschedinfo(v1,v2) sys_getinfo(GET_SCHEDINFO, v1,0, v2,0)
|
---|
| 120 | #define sys_getlocktimings(dst) sys_getinfo(GET_LOCKTIMING, dst, 0,0,0)
|
---|
| 121 | #define sys_getbiosbuffer(virp, sizep) sys_getinfo(GET_BIOSBUFFER, virp, \
|
---|
| 122 | sizeof(*virp), sizep, sizeof(*sizep))
|
---|
| 123 | _PROTOTYPE(int sys_getinfo, (int request, void *val_ptr, int val_len,
|
---|
| 124 | void *val_ptr2, int val_len2) );
|
---|
| 125 |
|
---|
| 126 | /* Signal control. */
|
---|
| 127 | _PROTOTYPE(int sys_kill, (int proc, int sig) );
|
---|
| 128 | _PROTOTYPE(int sys_sigsend, (int proc_nr, struct sigmsg *sig_ctxt) );
|
---|
| 129 | _PROTOTYPE(int sys_sigreturn, (int proc_nr, struct sigmsg *sig_ctxt) );
|
---|
| 130 | _PROTOTYPE(int sys_getksig, (int *k_proc_nr, sigset_t *k_sig_map) );
|
---|
| 131 | _PROTOTYPE(int sys_endksig, (int proc_nr) );
|
---|
| 132 |
|
---|
| 133 | /* NOTE: two different approaches were used to distinguish the device I/O
|
---|
| 134 | * types 'byte', 'word', 'long': the latter uses #define and results in a
|
---|
| 135 | * smaller implementation, but looses the static type checking.
|
---|
| 136 | */
|
---|
| 137 | _PROTOTYPE(int sys_voutb, (pvb_pair_t *pvb_pairs, int nr_ports) );
|
---|
| 138 | _PROTOTYPE(int sys_voutw, (pvw_pair_t *pvw_pairs, int nr_ports) );
|
---|
| 139 | _PROTOTYPE(int sys_voutl, (pvl_pair_t *pvl_pairs, int nr_ports) );
|
---|
| 140 | _PROTOTYPE(int sys_vinb, (pvb_pair_t *pvb_pairs, int nr_ports) );
|
---|
| 141 | _PROTOTYPE(int sys_vinw, (pvw_pair_t *pvw_pairs, int nr_ports) );
|
---|
| 142 | _PROTOTYPE(int sys_vinl, (pvl_pair_t *pvl_pairs, int nr_ports) );
|
---|
| 143 |
|
---|
| 144 | /* Shorthands for sys_out() system call. */
|
---|
| 145 | #define sys_outb(p,v) sys_out((p), (unsigned long) (v), DIO_BYTE)
|
---|
| 146 | #define sys_outw(p,v) sys_out((p), (unsigned long) (v), DIO_WORD)
|
---|
| 147 | #define sys_outl(p,v) sys_out((p), (unsigned long) (v), DIO_LONG)
|
---|
| 148 | _PROTOTYPE(int sys_out, (int port, unsigned long value, int type) );
|
---|
| 149 |
|
---|
| 150 | /* Shorthands for sys_in() system call. */
|
---|
| 151 | #define sys_inb(p,v) sys_in((p), (v), DIO_BYTE)
|
---|
| 152 | #define sys_inw(p,v) sys_in((p), (v), DIO_WORD)
|
---|
| 153 | #define sys_inl(p,v) sys_in((p), (v), DIO_LONG)
|
---|
| 154 | _PROTOTYPE(int sys_in, (int port, unsigned long *value, int type) );
|
---|
| 155 |
|
---|
| 156 | /* pci.c */
|
---|
| 157 | _PROTOTYPE( void pci_init, (void) );
|
---|
| 158 | _PROTOTYPE( void pci_init1, (char *name) );
|
---|
| 159 | _PROTOTYPE( int pci_first_dev, (int *devindp, u16_t *vidp, u16_t *didp) );
|
---|
| 160 | _PROTOTYPE( int pci_next_dev, (int *devindp, u16_t *vidp, u16_t *didp) );
|
---|
| 161 | _PROTOTYPE( int pci_find_dev, (U8_t bus, U8_t dev, U8_t func,
|
---|
| 162 | int *devindp) );
|
---|
| 163 | _PROTOTYPE( void pci_reserve, (int devind) );
|
---|
| 164 | _PROTOTYPE( void pci_ids, (int devind, u16_t *vidp, u16_t *didp) );
|
---|
| 165 | _PROTOTYPE( void pci_rescan_bus, (U8_t busnr) );
|
---|
| 166 | _PROTOTYPE( u8_t pci_attr_r8, (int devind, int port) );
|
---|
| 167 | _PROTOTYPE( u16_t pci_attr_r16, (int devind, int port) );
|
---|
| 168 | _PROTOTYPE( u32_t pci_attr_r32, (int devind, int port) );
|
---|
| 169 | _PROTOTYPE( void pci_attr_w8, (int devind, int port, U8_t value) );
|
---|
| 170 | _PROTOTYPE( void pci_attr_w16, (int devind, int port, U16_t value) );
|
---|
| 171 | _PROTOTYPE( void pci_attr_w32, (int devind, int port, u32_t value) );
|
---|
| 172 | _PROTOTYPE( char *pci_dev_name, (U16_t vid, U16_t did) );
|
---|
| 173 | _PROTOTYPE( char *pci_slot_name, (int devind) );
|
---|
| 174 |
|
---|
| 175 | #endif /* _SYSLIB_H */
|
---|
| 176 |
|
---|