From: David van Moolenbroek Date: Fri, 25 Mar 2011 10:45:57 +0000 (+0000) Subject: misc drivers: remove more non-safecopy support X-Git-Tag: v3.2.0~603 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/Bv9ARM.html?a=commitdiff_plain;h=294112db545f786a9aea95576bc008aec1a8b312;p=minix.git misc drivers: remove more non-safecopy support --- diff --git a/common/include/minix/com.h b/common/include/minix/com.h index 621ceecd9..97f5b3ff0 100644 --- a/common/include/minix/com.h +++ b/common/include/minix/com.h @@ -134,12 +134,6 @@ #define BUSC_PCI_IDS (BUSC_RQ_BASE + 4) /* Get vid/did from an * index */ -#define BUSC_PCI_DEV_NAME (BUSC_RQ_BASE + 5) /* Get the name of a - * PCI device - */ -#define BUSC_PCI_SLOT_NAME (BUSC_RQ_BASE + 6) /* Get the name of a - * PCI slot - */ #define BUSC_PCI_RESERVE (BUSC_RQ_BASE + 7) /* Reserve a PCI dev */ #define BUSC_PCI_ATTR_R8 (BUSC_RQ_BASE + 8) /* Read 8-bit * attribute value diff --git a/drivers/at_wini/at_wini.c b/drivers/at_wini/at_wini.c index 5d5748d30..052030745 100644 --- a/drivers/at_wini/at_wini.c +++ b/drivers/at_wini/at_wini.c @@ -1275,7 +1275,7 @@ unsigned nr_req; /* length of request vector */ (vir_bytes)(dma_buf+dma_buf_offset), n, D); if (s != OK) { - panic("w_transfer: sys_vircopy failed: %d", s); + panic("w_transfer: sys_safecopy failed: %d", s); } } else { memcpy((char *) iov->iov_addr + addr_offset, @@ -1625,7 +1625,7 @@ int *do_copyoutp; addr_offset, (vir_bytes)dma_buf+offset, n, D); if (r != OK) { - panic("setup_dma: sys_vircopy failed: %d", r); + panic("setup_dma: sys_safecopy failed: %d", r); } } else { memcpy(dma_buf + offset, diff --git a/drivers/bios_wini/bios_wini.c b/drivers/bios_wini/bios_wini.c index 96a9f4093..965ae879f 100644 --- a/drivers/bios_wini/bios_wini.c +++ b/drivers/bios_wini/bios_wini.c @@ -324,7 +324,7 @@ unsigned nr_req; /* length of request vector */ chunk, D); if (r != OK) - panic("sys_vircopy failed: %d", r); + panic("sys_safecopy failed: %d", r); } else { memcpy((char *) iop->iov_addr, bios_buf_v+count, chunk); diff --git a/drivers/pci/main.c b/drivers/pci/main.c index 4d2ba273d..65891eaf4 100644 --- a/drivers/pci/main.c +++ b/drivers/pci/main.c @@ -11,7 +11,6 @@ FORWARD _PROTOTYPE( void do_first_dev, (message *mp) ); FORWARD _PROTOTYPE( void do_next_dev, (message *mp) ); FORWARD _PROTOTYPE( void do_find_dev, (message *mp) ); FORWARD _PROTOTYPE( void do_ids, (message *mp) ); -FORWARD _PROTOTYPE( void do_dev_name, (message *mp) ); FORWARD _PROTOTYPE( void do_dev_name_s, (message *mp) ); FORWARD _PROTOTYPE( void do_slot_name_s, (message *mp) ); FORWARD _PROTOTYPE( void do_set_acl, (message *mp) ); @@ -65,7 +64,6 @@ int main(void) case BUSC_PCI_NEXT_DEV: do_next_dev(&m); break; case BUSC_PCI_FIND_DEV: do_find_dev(&m); break; case BUSC_PCI_IDS: do_ids(&m); break; - case BUSC_PCI_DEV_NAME: do_dev_name(&m); break; case BUSC_PCI_RESERVE: do_reserve(&m); break; case BUSC_PCI_ATTR_R8: do_attr_r8(&m); break; case BUSC_PCI_ATTR_R16: do_attr_r16(&m); break; @@ -224,43 +222,6 @@ message *mp; } } -PRIVATE void do_dev_name(mp) -message *mp; -{ - int r, name_len, len; - u16_t vid, did; - char *name_ptr, *name; - - vid= mp->m1_i1; - did= mp->m1_i2; - name_len= mp->m1_i3; - name_ptr= mp->m1_p1; - - name= pci_dev_name(vid, did); - if (name == NULL) - { - /* No name */ - r= ENOENT; - } - else - { - len= strlen(name)+1; - if (len > name_len) - len= name_len; - printf("PCI: pci`do_dev_name: calling do_vircopy\n"); - r= sys_vircopy(SELF, D, (vir_bytes)name, mp->m_source, D, - (vir_bytes)name_ptr, len); - } - - mp->m_type= r; - r= send(mp->m_source, mp); - if (r != 0) - { - printf("PCI: do_dev_name: unable to send to %d: %d\n", - mp->m_source, r); - } -} - PRIVATE void do_dev_name_s(mp) message *mp; { diff --git a/drivers/printer/printer.c b/drivers/printer/printer.c index 7d02e0ec9..c2213d171 100644 --- a/drivers/printer/printer.c +++ b/drivers/printer/printer.c @@ -98,15 +98,13 @@ PRIVATE int port_base; /* I/O port for printer */ PRIVATE int proc_nr; /* user requesting the printing */ PRIVATE cp_grant_id_t grant_nr; /* grant on which print happens */ PRIVATE int user_left; /* bytes of output left in user buf */ -PRIVATE vir_bytes user_vir_g; /* start of user buf (address or grant) */ PRIVATE vir_bytes user_vir_d; /* offset in user buf */ -PRIVATE int user_safe; /* address or grant? */ PUBLIC int writing; /* nonzero while write is in progress */ PRIVATE int irq_hook_id; /* id of irq hook at kernel */ FORWARD _PROTOTYPE( void do_cancel, (message *m_ptr) ); FORWARD _PROTOTYPE( void output_done, (void) ); -FORWARD _PROTOTYPE( void do_write, (message *m_ptr, int safe) ); +FORWARD _PROTOTYPE( void do_write, (message *m_ptr) ); FORWARD _PROTOTYPE( void do_status, (message *m_ptr) ); FORWARD _PROTOTYPE( void prepare_output, (void) ); FORWARD _PROTOTYPE( void do_initialize, (void) ); @@ -157,7 +155,7 @@ PUBLIC int main(int argc, char *argv[]) case DEV_CLOSE: reply(TASK_REPLY, pr_mess.m_source, pr_mess.IO_ENDPT, OK); break; - case DEV_WRITE_S: do_write(&pr_mess, 1); break; + case DEV_WRITE_S: do_write(&pr_mess); break; case DEV_STATUS: do_status(&pr_mess); break; case CANCEL: do_cancel(&pr_mess); break; default: @@ -203,9 +201,8 @@ PRIVATE int sef_cb_init_fresh(int type, sef_init_info_t *info) /*===========================================================================* * do_write * *===========================================================================*/ -PRIVATE void do_write(m_ptr, safe) +PRIVATE void do_write(m_ptr) register message *m_ptr; /* pointer to the newly arrived message */ -int safe; /* use virtual addresses or grant id's? */ { /* The printer is used by sending DEV_WRITE messages to it. Process one. */ @@ -230,11 +227,9 @@ int safe; /* use virtual addresses or grant id's? */ proc_nr = m_ptr->IO_ENDPT; user_left = m_ptr->COUNT; orig_count = m_ptr->COUNT; - user_vir_g = (vir_bytes) m_ptr->ADDRESS; /* Address or grant id. */ - user_vir_d = 0; /* Offset. */ - user_safe = safe; /* Address or grant? */ + user_vir_d = 0; /* Offset. */ writing = TRUE; - grant_nr = safe ? (cp_grant_id_t) m_ptr->ADDRESS : GRANT_INVALID; + grant_nr = (cp_grant_id_t) m_ptr->IO_GRANT; retries = MAX_ONLINE_RETRIES + 1; while (--retries > 0) { @@ -397,12 +392,9 @@ PRIVATE void prepare_output() register int chunk; if ( (chunk = user_left) > sizeof obuf) chunk = sizeof obuf; - if(user_safe) { - s=sys_safecopyfrom(proc_nr, user_vir_g, user_vir_d, - (vir_bytes) obuf, chunk, D); - } else { - s=sys_datacopy(proc_nr, user_vir_g, SELF, (vir_bytes) obuf, chunk); - } + + s=sys_safecopyfrom(proc_nr, grant_nr, user_vir_d, (vir_bytes) obuf, + chunk, D); if(s != OK) { done_status = EFAULT;