Retired DEV_{READ,WRITE,GATHER,SCATTER,IOCTL} (safe versions *_S are to
be used and drivers should never receieve these 'unsafe' variants any more).
This commit is contained in:
+12
-13
@@ -1051,7 +1051,7 @@ PRIVATE int w_io_test(void)
|
||||
if (w_prepare(w_drive * DEV_PER_DRIVE) == NIL_DEV)
|
||||
panic(w_name(), "Couldn't switch devices", NO_NUM);
|
||||
|
||||
r = w_transfer(SELF, DEV_GATHER, cvu64(0), &iov, 1, 0);
|
||||
r = w_transfer(SELF, DEV_GATHER_S, cvu64(0), &iov, 1, 0);
|
||||
|
||||
/* Switch back. */
|
||||
if (w_prepare(save_dev) == NIL_DEV)
|
||||
@@ -1142,21 +1142,21 @@ PRIVATE int do_transfer(struct wini *wn, unsigned int precomp,
|
||||
cmd.count = count;
|
||||
if (do_dma)
|
||||
{
|
||||
cmd.command = opcode == DEV_SCATTER ? CMD_WRITE_DMA :
|
||||
cmd.command = opcode == DEV_SCATTER_S ? CMD_WRITE_DMA :
|
||||
CMD_READ_DMA;
|
||||
}
|
||||
else
|
||||
cmd.command = opcode == DEV_SCATTER ? CMD_WRITE : CMD_READ;
|
||||
cmd.command = opcode == DEV_SCATTER_S ? CMD_WRITE : CMD_READ;
|
||||
|
||||
if (do_lba48) {
|
||||
if (do_dma)
|
||||
{
|
||||
cmd.command = ((opcode == DEV_SCATTER) ?
|
||||
cmd.command = ((opcode == DEV_SCATTER_S) ?
|
||||
CMD_WRITE_DMA_EXT : CMD_READ_DMA_EXT);
|
||||
}
|
||||
else
|
||||
{
|
||||
cmd.command = ((opcode == DEV_SCATTER) ?
|
||||
cmd.command = ((opcode == DEV_SCATTER_S) ?
|
||||
CMD_WRITE_EXT : CMD_READ_EXT);
|
||||
}
|
||||
cmd.count_prev= (count >> 8);
|
||||
@@ -1193,7 +1193,7 @@ PRIVATE int do_transfer(struct wini *wn, unsigned int precomp,
|
||||
*===========================================================================*/
|
||||
PRIVATE int w_transfer(proc_nr, opcode, position, iov, nr_req, safe)
|
||||
int proc_nr; /* process doing the request */
|
||||
int opcode; /* DEV_GATHER or DEV_SCATTER */
|
||||
int opcode; /* DEV_GATHER_S or DEV_SCATTER_S */
|
||||
u64_t position; /* offset on device to read or write */
|
||||
iovec_t *iov; /* pointer to read or write request vector */
|
||||
unsigned nr_req; /* length of request vector */
|
||||
@@ -1232,7 +1232,7 @@ int safe; /* iov contains addresses (0) or grants? */
|
||||
block = div64u(add64(w_dv->dv_base, position), SECTOR_SIZE);
|
||||
|
||||
do_dma= wn->dma;
|
||||
do_write= (opcode == DEV_SCATTER);
|
||||
do_write= (opcode == DEV_SCATTER_S);
|
||||
|
||||
if (nbytes >= wn->max_count) {
|
||||
/* The drive can't do more then max_count at once. */
|
||||
@@ -1254,7 +1254,7 @@ int safe; /* iov contains addresses (0) or grants? */
|
||||
r = do_transfer(wn, wn->precomp, (nbytes >> SECTOR_SHIFT),
|
||||
block, opcode, do_dma);
|
||||
|
||||
if (opcode == DEV_SCATTER) {
|
||||
if (opcode == DEV_SCATTER_S) {
|
||||
/* The specs call for a 400 ns wait after issuing the command.
|
||||
* Reading the alternate status register is the suggested
|
||||
* way to implement this wait.
|
||||
@@ -1355,7 +1355,7 @@ int safe; /* iov contains addresses (0) or grants? */
|
||||
* interrupt (write).
|
||||
*/
|
||||
|
||||
if (opcode == DEV_GATHER) {
|
||||
if (opcode == DEV_GATHER_S) {
|
||||
/* First an interrupt, then data. */
|
||||
if ((r = at_intr_wait()) != OK) {
|
||||
/* An error, send data to the bit bucket. */
|
||||
@@ -1380,7 +1380,7 @@ int safe; /* iov contains addresses (0) or grants? */
|
||||
if (!w_waitfor(STATUS_DRQ, STATUS_DRQ)) { r = ERR; break; }
|
||||
|
||||
/* Copy bytes to or from the device's buffer. */
|
||||
if (opcode == DEV_GATHER) {
|
||||
if (opcode == DEV_GATHER_S) {
|
||||
if(safe) {
|
||||
s=sys_safe_insw(wn->base_cmd + REG_DATA, proc_nr,
|
||||
(void *) (iov->iov_addr), addr_offset,
|
||||
@@ -2123,7 +2123,7 @@ void sense_request(void)
|
||||
*===========================================================================*/
|
||||
PRIVATE int atapi_transfer(proc_nr, opcode, position, iov, nr_req, safe)
|
||||
int proc_nr; /* process doing the request */
|
||||
int opcode; /* DEV_GATHER or DEV_SCATTER */
|
||||
int opcode; /* DEV_GATHER_S or DEV_SCATTER_S */
|
||||
u64_t position; /* offset on device to read or write */
|
||||
iovec_t *iov; /* pointer to read or write request vector */
|
||||
unsigned nr_req; /* length of request vector */
|
||||
@@ -2344,9 +2344,8 @@ int safe;
|
||||
{
|
||||
int r, timeout, prev;
|
||||
|
||||
if (m->m_type != DEV_IOCTL && m->m_type != DEV_IOCTL_S ) {
|
||||
if (m->m_type != DEV_IOCTL_S )
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
if (m->REQUEST == DIOCTIMEOUT) {
|
||||
if(safe) {
|
||||
|
||||
@@ -260,7 +260,7 @@ int safe; /* use safecopies? */
|
||||
/* Degrade to per-sector mode if there were errors. */
|
||||
if (errors > 0) nbytes = SECTOR_SIZE;
|
||||
|
||||
if (opcode == DEV_SCATTER) {
|
||||
if (opcode == DEV_SCATTER_S) {
|
||||
/* Copy from user space to the DMA buffer. */
|
||||
count = 0;
|
||||
for (iop = iov; count < nbytes; iop++) {
|
||||
@@ -294,7 +294,7 @@ int safe; /* use safecopies? */
|
||||
|
||||
/* Set up an extended read or write BIOS call. */
|
||||
reg86.u.b.intno = 0x13;
|
||||
reg86.u.w.ax = opcode == DEV_SCATTER ? 0x4300 : 0x4200;
|
||||
reg86.u.w.ax = opcode == DEV_SCATTER_S ? 0x4300 : 0x4200;
|
||||
reg86.u.b.dl = wn->drive_id;
|
||||
reg86.u.w.si = (bios_buf_phys + i13e_rw_off) % HCLICK_SIZE;
|
||||
reg86.u.w.ds = (bios_buf_phys + i13e_rw_off) / HCLICK_SIZE;
|
||||
@@ -305,7 +305,7 @@ int safe; /* use safecopies? */
|
||||
unsigned head = (block % secspcyl) / wn->sectors;
|
||||
|
||||
reg86.u.b.intno = 0x13;
|
||||
reg86.u.b.ah = opcode == DEV_SCATTER ? 0x03 : 0x02;
|
||||
reg86.u.b.ah = opcode == DEV_SCATTER_S ? 0x03 : 0x02;
|
||||
reg86.u.b.al = nbytes >> SECTOR_SHIFT;
|
||||
reg86.u.w.bx = bios_buf_phys % HCLICK_SIZE;
|
||||
reg86.u.w.es = bios_buf_phys / HCLICK_SIZE;
|
||||
@@ -325,7 +325,7 @@ int safe; /* use safecopies? */
|
||||
continue;
|
||||
}
|
||||
|
||||
if (opcode == DEV_GATHER) {
|
||||
if (opcode == DEV_GATHER_S) {
|
||||
/* Copy from the DMA buffer to user space. */
|
||||
count = 0;
|
||||
for (iop = iov; count < nbytes; iop++) {
|
||||
@@ -553,9 +553,8 @@ int safe;
|
||||
{
|
||||
int r, timeout, prev;
|
||||
|
||||
if (m->m_type != DEV_IOCTL && m->m_type != DEV_IOCTL_S ) {
|
||||
if (m->m_type != DEV_IOCTL_S )
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
if (m->REQUEST == DIOCOPENCT) {
|
||||
int count;
|
||||
|
||||
@@ -435,7 +435,7 @@ PRIVATE void f_cleanup()
|
||||
*===========================================================================*/
|
||||
PRIVATE int f_transfer(proc_nr, opcode, pos64, iov, nr_req, safe)
|
||||
int proc_nr; /* process doing the request */
|
||||
int opcode; /* DEV_GATHER or DEV_SCATTER */
|
||||
int opcode; /* DEV_GATHER_S or DEV_SCATTER_S */
|
||||
u64_t pos64; /* offset on device to read or write */
|
||||
iovec_t *iov; /* pointer to read or write request vector */
|
||||
unsigned nr_req; /* length of request vector */
|
||||
@@ -482,7 +482,7 @@ int safe;
|
||||
|
||||
/* Using a formatting device? */
|
||||
if (f_device & FORMAT_DEV_BIT) {
|
||||
if (opcode != DEV_SCATTER) return(EIO);
|
||||
if (opcode != DEV_SCATTER_S) return(EIO);
|
||||
if (iov->iov_size < SECTOR_SIZE + sizeof(fmt_param))
|
||||
return(EINVAL);
|
||||
|
||||
@@ -592,7 +592,7 @@ int safe;
|
||||
}
|
||||
}
|
||||
|
||||
if (r == OK && opcode == DEV_SCATTER) {
|
||||
if (r == OK && opcode == DEV_SCATTER_S) {
|
||||
/* Copy the user bytes to the DMA buffer. */
|
||||
if(safe) {
|
||||
s=sys_safecopyfrom(proc_nr, *ug, *up,
|
||||
@@ -619,7 +619,7 @@ int safe;
|
||||
r = fdc_transfer(opcode);
|
||||
}
|
||||
|
||||
if (r == OK && opcode == DEV_GATHER) {
|
||||
if (r == OK && opcode == DEV_GATHER_S) {
|
||||
/* Copy the DMA buffer to user space. */
|
||||
if(safe) {
|
||||
s=sys_safecopyto(proc_nr, *ug, *up,
|
||||
@@ -678,7 +678,7 @@ int safe;
|
||||
* dma_setup *
|
||||
*===========================================================================*/
|
||||
PRIVATE int dma_setup(opcode)
|
||||
int opcode; /* DEV_GATHER or DEV_SCATTER */
|
||||
int opcode; /* DEV_GATHER_S or DEV_SCATTER_S */
|
||||
{
|
||||
/* 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
|
||||
@@ -706,7 +706,7 @@ int opcode; /* DEV_GATHER or DEV_SCATTER */
|
||||
*/
|
||||
pv_set(byte_out[0], DMA_INIT, DMA_RESET_VAL); /* reset the dma controller */
|
||||
pv_set(byte_out[1], DMA_FLIPFLOP, 0); /* write anything to reset it */
|
||||
pv_set(byte_out[2], DMA_MODE, opcode == DEV_SCATTER ? DMA_WRITE : DMA_READ);
|
||||
pv_set(byte_out[2], DMA_MODE, opcode == DEV_SCATTER_S ? DMA_WRITE : DMA_READ);
|
||||
pv_set(byte_out[3], DMA_ADDR, (unsigned) tmp_phys >> 0);
|
||||
pv_set(byte_out[4], DMA_ADDR, (unsigned) tmp_phys >> 8);
|
||||
pv_set(byte_out[5], DMA_TOP, (unsigned) (tmp_phys >> 16));
|
||||
@@ -857,7 +857,7 @@ PRIVATE int seek()
|
||||
* fdc_transfer *
|
||||
*===========================================================================*/
|
||||
PRIVATE int fdc_transfer(opcode)
|
||||
int opcode; /* DEV_GATHER or DEV_SCATTER */
|
||||
int opcode; /* DEV_GATHER_S or DEV_SCATTER_S */
|
||||
{
|
||||
/* The drive is now on the proper cylinder. Read, write or format 1 block. */
|
||||
|
||||
@@ -880,7 +880,7 @@ int opcode; /* DEV_GATHER or DEV_SCATTER */
|
||||
cmd[5] = fmt_param.fill_byte_for_format;
|
||||
if (fdc_command(cmd, 6) != OK) return(ERR_TRANSFER);
|
||||
} else {
|
||||
cmd[0] = opcode == DEV_SCATTER ? FDC_WRITE : FDC_READ;
|
||||
cmd[0] = opcode == DEV_SCATTER_S ? FDC_WRITE : FDC_READ;
|
||||
cmd[1] = (fp->fl_head << 2) | f_drive;
|
||||
cmd[2] = fp->fl_cylinder;
|
||||
cmd[3] = fp->fl_head;
|
||||
@@ -1312,7 +1312,7 @@ int density;
|
||||
position = (off_t) f_dp->test << SECTOR_SHIFT;
|
||||
iovec1.iov_addr = (vir_bytes) tmp_buf;
|
||||
iovec1.iov_size = SECTOR_SIZE;
|
||||
result = f_transfer(SELF, DEV_GATHER, cvul64(position), &iovec1, 1, 0);
|
||||
result = f_transfer(SELF, DEV_GATHER_S, cvul64(position), &iovec1, 1, 0);
|
||||
|
||||
if (iovec1.iov_size != 0) return(EIO);
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
* driver_task: called by the device dependent task entry
|
||||
*/
|
||||
|
||||
|
||||
#include "../drivers.h"
|
||||
#include <sys/ioc_disk.h>
|
||||
#include <minix/mq.h>
|
||||
@@ -113,16 +114,22 @@ struct driver *dp; /* Device dependent entry points. */
|
||||
switch(mess.m_type) {
|
||||
case DEV_OPEN: r = (*dp->dr_open)(dp, &mess); break;
|
||||
case DEV_CLOSE: r = (*dp->dr_close)(dp, &mess); break;
|
||||
#ifdef DEV_IOCTL
|
||||
case DEV_IOCTL: r = (*dp->dr_ioctl)(dp, &mess, 0); break;
|
||||
#endif
|
||||
case DEV_IOCTL_S: r = (*dp->dr_ioctl)(dp, &mess, 1); break;
|
||||
case CANCEL: r = (*dp->dr_cancel)(dp, &mess);break;
|
||||
case DEV_SELECT: r = (*dp->dr_select)(dp, &mess);break;
|
||||
#ifdef DEV_READ
|
||||
case DEV_READ:
|
||||
case DEV_WRITE: r = do_rdwt(dp, &mess, 0); break;
|
||||
#endif
|
||||
case DEV_READ_S:
|
||||
case DEV_WRITE_S: r = do_rdwt(dp, &mess, 1); break;
|
||||
#ifdef DEV_GATHER
|
||||
case DEV_GATHER:
|
||||
case DEV_SCATTER: r = do_vrdwt(dp, &mess, 0); break;
|
||||
#endif
|
||||
case DEV_GATHER_S:
|
||||
case DEV_SCATTER_S: r = do_vrdwt(dp, &mess, 1); break;
|
||||
|
||||
@@ -212,8 +219,12 @@ int safe; /* use safecopies? */
|
||||
if ((*dp->dr_prepare)(mp->DEVICE) == NIL_DEV) return(ENXIO);
|
||||
|
||||
/* Create a one element scatter/gather vector for the buffer. */
|
||||
if(mp->m_type == DEV_READ || mp->m_type == DEV_READ_S) opcode = DEV_GATHER;
|
||||
else opcode = DEV_SCATTER;
|
||||
if(
|
||||
#ifdef DEV_READ
|
||||
mp->m_type == DEV_READ ||
|
||||
#endif
|
||||
mp->m_type == DEV_READ_S) opcode = DEV_GATHER_S;
|
||||
else opcode = DEV_SCATTER_S;
|
||||
|
||||
iovec1.iov_addr = (vir_bytes) mp->ADDRESS;
|
||||
iovec1.iov_size = mp->COUNT;
|
||||
@@ -272,8 +283,6 @@ int safe; /* use safecopies? */
|
||||
|
||||
/* Transfer bytes from/to the device. */
|
||||
opcode = mp->m_type;
|
||||
if(opcode == DEV_GATHER_S) opcode = DEV_GATHER;
|
||||
if(opcode == DEV_SCATTER_S) opcode = DEV_SCATTER;
|
||||
position= make64(mp->POSITION, mp->HIGHPOS);
|
||||
r = (*dp->dr_transfer)(mp->IO_ENDPT, opcode, position, iov,
|
||||
nr_req, safe);
|
||||
@@ -319,7 +328,10 @@ message *mp;
|
||||
switch (mp->m_type) {
|
||||
case DEV_OPEN: return(ENODEV);
|
||||
case DEV_CLOSE: return(OK);
|
||||
case DEV_IOCTL_S:
|
||||
#ifdef DEV_IOCTL
|
||||
case DEV_IOCTL: return(ENOTTY);
|
||||
#endif
|
||||
default: printf("nop: ignoring code %d\n", mp->m_type); return(EIO);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ struct part_entry *table; /* four entries */
|
||||
iovec1.iov_addr = (vir_bytes) partbuf;
|
||||
iovec1.iov_size = CD_SECTOR_SIZE;
|
||||
if ((*dp->dr_prepare)(device) != NIL_DEV) {
|
||||
(void) (*dp->dr_transfer)(SELF, DEV_GATHER, position, &iovec1, 1, 0);
|
||||
(void) (*dp->dr_transfer)(SELF, DEV_GATHER_S, position, &iovec1, 1, 0);
|
||||
}
|
||||
if (iovec1.iov_size != 0) {
|
||||
return 0;
|
||||
|
||||
+2
-2
@@ -226,7 +226,7 @@ subread(struct logdevice *log, int count, int proc_nr,
|
||||
*===========================================================================*/
|
||||
PRIVATE int log_transfer(proc_nr, opcode, position, iov, nr_req, safe)
|
||||
int proc_nr; /* process doing the request */
|
||||
int opcode; /* DEV_GATHER or DEV_SCATTER */
|
||||
int opcode; /* DEV_GATHER_S or DEV_SCATTER_S */
|
||||
u64_t position; /* offset on device to read or write */
|
||||
iovec_t *iov; /* pointer to read or write request vector */
|
||||
unsigned nr_req; /* length of request vector */
|
||||
@@ -258,7 +258,7 @@ int safe; /* safe copies? */
|
||||
switch (log_device) {
|
||||
|
||||
case MINOR_KLOG:
|
||||
if (opcode == DEV_GATHER) {
|
||||
if (opcode == DEV_GATHER_S) {
|
||||
if (log->log_proc_nr || count < 1) {
|
||||
/* There's already someone hanging to read, or
|
||||
* no real I/O requested.
|
||||
|
||||
@@ -121,7 +121,7 @@ int device;
|
||||
*===========================================================================*/
|
||||
PRIVATE int m_transfer(proc_nr, opcode, pos64, iov, nr_req, safe)
|
||||
int proc_nr; /* process doing the request */
|
||||
int opcode; /* DEV_GATHER or DEV_SCATTER */
|
||||
int opcode; /* DEV_GATHER_S or DEV_SCATTER_S */
|
||||
u64_t pos64; /* offset on device to read or write */
|
||||
iovec_t *iov; /* pointer to read or write request vector */
|
||||
unsigned nr_req; /* length of request vector */
|
||||
@@ -158,7 +158,7 @@ int safe; /* safe copies */
|
||||
|
||||
/* No copying; ignore request. */
|
||||
case NULL_DEV:
|
||||
if (opcode == DEV_GATHER) return(OK); /* always at EOF */
|
||||
if (opcode == DEV_GATHER_S) return(OK); /* always at EOF */
|
||||
break;
|
||||
|
||||
/* Virtual copying. For RAM disk, kernel memory and boot device. */
|
||||
@@ -169,7 +169,7 @@ int safe; /* safe copies */
|
||||
if (position + count > dv_size) count = dv_size - position;
|
||||
seg = m_seg[m_device];
|
||||
|
||||
if (opcode == DEV_GATHER) { /* copy actual data */
|
||||
if (opcode == DEV_GATHER_S) { /* copy actual data */
|
||||
if(safe) {
|
||||
r=sys_safecopyto(proc_nr, user_vir, vir_offset,
|
||||
position, count, seg);
|
||||
@@ -201,7 +201,7 @@ int safe; /* safe copies */
|
||||
panic("MEM","sys_umap failed in m_transfer",r);
|
||||
}
|
||||
|
||||
if (opcode == DEV_GATHER) { /* copy data */
|
||||
if (opcode == DEV_GATHER_S) { /* copy data */
|
||||
sys_physcopy(NONE, PHYS_SEG, mem_phys,
|
||||
NONE, PHYS_SEG, user_phys + vir_offset, count);
|
||||
} else {
|
||||
@@ -212,7 +212,7 @@ int safe; /* safe copies */
|
||||
|
||||
/* Null byte stream generator. */
|
||||
case ZERO_DEV:
|
||||
if (opcode == DEV_GATHER) {
|
||||
if (opcode == DEV_GATHER_S) {
|
||||
size_t suboffset = 0;
|
||||
left = count;
|
||||
while (left > 0) {
|
||||
@@ -237,7 +237,7 @@ int safe; /* safe copies */
|
||||
if (position >= dv_size) return(OK); /* check for EOF */
|
||||
if (position + count > dv_size) count = dv_size - position;
|
||||
|
||||
if (opcode == DEV_GATHER) { /* copy actual data */
|
||||
if (opcode == DEV_GATHER_S) { /* copy actual data */
|
||||
if(safe) {
|
||||
s=sys_safecopyto(proc_nr, user_vir, vir_offset,
|
||||
(vir_bytes)&imgrd[position], count, D);
|
||||
|
||||
@@ -140,7 +140,6 @@ PUBLIC void main(void)
|
||||
case DEV_CLOSE:
|
||||
reply(TASK_REPLY, pr_mess.m_source, pr_mess.IO_ENDPT, OK);
|
||||
break;
|
||||
case DEV_WRITE: do_write(&pr_mess, 0); break;
|
||||
case DEV_WRITE_S: do_write(&pr_mess, 1); break;
|
||||
case DEV_STATUS: do_status(&pr_mess); break;
|
||||
case CANCEL: do_cancel(&pr_mess); break;
|
||||
|
||||
@@ -122,12 +122,12 @@ int safe; /* safe copies? */
|
||||
|
||||
/* Random number generator. Character instead of block device. */
|
||||
case RANDOM_DEV:
|
||||
if (opcode == DEV_GATHER && !random_isseeded())
|
||||
if (opcode == DEV_GATHER_S && !random_isseeded())
|
||||
return(EAGAIN);
|
||||
left = count;
|
||||
while (left > 0) {
|
||||
chunk = (left > RANDOM_BUF_SIZE) ? RANDOM_BUF_SIZE : left;
|
||||
if (opcode == DEV_GATHER) {
|
||||
if (opcode == DEV_GATHER_S) {
|
||||
random_getbytes(random_buf, chunk);
|
||||
if(safe) {
|
||||
r= sys_safecopyto(proc_nr, user_vir, vir_offset,
|
||||
@@ -143,7 +143,7 @@ int safe; /* safe copies? */
|
||||
sys_vircopy(SELF, D, (vir_bytes) random_buf,
|
||||
proc_nr, D, user_vir + vir_offset, chunk);
|
||||
}
|
||||
} else if (opcode == DEV_SCATTER) {
|
||||
} else if (opcode == DEV_SCATTER_S) {
|
||||
if(safe) {
|
||||
r= sys_safecopyfrom(proc_nr, user_vir, vir_offset,
|
||||
(vir_bytes) random_buf, chunk, D);
|
||||
|
||||
@@ -101,10 +101,14 @@ PUBLIC void main()
|
||||
switch(mess.m_type) {
|
||||
case DEV_OPEN: r = dsp_open(); break;
|
||||
case DEV_CLOSE: r = dsp_close(); break;
|
||||
#ifdef DEV_IOCTL
|
||||
case DEV_IOCTL: r = dsp_ioctl(&mess); break;
|
||||
#endif
|
||||
#ifdef DEV_READ
|
||||
|
||||
case DEV_READ: r = EINVAL; break; /* Not yet implemented */
|
||||
case DEV_WRITE: dsp_write(&mess); continue; /* don't reply */
|
||||
#endif
|
||||
|
||||
case DEV_STATUS: dsp_status(&mess); continue; /* don't reply */
|
||||
case HARD_INT: dsp_hardware_msg(); continue; /* don't reply */
|
||||
@@ -226,7 +230,7 @@ message *m_ptr;
|
||||
|
||||
if(DmaBusy < 0) { /* Dma tranfer not yet started */
|
||||
|
||||
DmaMode = DEV_WRITE; /* Dma mode is writing */
|
||||
DmaMode = DEV_WRITE_S; /* Dma mode is writing */
|
||||
sys_datacopy(m_ptr->IO_ENDPT, (vir_bytes)m_ptr->ADDRESS, SELF, (vir_bytes)DmaPtr, (phys_bytes)DspFragmentSize);
|
||||
dsp_dma_setup(DmaPhys, DspFragmentSize * DMA_NR_OF_BUFFERS);
|
||||
dsp_setup();
|
||||
@@ -578,7 +582,7 @@ int count;
|
||||
pv_set(pvb[1], DMA8_CLEAR, 0x00); /* Clear flip flop */
|
||||
|
||||
/* set DMA mode */
|
||||
pv_set(pvb[2], DMA8_MODE, (DmaMode == DEV_WRITE ? DMA8_AUTO_PLAY : DMA8_AUTO_REC));
|
||||
pv_set(pvb[2], DMA8_MODE, (DmaMode == DEV_WRITE_S ? DMA8_AUTO_PLAY : DMA8_AUTO_REC));
|
||||
|
||||
pv_set(pvb[3], DMA8_ADDR, address >> 0); /* Low_byte of address */
|
||||
pv_set(pvb[4], DMA8_ADDR, address >> 8); /* High byte of address */
|
||||
@@ -596,7 +600,7 @@ int count;
|
||||
pv_set(pvb[1], DMA16_CLEAR, 0x00); /* Clear flip flop */
|
||||
|
||||
/* Set dma mode */
|
||||
pv_set(pvb[2], DMA16_MODE, (DmaMode == DEV_WRITE ? DMA16_AUTO_PLAY : DMA16_AUTO_REC));
|
||||
pv_set(pvb[2], DMA16_MODE, (DmaMode == DEV_WRITE_S ? DMA16_AUTO_PLAY : DMA16_AUTO_REC));
|
||||
|
||||
pv_set(pvb[3], DMA16_ADDR, (address >> 1) & 0xFF); /* Low_byte of address */
|
||||
pv_set(pvb[4], DMA16_ADDR, (address >> 9) & 0xFF); /* High byte of address */
|
||||
@@ -619,7 +623,7 @@ PRIVATE void dsp_setup()
|
||||
dsp_set_speed(DspSpeed);
|
||||
|
||||
/* Put the speaker on */
|
||||
if(DmaMode == DEV_WRITE) {
|
||||
if(DmaMode == DEV_WRITE_S) {
|
||||
dsp_command (DSP_CMD_SPKON); /* put speaker on */
|
||||
|
||||
/* Program DSP with dma mode */
|
||||
|
||||
@@ -71,7 +71,9 @@ message mess;
|
||||
switch(mess.m_type) {
|
||||
case DEV_OPEN: err = mixer_open(&mess); break;
|
||||
case DEV_CLOSE: err = mixer_close(&mess); break;
|
||||
#ifdef DEV_IOCTL
|
||||
case DEV_IOCTL: err = mixer_ioctl(&mess); break;
|
||||
#endif
|
||||
default: err = EINVAL; break;
|
||||
}
|
||||
|
||||
|
||||
@@ -810,8 +810,6 @@ PUBLIC void do_video(message *m)
|
||||
break;
|
||||
case DEV_IOCTL_S:
|
||||
safe=1;
|
||||
/* Fallthrough. */
|
||||
case DEV_IOCTL:
|
||||
if (m->TTY_REQUEST == MIOCMAP || m->TTY_REQUEST == MIOCUNMAP)
|
||||
{
|
||||
int r, do_map;
|
||||
|
||||
@@ -214,8 +214,6 @@ message *m;
|
||||
break;
|
||||
case DEV_READ_S:
|
||||
safecopy = 1;
|
||||
/* Fallthrough. */
|
||||
case DEV_READ:
|
||||
if (kbdp->req_size)
|
||||
{
|
||||
/* We handle only request at a time */
|
||||
@@ -263,8 +261,6 @@ message *m;
|
||||
|
||||
case DEV_WRITE_S:
|
||||
safecopy = 1;
|
||||
/* Fallthrough. */
|
||||
case DEV_WRITE:
|
||||
if (kbdp != &kbdaux)
|
||||
{
|
||||
printf("write to keyboard not implemented\n");
|
||||
@@ -316,8 +312,6 @@ message *m;
|
||||
break;
|
||||
case DEV_IOCTL_S:
|
||||
safecopy=1;
|
||||
/* Fallthrough. */
|
||||
case DEV_IOCTL:
|
||||
if (kbdp == &kbd && m->TTY_REQUEST == KIOCSLEDS)
|
||||
{
|
||||
kio_leds_t leds;
|
||||
|
||||
@@ -95,8 +95,6 @@ message *m_ptr;
|
||||
switch (m_ptr->m_type) {
|
||||
case DEV_READ_S:
|
||||
safe=1;
|
||||
/* fallthrough */
|
||||
case DEV_READ:
|
||||
/* Check, store information on the reader, do I/O. */
|
||||
if (pp->state & TTY_CLOSED) {
|
||||
r = 0;
|
||||
@@ -146,8 +144,6 @@ message *m_ptr;
|
||||
|
||||
case DEV_WRITE_S:
|
||||
safe=1;
|
||||
/* fallthrough */
|
||||
case DEV_WRITE:
|
||||
/* Check, store information on the writer, do I/O. */
|
||||
if (pp->state & TTY_CLOSED) {
|
||||
r = EIO;
|
||||
|
||||
+1
-5
@@ -259,8 +259,7 @@ PUBLIC void main(void)
|
||||
tp = tty_addr(line - TTYPX_MINOR + NR_CONS + NR_RS_LINES);
|
||||
} else if ((line - PTYPX_MINOR) < NR_PTYS) {
|
||||
tp = tty_addr(line - PTYPX_MINOR + NR_CONS + NR_RS_LINES);
|
||||
if (tty_mess.m_type != DEV_IOCTL &&
|
||||
tty_mess.m_type != DEV_IOCTL_S) {
|
||||
if (tty_mess.m_type != DEV_IOCTL_S) {
|
||||
do_pty(tp, &tty_mess);
|
||||
continue;
|
||||
}
|
||||
@@ -282,11 +281,8 @@ PUBLIC void main(void)
|
||||
|
||||
/* Execute the requested device driver function. */
|
||||
switch (tty_mess.m_type) {
|
||||
case DEV_READ: do_read(tp, &tty_mess, 0); break;
|
||||
case DEV_READ_S: do_read(tp, &tty_mess, 1); break;
|
||||
case DEV_WRITE: do_write(tp, &tty_mess, 0); break;
|
||||
case DEV_WRITE_S: do_write(tp, &tty_mess, 1); break;
|
||||
case DEV_IOCTL: do_ioctl(tp, &tty_mess, 0); break;
|
||||
case DEV_IOCTL_S: do_ioctl(tp, &tty_mess, 1); break;
|
||||
case DEV_OPEN: do_open(tp, &tty_mess); break;
|
||||
case DEV_CLOSE: do_close(tp, &tty_mess); break;
|
||||
|
||||
Reference in New Issue
Block a user