Ejemplo n.º 1
0
cyg_bool mii_negotiate(void)
{
  int timeout = 100000;
  
  MIIAR = PHYS(4);
  
  mii_poll_busy();
  
  MIIAR = PHYS(0);
  MIIWDR |= 0x1200;
  
  mii_poll_busy();
  
  while(timeout)
    {
      MIIAR = PHYS(1);
      MIICR = 1;
      
      mii_poll_busy();
      
      if(0x24 == (MIIRDR & 0x24))
        return 0;
      else
        timeout--;
    }
  
  return 1;
}
Ejemplo n.º 2
0
cyg_bool mii_check_duplex(void)
{
  MIIAR = PHYS(17);
  MIICR = 1;
  mii_poll_busy();
  return (MIIRDR >> 9) & 1;
}
Ejemplo n.º 3
0
cyg_bool mii_check_speed(void)
{
  MIIAR = PHYS(17);
  MIICR = 1;
  mii_poll_busy();
  return (MIIRDR >> 14) & 1;
}
Ejemplo n.º 4
0
void mii_set_speed(cyg_bool speed, cyg_bool duplex)
{
  unsigned long int timeout = 1000000;
  
  MIIAR = PHYS(0);      // select command register
  MIIWDR = (speed << 13) | (duplex << 8);       // set speed and duplex
  mii_poll_busy();
  
  
  while(timeout)
    {
      MIIAR = PHYS(1);  // select status register
      MIICR = 1;
      mii_poll_busy();
      if((MIIRDR) & 0x4)
        break;
      timeout--;
    }
}
Ejemplo n.º 5
0
Archivo: vm.c Proyecto: kkaneda/tvmm
/* Create a page table that maps VM's physical addresses to PM's physical address and 
 * return the (PM's) physical base address of the table.  */
static unsigned long 
create_vm_pmem_mapping_table ( unsigned long vm_pmem_start, unsigned long vm_pmem_size )
{
	const unsigned long cr3  = pml4_table_create ( );
	const unsigned long pml4 = ( unsigned long ) VIRT ( cr3 );
	const unsigned long vm_pmem_pfn = PFN_DOWN_2MB ( PHYS ( vm_pmem_start ) );
	int i;

	for ( i = 0; i < PFN_UP_2MB ( vm_pmem_size ); i++ ) {
		const unsigned long vm_paddr = i << PAGE_SHIFT_2MB;
		const unsigned long pm_pfn   = i + ( is_reserved_pmem ( i ) ? 0 : vm_pmem_pfn ); /* for VGA (too naive) */
		const unsigned long pm_paddr = pm_pfn << PAGE_SHIFT_2MB;

		mmap ( pml4, vm_paddr, pm_paddr, 1 /* is_user */ );
	}

	printf ( "Page table for nested paging created.\n" );
	return cr3;
}
Ejemplo n.º 6
0
void mii_reset(void)
{
  MIIAR = PHYS(0);      // select command register
  MIIWDR = 0x8000;      // reset
  mii_poll_busy();
}
Ejemplo n.º 7
0
Archivo: vm.c Proyecto: kkaneda/tvmm
static void
switch_to_guest_os ( struct vm *vm )
{
	u64 p_vmcb = PHYS ( vm->vmcb );
	svm_launch ( p_vmcb );
}