Message type for SYS_VDEVIO

Change-Id: I62ceb5d487c5acd08cb100f340dd387e733180b4
This commit is contained in:
Lionel Sambuc 2014-05-21 10:45:19 +02:00
parent a8c16a502a
commit 85e7cb92a9
9 changed files with 37 additions and 30 deletions

View file

@ -299,8 +299,6 @@
# define DIO_SAFE_OUTPUT_LONG (_DIO_OUTPUT|_DIO_LONG|_DIO_SAFE) # define DIO_SAFE_OUTPUT_LONG (_DIO_OUTPUT|_DIO_LONG|_DIO_SAFE)
#define DIO_PORT m2_l1 /* single port address */ #define DIO_PORT m2_l1 /* single port address */
#define DIO_VALUE m2_l2 /* single I/O value */ #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. */ /* Field names for SYS_SETALARM. */
#define ALRM_EXP_TIME m2_l1 /* expire time for the alarm call */ #define ALRM_EXP_TIME m2_l1 /* expire time for the alarm call */

View file

@ -712,6 +712,15 @@ typedef struct {
} mess_lsys_krn_sys_sdevio; } mess_lsys_krn_sys_sdevio;
_ASSERT_MSG_SIZE(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 { typedef struct {
phys_bytes base; phys_bytes base;
phys_bytes count; phys_bytes count;
@ -1447,6 +1456,7 @@ typedef struct {
mess_lsys_krn_schedule m_lsys_krn_schedule; mess_lsys_krn_schedule m_lsys_krn_schedule;
mess_lsys_krn_sys_memset m_lsys_krn_sys_memset; mess_lsys_krn_sys_memset m_lsys_krn_sys_memset;
mess_lsys_krn_sys_sdevio m_lsys_krn_sys_sdevio; 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; mess_lsys_pci_busc_get_bar m_lsys_pci_busc_get_bar;

View file

@ -2,9 +2,9 @@
* m_type: SYS_VDEVIO * m_type: SYS_VDEVIO
* *
* The parameters for this kernel call are: * The parameters for this kernel call are:
* m2_i3: DIO_REQUEST (request input or output) * m_lsys_krn_sys_vdevio.request (request input or output)
* m2_p1: DIO_VEC_ADDR (pointer to port/ value pairs) * m_lsys_krn_sys_vdevio.vec_addr (pointer to port/ value pairs)
* m2_i2: DIO_VEC_SIZE (number of ports to read or write) * m_lsys_krn_sys_vdevio.vec_size (number of ports to read or write)
*/ */
#include "kernel/system.h" #include "kernel/system.h"
@ -42,12 +42,12 @@ int do_vdevio(struct proc * caller, message * m_ptr)
int r; int r;
/* Get the request, size of the request vector, and check the values. */ /* Get the request, size of the request vector, and check the values. */
io_dir = m_ptr->DIO_REQUEST & _DIO_DIRMASK; io_dir = m_ptr->m_lsys_krn_sys_vdevio.request & _DIO_DIRMASK;
io_type = m_ptr->DIO_REQUEST & _DIO_TYPEMASK; io_type = m_ptr->m_lsys_krn_sys_vdevio.request & _DIO_TYPEMASK;
if (io_dir == _DIO_INPUT) io_in = TRUE; if (io_dir == _DIO_INPUT) io_in = TRUE;
else if (io_dir == _DIO_OUTPUT) io_in = FALSE; else if (io_dir == _DIO_OUTPUT) io_in = FALSE;
else return(EINVAL); 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) { switch (io_type) {
case _DIO_BYTE: case _DIO_BYTE:
bytes = vec_size * sizeof(pvb_pair_t); 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); if (bytes > sizeof(vdevio_buf)) return(E2BIG);
/* Copy (port,value)-pairs from user. */ /* 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) KERNEL, (vir_bytes) vdevio_buf, bytes)) != OK)
return r; return r;
@ -152,7 +152,7 @@ int do_vdevio(struct proc * caller, message * m_ptr)
/* Almost done, copy back results for input requests. */ /* Almost done, copy back results for input requests. */
if (io_in) if (io_in)
if((r=data_copy(KERNEL, (vir_bytes) vdevio_buf, 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) (phys_bytes) bytes)) != OK)
return r; return r;
return(OK); return(OK);

View file

@ -9,9 +9,9 @@ int nr_ports; /* nr of pairs to be processed */
{ {
message m_io; message m_io;
m_io.DIO_REQUEST = _DIO_INPUT | _DIO_BYTE; m_io.m_lsys_krn_sys_vdevio.request = _DIO_INPUT | _DIO_BYTE;
m_io.DIO_VEC_ADDR = (char *) pvb_pairs; m_io.m_lsys_krn_sys_vdevio.vec_addr = (vir_bytes) pvb_pairs;
m_io.DIO_VEC_SIZE = nr_ports; m_io.m_lsys_krn_sys_vdevio.vec_size = nr_ports;
return _kernel_call(SYS_VDEVIO, &m_io); return _kernel_call(SYS_VDEVIO, &m_io);
} }

View file

@ -9,9 +9,9 @@ int nr_ports; /* nr of pairs to be processed */
{ {
message m_io; message m_io;
m_io.DIO_REQUEST = _DIO_INPUT | _DIO_LONG; m_io.m_lsys_krn_sys_vdevio.request = _DIO_INPUT | _DIO_LONG;
m_io.DIO_VEC_ADDR = (char *) pvl_pairs; m_io.m_lsys_krn_sys_vdevio.vec_addr = (vir_bytes)pvl_pairs;
m_io.DIO_VEC_SIZE = nr_ports; m_io.m_lsys_krn_sys_vdevio.vec_size = nr_ports;
return _kernel_call(SYS_VDEVIO, &m_io); return _kernel_call(SYS_VDEVIO, &m_io);
} }

View file

@ -1,6 +1,5 @@
#include "syslib.h" #include "syslib.h"
/*===========================================================================* /*===========================================================================*
* sys_vinw * * sys_vinw *
*===========================================================================*/ *===========================================================================*/
@ -10,9 +9,9 @@ int nr_ports; /* nr of pairs to be processed */
{ {
message m_io; message m_io;
m_io.DIO_REQUEST = _DIO_WORD | _DIO_INPUT; m_io.m_lsys_krn_sys_vdevio.request = _DIO_WORD | _DIO_INPUT;
m_io.DIO_VEC_ADDR = (char *) pvw_pairs; m_io.m_lsys_krn_sys_vdevio.vec_addr = (vir_bytes)pvw_pairs;
m_io.DIO_VEC_SIZE = nr_ports; m_io.m_lsys_krn_sys_vdevio.vec_size = nr_ports;
return _kernel_call(SYS_VDEVIO, &m_io); return _kernel_call(SYS_VDEVIO, &m_io);
} }

View file

@ -8,9 +8,10 @@ pvb_pair_t *pvb_pairs; /* (port,byte-value)-pairs */
int nr_ports; /* nr of pairs to be processed */ int nr_ports; /* nr of pairs to be processed */
{ {
message m_io; message m_io;
m_io.DIO_REQUEST = _DIO_OUTPUT | _DIO_BYTE;
m_io.DIO_VEC_ADDR = (char *) pvb_pairs; m_io.m_lsys_krn_sys_vdevio.request = _DIO_OUTPUT | _DIO_BYTE;
m_io.DIO_VEC_SIZE = nr_ports; 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); return _kernel_call(SYS_VDEVIO, &m_io);
} }

View file

@ -9,9 +9,9 @@ int nr_ports; /* nr of pairs to be processed */
{ {
message m_io; message m_io;
m_io.DIO_REQUEST = _DIO_OUTPUT | _DIO_LONG; m_io.m_lsys_krn_sys_vdevio.request = _DIO_OUTPUT | _DIO_LONG;
m_io.DIO_VEC_ADDR = (char *) pvl_pairs; m_io.m_lsys_krn_sys_vdevio.vec_addr = (vir_bytes)pvl_pairs;
m_io.DIO_VEC_SIZE = nr_ports; m_io.m_lsys_krn_sys_vdevio.vec_size = nr_ports;
return _kernel_call(SYS_VDEVIO, &m_io); return _kernel_call(SYS_VDEVIO, &m_io);
} }

View file

@ -1,6 +1,5 @@
#include "syslib.h" #include "syslib.h"
/*===========================================================================* /*===========================================================================*
* sys_voutw * * sys_voutw *
*===========================================================================*/ *===========================================================================*/
@ -10,9 +9,9 @@ int nr_ports; /* nr of pairs to be processed */
{ {
message m_io; message m_io;
m_io.DIO_REQUEST = _DIO_OUTPUT | _DIO_WORD; m_io.m_lsys_krn_sys_vdevio.request = _DIO_OUTPUT | _DIO_WORD;
m_io.DIO_VEC_ADDR = (char *) pvw_pairs; m_io.m_lsys_krn_sys_vdevio.vec_addr = (vir_bytes)pvw_pairs;
m_io.DIO_VEC_SIZE = nr_ports; m_io.m_lsys_krn_sys_vdevio.vec_size = nr_ports;
return _kernel_call(SYS_VDEVIO, &m_io); return _kernel_call(SYS_VDEVIO, &m_io);
} }