示例#1
0
io_return_t
chips_init(struct vc_info * info) 
{
	extern Boot_Video       boot_video_info;
	unsigned char		val;

	if (kernel_map) {
		regBase = (volatile unsigned char *)
			io_map((unsigned int)regBasePhys, 4096);
		simple_lock_init(&chips_lock, ETAP_IO_TTY);
	}

	strcpy(chips_info.v_name, chips_node->name);
	chips_info.v_width = boot_video_info.v_width;
	chips_info.v_height = boot_video_info.v_height;
	chips_info.v_depth = boot_video_info.v_depth;
	chips_info.v_rowbytes = boot_video_info.v_rowBytes;
	chips_info.v_physaddr = boot_video_info.v_baseAddr;
	chips_info.v_baseaddr = chips_info.v_physaddr;
	chips_info.v_type = VC_TYPE_PCI;

	memcpy(info, &chips_info, sizeof(chips_info));

	return	D_SUCCESS;
}
示例#2
0
void
autoconf(void)
{
	/* make IO area mappable from user applications */

	(void)pmap_add_physical_memory(powermac_info.io_base_phys,
				       (powermac_info.io_base_phys +
					powermac_info.io_size),
				       FALSE,
				       PTE_WIMG_IO);

	/* remap IO area into virtual space so that devices can
	 * set up their pointers to a virtual mapping
	 */

	powermac_info.io_base_virt = io_map(powermac_info.io_base_phys,
					    powermac_info.io_size);

	powermac_io_init(powermac_info.io_base_virt);

	/* Make sure that interrupts are correctly initialized before
	 * we run the generic code. setting remains at splhigh. We must
	 * do this AFTER the io mappings have been initialised since
	 * interrupts may use registers in the io space
	 */
	interrupt_init();

#if NCPUS >1
	/*
	 *		Probe the MP hardware now that we have some memory
	 */
	mp_probe_cpus();
#endif	/* NCPUS > 1 */


	/* probeio needs interrupts enabled
	 * interrupts get switched on for the first time here.
	 */
	spllo();

	probeio();

	/* We no longer need BATs to map I/O */
	if (PROCESSOR_VERSION != PROCESSOR_VERSION_601) {
		mtdbatu(3,BAT_INVALID); mtdbatl(3,BAT_INVALID);
		mtdbatu(2,BAT_INVALID); mtdbatl(2,BAT_INVALID);
	}
	
	return;
}
示例#3
0
文件: map.c 项目: GNUHurdTR/hurd
/* Return a memory object paging on STORE.  [among other reasons,] this may
   fail because store contains non-contiguous regions on the underlying
   object.  In such a case you can try calling some of the routines below to
   get a pager.  */
error_t
store_map (const struct store *store, vm_prot_t prot,
	   mach_port_t *memobj)
{
  error_t (*map) (const struct store *store, vm_prot_t prot,
		  mach_port_t *memobj) =
    store->class->map;
  error_t err = map ? (*map) (store, prot, memobj) : EOPNOTSUPP;

  if (err == EOPNOTSUPP && store->source != MACH_PORT_NULL)
    /* Can't map the store directly, but we know it represents the file
       STORE->source, so we can try mapping that instead.  */
    {
      mach_port_t rd_memobj, wr_memobj;
      int ro = (store->flags & STORE_HARD_READONLY);

      if ((prot & VM_PROT_WRITE) && ro)
	return EACCES;

      err = io_map (store->port, &rd_memobj, &wr_memobj);
      if (! err)
	{
	  *memobj = rd_memobj;

	  if (!ro || wr_memobj != MACH_PORT_NULL)
	    /* If either we or the server think this object is writable, then
	       the write-memory-object must be the same as the read one (if
	       we only care about reading, then it can be null too).  */
	    {
	      if (rd_memobj == wr_memobj)
		{
		  if (rd_memobj != MACH_PORT_NULL)
		    mach_port_mod_refs (mach_task_self (), rd_memobj,
					MACH_PORT_RIGHT_SEND, -1);
		}
	      else
		{
		  if (rd_memobj != MACH_PORT_NULL)
		    mach_port_deallocate (mach_task_self (), rd_memobj);
		  if (wr_memobj != MACH_PORT_NULL)
		    mach_port_deallocate (mach_task_self (), wr_memobj);
		  err = EOPNOTSUPP;
		}
	    }
	}
    }

  return err;
}
示例#4
0
/*
 * Allocate and map memory for devices that may need to be mapped before
 * Mach VM is running.
 *
 * This maps the all pages containing [PHYS_ADDR:PHYS_ADDR + SIZE].
 * For contiguous requests to those pages will reuse the previously
 * established mapping.
 *
 * Warning: this leaks memory maps for now, do not use it yet for something
 * else than Mach shutdown.
 */
vm_offset_t
io_map_cached(
	vm_offset_t	phys_addr,
	vm_size_t	size)
{
  static vm_offset_t base;
  static vm_size_t length;
  static vm_offset_t map;

  if (! map
      || (phys_addr < base)
      || (base + length < phys_addr + size))
    {
      base = trunc_page(phys_addr);
      length = round_page(phys_addr - base + size);
      map = io_map(base, length);
    }

  return map + (phys_addr - base);
}
示例#5
0
vm_offset_t io_map_spec(vm_map_offset_t phys_addr, vm_size_t size, unsigned int flags)
{
  return (io_map(phys_addr, size, flags));
}