예제 #1
0
void BSPKitlEthPowerOn(void)
{
    OAL_KITL_ARGS *pKITLArgs;
    PBYTE  pBaseIOAddress = NULL;
    UINT32 MemoryBase = 0;   

    KITL_RETAILMSG(ZONE_INIT, ("BSPKitlEthPowerOn: Powering On Ethernet KITL.\r\n"));

    pKITLArgs = (OAL_KITL_ARGS *)OALArgsQuery(OAL_ARGS_QUERY_KITL);

    if (pKITLArgs == NULL)
    {
        // This should do not happen, since this function is part of the Eth KITL driver structure
        // But still, just in case...
        KITL_RETAILMSG(ZONE_ERROR, ("BSPKitlEthPowerOn: No KITL args, returning.\r\n"));
        return;
    }

    //configure chipselect for DM9000A
    InitSROMC_DM9000A();

    pBaseIOAddress   = (PBYTE)OALPAtoVA(pKITLArgs->devLoc.LogicalLoc, FALSE);
    MemoryBase       = (UINT32)OALPAtoVA(BSP_BASE_REG_PA_DM9000A_MEMBASE, FALSE);

    // Initialize the controller.
    if (!DM9000AInit((PBYTE)pBaseIOAddress, MemoryBase, pKITLArgs->mac))
    {
        KITL_RETAILMSG(ZONE_INIT, ("BSPKitlEthPowerOn: ERROR: Failed to re-initialize Ethernet controller.\r\n"));
    }
}
예제 #2
0
static BOOL ReserveKitlIRQ()
{
    // If we're using an interrupt for KITL, make sure nothing else can share its IRQ
    // by reserving it in the resource manager

    BOOL retVal = FALSE;
    UINT32 kitlFlags;

    if(!OALKitlGetFlags(&kitlFlags))
    {
        KITL_RETAILMSG(ZONE_WARNING,("WARN: Reserve KITL IRQ: Could not get KITL flags, bailing out\r\n"));
        return FALSE;
    }

    // Are we using active, interrupt-based KITL?
    if((g_pNKGlobal->pfnKITLIoctl) &&
      (kitlFlags & OAL_KITL_FLAGS_ENABLED) &&
      !(kitlFlags & OAL_KITL_FLAGS_PASSIVE) &&
      !(kitlFlags & OAL_KITL_FLAGS_POLL))
    {
        DWORD dwStatus, dwDisp, dwEnableKITLSharedIRQ;
        DWORD dwSize = sizeof(DWORD);
        HKEY hkResourcesReserved;
        HKEY hkNoReserve;
        DWORD kitlIRQ = g_pX86KitlInfo->pX86Info->ucKitlIrq;
        const WCHAR szReservedIRQPath[] = L"Drivers\\Resources\\IRQ\\Reserved";
        const WCHAR szNoReservePath[] = L"Platform";

        // Check the registry to see if we've added a platform-specific key telling us disable IRQ sharing with the KITL NIC
        if(!(dwStatus = NKRegOpenKeyEx(HKEY_LOCAL_MACHINE, szNoReservePath, 0, 0, &hkNoReserve)))
        {
            if(!(dwStatus = NKRegQueryValueEx(hkNoReserve, TEXT("DisableKITLSharedIRQ"), NULL, NULL, (BYTE*)(&dwEnableKITLSharedIRQ), &dwSize)))
            {
                if(dwEnableKITLSharedIRQ == 1)
                {
                    // Registry has requested that disable IRQ sharing for KITL (this can help verify debugger hangs
                    // that occur due to IRQ-sharing hangs)
 
                    // If we got here then go ahead and reserve the IRQ
                    if(!(dwStatus = NKRegCreateKeyEx(HKEY_LOCAL_MACHINE, szReservedIRQPath, 0, NULL, 0, 0, NULL, &hkResourcesReserved, &dwDisp)))
                    {
                        if(!(dwStatus = NKRegSetValueEx(hkResourcesReserved, TEXT("KitlIRQ"), 0, REG_DWORD, (BYTE*)(&kitlIRQ), sizeof(DWORD))))
                        {
                            KITL_RETAILMSG (ZONE_INIT,("Reserve KITL IRQ: Reserved IRQ %d.  Other device drivers will not load on this IRQ.\r\n",kitlIRQ));
                            retVal = TRUE;
                        }
                        else
                        {
                            KITL_RETAILMSG(ZONE_INIT, ("Reserve KITL IRQ: Error creating reserved value\r\n"));
                        }
                    }
                    else
                    {
                        KITL_RETAILMSG(ZONE_INIT, ("Reserve KITL IRQ: Error creating reserved key\r\n"));
                    }
                }
            }
        }
    }
    else
    {
        // Not using active interrupt-based KITL, don't need to reserve an IRQ
        retVal = TRUE;
    }

    if(!retVal)
    {        
        KITL_RETAILMSG(ZONE_INIT, ("Reserve KITL IRQ: No IRQ reserved, KITL NIC IRQ may be shared with other devices.\r\n"));
    }

    return retVal;
}
예제 #3
0
void BSPKitlEthPowerOff(void)
{
    // Nothing to do here.
    KITL_RETAILMSG(ZONE_INIT, ("\r\nBSPKitlEthPowerOff: Ethernet KITL Powered Off\r\n"));
}
예제 #4
0
VOID OALKitlInitRegistry()
{
    HKEY Key;
    DWORD Status;
    DWORD Disposition;
    DWORD Value;
    DWORD Flags;
    DEVICE_LOCATION devLoc;

    // Get KITL device location
    if (!OALKitlGetDevLoc(&devLoc))
        goto CleanUp;

    if (devLoc.LogicalLoc == S3C6410_BASE_REG_PA_USBOTG_LINK)
    {
        // Disable the UsbFn driver since it is used for KITL
        //

        Status = NKRegCreateKeyEx(HKEY_LOCAL_MACHINE, L"Drivers\\BuiltIn\\SC6410USBFN", 0, NULL, 0, 0, NULL, &Key, &Disposition);

        if (Status == ERROR_SUCCESS)
        {
            Disposition = DEVFLAGS_NOLOAD;
            // Set Flags value to indicate no loading of driver for this device
            Status = NKRegSetValueEx(Key, DEVLOAD_FLAGS_VALNAME, 0, DEVLOAD_FLAGS_VALTYPE, (PBYTE)&Disposition, sizeof(Disposition));
        }

        // Close the registry key.
        NKRegCloseKey(Key);

        if (Status != ERROR_SUCCESS)
        {
            KITL_RETAILMSG(ZONE_INIT, ("OALKitlInitRegistry: failed to set \"no load\" key for Usbfn driver.\r\n"));
            goto CleanUp;
        }

        KITL_RETAILMSG(ZONE_INIT, ("INFO: USB being used for KITL - disabling Usbfn driver...\r\n"));
    }

    if (devLoc.LogicalLoc == BSP_BASE_REG_PA_DM9000A_IOBASE)
    {
        // If KITL is over Ethernet and interrupt is enabled, let the 
        // PowerButton Driver know, so that it can disable the Reset Button 
        // (The Reset button interrupt clashes with the Ethernet KITL interrupt)

        // Get the KITL flags
        if (!OALKitlGetFlags(&Flags))
            goto CleanUp;

        if (!(Flags & OAL_KITL_FLAGS_POLL))
        {
            Status = NKRegCreateKeyEx(HKEY_LOCAL_MACHINE, L"Drivers\\BuiltIn\\PowerButton", 0, NULL, 0, 0, NULL, &Key, &Disposition);

            if (Status == ERROR_SUCCESS)
            {
                Value = 1;
                Status = NKRegSetValueEx(Key, L"EthernetKITLInterruptEnabled", 0, REG_DWORD, (PBYTE)&Value, sizeof(Value));
            }

            // Close the registry key.
            NKRegCloseKey(Key);

            if (Status != ERROR_SUCCESS)
            {
                KITL_RETAILMSG(ZONE_INIT, ("OALKitlInitRegistry: failed to set key to disable reset button.\r\n"));
                goto CleanUp;
            }

            KITL_RETAILMSG(ZONE_INIT, ("INFO: Ethernet KITL Interrupt enabled - disabling reset button in button driver.\r\n"));

        }
    }

CleanUp:
    return;
}
예제 #5
0
BOOL
OEMKitlStartup(
    )
{
    BOOL rc = FALSE;

    OAL_KITL_ARGS *pArgs, args;
    CHAR *szDeviceId;
    
    KITLSetDebug(
                ZONE_ERROR |
                ZONE_WARNING |
        //        ZONE_INIT |        
        //        ZONE_KITL_OAL |
        //        ZONE_KITL_ETHER |
                0);


    KITL_RETAILMSG(ZONE_KITL_OAL, ("+OALKitlStart\r\n"));

    // First get boot args and device id
    pArgs = (OAL_KITL_ARGS*)OALArgsQuery(OAL_ARGS_QUERY_KITL);

    // If we don't get kitl arguments use default
    if (pArgs == NULL)
        {
		const UINT16 defaultMac[] = DEFAULT_MAC_ADDRESS;
        KITL_RETAILMSG(ZONE_WARNING, (
            "WARN: Boot arguments not found, use defaults\r\n"
            ));
        memset(&args, 0, sizeof(args));
        args.flags = OAL_KITL_FLAGS_ENABLED|OAL_KITL_FLAGS_DHCP;
        args.devLoc.IfcType = Internal;
        args.devLoc.BusNumber = 0;
        args.devLoc.LogicalLoc = BSP_LAN9115_REGS_PA;
		memcpy(args.mac,defaultMac,sizeof(args.mac));
        pArgs = &args;
        }

    // We always create device name
	// Try to generate from device id...

    szDeviceId = OALArgsQuery(OAL_ARGS_QUERY_DEVICE_PREFIX);
    
    if (szDeviceId == NULL) {
        szDeviceId = BSP_DEVICE_35xx_PREFIX;
    }
    pArgs->flags |= OAL_KITL_FLAGS_EXTNAME;
    
    // Initialize debug device
    switch (pArgs->devLoc.IfcType)
        {
        case Internal:
            switch (pArgs->devLoc.LogicalLoc)
                {
                case BSP_LAN9115_REGS_PA:
#if 0
					// enable clocks to GPIO banks that have KITL dependencies so we can do initialization
                    OEMKitlEnableClocks(TRUE);
                    
                    // Reset LAN chip
                    pGPIORegs = OALPAtoUA(BSP_RESET_ETHER_KITL_GPIO_PA);
                    CLRREG32(&pGPIORegs->DATAOUT, 1 << (BSP_RESET_ETHER_KITL_GPIO % 32));
                    OALStall(1000);
                    SETREG32(&pGPIORegs->DATAOUT, 1 << (BSP_RESET_ETHER_KITL_GPIO % 32));
                    OALStall(1000);

                    // Prepare interrupt
                    pGPIORegs = OALPAtoUA(BSP_ETHER_GPIO_PA);
                    SETREG32(&pGPIORegs->OE, 1 << (BSP_IRQ_ETHER_KITL % 32));
                    // Interrupt on falling edge
                    SETREG32(&pGPIORegs->FALLINGDETECT, 1 << (BSP_IRQ_ETHER_KITL % 32));

                    OEMKitlEnableClocks(FALSE);
#endif
                    break;
                }
            break;
        }

    // Finally call KITL library
    rc = OALKitlInit(szDeviceId, pArgs, g_kitlDevices);

    // If it failed or KITL is disabled
    if (!rc || (pArgs->flags & OAL_KITL_FLAGS_ENABLED) == 0) goto cleanUp;

    // enable kitl interrupts
    s_bKitlActive = TRUE;
    OEMKitlEnable(TRUE);
    
cleanUp:
    KITL_RETAILMSG(ZONE_KITL_OAL, ("-OALKitlStart(rc = %d)\r\n", rc));

    return rc;
}