📄 rclanmtl.c
字号:
**** get promiscuous mode setting**** Possible return values placed in pMode:** 0 = promisuous mode not set** 1 = promisuous mode is set**** =========================================================================*/RC_RETURNRCGetPromiscuousMode (struct net_device * dev, PU32 pMode, PFNWAITCALLBACK WaitCallback){ PU32 pMsg; volatile PU32 p32; U32 msgOffset, i; PPAB pPab = ((PDPA) dev->priv)->pPab; msgOffset = pPab->p_atu->InQueue; if (msgOffset == 0xFFFFFFFF) { dprintk (KERN_WARNING "RCGetLinkSpeed(): Inbound Free Q empty!\n"); return RC_RTN_FREE_Q_EMPTY; } /* calc virtual address of msg - virtual already mapped to physical */ pMsg = (PU32) (pPab->pPci45LinBaseAddr + msgOffset); /* virtual pointer to return buffer - clear first two dwords */ p32 = (volatile PU32) pPab->pLinOutMsgBlock; p32[0] = 0xff; /* setup private message */ pMsg[0] = SIX_WORD_MSG_SIZE | SGL_OFFSET_0; pMsg[1] = I2O_PRIVATE << 24 | I2O_HOST_TID << 12 | RC_LAN_TARGET_ID; pMsg[2] = 0; /* initiator context */ pMsg[3] = 0x219; /* transaction context */ pMsg[4] = RC_PCI45_VENDOR_ID << 16 | RC_PRIVATE_GET_PROMISCUOUS_MODE; /* phys address to return status - area right after PAB */ pMsg[5] = pPab->outMsgBlockPhyAddr; /* post to Inbound Post Q */ pPab->p_atu->InQueue = msgOffset; i = 0; /* wait for response */ while (p32[0] == 0xff) { if (i++ > 0xff) { dprintk ("Timeout waiting for promiscuous mode\n"); return RC_RTN_NO_LINK_SPEED; } udelay(50); } /* get mode */ *pMode = (U8) ((volatile PU8) p32)[0] & 0x0f; return RC_RTN_NO_ERROR;}/*** =========================================================================** RCSetBroadcastMode()**** Defined values for Mode:** 0 - turn off promiscuous mode** 1 - turn on promiscuous mode**** =========================================================================*/RC_RETURNRCSetBroadcastMode (struct net_device * dev, U16 Mode){ U32 off; PU32 pMsg; PPAB pPab = ((PDPA) dev->priv)->pPab; if (pPab == NULL) return RC_RTN_ADPTR_NOT_REGISTERED; off = pPab->p_atu->InQueue; /* get addresss of message */ if (0xFFFFFFFF == off) return RC_RTN_FREE_Q_EMPTY; pMsg = (PU32) (pPab->pPci45LinBaseAddr + off); /* setup private message */ pMsg[0] = SIX_WORD_MSG_SIZE | SGL_OFFSET_0; pMsg[1] = I2O_PRIVATE << 24 | I2O_HOST_TID << 12 | RC_LAN_TARGET_ID; pMsg[2] = 0; /* initiator context */ pMsg[3] = 0x219; /* transaction context */ pMsg[4] = RC_PCI45_VENDOR_ID << 16 | RC_PRIVATE_SET_BROADCAST_MODE; pMsg[5] = Mode; /* promiscuous mode setting */ pPab->p_atu->InQueue = off; /* send it to the device */ return RC_RTN_NO_ERROR;}/*** =========================================================================** RCGetBroadcastMode()**** get promiscuous mode setting**** Possible return values placed in pMode:** 0 = promisuous mode not set** 1 = promisuous mode is set**** =========================================================================*/RC_RETURNRCGetBroadcastMode (struct net_device * dev, PU32 pMode, PFNWAITCALLBACK WaitCallback){ U32 msgOffset; PU32 pMsg; volatile PU32 p32; PPAB pPab = ((PDPA) dev->priv)->pPab; msgOffset = pPab->p_atu->InQueue; if (msgOffset == 0xFFFFFFFF) { dprintk (KERN_WARNING "RCGetLinkSpeed(): Inbound Free Q empty!\n"); return RC_RTN_FREE_Q_EMPTY; } /* calc virtual address of msg - virtual already mapped to physical */ pMsg = (PU32) (pPab->pPci45LinBaseAddr + msgOffset); /* virtual pointer to return buffer - clear first two dwords */ p32 = (volatile PU32) pPab->pLinOutMsgBlock; p32[0] = 0xff; /* setup private message */ pMsg[0] = SIX_WORD_MSG_SIZE | SGL_OFFSET_0; pMsg[1] = I2O_PRIVATE << 24 | I2O_HOST_TID << 12 | RC_LAN_TARGET_ID; pMsg[2] = 0; /* initiator context */ pMsg[3] = 0x219; /* transaction context */ pMsg[4] = RC_PCI45_VENDOR_ID << 16 | RC_PRIVATE_GET_BROADCAST_MODE; /* phys address to return status - area right after PAB */ pMsg[5] = pPab->outMsgBlockPhyAddr; /* post to Inbound Post Q */ pPab->p_atu->InQueue = msgOffset; /* wait for response */ if (p32[0] == 0xff) { dprintk (KERN_WARNING "Timeout waiting for promiscuous mode\n"); return RC_RTN_NO_LINK_SPEED; } /* get mode */ *pMode = (U8) ((volatile PU8) p32)[0] & 0x0f; return RC_RTN_NO_ERROR;}/*** =========================================================================** RCGetLinkSpeed()**** get ethernet link speed. **** 0 = Unknown** 1 = Full Duplex 100BaseT** 2 = Half duplex 100BaseT** 3 = Full Duplex 10BaseT** 4 = Half duplex 10BaseT**** =========================================================================*/RC_RETURNRCGetLinkSpeed (struct net_device * dev, PU32 pLinkSpeedCode, PFNWAITCALLBACK WaitCallback){ U32 msgOffset, i; PU32 pMsg; volatile PU32 p32; U8 IOPLinkSpeed; PPAB pPab = ((PDPA) dev->priv)->pPab; msgOffset = pPab->p_atu->InQueue; if (msgOffset == 0xFFFFFFFF) { dprintk (KERN_WARNING "RCGetLinkSpeed(): Inbound Free Q empty!\n"); return RC_RTN_FREE_Q_EMPTY; } /* calc virtual address of msg - virtual already mapped to physical */ pMsg = (PU32) (pPab->pPci45LinBaseAddr + msgOffset); /* virtual pointer to return buffer - clear first two dwords */ p32 = (volatile PU32) pPab->pLinOutMsgBlock; p32[0] = 0xff; /* setup private message */ pMsg[0] = SIX_WORD_MSG_SIZE | SGL_OFFSET_0; pMsg[1] = I2O_PRIVATE << 24 | I2O_HOST_TID << 12 | RC_LAN_TARGET_ID; pMsg[2] = 0; /* initiator context */ pMsg[3] = 0x219; /* transaction context */ pMsg[4] = RC_PCI45_VENDOR_ID << 16 | RC_PRIVATE_GET_LINK_SPEED; /* phys address to return status - area right after PAB */ pMsg[5] = pPab->outMsgBlockPhyAddr; /* post to Inbound Post Q */ pPab->p_atu->InQueue = msgOffset; /* wait for response */ i = 0; while (p32[0] == 0xff) { if (i++ > 0xff) { dprintk ("Timeout waiting for link speed\n"); return RC_RTN_NO_LINK_SPEED; } udelay(50); } /* get Link speed */ IOPLinkSpeed = (U8) ((volatile PU8) p32)[0] & 0x0f; *pLinkSpeedCode = IOPLinkSpeed; return RC_RTN_NO_ERROR;}/*** =========================================================================** RCReportDriverCapability(struct net_device *dev, U32 capability)**** Currently defined bits:** WARM_REBOOT_CAPABLE 0x01**** =========================================================================*/RC_RETURNRCReportDriverCapability (struct net_device * dev, U32 capability){ U32 off; PU32 pMsg; PPAB pPab = ((PDPA) dev->priv)->pPab; if (pPab == NULL) return RC_RTN_ADPTR_NOT_REGISTERED; off = pPab->p_atu->InQueue; /* get addresss of message */ if (0xFFFFFFFF == off) return RC_RTN_FREE_Q_EMPTY; pMsg = (PU32) (pPab->pPci45LinBaseAddr + off); /* setup private message */ pMsg[0] = SIX_WORD_MSG_SIZE | SGL_OFFSET_0; pMsg[1] = I2O_PRIVATE << 24 | I2O_HOST_TID << 12 | RC_LAN_TARGET_ID; pMsg[2] = 0; /* initiator context */ pMsg[3] = 0x219; /* transaction context */ pMsg[4] = RC_PCI45_VENDOR_ID << 16 | RC_PRIVATE_REPORT_DRIVER_CAPABILITY; pMsg[5] = capability; pPab->p_atu->InQueue = off; /* send it to the I2O device */ return RC_RTN_NO_ERROR;}/*** =========================================================================** RCGetFirmwareVer()**** Return firmware version in the form "SoftwareVersion : Bt BootVersion"**** =========================================================================*/RC_RETURNRCGetFirmwareVer (struct net_device * dev, PU8 pFirmString, PFNWAITCALLBACK WaitCallback){ U32 msgOffset, i; PU32 pMsg; volatile PU32 p32; PPAB pPab = ((PDPA) dev->priv)->pPab; msgOffset = pPab->p_atu->InQueue; if (msgOffset == 0xFFFFFFFF) { dprintk ("RCGetFirmwareVer(): Inbound Free Q empty!\n"); return RC_RTN_FREE_Q_EMPTY; } /* calc virtual address of msg - virtual already mapped to physical */ pMsg = (PU32) (pPab->pPci45LinBaseAddr + msgOffset); /* virtual pointer to return buffer - clear first two dwords */ p32 = (volatile PU32) pPab->pLinOutMsgBlock; p32[0] = 0xff; /* setup private message */ pMsg[0] = SIX_WORD_MSG_SIZE | SGL_OFFSET_0; pMsg[1] = I2O_PRIVATE << 24 | I2O_HOST_TID << 12 | RC_LAN_TARGET_ID; pMsg[2] = 0; /* initiator context */ pMsg[3] = 0x219; /* transaction context */ pMsg[4] = RC_PCI45_VENDOR_ID << 16 | RC_PRIVATE_GET_FIRMWARE_REV; /* phys address to return status - area right after PAB */ pMsg[5] = pPab->outMsgBlockPhyAddr; /* post to Inbound Post Q */ pPab->p_atu->InQueue = msgOffset; /* wait for response */ i = 0; while (p32[0] == 0xff) { if (i++ > 0xff) { dprintk ("Timeout waiting for link speed\n"); return RC_RTN_NO_FIRM_VER; } udelay(50); } strcpy (pFirmString, (PU8) p32); return RC_RTN_NO_ERROR;}/*** =========================================================================** RCResetLANCard()**** ResourceFlags indicates whether to return buffer resource explicitly** to host or keep and reuse.** CallbackFunction (if not NULL) is the function to be called when ** reset is complete.** If CallbackFunction is NULL, ReturnAddr will have a 1 placed in it when** reset is done (if not NULL).**** =========================================================================*/RC_RETURNRCResetLANCard (struct net_device * dev, U16 ResourceFlags, PU32 ReturnAddr, PFNCALLBACK CallbackFunction){ unsigned long off; PU32 pMsg; PPAB pPab = ((PDPA) dev->priv)->pPab; long timeout = 0; if (pPab == NULL) return RC_RTN_ADPTR_NOT_REGISTERED; off = pPab->p_atu->InQueue; /* get addresss of message */ if (0xFFFFFFFF == off) return RC_RTN_FREE_Q_EMPTY; pPab->pCallbackFunc = CallbackFunction; pMsg = (PU32) (pPab->pPci45LinBaseAddr + off); /* setup message */ pMsg[0] = FOUR_WORD_MSG_SIZE | SGL_OFFSET_0; pMsg[1] = I2O_LAN_RESET << 24 | I2O_HOST_TID << 12 | RC_LAN_TARGET_ID; pMsg[2] = DEFAULT_RECV_INIT_CONTEXT; pMsg[3] = ResourceFlags << 16; /* resource flags */ pPab->p_atu->InQueue = off; /* send it to the I2O device */ if (CallbackFunction == (PFNCALLBACK) NULL) { /* call RCProcI2OMsgQ() until something in pPab->pCallbackFunc or until timer goes off */ while (pPab->pCallbackFunc == (PFNCALLBACK) NULL) { RCProcI2OMsgQ (dev); mdelay (1); timeout++; if (timeout > 200) { break; } } if (ReturnAddr != (PU32) NULL) *ReturnAddr = (U32) pPab->pCallbackFunc; } return RC_RTN_NO_ERROR;}/*** =========================================================================** RCResetIOP()**** Send StatusGet Msg, wait for results return directly to buffer.**** =========================================================================*/RC_RETURNRCResetIOP (struct net_device * dev){ U32 msgOffset, i; PU32 pMsg; PPAB pPab = ((PDPA) dev->priv)->pPab; volatile PU32 p32; msgOffset = pPab->p_atu->InQueue; if (msgOffset == 0xFFFFFFFF) { return RC_RTN_FREE_Q_EMPTY; } /* calc virtual address of msg - virtual already mapped to physical */ pMsg = (PU32) (pPab->pPci45LinBaseAddr + msgOffset); pMsg[0] = NINE_WORD_MSG_SIZE | SGL_OFFSET_0; pMsg[1] = I2O_EXEC_IOP_RESET << 24 | I2O_HOST_TID << 12 | I2O_IOP_TID; pMsg[2] = 0; /* universal context */ pMsg[3] = 0; /* universal context */ pMsg[4] = 0; /* universal context */ pMsg[5] = 0; /* universal context */ /* phys address to return status - area right after PAB */ pMsg[6] = pPab->outMsgBlockPhyAddr; pMsg[7] = 0; pMsg[8] = 1; /* return 1 byte */ /* virtual pointer to return buffer - clear first two dwords */ p32 = (volatile PU32) pPab->pLinOutMsgBlock; p32[0] = 0; p32[1] = 0; /* post to Inbound Post Q */ pPab->p_atu->InQueue = msgOffset; /* wait for response */ i = 0; while (!p32[0] && !p32[1]) { if (i++ > 0xff) { dprintk ("RCResetIOP timeout\n"); return RC_RTN_MSG_REPLY_TIMEOUT; } udelay(100); } return RC_RTN_NO_ERROR;}/*** =========================================================================** RCShutdownLANCard()**** ResourceFlags indicates whether to return buffer resource explicitly** to host or keep and reuse.** CallbackFunction (if not NULL) is the function to be called when ** shutdown is complete.** If CallbackFunction is NULL, ReturnAddr will have a 1 placed in it when** shutdown is done (if not NULL).**** =========================================================================*/RC_RETURNRCShutdownLANCard (struct net_device * dev, U16 ResourceFlags, PU32 ReturnAddr, PFNCALLBACK CallbackFunction){ volatile PU32 pMsg; U32 off; PPAB pPab = ((PDPA) dev->priv)->pPab; long timeout = 0; if (pPab == NULL) return RC_RTN_ADPTR_NOT_REGISTERED; off = pPab->p_atu->InQueue; /* get addresss of message */ if (0xFFFFFFFF == off) return RC_RTN_FREE_Q_EMPTY; pPab->pCallbackFunc = CallbackFunction; pMsg = (PU32) (pPab->pPci45LinBaseAddr + off); /* setup message */ pMsg[0] = FOUR_WORD_MSG_SIZE | SGL_OFFSET_0; pMsg[1] = I2O_LAN_SHUTDOWN << 24 | I2O_HOST_TID << 12 | RC_LAN_TARGET_ID;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -