kernel/eka/drivers/pbus/mmc/mmccd_init.cpp
changeset 287 ddfd5aa0d58f
parent 176 af6ec97d9189
equal deleted inserted replaced
286:48e57fb1237e 287:ddfd5aa0d58f
     1 // Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 1995-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    15 // 
    15 // 
    16 //
    16 //
    17 
    17 
    18 #include <drivers/mmccd_ifc.h>
    18 #include <drivers/mmccd_ifc.h>
    19 #include <drivers/pbusmedia.h>
    19 #include <drivers/pbusmedia.h>
    20 
    20 #include <drivers/mmc.h>
    21 
       
    22 
    21 
    23 
    22 
    24 /**
    23 /**
    25 Starts the sequence of operations that creates the platform specific objects,
    24 Starts the sequence of operations that creates the platform specific objects,
    26 registers the socket, and initialises the stack.
    25 registers the socket, and initialises the stack.
   205 			__KTRACE_OPT(KPBUS1,Kern::Printf("Socket %d Created OK",i));
   204 			__KTRACE_OPT(KPBUS1,Kern::Printf("Socket %d Created OK",i));
   206 			}
   205 			}
   207 		else
   206 		else
   208 			__KTRACE_OPT(KPBUS1,Kern::Printf("Socket %d not MMC card",i));
   207 			__KTRACE_OPT(KPBUS1,Kern::Printf("Socket %d not MMC card",i));
   209 		}
   208 		}
       
   209 
       
   210 	// set RpmbConfigRead to true and ensure that changes to RpmbConfigRead, NumberOfRpmbs 
       
   211 	// and TheRpmbs are flushed at the same time
       
   212 	__e32_atomic_store_ord32(&RpmbParmsPopulated, ETrue);
   210 		
   213 		
   211 	__KTRACE_OPT(KPBUS1,Kern::Printf("<TMMCardControllerInterface::Create, ret %d",r));
   214 	__KTRACE_OPT(KPBUS1,Kern::Printf("<TMMCardControllerInterface::Create, ret %d",r));
   212 	return r;
   215 	return r;
   213 	}
   216 	}
   214 
   217 
   228 		
   231 		
   229 	DMMCSocket* pS = (DMMCSocket*) TheSockets[aSocket];
   232 	DMMCSocket* pS = (DMMCSocket*) TheSockets[aSocket];
   230 	if(pS == NULL)
   233 	if(pS == NULL)
   231 		return(KErrNoMemory);
   234 		return(KErrNoMemory);
   232 
   235 
   233 	TMMCMachineInfo mi;
   236 	// Retrieve RPMB specific information from the PSL layer
   234 	pS->iStack->MachineInfo(mi);
   237 	__KTRACE_OPT(KPBUS1, Kern::Printf("RPMB: Begin registering RPMB information from PSL layer"));
       
   238 	
       
   239 	TMMCMachineInfoV44 mi;
       
   240     TMMCMachineInfoV44Pckg machineInfoPckg(mi);
       
   241     pS->iStack->MachineInfo(machineInfoPckg);
       
   242 
       
   243 	// Register each slot marked as being RPMB capable
       
   244 	// Code won't write beyond the end of TheRpmbs[] because 4 slots are reserved 
       
   245 	// for each pbus socket and only 4 slots are processed for each socket
       
   246 	TInt rpmbSlots = (mi.iRpmbSlotCount <= 4) ? mi.iRpmbSlotCount : 4;
       
   247 
       
   248 	// if baseport set up so that iRpmbSlotList==NULL assert now
       
   249 	__ASSERT_ALWAYS((((rpmbSlots>0)&&(mi.iRpmbSlotList!=NULL))||(rpmbSlots==0)), Kern::Fault(__FILE__, __LINE__));
       
   250 	TInt i;
       
   251 	for ( i=0; i<rpmbSlots; i++)
       
   252 		{
       
   253 			TheRpmbs[NumberOfRpmbs].iSocketPtr = pS;
       
   254 			TheRpmbs[NumberOfRpmbs].iCardNumber = mi.iRpmbSlotList[i];
       
   255 			__KTRACE_OPT(KPBUS1, Kern::Printf("RPMB: TheRpmbs[%d]: socketPtr %x: CardNumber %d", NumberOfRpmbs, pS, mi.iRpmbSlotList[i]));
       
   256 			NumberOfRpmbs++;
       
   257 		}
       
   258 	__KTRACE_OPT(KPBUS1, Kern::Printf("RPMB: Registering of RPMB information from PSL layer complete"));
   235 	
   259 	
   236 	// There may be more than one physical card slot for this socket/stack;
   260 	// There may be more than one physical card slot for this socket/stack;
   237 	// if this is the case, then we have to create a separate DPBusPrimaryMedia 
   261 	// if this is the case, then we have to create a separate DPBusPrimaryMedia 
   238 	// for each one. This is the only way to get the local media sub-system to iterate 
   262 	// for each one. This is the only way to get the local media sub-system to iterate 
   239 	// through the installed set of media drivers repeatedly for each card slot
   263 	// through the installed set of media drivers repeatedly for each card slot
   256 		pS->iStack->DemandPagingInfo(demandPagingInfo) == KErrNone ? (TBool)ETrue : (TBool)EFalse;
   280 		pS->iStack->DemandPagingInfo(demandPagingInfo) == KErrNone ? (TBool)ETrue : (TBool)EFalse;
   257 
   281 
   258 #endif // __WINS__
   282 #endif // __WINS__
   259 
   283 
   260 
   284 
   261 	for (TInt i=0; i<physicalCardSlots ; i++)	
   285 	for (i=0; i<physicalCardSlots ; i++)	
   262 		{
   286 		{
   263 		DPBusPrimaryMedia* pMedia = new DPBusPrimaryMedia(pS);
   287 		DPBusPrimaryMedia* pMedia = new DPBusPrimaryMedia(pS);
   264 		if (pMedia == NULL)
   288 		if (pMedia == NULL)
   265 			return(KErrNoMemory);
   289 			return(KErrNoMemory);
   266 		// store the slot number in DPBusPrimaryMedia so that it can 
   290 		// store the slot number in DPBusPrimaryMedia so that it can