static void PlatformIOWrite4Byte(struct net_device *dev, u32 offset, u32 data) { if (offset == PhyAddr) { /* For Base Band configuration. */ unsigned char cmdByte; unsigned long dataBytes; unsigned char idx; u8 u1bTmp; cmdByte = (u8)(data & 0x000000ff); dataBytes = data>>8; /* NdisAcquireSpinLock( &(pDevice->IoSpinLock) ); */ for (idx = 0; idx < 30; idx++) { /* Make sure command bit is clear before access it. */ u1bTmp = PlatformIORead1Byte(dev, PhyAddr); if ((u1bTmp & BIT7) == 0) break; else mdelay(10); } for (idx = 0; idx < 3; idx++) PlatformIOWrite1Byte(dev, offset+1+idx, ((u8 *)&dataBytes)[idx]); write_nic_byte(dev, offset, cmdByte); /* NdisReleaseSpinLock( &(pDevice->IoSpinLock) ); */ } else {
void PlatformIOWrite4Byte( struct net_device *dev, u32 offset, u32 data ) { //{by amy 080312 if (offset == PhyAddr) {//For Base Band configuration. unsigned char cmdByte; unsigned long dataBytes; unsigned char idx; u8 u1bTmp; cmdByte = (u8)(data & 0x000000ff); dataBytes = data>>8; // // 071010, rcnjko: // The critical section is only BB read/write race condition. // Assumption: // 1. We assume NO one will access BB at DIRQL, otherwise, system will crash for // acquiring the spinlock in such context. // 2. PlatformIOWrite4Byte() MUST NOT be recursive. // // NdisAcquireSpinLock( &(pDevice->IoSpinLock) ); for(idx = 0; idx < 30; idx++) { // Make sure command bit is clear before access it. u1bTmp = PlatformIORead1Byte(dev, PhyAddr); if((u1bTmp & BIT7) == 0) break; else mdelay(10); } for(idx=0; idx < 3; idx++) { PlatformIOWrite1Byte(dev,offset+1+idx,((u8*)&dataBytes)[idx] ); } write_nic_byte(dev, offset, cmdByte); // NdisReleaseSpinLock( &(pDevice->IoSpinLock) ); }