(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,
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,
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) );
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;
}
}
-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;
{
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) );
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:
/*===========================================================================*
* 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. */
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) {
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;