summaryrefslogtreecommitdiffstats
path: root/src/usr/hwpf/hwp/bus_training/io_pre_trainadv.C
blob: e0911e90a01819f2cc582a0f024bff71895c1cc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/hwpf/hwp/bus_training/io_pre_trainadv.C $             */
/*                                                                        */
/* IBM CONFIDENTIAL                                                       */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 2013                   */
/*                                                                        */
/* p1                                                                     */
/*                                                                        */
/* Object Code Only (OCO) source materials                                */
/* Licensed Internal Code Source Materials                                */
/* IBM HostBoot Licensed Internal Code                                    */
/*                                                                        */
/* The source code for this program is not published or otherwise         */
/* divested of its trade secrets, irrespective of what has been           */
/* deposited with the U.S. Copyright Office.                              */
/*                                                                        */
/* Origin: 30                                                             */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */
// $Id: io_pre_trainadv.C,v 1.1 2013/05/10 20:05:59 thomsen Exp $
// *!***************************************************************************
// *! (C) Copyright International Business Machines Corp. 1997, 1998
// *!           All Rights Reserved -- Property of IBM
// *!                   *** IBM Confidential ***
// *!***************************************************************************
// *! FILENAME             : io_pre_trainadv.C
// *! TITLE                :
// *! DESCRIPTION          : The purpose of this code is to allow for future pre-training activity such as Host-based characterization
// *! CONTEXT              :
// *!
// *! OWNER  NAME          : Varghese, Varkey         Email: varkey.kv@in.ibm.com
// *! BACKUP NAME          : Swaminathan, Janani      Email: jaswamin@in.ibm.com
// *!
// *!***************************************************************************
// CHANGE HISTORY:
//------------------------------------------------------------------------------
// Version:|Author: | Date:  | Comment:
// --------|--------|--------|--------------------------------------------------
//   1.1   |thomsen |05/10/13| Initial empty shell
//------------------------------------------------------------------------------

#include <fapi.H>
#include "io_pre_trainadv.H"
#include "gcr_funcs.H"

extern "C" {


using namespace fapi;
//================================================================================================================================
// These functions work on a pair of targets. One is the master side of the bus interface, the other the slave side. For eg; in EDI(DMI2)PU is the master and Centaur is the slave
// In EI4 both sides have pu targets
ReturnCode io_pre_trainadv(const Target& target){
    ReturnCode rc;
    //uint32_t master_group=0;
    FAPI_DBG("Running IO PRE TRAINING ADVANCED PROCEDURE");
    //     ____  __  _______
    //    / __ \/  |/  /  _/
    //   / / / / /|_/ // /
    //  / /_/ / /  / // /
    // /_____/_/  /_/___/
    if( (target.getType() == fapi::TARGET_TYPE_MCS_CHIPLET )){
      FAPI_DBG("This is a Processor DMI bus pre training invocation using base DMI scom address");
      //master_interface=CP_IOMC0_P0; // base scom for MC bus
      //master_group=3; // Design requires us to do this as per scom map and layout
      // USER CODE HERE: ex. rc=run_offset_cal(target,master_interface,master_group);if (rc) {return(rc);};
    }
    else if( (target.getType() ==  fapi::TARGET_TYPE_MEMBUF_CHIP)){
      FAPI_DBG("This is a Centaur DMI bus pre training invocation using base DMI scom address");
      //master_interface=CEN_DMI; // base scom for CEN
      //master_group=0;
      // USER CODE HERE: ex. rc=run_offset_cal(target,master_interface,master_group);if (rc) {return(rc);};
    }
    //    _  __ __
    //   | |/ // /_  __  _______
    //   |   // __ \/ / / / ___/
    //  /   |/ /_/ / /_/ (__  )
    // /_/|_/_.___/\__,_/____/
    else if( (target.getType() == fapi::TARGET_TYPE_XBUS_ENDPOINT  )){
      FAPI_DBG("This is a X Bus pre training invocation");
      //master_interface=CP_FABRIC_X0; // base scom for X bus
      //master_group=0; // Design requires us to do this as per scom map and layout
      if(rc.ok()){
          // No Z cal in EI4/X bus design
          for(int i=0;i<5;++i){
             //master_group=i;
              // USER CODE HERE: ex. rc=run_offset_cal(target,master_interface,master_group);if (rc) {return(rc);};
          }
      }
    }
    //     ___    __
    //    /   |  / /_  __  _______
    //   / /| | / __ \/ / / / ___/
    //  / ___ |/ /_/ / /_/ (__  )
    // /_/  |_/_.___/\__,_/____/
    else if( (target.getType() == fapi::TARGET_TYPE_ABUS_ENDPOINT )){
      FAPI_DBG("This is an A Bus pre training invocation");
      //master_interface=CP_FABRIC_A0; // base scom for A bus , assume translation to A1 by PLAT
      //master_group=0; // Design requires us to do this as per scom map and layout
                // EDI-A bus needs both impedance cal and offset cal
      // USER CODE HERE: ex. rc=run_offset_cal(target,master_interface,master_group);if (rc) {return(rc);};
    }
    else{
      FAPI_ERR("Invalid io_pre_trainadv HWP invocation . Target doesnt belong to DMI/X/A instances");
      // ADD THIS WHEN IMPLEMENTING FUNCTION: FAPI_SET_HWP_ERROR(rc, IO_PRE_TRAINADV_INVALID_INVOCATION_RC);
    }
    return rc;
}
//================================================================================================================================


} //end extern C
OpenPOWER on IntegriCloud