diff options
author | Marc Jones <marc.jones@amd.com> | 2008-07-17 19:50:37 +0000 |
---|---|---|
committer | Marc Jones <marc.jones@amd.com> | 2008-07-17 19:50:37 +0000 |
commit | 212486e9f634f6a6aaf1efdacfb39397c19a7bc7 (patch) | |
tree | eb784b0a0ac6e8f0e19f88d8dbec9213ad537e00 | |
parent | 2df291574dd16038714091ac44f0d602c764c17d (diff) |
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
-rw-r--r-- | src/northbridge/amd/amdht/h3finit.c | 106 | ||||
-rw-r--r-- | src/northbridge/amd/amdht/h3ncmn.c | 33 |
2 files changed, 85 insertions, 54 deletions
diff --git a/src/northbridge/amd/amdht/h3finit.c b/src/northbridge/amd/amdht/h3finit.c index 7d3836255e..98af59f679 100644 --- a/src/northbridge/amd/amdht/h3finit.c +++ b/src/northbridge/amd/amdht/h3finit.c @@ -112,7 +112,7 @@ */ /*---------------------------------------------------------------------------------------- - * int + * u8 * graphHowManyNodes(u8 *graph) * * Description: @@ -123,7 +123,7 @@ * @param[out] u8 results = the number of nodes in the graph * --------------------------------------------------------------------------------------- */ -int graphHowManyNodes(u8 *graph) +u8 graphHowManyNodes(u8 *graph) { return graph[0]; } @@ -198,7 +198,7 @@ u8 graphGetRsp(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((nodeA < size) && (nodeB < size)); return (graph[1+(nodeA*size+nodeB)*2+1] & 0x0F); @@ -206,7 +206,7 @@ u8 graphGetReq(u8 *graph, u8 nodeA, u8 nodeB) /*---------------------------------------------------------------------------------------- * u8 - * graphGetBc(unsigned char *graph, int nodeA, int nodeB) + * graphGetBc(u8 *graph, u8 nodeA, u8 nodeB) * * Description: * 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 * --------------------------------------------------------------------------------------- */ -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((nodeA < size) && (nodeB < size)); 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) */ if (pDat->HtBlock->AMD_CB_EventNotify) { - sHtEventCohFamilyFeud evt = {sizeof(sHtEventCohFamilyFeud), - currentNode, - currentLink, - pDat->NodesDiscovered}; + sHtEventCohFamilyFeud evt; + evt.eSize = sizeof(sHtEventCohFamilyFeud); + evt.node = currentNode; + evt.link = currentLink; + evt.totalNodes = pDat->NodesDiscovered; pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_ERROR, HT_EVENT_COH_FAMILY_FEUD, @@ -470,11 +471,12 @@ void htDiscoveryFloodFill(sMainData *pDat) /* Notify BIOS of event */ if (pDat->HtBlock->AMD_CB_EventNotify) { - sHtEventCohMpCapMismatch evt = {sizeof(sHtEventCohMpCapMismatch), - currentNode, - currentLink, - pDat->sysMpCap, - pDat->NodesDiscovered}; + sHtEventCohMpCapMismatch evt; + evt.eSize = sizeof(sHtEventCohMpCapMismatch); + evt.node = currentNode; + evt.link = currentLink; + evt.sysMpCap = pDat->sysMpCap; + evt.totalNodes = pDat->NodesDiscovered; pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_ERROR, HT_EVENT_COH_MPCAP_MISMATCH, @@ -502,10 +504,11 @@ void htDiscoveryFloodFill(sMainData *pDat) */ if (pDat->HtBlock->AMD_CB_EventNotify) { - sHtEventCohNodeDiscovered evt = {sizeof(sHtEventCohNodeDiscovered), - currentNode, - currentLink, - token}; + sHtEventCohNodeDiscovered evt; + evt.eSize = sizeof(sHtEventCohNodeDiscovered); + evt.node = currentNode; + evt.link = currentLink; + evt.newNode = token; pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_INFO, HT_EVENT_COH_NODE_DISCOVERED, @@ -527,12 +530,13 @@ void htDiscoveryFloodFill(sMainData *pDat) */ if (pDat->HtBlock->AMD_CB_EventNotify) { - sHtEventCohLinkExceed evt = {sizeof(sHtEventCohLinkExceed), - currentNode, - currentLink, - token, - pDat->NodesDiscovered, - pDat->nb->maxLinks}; + sHtEventCohLinkExceed evt; + evt.eSize = sizeof(sHtEventCohLinkExceed); + evt.node = currentNode; + evt.link = currentLink; + evt.targetNode = token; + evt.totalNodes = pDat->NodesDiscovered; + evt.maxLinks = pDat->nb->maxLinks; pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_ERROR, HT_EVENT_COH_LINK_EXCEED, @@ -776,8 +780,9 @@ void lookupComputeAndLoadRoutingTables(sMainData *pDat) */ if (pDat->HtBlock->AMD_CB_EventNotify) { - sHtEventCohNoTopology evt = {sizeof(sHtEventCohNoTopology), - pDat->NodesDiscovered}; + sHtEventCohNoTopology evt; + evt.eSize = sizeof(sHtEventCohNoTopology); + evt.totalNodes = pDat->NodesDiscovered; pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_ERROR, HT_EVENT_COH_NO_TOPOLOGY, @@ -840,7 +845,7 @@ void finializeCoherentInit(sMainData *pDat) */ void coherentInit(sMainData *pDat) { - int i, j; + u8 i, j; #ifdef HT_BUILD_NC_ONLY /* Replace discovery process with: @@ -912,7 +917,11 @@ void processLink(u8 node, u8 link, sMainData *pDat) */ 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); } @@ -927,7 +936,10 @@ void processLink(u8 node, u8 link, sMainData *pDat) */ 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, HT_EVENT_NCOH_CFG_MAP_EXCEED, @@ -1049,11 +1061,12 @@ void processLink(u8 node, u8 link, sMainData *pDat) */ if (pDat->HtBlock->AMD_CB_EventNotify) { - sHtEventNcohLinkExceed evt = {sizeof(sHtEventNcohLinkExceed), - node, - link, - depth, - pDat->nb->maxLinks}; + sHtEventNcohLinkExceed evt; + evt.eSize = sizeof(sHtEventNcohLinkExceed); + evt.node = node; + evt.link = link; + evt.depth = depth; + evt.maxLinks = pDat->nb->maxLinks; pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_ERROR, 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 */ if (pDat->HtBlock->AMD_CB_EventNotify) { - sHtEventNcohBuidExceed evt = {sizeof(sHtEventNcohBuidExceed), - node, link, depth, (u8)currentBUID, (u8)unitIDcnt}; + sHtEventNcohBuidExceed evt; + 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); } @@ -1115,8 +1133,12 @@ void processLink(u8 node, u8 link, sMainData *pDat) /* An error handler for this critical error */ if (pDat->HtBlock->AMD_CB_EventNotify) { - sHtEventNcohDeviceFailed evt = {sizeof(sHtEventNcohDeviceFailed), - node, link, depth, (u8)currentBUID}; + sHtEventNcohDeviceFailed evt; + 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); } @@ -1138,7 +1160,11 @@ void processLink(u8 node, u8 link, sMainData *pDat) if (pDat->HtBlock->AMD_CB_EventNotify) { /* 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); } diff --git a/src/northbridge/amd/amdht/h3ncmn.c b/src/northbridge/amd/amdht/h3ncmn.c index 828097a42f..5b038a3a58 100644 --- a/src/northbridge/amd/amdht/h3ncmn.c +++ b/src/northbridge/amd/amdht/h3ncmn.c @@ -401,7 +401,11 @@ BOOL readTrueLinkFailStatus(u8 node, u8 link, sMainData *pDat, cNorthBridge *nb) if (pDat->HtBlock->AMD_CB_EventNotify) { /* 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, HT_EVENT_HW_HTCRC, @@ -414,7 +418,10 @@ BOOL readTrueLinkFailStatus(u8 node, u8 link, sMainData *pDat, cNorthBridge *nb) if (pDat->HtBlock->AMD_CB_EventNotify) { /* 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, HT_EVENT_HW_SYNCHFLOOD, @@ -1112,8 +1119,6 @@ u8 convertBitsToWidth(u8 value, cNorthBridge *nb) return 2; } 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; } 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) { - sHtEventOptRequiredCap evt ={sizeof(sHtEventOptRequiredCap), - pDat->PortList[i].NodeID, - pDat->PortList[i].HostLink, - pDat->PortList[i].HostDepth}; + sHtEventOptRequiredCap evt; + evt.eSize = sizeof(sHtEventOptRequiredCap); + evt.node = pDat->PortList[i].NodeID; + evt.link = pDat->PortList[i].HostLink; + evt.depth = pDat->PortList[i].HostDepth; pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_WARNING, HT_EVENT_OPT_REQUIRED_CAP_RETRY, @@ -1513,10 +1517,11 @@ void setLinkData(sMainData *pDat, cNorthBridge *nb) { if (pDat->HtBlock->AMD_CB_EventNotify) { - sHtEventOptRequiredCap evt ={sizeof(sHtEventOptRequiredCap), - pDat->PortList[i].NodeID, - pDat->PortList[i].HostLink, - pDat->PortList[i].HostDepth}; + sHtEventOptRequiredCap evt; + evt.eSize = sizeof(sHtEventOptRequiredCap); + evt.node = pDat->PortList[i].NodeID; + evt.link = pDat->PortList[i].HostLink; + evt.depth = pDat->PortList[i].HostDepth; pDat->HtBlock->AMD_CB_EventNotify(HT_EVENT_CLASS_WARNING, HT_EVENT_OPT_REQUIRED_CAP_GEN3, |