Clean up AMD FAM10 HT variable initialization. The structure init is cleaner, avoid compiler warnings, and matches the AMD example code more closely.

Signed-off-by: Marc Jones <marc.jones@amd.com>

Acked-by: Peter Stuge <peter@stuge.se>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>



git-svn-id: svn://svn.coreboot.org/coreboot/trunk@3425 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Marc Jones 2008-07-17 19:50:37 +00:00
parent 2df291574d
commit 212486e9f6
2 changed files with 85 additions and 54 deletions

View File

@ -112,7 +112,7 @@
*/ */
/*---------------------------------------------------------------------------------------- /*----------------------------------------------------------------------------------------
* int * u8
* graphHowManyNodes(u8 *graph) * graphHowManyNodes(u8 *graph)
* *
* Description: * Description:
@ -123,7 +123,7 @@
* @param[out] u8 results = the number of nodes in the graph * @param[out] u8 results = the number of nodes in the graph
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
*/ */
int graphHowManyNodes(u8 *graph) u8 graphHowManyNodes(u8 *graph)
{ {
return graph[0]; return graph[0];
} }
@ -198,7 +198,7 @@ u8 graphGetRsp(u8 *graph, u8 nodeA, u8 nodeB)
*/ */
u8 graphGetReq(u8 *graph, u8 nodeA, u8 nodeB) u8 graphGetReq(u8 *graph, u8 nodeA, u8 nodeB)
{ {
int size = graph[0]; u8 size = graph[0];
ASSERT(size <= MAX_NODES); ASSERT(size <= MAX_NODES);
ASSERT((nodeA < size) && (nodeB < size)); ASSERT((nodeA < size) && (nodeB < size));
return (graph[1+(nodeA*size+nodeB)*2+1] & 0x0F); return (graph[1+(nodeA*size+nodeB)*2+1] & 0x0F);
@ -206,7 +206,7 @@ u8 graphGetReq(u8 *graph, u8 nodeA, u8 nodeB)
/*---------------------------------------------------------------------------------------- /*----------------------------------------------------------------------------------------
* u8 * u8
* graphGetBc(unsigned char *graph, int nodeA, int nodeB) * graphGetBc(u8 *graph, u8 nodeA, u8 nodeB)
* *
* Description: * Description:
* Returns a bit vector of nodes that nodeA should forward a broadcast from * Returns a bit vector of nodes that nodeA should forward a broadcast from
@ -219,9 +219,9 @@ u8 graphGetReq(u8 *graph, u8 nodeA, u8 nodeB)
* OU u8 results = the broadcast routes for nodeA from nodeB * OU u8 results = the broadcast routes for nodeA from nodeB
* --------------------------------------------------------------------------------------- * ---------------------------------------------------------------------------------------
*/ */
u8 graphGetBc(unsigned char *graph, int nodeA, int nodeB) u8 graphGetBc(u8 *graph, u8 nodeA, u8 nodeB)
{ {
int size = graph[0]; u8 size = graph[0];
ASSERT(size <= MAX_NODES); ASSERT(size <= MAX_NODES);
ASSERT((nodeA < size) && (nodeB < size)); ASSERT((nodeA < size) && (nodeB < size));
return graph[1+(nodeA*size+nodeB)*2]; return graph[1+(nodeA*size+nodeB)*2];
@ -415,10 +415,11 @@ void htDiscoveryFloodFill(sMainData *pDat)
/* Notify BIOS of event (while variables are still the same) */ /* Notify BIOS of event (while variables are still the same) */
if (pDat->HtBlock->AMD_CB_EventNotify) if (pDat->HtBlock->AMD_CB_EventNotify)
{ {
sHtEventCohFamilyFeud evt = {sizeof(sHtEventCohFamilyFeud), sHtEventCohFamilyFeud evt;
currentNode, evt.eSize = sizeof(sHtEventCohFamilyFeud);
currentLink, evt.node = currentNode;
pDat->NodesDiscovered}; evt.link = currentLink;
evt.totalNodes = pDat->NodesDiscovered;
pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_ERROR, pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_ERROR,
HT_EVENT_COH_FAMILY_FEUD, HT_EVENT_COH_FAMILY_FEUD,
@ -470,11 +471,12 @@ void htDiscoveryFloodFill(sMainData *pDat)
/* Notify BIOS of event */ /* Notify BIOS of event */
if (pDat->HtBlock->AMD_CB_EventNotify) if (pDat->HtBlock->AMD_CB_EventNotify)
{ {
sHtEventCohMpCapMismatch evt = {sizeof(sHtEventCohMpCapMismatch), sHtEventCohMpCapMismatch evt;
currentNode, evt.eSize = sizeof(sHtEventCohMpCapMismatch);
currentLink, evt.node = currentNode;
pDat->sysMpCap, evt.link = currentLink;
pDat->NodesDiscovered}; evt.sysMpCap = pDat->sysMpCap;
evt.totalNodes = pDat->NodesDiscovered;
pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_ERROR, pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_ERROR,
HT_EVENT_COH_MPCAP_MISMATCH, HT_EVENT_COH_MPCAP_MISMATCH,
@ -502,10 +504,11 @@ void htDiscoveryFloodFill(sMainData *pDat)
*/ */
if (pDat->HtBlock->AMD_CB_EventNotify) if (pDat->HtBlock->AMD_CB_EventNotify)
{ {
sHtEventCohNodeDiscovered evt = {sizeof(sHtEventCohNodeDiscovered), sHtEventCohNodeDiscovered evt;
currentNode, evt.eSize = sizeof(sHtEventCohNodeDiscovered);
currentLink, evt.node = currentNode;
token}; evt.link = currentLink;
evt.newNode = token;
pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_INFO, pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_INFO,
HT_EVENT_COH_NODE_DISCOVERED, HT_EVENT_COH_NODE_DISCOVERED,
@ -527,12 +530,13 @@ void htDiscoveryFloodFill(sMainData *pDat)
*/ */
if (pDat->HtBlock->AMD_CB_EventNotify) if (pDat->HtBlock->AMD_CB_EventNotify)
{ {
sHtEventCohLinkExceed evt = {sizeof(sHtEventCohLinkExceed), sHtEventCohLinkExceed evt;
currentNode, evt.eSize = sizeof(sHtEventCohLinkExceed);
currentLink, evt.node = currentNode;
token, evt.link = currentLink;
pDat->NodesDiscovered, evt.targetNode = token;
pDat->nb->maxLinks}; evt.totalNodes = pDat->NodesDiscovered;
evt.maxLinks = pDat->nb->maxLinks;
pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_ERROR, pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_ERROR,
HT_EVENT_COH_LINK_EXCEED, HT_EVENT_COH_LINK_EXCEED,
@ -776,8 +780,9 @@ void lookupComputeAndLoadRoutingTables(sMainData *pDat)
*/ */
if (pDat->HtBlock->AMD_CB_EventNotify) if (pDat->HtBlock->AMD_CB_EventNotify)
{ {
sHtEventCohNoTopology evt = {sizeof(sHtEventCohNoTopology), sHtEventCohNoTopology evt;
pDat->NodesDiscovered}; evt.eSize = sizeof(sHtEventCohNoTopology);
evt.totalNodes = pDat->NodesDiscovered;
pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_ERROR, pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_ERROR,
HT_EVENT_COH_NO_TOPOLOGY, HT_EVENT_COH_NO_TOPOLOGY,
@ -840,7 +845,7 @@ void finializeCoherentInit(sMainData *pDat)
*/ */
void coherentInit(sMainData *pDat) void coherentInit(sMainData *pDat)
{ {
int i, j; u8 i, j;
#ifdef HT_BUILD_NC_ONLY #ifdef HT_BUILD_NC_ONLY
/* Replace discovery process with: /* Replace discovery process with:
@ -912,7 +917,11 @@ void processLink(u8 node, u8 link, sMainData *pDat)
*/ */
if (pDat->HtBlock->AMD_CB_EventNotify) if (pDat->HtBlock->AMD_CB_EventNotify)
{ {
sHTEventNcohBusMaxExceed evt = {sizeof(sHTEventNcohBusMaxExceed), node, link, pDat->AutoBusCurrent}; sHTEventNcohBusMaxExceed evt;
evt.eSize = sizeof(sHTEventNcohBusMaxExceed);
evt.node = node;
evt.link = link;
evt.bus = pDat->AutoBusCurrent;
pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_ERROR,HT_EVENT_NCOH_BUS_MAX_EXCEED,(u8 *)&evt); pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_ERROR,HT_EVENT_NCOH_BUS_MAX_EXCEED,(u8 *)&evt);
} }
@ -927,7 +936,10 @@ void processLink(u8 node, u8 link, sMainData *pDat)
*/ */
if (pDat->HtBlock->AMD_CB_EventNotify) if (pDat->HtBlock->AMD_CB_EventNotify)
{ {
sHtEventNcohCfgMapExceed evt = {sizeof(sHtEventNcohCfgMapExceed), node, link}; sHtEventNcohCfgMapExceed evt;
evt.eSize = sizeof(sHtEventNcohCfgMapExceed);
evt.node = node;
evt.link = link;
pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_ERROR, pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_ERROR,
HT_EVENT_NCOH_CFG_MAP_EXCEED, HT_EVENT_NCOH_CFG_MAP_EXCEED,
@ -1049,11 +1061,12 @@ void processLink(u8 node, u8 link, sMainData *pDat)
*/ */
if (pDat->HtBlock->AMD_CB_EventNotify) if (pDat->HtBlock->AMD_CB_EventNotify)
{ {
sHtEventNcohLinkExceed evt = {sizeof(sHtEventNcohLinkExceed), sHtEventNcohLinkExceed evt;
node, evt.eSize = sizeof(sHtEventNcohLinkExceed);
link, evt.node = node;
depth, evt.link = link;
pDat->nb->maxLinks}; evt.depth = depth;
evt.maxLinks = pDat->nb->maxLinks;
pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_ERROR, pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_ERROR,
HT_EVENT_NCOH_LINK_EXCEED, HT_EVENT_NCOH_LINK_EXCEED,
@ -1097,8 +1110,13 @@ void processLink(u8 node, u8 link, sMainData *pDat)
/* An error handler for the case where we run out of BUID's on a chain */ /* An error handler for the case where we run out of BUID's on a chain */
if (pDat->HtBlock->AMD_CB_EventNotify) if (pDat->HtBlock->AMD_CB_EventNotify)
{ {
sHtEventNcohBuidExceed evt = {sizeof(sHtEventNcohBuidExceed), sHtEventNcohBuidExceed evt;
node, link, depth, (u8)currentBUID, (u8)unitIDcnt}; evt.eSize = sizeof(sHtEventNcohBuidExceed);
evt.node = node;
evt.link = link;
evt.depth = depth;
evt.currentBUID = (uint8)currentBUID;
evt.unitCount = (uint8)unitIDcnt;
pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_ERROR,HT_EVENT_NCOH_BUID_EXCEED,(u8 *)&evt); pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_ERROR,HT_EVENT_NCOH_BUID_EXCEED,(u8 *)&evt);
} }
@ -1115,8 +1133,12 @@ void processLink(u8 node, u8 link, sMainData *pDat)
/* An error handler for this critical error */ /* An error handler for this critical error */
if (pDat->HtBlock->AMD_CB_EventNotify) if (pDat->HtBlock->AMD_CB_EventNotify)
{ {
sHtEventNcohDeviceFailed evt = {sizeof(sHtEventNcohDeviceFailed), sHtEventNcohDeviceFailed evt;
node, link, depth, (u8)currentBUID}; evt.eSize = sizeof(sHtEventNcohDeviceFailed);
evt.node = node;
evt.link = link;
evt.depth = depth;
evt.attemptedBUID = (uint8)currentBUID;
pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_ERROR,HT_EVENT_NCOH_DEVICE_FAILED,(u8 *)&evt); pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_ERROR,HT_EVENT_NCOH_DEVICE_FAILED,(u8 *)&evt);
} }
@ -1138,7 +1160,11 @@ void processLink(u8 node, u8 link, sMainData *pDat)
if (pDat->HtBlock->AMD_CB_EventNotify) if (pDat->HtBlock->AMD_CB_EventNotify)
{ {
/* Provide information on automatic device results */ /* Provide information on automatic device results */
sHtEventNcohAutoDepth evt = {sizeof(sHtEventNcohAutoDepth), node, link, (depth - 1)}; sHtEventNcohAutoDepth evt;
evt.eSize = sizeof(sHtEventNcohAutoDepth);
evt.node = node;
evt.link = link;
evt.depth = (depth - 1);
pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_INFO,HT_EVENT_NCOH_AUTO_DEPTH,(u8 *)&evt); pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_INFO,HT_EVENT_NCOH_AUTO_DEPTH,(u8 *)&evt);
} }

View File

@ -401,7 +401,11 @@ BOOL readTrueLinkFailStatus(u8 node, u8 link, sMainData *pDat, cNorthBridge *nb)
if (pDat->HtBlock->AMD_CB_EventNotify) if (pDat->HtBlock->AMD_CB_EventNotify)
{ {
/* Pass the node and link on which the generic synch flood event occurred. */ /* Pass the node and link on which the generic synch flood event occurred. */
sHtEventHWHtCrc evt = {sizeof(sHtEventHWHtCrc), node, link, (u8)crc}; sHtEventHWHtCrc evt;
evt.eSize = sizeof(sHtEventHWHtCrc);
evt.node = node;
evt.link = link;
evt.laneMask = (uint8)crc;
pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_HW_FAULT, pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_HW_FAULT,
HT_EVENT_HW_HTCRC, HT_EVENT_HW_HTCRC,
@ -414,7 +418,10 @@ BOOL readTrueLinkFailStatus(u8 node, u8 link, sMainData *pDat, cNorthBridge *nb)
if (pDat->HtBlock->AMD_CB_EventNotify) if (pDat->HtBlock->AMD_CB_EventNotify)
{ {
/* Pass the node and link on which the generic synch flood event occurred. */ /* Pass the node and link on which the generic synch flood event occurred. */
sHtEventHWSynchFlood evt = {sizeof(sHtEventHWSynchFlood), node, link}; sHtEventHWSynchFlood evt;
evt.eSize = sizeof(sHtEventHWSynchFlood);
evt.node = node;
evt.link = link;
pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_HW_FAULT, pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_HW_FAULT,
HT_EVENT_HW_SYNCHFLOOD, HT_EVENT_HW_SYNCHFLOOD,
@ -1112,8 +1119,6 @@ u8 convertBitsToWidth(u8 value, cNorthBridge *nb)
return 2; return 2;
} }
STOP_HERE; /* This is an error internal condition */ STOP_HERE; /* This is an error internal condition */
return 0xFF; // make the compiler happy.
} }
/**---------------------------------------------------------------------------------------- /**----------------------------------------------------------------------------------------
@ -1143,8 +1148,6 @@ u8 convertWidthToBits(u8 value, cNorthBridge *nb)
return 4; return 4;
} }
STOP_HERE; /* This is an internal error condition */ STOP_HERE; /* This is an internal error condition */
return 0xFF; // make the compiler happy.
} }
/**---------------------------------------------------------------------------------------- /**----------------------------------------------------------------------------------------
@ -1468,10 +1471,11 @@ void setLinkData(sMainData *pDat, cNorthBridge *nb)
{ {
if (pDat->HtBlock->AMD_CB_EventNotify) if (pDat->HtBlock->AMD_CB_EventNotify)
{ {
sHtEventOptRequiredCap evt ={sizeof(sHtEventOptRequiredCap), sHtEventOptRequiredCap evt;
pDat->PortList[i].NodeID, evt.eSize = sizeof(sHtEventOptRequiredCap);
pDat->PortList[i].HostLink, evt.node = pDat->PortList[i].NodeID;
pDat->PortList[i].HostDepth}; evt.link = pDat->PortList[i].HostLink;
evt.depth = pDat->PortList[i].HostDepth;
pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_WARNING, pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_WARNING,
HT_EVENT_OPT_REQUIRED_CAP_RETRY, HT_EVENT_OPT_REQUIRED_CAP_RETRY,
@ -1513,10 +1517,11 @@ void setLinkData(sMainData *pDat, cNorthBridge *nb)
{ {
if (pDat->HtBlock->AMD_CB_EventNotify) if (pDat->HtBlock->AMD_CB_EventNotify)
{ {
sHtEventOptRequiredCap evt ={sizeof(sHtEventOptRequiredCap), sHtEventOptRequiredCap evt;
pDat->PortList[i].NodeID, evt.eSize = sizeof(sHtEventOptRequiredCap);
pDat->PortList[i].HostLink, evt.node = pDat->PortList[i].NodeID;
pDat->PortList[i].HostDepth}; evt.link = pDat->PortList[i].HostLink;
evt.depth = pDat->PortList[i].HostDepth;
pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_WARNING, pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_WARNING,
HT_EVENT_OPT_REQUIRED_CAP_GEN3, HT_EVENT_OPT_REQUIRED_CAP_GEN3,