示例#1
0
static bool ReplaceMenu(FScanner &sc, FMenuDescriptor *desc)
{
	FMenuDescriptor **pOld = MenuDescriptors.CheckKey(desc->mMenuName);
	if (pOld != NULL && *pOld != NULL) 
	{
		if (CheckCompatible(desc, *pOld))
		{
			delete *pOld;
		}
		else
		{
			sc.ScriptMessage("Tried to replace menu '%s' with a menu of different type", desc->mMenuName.GetChars());
			return true;
		}
	}
	MenuDescriptors[desc->mMenuName] = desc;
	return false;
}
示例#2
0
/**
 * Explore for a new node over a link, handling whatever is found.
 *
 * Open a temporary route over a link on the current node.
 * Make checks for compatibility and capability in the proper sequence.
 * If the node found is new, set a token to it, so it will be recognized in the
 * future, and notify an event for finding a new node.
 * If the node is already found (token is set), just return status.
 *
 * @param[in]     CurrentNode         The node we are exploring from
 * @param[in]     CurrentLink         The Link on that node to explore.
 * @param[in]     LogicalProcessor    The processor to update in the maps.
 * @param[in,out] NewNodeSavedInfo    The saved info for nodes in that processor.
 * @param[in]     State               Access to Northbridge interface.
 *
 * @retval ExploreNodeStatusNew    A new node was found
 * @retval ExploreNodeStatusGood   This is a good link to an already known node
 * @retval ExploreNodeStatusStop   Stop Coherent Discovery
 */
EXPLORE_NODE_STATUS
STATIC
ExploreNode (
  IN       UINT8       CurrentNode,
  IN       UINT8       CurrentLink,
  IN       UINT8       LogicalProcessor,
  IN OUT   NEW_NODE_SAVED_INFO_LIST NewNodeSavedInfo,
  IN       STATE_DATA  *State
  )
{
  UINT8 Token;
  EXPLORE_NODE_STATUS Status;

  // Modify CurrentNode's routing table to use CurrentLink to send
  // traffic to CurrentNode + 1
  //
  State->Nb->WriteRoutingTable (CurrentNode, (CurrentNode + 1), CurrentLink, State->Nb);
  if (!State->Nb->HandleSpecialNodeCase ((CurrentNode + 1), CurrentLink, State, State->Nb)) {
    if (CheckCompatible (CurrentNode, CurrentLink, State)) {
      // Read Token from Current + 1
      Token = State->Nb->ReadToken ((CurrentNode + 1), State->Nb);
      ASSERT (Token <= State->NodesDiscovered);
      if (Token == 0) {
        State->NodesDiscovered++;
        ASSERT (State->NodesDiscovered < MAX_NODES);
        if (CheckCapable (CurrentNode, CurrentLink, State)) {
          Token = State->NodesDiscovered;
          State->Nb->WriteToken ((CurrentNode + 1), Token, State->Nb);
          // Fill in Saved New Node info for the discovered node.
          // We do this so we don't have to keep a temporary route open to it.
          // So we save everything that might be needed to set the socket and node
          // maps for either the software or hardware method.
          //
          (*NewNodeSavedInfo)[Token].LogicalProcessor = LogicalProcessor;
          (*NewNodeSavedInfo)[Token].CurrentNode = CurrentNode;
          (*NewNodeSavedInfo)[Token].CurrentLink = CurrentLink;
          (*NewNodeSavedInfo)[Token].PackageLink = State->Nb->GetPackageLink (CurrentNode, CurrentLink, State->Nb);
          (*NewNodeSavedInfo)[Token].HardwareSocket = State->Nb->GetSocket (Token, (CurrentNode + 1), State->Nb);
          State->Nb->GetModuleInfo (
            CurrentNode,
            &((*NewNodeSavedInfo)[Token].CurrentModuleType),
            &((*NewNodeSavedInfo)[Token].CurrentModule),
            State->Nb
            );
          State->Nb->GetModuleInfo (
            (CurrentNode + 1),
            &((*NewNodeSavedInfo)[Token].NewModuleType),
            &((*NewNodeSavedInfo)[Token].NewModule),
            State->Nb
            );

          // Notify BIOS with info
          NotifyInfoCohNodeDiscovered (
            CurrentNode,
            CurrentLink,
            Token,
            (CurrentNode + 1),
            State
            );
          Status = ExploreNodeStatusNew;
        } else {
          // Failed Capable
          Status = ExploreNodeStatusStop;
        }
      } else {
        // Not a new node, token already set
        Status = ExploreNodeStatusGood;
      }
    } else {
      // Failed Compatible
      Status = ExploreNodeStatusStop;
    }
  } else {
    // Ignore this node
    Status = ExploreNodeStatusIgnore;
  }

  return Status;
}