]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EmbeddedPkg/Drivers/Lan9118Dxe/Lan9118Dxe.c
EmbeddedPkg: Fix typos in comments
[mirror_edk2.git] / EmbeddedPkg / Drivers / Lan9118Dxe / Lan9118Dxe.c
index d0bf7beefe2afd2eded73a7c2fbec62b2c91b262..bdc390f352480bdf751c586ce950d12dc62d69f7 100644 (file)
@@ -297,7 +297,7 @@ SnpInitialize (
   }\r
 \r
   // Read the PM register\r
-  PmConf = MmioRead32 (LAN9118_PMT_CTRL);\r
+  PmConf = Lan9118MmioRead32 (LAN9118_PMT_CTRL);\r
 \r
   // MPTCTRL_WOL_EN: Allow Wake-On-Lan to detect wake up frames or magic packets\r
   // MPTCTRL_ED_EN:  Allow energy detection to allow lowest power consumption mode\r
@@ -306,8 +306,7 @@ SnpInitialize (
   PmConf |= (MPTCTRL_WOL_EN | MPTCTRL_ED_EN | MPTCTRL_PME_EN);\r
 \r
   // Write the current configuration to the register\r
-  MmioWrite32 (LAN9118_PMT_CTRL, PmConf);\r
-  MemoryFence();\r
+  Lan9118MmioWrite32 (LAN9118_PMT_CTRL, PmConf);\r
 \r
   // Configure GPIO and HW\r
   Status = ConfigureHardware (HW_CONF_USE_LEDS, Snp);\r
@@ -358,7 +357,7 @@ SnpInitialize (
   }\r
 \r
   // Now acknowledge all interrupts\r
-  MmioWrite32 (LAN9118_INT_STS, ~0);\r
+  Lan9118MmioWrite32 (LAN9118_INT_STS, ~0);\r
 \r
   // Declare the driver as initialized\r
   Snp->Mode->State = EfiSimpleNetworkInitialized;\r
@@ -421,7 +420,7 @@ SnpReset (
   }\r
 \r
   // Read the PM register\r
-  PmConf = MmioRead32 (LAN9118_PMT_CTRL);\r
+  PmConf = Lan9118MmioRead32 (LAN9118_PMT_CTRL);\r
 \r
   // MPTCTRL_WOL_EN: Allow Wake-On-Lan to detect wake up frames or magic packets\r
   // MPTCTRL_ED_EN:  Allow energy detection to allow lowest power consumption mode\r
@@ -429,8 +428,7 @@ SnpReset (
   PmConf |= (MPTCTRL_WOL_EN | MPTCTRL_ED_EN | MPTCTRL_PME_EN);\r
 \r
   // Write the current configuration to the register\r
-  MmioWrite32 (LAN9118_PMT_CTRL, PmConf);\r
-  MemoryFence();\r
+  Lan9118MmioWrite32 (LAN9118_PMT_CTRL, PmConf);\r
 \r
   // Reactivate the LEDs\r
   Status = ConfigureHardware (HW_CONF_USE_LEDS, Snp);\r
@@ -440,12 +438,11 @@ SnpReset (
 \r
   // Check that a buffer size was specified in SnpInitialize\r
   if (gTxBuffer != 0) {\r
-    HwConf = MmioRead32 (LAN9118_HW_CFG);        // Read the HW register\r
+    HwConf = Lan9118MmioRead32 (LAN9118_HW_CFG);        // Read the HW register\r
     HwConf &= ~HW_CFG_TX_FIFO_SIZE_MASK;         // Clear buffer bits first\r
     HwConf |= HW_CFG_TX_FIFO_SIZE(gTxBuffer);    // assign size chosen in SnpInitialize\r
 \r
-    MmioWrite32 (LAN9118_HW_CFG, HwConf);        // Write the conf\r
-    MemoryFence();\r
+    Lan9118MmioWrite32 (LAN9118_HW_CFG, HwConf);        // Write the conf\r
   }\r
 \r
   // Enable the receiver and transmitter and clear their contents\r
@@ -453,7 +450,7 @@ SnpReset (
   StartTx (START_TX_MAC | START_TX_CFG | START_TX_CLEAR, Snp);\r
 \r
   // Now acknowledge all interrupts\r
-  MmioWrite32 (LAN9118_INT_STS, ~0);\r
+  Lan9118MmioWrite32 (LAN9118_INT_STS, ~0);\r
 \r
   return EFI_SUCCESS;\r
 }\r
@@ -700,7 +697,6 @@ SnpReceiveFilters (
   // Write the options to the MAC_CSR\r
   //\r
   IndirectMACWrite32 (INDIRECT_MAC_INDEX_CR, MacCSRValue);\r
-  MemoryFence();\r
 \r
   //\r
   // If we have to retrieve something, start packet reception.\r
@@ -995,12 +991,12 @@ SnpGetStatus (
   // consumer of SNP does not call GetStatus.)\r
   // TODO will we lose TxStatuses if this happens? Maybe in SnpTransmit we\r
   // should check for it and dump the TX Status FIFO.\r
-  FifoInt = MmioRead32 (LAN9118_FIFO_INT);\r
+  FifoInt = Lan9118MmioRead32 (LAN9118_FIFO_INT);\r
 \r
   // Clear the TX Status FIFO Overflow\r
   if ((FifoInt & INSTS_TXSO) == 0) {\r
     FifoInt |= INSTS_TXSO;\r
-    MmioWrite32 (LAN9118_FIFO_INT, FifoInt);\r
+    Lan9118MmioWrite32 (LAN9118_FIFO_INT, FifoInt);\r
   }\r
 \r
   // Read interrupt status if IrqStat is not NULL\r
@@ -1008,30 +1004,30 @@ SnpGetStatus (
     *IrqStat = 0;\r
 \r
     // Check for receive interrupt\r
-    if (MmioRead32 (LAN9118_INT_STS) & INSTS_RSFL) { // Data moved from rx FIFO\r
+    if (Lan9118MmioRead32 (LAN9118_INT_STS) & INSTS_RSFL) { // Data moved from rx FIFO\r
       *IrqStat |= EFI_SIMPLE_NETWORK_RECEIVE_INTERRUPT;\r
-      MmioWrite32 (LAN9118_INT_STS,INSTS_RSFL);\r
+      Lan9118MmioWrite32 (LAN9118_INT_STS,INSTS_RSFL);\r
     }\r
 \r
     // Check for transmit interrupt\r
-    if (MmioRead32 (LAN9118_INT_STS) & INSTS_TSFL) {\r
+    if (Lan9118MmioRead32 (LAN9118_INT_STS) & INSTS_TSFL) {\r
       *IrqStat |= EFI_SIMPLE_NETWORK_TRANSMIT_INTERRUPT;\r
-      MmioWrite32 (LAN9118_INT_STS,INSTS_TSFL);\r
+      Lan9118MmioWrite32 (LAN9118_INT_STS,INSTS_TSFL);\r
     }\r
 \r
     // Check for software interrupt\r
-    if (MmioRead32 (LAN9118_INT_STS) & INSTS_SW_INT) {\r
+    if (Lan9118MmioRead32 (LAN9118_INT_STS) & INSTS_SW_INT) {\r
       *IrqStat |= EFI_SIMPLE_NETWORK_SOFTWARE_INTERRUPT;\r
-      MmioWrite32 (LAN9118_INT_STS,INSTS_SW_INT);\r
+      Lan9118MmioWrite32 (LAN9118_INT_STS,INSTS_SW_INT);\r
     }\r
   }\r
 \r
   // Check Status of transmitted packets\r
   // (We ignore TXSTATUS_NO_CA has it might happen in Full Duplex)\r
 \r
-  NumTxStatusEntries = MmioRead32(LAN9118_TX_FIFO_INF) & TXFIFOINF_TXSUSED_MASK;\r
+  NumTxStatusEntries = Lan9118MmioRead32(LAN9118_TX_FIFO_INF) & TXFIFOINF_TXSUSED_MASK;\r
   if (NumTxStatusEntries > 0) {\r
-    TxStatus = MmioRead32 (LAN9118_TX_STATUS);\r
+    TxStatus = Lan9118MmioRead32 (LAN9118_TX_STATUS);\r
     PacketTag = TxStatus >> 16;\r
     TxStatus = TxStatus & 0xFFFF;\r
     if ((TxStatus & TXSTATUS_ES) && (TxStatus != (TXSTATUS_ES | TXSTATUS_NO_CA))) {\r
@@ -1059,10 +1055,12 @@ SnpGetStatus (
       LanDriver->Stats.TxTotalFrames += 1;\r
       *TxBuff = LanDriver->TxRing[PacketTag % LAN9118_TX_RING_NUM_ENTRIES];\r
     }\r
+  } else if (TxBuff != NULL) {\r
+    *TxBuff = NULL;\r
   }\r
 \r
   // Check for a TX Error interrupt\r
-  Interrupts = MmioRead32 (LAN9118_INT_STS);\r
+  Interrupts = Lan9118MmioRead32 (LAN9118_INT_STS);\r
   if (Interrupts & INSTS_TXE) {\r
     DEBUG ((EFI_D_ERROR, "LAN9118: Transmitter error. Restarting..."));\r
 \r
@@ -1220,25 +1218,25 @@ SnpTransmit (
     CommandB = TX_CMD_B_PACKET_TAG (PacketTag) | TX_CMD_B_PACKET_LENGTH (BuffSize);\r
 \r
     // Write the commands first\r
-    MmioWrite32 (LAN9118_TX_DATA, CommandA);\r
-    MmioWrite32 (LAN9118_TX_DATA, CommandB);\r
+    Lan9118MmioWrite32 (LAN9118_TX_DATA, CommandA);\r
+    Lan9118MmioWrite32 (LAN9118_TX_DATA, CommandB);\r
 \r
     // Write the destination address\r
-    MmioWrite32 (LAN9118_TX_DATA,\r
+    Lan9118MmioWrite32 (LAN9118_TX_DATA,\r
                (DstAddr->Addr[0]) |\r
                (DstAddr->Addr[1] << 8) |\r
                (DstAddr->Addr[2] << 16) |\r
                (DstAddr->Addr[3] << 24)\r
                );\r
 \r
-    MmioWrite32 (LAN9118_TX_DATA,\r
+    Lan9118MmioWrite32 (LAN9118_TX_DATA,\r
                (DstAddr->Addr[4]) |\r
                (DstAddr->Addr[5] << 8) |\r
                (SrcAddr->Addr[0] << 16) | // Write the Source Address\r
                (SrcAddr->Addr[1] << 24)\r
                );\r
 \r
-    MmioWrite32 (LAN9118_TX_DATA,\r
+    Lan9118MmioWrite32 (LAN9118_TX_DATA,\r
                (SrcAddr->Addr[2]) |\r
                (SrcAddr->Addr[3] << 8) |\r
                (SrcAddr->Addr[4] << 16) |\r
@@ -1246,18 +1244,18 @@ SnpTransmit (
                );\r
 \r
     // Write the Protocol\r
-    MmioWrite32 (LAN9118_TX_DATA, (UINT32)(HTONS (LocalProtocol)));\r
+    Lan9118MmioWrite32 (LAN9118_TX_DATA, (UINT32)(HTONS (LocalProtocol)));\r
 \r
     // Next buffer is the payload\r
     CommandA = TX_CMD_A_LAST_SEGMENT | TX_CMD_A_BUFF_SIZE (BuffSize - HdrSize) | TX_CMD_A_COMPLETION_INT | TX_CMD_A_DATA_START_OFFSET (2); // 2 bytes beginning offset\r
 \r
     // Write the commands\r
-    MmioWrite32 (LAN9118_TX_DATA, CommandA);\r
-    MmioWrite32 (LAN9118_TX_DATA, CommandB);\r
+    Lan9118MmioWrite32 (LAN9118_TX_DATA, CommandA);\r
+    Lan9118MmioWrite32 (LAN9118_TX_DATA, CommandB);\r
 \r
     // Write the payload\r
     for (Count = 0; Count < ((BuffSize + 3) >> 2) - 3; Count++) {\r
-      MmioWrite32 (LAN9118_TX_DATA, LocalData[Count + 3]);\r
+      Lan9118MmioWrite32 (LAN9118_TX_DATA, LocalData[Count + 3]);\r
     }\r
   } else {\r
     // Format pointer\r
@@ -1268,12 +1266,12 @@ SnpTransmit (
     CommandB = TX_CMD_B_PACKET_TAG (PacketTag) | TX_CMD_B_PACKET_LENGTH (BuffSize);\r
 \r
     // Write the commands first\r
-    MmioWrite32 (LAN9118_TX_DATA, CommandA);\r
-    MmioWrite32 (LAN9118_TX_DATA, CommandB);\r
+    Lan9118MmioWrite32 (LAN9118_TX_DATA, CommandA);\r
+    Lan9118MmioWrite32 (LAN9118_TX_DATA, CommandB);\r
 \r
     // Write all the data\r
     for (Count = 0; Count < ((BuffSize + 3) >> 2); Count++) {\r
-      MmioWrite32 (LAN9118_TX_DATA, LocalData[Count]);\r
+      Lan9118MmioWrite32 (LAN9118_TX_DATA, LocalData[Count]);\r
     }\r
   }\r
 \r
@@ -1361,13 +1359,13 @@ SnpReceive (
   // explain those errors has been found so far and everything seems to\r
   // work perfectly when they are just ignored.\r
   //\r
-  IntSts = MmioRead32 (LAN9118_INT_STS);\r
+  IntSts = Lan9118MmioRead32 (LAN9118_INT_STS);\r
   if ((IntSts & INSTS_RXE) && (!(IntSts & INSTS_RSFF))) {\r
-    MmioWrite32 (LAN9118_INT_STS, INSTS_RXE);\r
+    Lan9118MmioWrite32 (LAN9118_INT_STS, INSTS_RXE);\r
   }\r
 \r
   // Count dropped frames\r
-  DroppedFrames = MmioRead32 (LAN9118_RX_DROP);\r
+  DroppedFrames = Lan9118MmioRead32 (LAN9118_RX_DROP);\r
   LanDriver->Stats.RxDroppedFrames += DroppedFrames;\r
 \r
   NumPackets = RxStatusUsedSpace (0, Snp) / 4;\r
@@ -1376,7 +1374,7 @@ SnpReceive (
   }\r
 \r
   // Read Rx Status (only if not empty)\r
-  RxFifoStatus = MmioRead32 (LAN9118_RX_STATUS);\r
+  RxFifoStatus = Lan9118MmioRead32 (LAN9118_RX_STATUS);\r
   LanDriver->Stats.RxTotalFrames += 1;\r
 \r
   // First check for errors\r
@@ -1449,13 +1447,13 @@ SnpReceive (
 \r
   // Set the amount of data to be transfered out of FIFO for THIS packet\r
   // This can be used to trigger an interrupt, and status can be checked\r
-  RxCfgValue = MmioRead32 (LAN9118_RX_CFG);\r
+  RxCfgValue = Lan9118MmioRead32 (LAN9118_RX_CFG);\r
   RxCfgValue &= ~(RXCFG_RX_DMA_CNT_MASK);\r
   RxCfgValue |= RXCFG_RX_DMA_CNT (ReadLimit);\r
 \r
   // Set end alignment to 4-bytes\r
   RxCfgValue &= ~(RXCFG_RX_END_ALIGN_MASK);\r
-  MmioWrite32 (LAN9118_RX_CFG, RxCfgValue);\r
+  Lan9118MmioWrite32 (LAN9118_RX_CFG, RxCfgValue);\r
 \r
   // Update buffer size\r
   *BuffSize = PLength; // -4 bytes may be needed: Received in buffer as\r
@@ -1470,7 +1468,7 @@ SnpReceive (
 \r
   // Read Rx Packet\r
   for (Count = 0; Count < ReadLimit; Count++) {\r
-    RawData[Count] = MmioRead32 (LAN9118_RX_DATA);\r
+    RawData[Count] = Lan9118MmioRead32 (LAN9118_RX_DATA);\r
   }\r
 \r
   // Get the destination address\r
@@ -1501,7 +1499,7 @@ SnpReceive (
   }\r
 \r
   // Check for Rx errors (worst possible error)\r
-  if (MmioRead32 (LAN9118_INT_STS) & INSTS_RXE) {\r
+  if (Lan9118MmioRead32 (LAN9118_INT_STS) & INSTS_RXE) {\r
     DEBUG ((EFI_D_WARN, "Warning: Receiver Error. Restarting...\n"));\r
 \r
     // Software reset, the RXE interrupt is cleared by the reset.\r
@@ -1518,7 +1516,7 @@ SnpReceive (
     }\r
 \r
     //\r
-    // Restart the receiver and the transmitter without reseting the FIFOs\r
+    // Restart the receiver and the transmitter without resetting the FIFOs\r
     // as it has been done by SoftReset().\r
     //\r
     StartRx (0, Snp);\r