Fix K8 report bugs.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8139 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
		@@ -1065,6 +1065,11 @@ IsaIoMap_FullSupport (
 | 
				
			|||||||
  if (Operation < 0 || Operation >= EfiIsaIoOperationMaximum) {
 | 
					  if (Operation < 0 || Operation >= EfiIsaIoOperationMaximum) {
 | 
				
			||||||
    return EFI_INVALID_PARAMETER;
 | 
					    return EFI_INVALID_PARAMETER;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (ChannelNumber >= 8) {
 | 
				
			||||||
 | 
					    return EFI_INVALID_PARAMETER;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
  // See if this is a Slave DMA Operation
 | 
					  // See if this is a Slave DMA Operation
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -373,6 +373,10 @@ ReassignIdeResources (
 | 
				
			|||||||
  UINT16                  CommandBlockBaseAddr;
 | 
					  UINT16                  CommandBlockBaseAddr;
 | 
				
			||||||
  UINT16                  ControlBlockBaseAddr;
 | 
					  UINT16                  ControlBlockBaseAddr;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (IdeDev->Channel >= IdeMaxChannel) {
 | 
				
			||||||
 | 
					    return EFI_INVALID_PARAMETER;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
  // Requery IDE IO port registers' base addresses in case of the switch of
 | 
					  // Requery IDE IO port registers' base addresses in case of the switch of
 | 
				
			||||||
  // native and legacy modes
 | 
					  // native and legacy modes
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -360,6 +360,14 @@ IDEBusDriverBindingStart (
 | 
				
			|||||||
    EndIdeChannel       = BeginningIdeChannel;
 | 
					    EndIdeChannel       = BeginningIdeChannel;
 | 
				
			||||||
    BeginningIdeDevice  = Node->Atapi.SlaveMaster;
 | 
					    BeginningIdeDevice  = Node->Atapi.SlaveMaster;
 | 
				
			||||||
    EndIdeDevice        = BeginningIdeDevice;
 | 
					    EndIdeDevice        = BeginningIdeDevice;
 | 
				
			||||||
 | 
					    if (BeginningIdeChannel >= IdeMaxChannel || EndIdeChannel >= IdeMaxChannel) {
 | 
				
			||||||
 | 
					      Status = EFI_INVALID_PARAMETER;
 | 
				
			||||||
 | 
					      goto ErrorExit;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    if (BeginningIdeDevice >= IdeMaxDevice|| EndIdeDevice >= IdeMaxDevice) {
 | 
				
			||||||
 | 
					      Status = EFI_INVALID_PARAMETER;
 | 
				
			||||||
 | 
					      goto ErrorExit;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
@@ -1030,8 +1038,9 @@ DeRegisterIdeDevice (
 | 
				
			|||||||
  // Release allocated resources
 | 
					  // Release allocated resources
 | 
				
			||||||
  //
 | 
					  //
 | 
				
			||||||
  Index = IdeBlkIoDevice->Channel * 2 + IdeBlkIoDevice->Device;
 | 
					  Index = IdeBlkIoDevice->Channel * 2 + IdeBlkIoDevice->Device;
 | 
				
			||||||
  IdeBlkIoDevice->IdeBusDriverPrivateData->HaveScannedDevice[Index] = FALSE;
 | 
					  if (Index < MAX_IDE_DEVICE) {
 | 
				
			||||||
 | 
					    IdeBlkIoDevice->IdeBusDriverPrivateData->HaveScannedDevice[Index] = FALSE;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
  ReleaseIdeResources (IdeBlkIoDevice);
 | 
					  ReleaseIdeResources (IdeBlkIoDevice);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return EFI_SUCCESS;
 | 
					  return EFI_SUCCESS;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1202,7 +1202,11 @@ GetHpcPciAddressFromRootBridge (
 | 
				
			|||||||
    return EFI_NOT_FOUND;
 | 
					    return EFI_NOT_FOUND;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  *PciAddress = EFI_PCI_ADDRESS (Temp->BusNumber, Temp->DeviceNumber, Temp->FunctionNumber, 0);
 | 
					  if (Temp != NULL) {
 | 
				
			||||||
 | 
					    *PciAddress = EFI_PCI_ADDRESS (Temp->BusNumber, Temp->DeviceNumber, Temp->FunctionNumber, 0);
 | 
				
			||||||
 | 
					  } else {
 | 
				
			||||||
 | 
					    return EFI_NOT_FOUND;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return EFI_SUCCESS;
 | 
					  return EFI_SUCCESS;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -127,7 +127,7 @@ MakeTable (
 | 
				
			|||||||
  UINT16  WordOfStart;
 | 
					  UINT16  WordOfStart;
 | 
				
			||||||
  UINT16  WordOfCount;
 | 
					  UINT16  WordOfCount;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  for (Index = 1; Index <= 16; Index++) {
 | 
					  for (Index = 0; Index <= 16; Index++) {
 | 
				
			||||||
    Count[Index] = 0;
 | 
					    Count[Index] = 0;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -135,6 +135,7 @@ MakeTable (
 | 
				
			|||||||
    Count[BitLen[Index]]++;
 | 
					    Count[BitLen[Index]]++;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
 | 
					  Start[0] = 0;
 | 
				
			||||||
  Start[1] = 0;
 | 
					  Start[1] = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  for (Index = 1; Index <= 16; Index++) {
 | 
					  for (Index = 1; Index <= 16; Index++) {
 | 
				
			||||||
@@ -150,6 +151,7 @@ MakeTable (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  JuBits = (UINT16) (16 - TableBits);
 | 
					  JuBits = (UINT16) (16 - TableBits);
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
 | 
					  Weight[0] = 0;
 | 
				
			||||||
  for (Index = 1; Index <= TableBits; Index++) {
 | 
					  for (Index = 1; Index <= TableBits; Index++) {
 | 
				
			||||||
    Start[Index] >>= JuBits;
 | 
					    Start[Index] >>= JuBits;
 | 
				
			||||||
    Weight[Index] = (UINT16) (1U << (TableBits - Index));
 | 
					    Weight[Index] = (UINT16) (1U << (TableBits - Index));
 | 
				
			||||||
@@ -164,8 +166,8 @@ MakeTable (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  if (Index != 0) {
 | 
					  if (Index != 0) {
 | 
				
			||||||
    Index3 = (UINT16) (1U << TableBits);
 | 
					    Index3 = (UINT16) (1U << TableBits);
 | 
				
			||||||
    while (Index != Index3) {
 | 
					    if (Index < Index3) {
 | 
				
			||||||
      Table[Index++] = 0;
 | 
					      SetMem16 (Table + Index, (Index3 - Index) * sizeof (*Table), 0);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -175,7 +177,7 @@ MakeTable (
 | 
				
			|||||||
  for (Char = 0; Char < NumOfChar; Char++) {
 | 
					  for (Char = 0; Char < NumOfChar; Char++) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Len = BitLen[Char];
 | 
					    Len = BitLen[Char];
 | 
				
			||||||
    if (Len == 0) {
 | 
					    if (Len == 0 || Len >= 17) {
 | 
				
			||||||
      continue;
 | 
					      continue;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -194,15 +196,17 @@ MakeTable (
 | 
				
			|||||||
      Index   = (UINT16) (Len - TableBits);
 | 
					      Index   = (UINT16) (Len - TableBits);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      while (Index != 0) {
 | 
					      while (Index != 0) {
 | 
				
			||||||
        if (*Pointer == 0) {
 | 
					        if (*Pointer == 0 && Avail < (2 * NC - 1)) {
 | 
				
			||||||
          Sd->mRight[Avail]                     = Sd->mLeft[Avail] = 0;
 | 
					          Sd->mRight[Avail] = Sd->mLeft[Avail] = 0;
 | 
				
			||||||
          *Pointer = Avail++;
 | 
					          *Pointer = Avail++;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        if (Index3 & Mask) {
 | 
					        if (*Pointer < (2 * NC - 1)) {
 | 
				
			||||||
          Pointer = &Sd->mRight[*Pointer];
 | 
					          if ((Index3 & Mask) != 0) {
 | 
				
			||||||
        } else {
 | 
					            Pointer = &Sd->mRight[*Pointer];
 | 
				
			||||||
          Pointer = &Sd->mLeft[*Pointer];
 | 
					          } else {
 | 
				
			||||||
 | 
					            Pointer = &Sd->mLeft[*Pointer];
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Index3 <<= 1;
 | 
					        Index3 <<= 1;
 | 
				
			||||||
@@ -294,28 +298,37 @@ ReadPTLen (
 | 
				
			|||||||
  volatile UINT16  Index;
 | 
					  volatile UINT16  Index;
 | 
				
			||||||
  UINT32  Mask;
 | 
					  UINT32  Mask;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
 | 
					  // Read Extra Set Code Length Array size 
 | 
				
			||||||
 | 
					  //
 | 
				
			||||||
  Number = (UINT16) GetBits (Sd, nbit);
 | 
					  Number = (UINT16) GetBits (Sd, nbit);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (Number == 0) {
 | 
					  if (Number == 0) {
 | 
				
			||||||
 | 
					    //
 | 
				
			||||||
 | 
					    // This represents only Huffman code used
 | 
				
			||||||
 | 
					    //
 | 
				
			||||||
    CharC = (UINT16) GetBits (Sd, nbit);
 | 
					    CharC = (UINT16) GetBits (Sd, nbit);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (Index = 0; Index < 256; Index++) {
 | 
					    for (Index = 0; Index < 256; Index++) {
 | 
				
			||||||
      Sd->mPTTable[Index] = CharC;
 | 
					      Sd->mPTTable[Index] = CharC;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (Index = 0; Index < nn; Index++) {
 | 
					    SetMem (Sd->mPTLen, nn, 0);
 | 
				
			||||||
      Sd->mPTLen[Index] = 0;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Index = 0;
 | 
					  Index = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  while (Index < Number) {
 | 
					  while (Index < Number && Index < NPT) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    CharC = (UINT16) (Sd->mBitBuf >> (BITBUFSIZ - 3));
 | 
					    CharC = (UINT16) (Sd->mBitBuf >> (BITBUFSIZ - 3));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    //
 | 
				
			||||||
 | 
					    // If a code length is less than 7, then it is encoded as a 3-bit
 | 
				
			||||||
 | 
					    // value. Or it is encoded as a series of "1"s followed by a 
 | 
				
			||||||
 | 
					    // terminating "0". The number of "1"s = Code length - 4.
 | 
				
			||||||
 | 
					    //
 | 
				
			||||||
    if (CharC == 7) {
 | 
					    if (CharC == 7) {
 | 
				
			||||||
      Mask = 1U << (BITBUFSIZ - 1 - 3);
 | 
					      Mask = 1U << (BITBUFSIZ - 1 - 3);
 | 
				
			||||||
      while (Mask & Sd->mBitBuf) {
 | 
					      while (Mask & Sd->mBitBuf) {
 | 
				
			||||||
@@ -328,15 +341,21 @@ ReadPTLen (
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    Sd->mPTLen[Index++] = (UINT8) CharC;
 | 
					    Sd->mPTLen[Index++] = (UINT8) CharC;
 | 
				
			||||||
 
 | 
					 
 | 
				
			||||||
 | 
					    //
 | 
				
			||||||
 | 
					    // For Code&Len Set, 
 | 
				
			||||||
 | 
					    // After the third length of the code length concatenation,
 | 
				
			||||||
 | 
					    // a 2-bit value is used to indicated the number of consecutive 
 | 
				
			||||||
 | 
					    // zero lengths after the third length.
 | 
				
			||||||
 | 
					    //
 | 
				
			||||||
    if (Index == Special) {
 | 
					    if (Index == Special) {
 | 
				
			||||||
      CharC = (UINT16) GetBits (Sd, 2);
 | 
					      CharC = (UINT16) GetBits (Sd, 2);
 | 
				
			||||||
      while ((INT16) (--CharC) >= 0) {
 | 
					      while ((INT16) (--CharC) >= 0 && Index < NPT) {
 | 
				
			||||||
        Sd->mPTLen[Index++] = 0;
 | 
					        Sd->mPTLen[Index++] = 0;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  while (Index < nn) {
 | 
					  while (Index < nn && Index < NPT) {
 | 
				
			||||||
    Sd->mPTLen[Index++] = 0;
 | 
					    Sd->mPTLen[Index++] = 0;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
@@ -365,11 +384,12 @@ ReadCLen (
 | 
				
			|||||||
  Number = (UINT16) GetBits (Sd, CBIT);
 | 
					  Number = (UINT16) GetBits (Sd, CBIT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (Number == 0) {
 | 
					  if (Number == 0) {
 | 
				
			||||||
 | 
					    //
 | 
				
			||||||
 | 
					    // This represents only Huffman code used
 | 
				
			||||||
 | 
					    //
 | 
				
			||||||
    CharC = (UINT16) GetBits (Sd, CBIT);
 | 
					    CharC = (UINT16) GetBits (Sd, CBIT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (Index = 0; Index < NC; Index++) {
 | 
					    SetMem (Sd->mCLen, NC, 0);
 | 
				
			||||||
      Sd->mCLen[Index] = 0;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (Index = 0; Index < 4096; Index++) {
 | 
					    for (Index = 0; Index < 4096; Index++) {
 | 
				
			||||||
      Sd->mCTable[Index] = CharC;
 | 
					      Sd->mCTable[Index] = CharC;
 | 
				
			||||||
@@ -379,8 +399,7 @@ ReadCLen (
 | 
				
			|||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Index = 0;
 | 
					  Index = 0;
 | 
				
			||||||
  while (Index < Number) {
 | 
					  while (Index < Number && Index < NC) {
 | 
				
			||||||
 | 
					 | 
				
			||||||
    CharC = Sd->mPTTable[Sd->mBitBuf >> (BITBUFSIZ - 8)];
 | 
					    CharC = Sd->mPTTable[Sd->mBitBuf >> (BITBUFSIZ - 8)];
 | 
				
			||||||
    if (CharC >= NT) {
 | 
					    if (CharC >= NT) {
 | 
				
			||||||
      Mask = 1U << (BITBUFSIZ - 1 - 8);
 | 
					      Mask = 1U << (BITBUFSIZ - 1 - 8);
 | 
				
			||||||
@@ -412,7 +431,7 @@ ReadCLen (
 | 
				
			|||||||
        CharC = (UINT16) (GetBits (Sd, CBIT) + 20);
 | 
					        CharC = (UINT16) (GetBits (Sd, CBIT) + 20);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      while ((INT16) (--CharC) >= 0) {
 | 
					      while ((INT16) (--CharC) >= 0 && Index < NC) {
 | 
				
			||||||
        Sd->mCLen[Index++] = 0;
 | 
					        Sd->mCLen[Index++] = 0;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -423,9 +442,7 @@ ReadCLen (
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  while (Index < NC) {
 | 
					  SetMem (Sd->mCLen + Index, NC - Index, 0);
 | 
				
			||||||
    Sd->mCLen[Index++] = 0;
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
  MakeTable (Sd, NC, Sd->mCLen, 12, Sd->mCTable);
 | 
					  MakeTable (Sd, NC, Sd->mCLen, 12, Sd->mCTable);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user