From: Lionel Sambuc Date: Wed, 21 May 2014 08:45:19 +0000 (+0200) Subject: Message type for SYS_VDEVIO X-Git-Tag: v3.3.0~229 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/openssl_button.gif?a=commitdiff_plain;h=85e7cb92a951bdc87674181715913f1f68f4e96e;p=minix.git Message type for SYS_VDEVIO Change-Id: I62ceb5d487c5acd08cb100f340dd387e733180b4 --- diff --git a/include/minix/com.h b/include/minix/com.h index 285ec1ba2..5faacbec0 100644 --- a/include/minix/com.h +++ b/include/minix/com.h @@ -299,8 +299,6 @@ # define DIO_SAFE_OUTPUT_LONG (_DIO_OUTPUT|_DIO_LONG|_DIO_SAFE) #define DIO_PORT m2_l1 /* single port address */ #define DIO_VALUE m2_l2 /* single I/O value */ -#define DIO_VEC_ADDR m2_p1 /* address of buffer or (p,v)-pairs */ -#define DIO_VEC_SIZE m2_l2 /* number of elements in vector */ /* Field names for SYS_SETALARM. */ #define ALRM_EXP_TIME m2_l1 /* expire time for the alarm call */ diff --git a/include/minix/ipc.h b/include/minix/ipc.h index 793901da3..dfae34d2c 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -712,6 +712,15 @@ typedef struct { } mess_lsys_krn_sys_sdevio; _ASSERT_MSG_SIZE(mess_lsys_krn_sys_sdevio); +typedef struct { + int request; + int vec_size; + vir_bytes vec_addr; /* pv{b,w,l}_pair_t * */ + + uint8_t padding[44]; +} mess_lsys_krn_sys_vdevio; +_ASSERT_MSG_SIZE(mess_lsys_krn_sys_vdevio); + typedef struct { phys_bytes base; phys_bytes count; @@ -1447,6 +1456,7 @@ typedef struct { mess_lsys_krn_schedule m_lsys_krn_schedule; mess_lsys_krn_sys_memset m_lsys_krn_sys_memset; mess_lsys_krn_sys_sdevio m_lsys_krn_sys_sdevio; + mess_lsys_krn_sys_vdevio m_lsys_krn_sys_vdevio; mess_lsys_pci_busc_get_bar m_lsys_pci_busc_get_bar; diff --git a/kernel/system/do_vdevio.c b/kernel/system/do_vdevio.c index 94bc6d1b6..d70fde655 100644 --- a/kernel/system/do_vdevio.c +++ b/kernel/system/do_vdevio.c @@ -2,9 +2,9 @@ * m_type: SYS_VDEVIO * * The parameters for this kernel call are: - * m2_i3: DIO_REQUEST (request input or output) - * m2_p1: DIO_VEC_ADDR (pointer to port/ value pairs) - * m2_i2: DIO_VEC_SIZE (number of ports to read or write) + * m_lsys_krn_sys_vdevio.request (request input or output) + * m_lsys_krn_sys_vdevio.vec_addr (pointer to port/ value pairs) + * m_lsys_krn_sys_vdevio.vec_size (number of ports to read or write) */ #include "kernel/system.h" @@ -42,12 +42,12 @@ int do_vdevio(struct proc * caller, message * m_ptr) int r; /* Get the request, size of the request vector, and check the values. */ - io_dir = m_ptr->DIO_REQUEST & _DIO_DIRMASK; - io_type = m_ptr->DIO_REQUEST & _DIO_TYPEMASK; + io_dir = m_ptr->m_lsys_krn_sys_vdevio.request & _DIO_DIRMASK; + io_type = m_ptr->m_lsys_krn_sys_vdevio.request & _DIO_TYPEMASK; if (io_dir == _DIO_INPUT) io_in = TRUE; else if (io_dir == _DIO_OUTPUT) io_in = FALSE; else return(EINVAL); - if ((vec_size = m_ptr->DIO_VEC_SIZE) <= 0) return(EINVAL); + if ((vec_size = m_ptr->m_lsys_krn_sys_vdevio.vec_size) <= 0) return(EINVAL); switch (io_type) { case _DIO_BYTE: bytes = vec_size * sizeof(pvb_pair_t); @@ -66,7 +66,7 @@ int do_vdevio(struct proc * caller, message * m_ptr) if (bytes > sizeof(vdevio_buf)) return(E2BIG); /* Copy (port,value)-pairs from user. */ - if((r=data_copy(caller->p_endpoint, (vir_bytes) m_ptr->DIO_VEC_ADDR, + if((r=data_copy(caller->p_endpoint, m_ptr->m_lsys_krn_sys_vdevio.vec_addr, KERNEL, (vir_bytes) vdevio_buf, bytes)) != OK) return r; @@ -152,7 +152,7 @@ int do_vdevio(struct proc * caller, message * m_ptr) /* Almost done, copy back results for input requests. */ if (io_in) if((r=data_copy(KERNEL, (vir_bytes) vdevio_buf, - caller->p_endpoint, (vir_bytes) m_ptr->DIO_VEC_ADDR, + caller->p_endpoint, m_ptr->m_lsys_krn_sys_vdevio.vec_addr, (phys_bytes) bytes)) != OK) return r; return(OK); diff --git a/lib/libsys/arch/i386/sys_vinb.c b/lib/libsys/arch/i386/sys_vinb.c index 3dcc040e1..3892b199d 100644 --- a/lib/libsys/arch/i386/sys_vinb.c +++ b/lib/libsys/arch/i386/sys_vinb.c @@ -9,9 +9,9 @@ int nr_ports; /* nr of pairs to be processed */ { message m_io; - m_io.DIO_REQUEST = _DIO_INPUT | _DIO_BYTE; - m_io.DIO_VEC_ADDR = (char *) pvb_pairs; - m_io.DIO_VEC_SIZE = nr_ports; + m_io.m_lsys_krn_sys_vdevio.request = _DIO_INPUT | _DIO_BYTE; + m_io.m_lsys_krn_sys_vdevio.vec_addr = (vir_bytes) pvb_pairs; + m_io.m_lsys_krn_sys_vdevio.vec_size = nr_ports; return _kernel_call(SYS_VDEVIO, &m_io); } diff --git a/lib/libsys/arch/i386/sys_vinl.c b/lib/libsys/arch/i386/sys_vinl.c index d3fe9d4f8..6cfaeef3a 100644 --- a/lib/libsys/arch/i386/sys_vinl.c +++ b/lib/libsys/arch/i386/sys_vinl.c @@ -9,9 +9,9 @@ int nr_ports; /* nr of pairs to be processed */ { message m_io; - m_io.DIO_REQUEST = _DIO_INPUT | _DIO_LONG; - m_io.DIO_VEC_ADDR = (char *) pvl_pairs; - m_io.DIO_VEC_SIZE = nr_ports; + m_io.m_lsys_krn_sys_vdevio.request = _DIO_INPUT | _DIO_LONG; + m_io.m_lsys_krn_sys_vdevio.vec_addr = (vir_bytes)pvl_pairs; + m_io.m_lsys_krn_sys_vdevio.vec_size = nr_ports; return _kernel_call(SYS_VDEVIO, &m_io); } diff --git a/lib/libsys/arch/i386/sys_vinw.c b/lib/libsys/arch/i386/sys_vinw.c index 19c718dcc..6545ba12f 100644 --- a/lib/libsys/arch/i386/sys_vinw.c +++ b/lib/libsys/arch/i386/sys_vinw.c @@ -1,6 +1,5 @@ #include "syslib.h" - /*===========================================================================* * sys_vinw * *===========================================================================*/ @@ -10,9 +9,9 @@ int nr_ports; /* nr of pairs to be processed */ { message m_io; - m_io.DIO_REQUEST = _DIO_WORD | _DIO_INPUT; - m_io.DIO_VEC_ADDR = (char *) pvw_pairs; - m_io.DIO_VEC_SIZE = nr_ports; + m_io.m_lsys_krn_sys_vdevio.request = _DIO_WORD | _DIO_INPUT; + m_io.m_lsys_krn_sys_vdevio.vec_addr = (vir_bytes)pvw_pairs; + m_io.m_lsys_krn_sys_vdevio.vec_size = nr_ports; return _kernel_call(SYS_VDEVIO, &m_io); } diff --git a/lib/libsys/arch/i386/sys_voutb.c b/lib/libsys/arch/i386/sys_voutb.c index 1e7fe12cf..ff0233b63 100644 --- a/lib/libsys/arch/i386/sys_voutb.c +++ b/lib/libsys/arch/i386/sys_voutb.c @@ -8,9 +8,10 @@ pvb_pair_t *pvb_pairs; /* (port,byte-value)-pairs */ int nr_ports; /* nr of pairs to be processed */ { message m_io; - m_io.DIO_REQUEST = _DIO_OUTPUT | _DIO_BYTE; - m_io.DIO_VEC_ADDR = (char *) pvb_pairs; - m_io.DIO_VEC_SIZE = nr_ports; + + m_io.m_lsys_krn_sys_vdevio.request = _DIO_OUTPUT | _DIO_BYTE; + m_io.m_lsys_krn_sys_vdevio.vec_addr = (vir_bytes)pvb_pairs; + m_io.m_lsys_krn_sys_vdevio.vec_size = nr_ports; return _kernel_call(SYS_VDEVIO, &m_io); } diff --git a/lib/libsys/arch/i386/sys_voutl.c b/lib/libsys/arch/i386/sys_voutl.c index e56e6aec5..c1298811d 100644 --- a/lib/libsys/arch/i386/sys_voutl.c +++ b/lib/libsys/arch/i386/sys_voutl.c @@ -9,9 +9,9 @@ int nr_ports; /* nr of pairs to be processed */ { message m_io; - m_io.DIO_REQUEST = _DIO_OUTPUT | _DIO_LONG; - m_io.DIO_VEC_ADDR = (char *) pvl_pairs; - m_io.DIO_VEC_SIZE = nr_ports; + m_io.m_lsys_krn_sys_vdevio.request = _DIO_OUTPUT | _DIO_LONG; + m_io.m_lsys_krn_sys_vdevio.vec_addr = (vir_bytes)pvl_pairs; + m_io.m_lsys_krn_sys_vdevio.vec_size = nr_ports; return _kernel_call(SYS_VDEVIO, &m_io); } diff --git a/lib/libsys/arch/i386/sys_voutw.c b/lib/libsys/arch/i386/sys_voutw.c index 6d252720d..08525c597 100644 --- a/lib/libsys/arch/i386/sys_voutw.c +++ b/lib/libsys/arch/i386/sys_voutw.c @@ -1,6 +1,5 @@ #include "syslib.h" - /*===========================================================================* * sys_voutw * *===========================================================================*/ @@ -10,9 +9,9 @@ int nr_ports; /* nr of pairs to be processed */ { message m_io; - m_io.DIO_REQUEST = _DIO_OUTPUT | _DIO_WORD; - m_io.DIO_VEC_ADDR = (char *) pvw_pairs; - m_io.DIO_VEC_SIZE = nr_ports; + m_io.m_lsys_krn_sys_vdevio.request = _DIO_OUTPUT | _DIO_WORD; + m_io.m_lsys_krn_sys_vdevio.vec_addr = (vir_bytes)pvw_pairs; + m_io.m_lsys_krn_sys_vdevio.vec_size = nr_ports; return _kernel_call(SYS_VDEVIO, &m_io); }