예제 #1
0
static BOOL ADPbDynaAllocBuf(
    PSAdapterInfo pAdapter
    )
{
	/* Allocate RD/TD pointer array & DescBuf SAllocMap array. */
	/* modified by kevin:mALLOc supplied by u-boot */
	pAdapter->apRD = (PSRxDesc *)mALLOc(sizeof(PSRxDesc) * pAdapter->cbRD);
	MacDump(MACDBG_INFO, ("[ADPbDynaAllocBuf] - pAdapter->apRD : %p, size : %d\n", pAdapter->apRD,
		sizeof(PSRxDesc)*pAdapter->cbRD));
	pAdapter->aamRxDescBuf = (PSAllocMap)mALLOc(sizeof(SAllocMap) * pAdapter->cbRD);
	MacDump(MACDBG_INFO, ("[ADPbDynaAllocBuf] - pAdapter->aamRxDescBuf : %p, size : %d\n",
		pAdapter->aamRxDescBuf, sizeof(SAllocMap) * pAdapter->cbRD));

	pAdapter->apTD = (PSTxDesc *)mALLOc(sizeof(PSTxDesc) * pAdapter->cbTD);
	MacDump(MACDBG_INFO, ("[ADPbDynaAllocBuf] - pAdapter->apTD : %p, size : %d\n", pAdapter->apTD,
		sizeof(PSTxDesc)*pAdapter->cbTD));
	pAdapter->aamTxDescBuf = (PSAllocMap)mALLOc(sizeof(SAllocMap) * pAdapter->cbTD);
	MacDump(MACDBG_INFO, ("[ADPbDynaAllocBuf] - pAdapter->aamTxDescBuf : %p, size : %d\n",
		pAdapter->aamTxDescBuf, sizeof(SAllocMap) * pAdapter->cbTD));

	if ((pAdapter->apRD == NULL) || (pAdapter->apTD == NULL) ||
	(pAdapter->aamTxDescBuf == NULL) || (pAdapter->aamRxDescBuf == NULL))
		return FALSE;

	return TRUE;
}
예제 #2
0
void env_relocate (void)
{
	DEBUGF ("%s[%d] offset = 0x%lx\n", __FUNCTION__,__LINE__, gd->reloc_off);

	env_ptr = (env_t *)mALLOc (CONFIG_ENV_SIZE);
	DEBUGF ("%s[%d] malloced ENV at %p\n", __FUNCTION__,__LINE__,env_ptr);

    set_env_funcptrs() ;
    (*env_init)() ;

	if (gd->env_valid == 0) {
#if defined(CONFIG_GTH)	|| defined(CONFIG_ENV_IS_NOWHERE)	/* Environment not changable */
		puts ("Using default environment\n\n");
#else
		//puts ("*** Warning - bad CRC, using default environment\n\n");
		puts ("*** We do not have environment varialbes stored in the booting storgage, so we using default environment\n\n");
		//show_boot_progress (-60);
#endif
		set_default_env();
	}
	else {
        printf("  Finding the environment variables in boot storage...\n") ;
		(*env_relocate_spec)();
	}
	gd->env_addr = (ulong)&(env_ptr->data);
}
예제 #3
0
UINT
ADPuInitAll(
    void
    )
{
	int     ii;
	UINT    uTotalDev = 0;

	/* modified by kevin:mALLOc supplied by u-boot */
	if (!g_bInit) {
		sg_aAdapter = (PSAdapterInfo)mALLOc(sizeof(SAdapterInfo) * CB_MAX_NET_DEVICE);

		if (sg_aAdapter != NULL) {
			/* modifiey by kevin:memset supplied by u-boot */
			memset(sg_aAdapter, 0, sizeof(SAdapterInfo) * CB_MAX_NET_DEVICE);
		} else {
			return 0;
		}
	}

	for (ii = 0; ii < CB_MAX_NET_DEVICE; ii++) {
		s_vInit(&sg_aAdapter[ii], CB_MAX_NET_DEVICE, ii);

		if ((&sg_aAdapter[ii])->wDevId == W_DEVICE_ID_3106A ||
			(&sg_aAdapter[ii])->wDevId == W_DEVICE_ID_3053A)
			uTotalDev++;
	}

	return uTotalDev;
}
예제 #4
0
/*---------------------  Export Functions  --------------------------*/
BOOL
ADPbBind(
    PSAdapterInfo pAdapter
    )
{
	/* build RDR/TDR */
	if (!ALCbAllocateRdrMemory(pAdapter)) {
		printf("allocate Buffer or RD fail!\n");
		return FALSE;
	}
	if (!ALCbAllocateTdrMemory(pAdapter)) {
		printf("allocate Buffer or TD fail!\n");
		return FALSE;
	}

	ALCvChainRdrMemory(pAdapter);
	ALCvChainTdrMemory(pAdapter);
	/* Mac init & mii init */
	if (!ADPbInitializeEx(pAdapter)) {
		printf("init ex fail\n");
		return FALSE;
	}
	/* Hook Interrupt Service Routine on IRQ */
	/* set_irq_handlers(pAdapter->byIrqLevel, pAdapter->pvAdapterIsr); */

	/* Enable Interrupt Mask */
	/* unmask_interrupt(pAdapter->byIrqLevel); */

	/* MacDump(MACDBG_INFO, ("[ADPbBind] - Hook ISR on IRQ%d\n", pAdapter->byIrqLevel)); */

	/* Start ISR */
	MACvIntEnable(pAdapter->dwIoBase, pAdapter->byRevId, IMR_MASK_VALUE);

	/* Wait MAUTO to poll twice, then MIISR_LNKFL will be correct status */
	/* kevin???? */
	PCAvDelayByIO(CB_DELAY_MII_STABLE * 20000);
	/* Update link status */
	pAdapter->bLinkPass = MACbIsCableLinkOk(pAdapter->dwIoBase);
	if (pAdapter->bLinkPass) {
		MacDump(MACDBG_INFO, ("[ADPbBind]- Link Pass\n"));

		/* update duplex status */
		/* NOTE.... here we don't call MIIbIsInFullDuplexMode(), because */
		/* we won't turn on/off MAUTO */
		MACvIsInFullDuplexMode(&pAdapter->bFullDuplex, pAdapter->dwIoBase);
		/* Update speed status */
		pAdapter->bSpeed100M = MACbIsIn100MMode(pAdapter->dwIoBase, pAdapter->byRevId);
	} else
		MacDump(MACDBG_INFO, ("[ADPbBind]- Fail\n"));

	pAdapter->pbyTmpBuff = (PBYTE)mALLOc(CB_MAX_BUF_SIZE);
	MacDump(MACDBG_INFO, ("[ADPbBind]- Exit!\n"));

	return TRUE;
}
예제 #5
0
/* malloc() replacment functions are found below:
 * operator new() and operator new[]() are defined in malloc_extra.cpp
 * because this code is inside extern "C" { ... }
 */
void *constrained_malloc( size_t nbytes )
{
	if ( !using_opera_allocator() )
		return malloc(nbytes);

	void *res = NULL;

	MALLOC_WRAPPED_ACTION (
		if ( alloc_within_limits(nbytes) )
	    {
		    g_constrained_allocation = 1;
			res = mALLOc(nbytes);
			g_constrained_allocation = 0;
			constrain_tag_allocation(res);
		}
	);
예제 #6
0
VOID
MEMvAllocateShared(
	PSAllocMap pamMem
	)
{
	if (!g_bInit)
		pamMem->dwRawVAddr = (DWORD)mALLOc((size_t)pamMem->dwRawSize * (size_t)sizeof(BYTE));

	/* If allocation failed, virtual/phisical address == NULL */
	if ((PVOID)pamMem->dwRawVAddr == NULL) {
		LODWORD(pamMem->qwRawPAddr) = 0;
		HIDWORD(pamMem->qwRawPAddr) = 0;
		return;
	} else
		memset((PVOID)pamMem->dwRawVAddr, 0, (size_t)pamMem->dwRawSize * (size_t)sizeof(BYTE));

	LODWORD(pamMem->qwRawPAddr) = pamMem->dwRawVAddr;
	HIDWORD(pamMem->qwRawPAddr) = 0;
}