//****************************************************************************
//                   INTEL CORPORATION PROPRIETARY INFORMATION
//       This software is supplied under the terms of a license agreement or
//       nondisclosure agreement with Intel Corporation and may not be copied
//       or disclosed except in accordance with the terms of that agreement.
//         Copyright (c) 2010-2012 Intel Corporation. All Rights Reserved.
//****************************************************************************
//
//  TITLE: Master.CFG             DATE CREATED:  09/06/2012
//****************************************************************************
//  Revision History:
//
//****************************************************************************

CONFIGURATION   "Master.cfg, Rev 1.16"
DISPLAY         "S1200BTL/S1200BTM platform FRU & SDR package version 1.16"

// Detect Product ID***********************************************************
PROBE           "BASEBOARD_PRODID" "48" 
FOUND           "BTP"  

IFSET "BTP"
    DISPLAY "Intel(R) Server Board S1200BTL/S1200BTM platform"
ELSE
    DISPLAY ""
    DISPLAY "This is either the incorrect FRU/SDR package for this baseboard"
    DISPLAY "or your platform ID is incorrectly programmed."
    ERRORLEVEL 01
ENDIF

DISPLAY         "Copyright (c) 2010-2012 Intel Corporation"
DISPLAY         " "

//If it's for factory use, please un-comment FACTORY_MODE tag
//SET "FACTORY_MODE"

IFSET "FACTORY_MODE"
    SET "SDR"
ELSE
    //Set auto-detection tag, now comment it before auto-detection implemented
    SET "AUTO_DETECTION"

    //Set user selection
    //SET "USER_SELECT"

    MENUTITLE   "Select the function you desire to perform:"
    MENU        "SDR"   "Update only the SDR repository"
    MENU        "FRU"   "Update only the FRU repository"
    MENU        "BOTH"  "Update both the FRU and the SDR repository"
    MENU        "ASSET" "Modify the Product Asset Tag"
    MENU        "EXIT1" "Exit"
    MENUPROMPT
    DISPLAY " "
ENDIF
IFSET "EXIT1"
    DISPLAY "Exit without making any changes"
ELSE
    // Set both FRU and SDR
    IFSET "BOTH"
        SET "SDR"
        SET "FRU"
    ENDIF
    IFSET   "ASSET"
        FRUNAME     "SYSTEM"
        FRUADDRESS  "IMBDEVICE" FF 20
        FRUAREA     "PRODUCT"
        FRUFIELD    "AT" "@STDIN:ASCII"
    ELSE
        IFSET "SDR"
            //Support since FBTP_07
            IFSET "AUTO_DETECTION"
            
                // Check for Front Panel Temperature *******************************************
                PROBE   "PING" "03" "9A"
                FOUND   "FP_TEMP"   ""
                IFSET   "FP_TEMP"
                    DISPLAY "Front Panel Temperature Sensor is Detected."
                ELSE
                    DISPLAY ""
                    DISPLAY "Front Panel Temperature sensor device hardware is not found."
                ENDIF
            
                //Check FP FRU exist or not
                PROBE   "PING" "03" "AE"
                FOUND "FP_FRU" ""
                IFSET "FP_FRU"
                   DISPLAY ""
                   DISPLAY "Front Panel FRU is Detected"
                   DISPLAY ""
                ENDIF
                
                IFSET "FP_FRU"
                    //Check PS FRU is 350W PS FRU, since only 350W PSU has PBMus
                    PROBE "IMBDEVICE" "02"
                    FOUND "PS1_FRU" ""
                    IFSET "PS1_FRU"
                        FRUNAME "SYSTEM"
                        FRUADDRESS 02
                        FRUAREA "PRODUCT"
                        PROBE FRUFIELD "PN" "DPS-350AB-12 A"
                        FOUND "PS1" ""                        
                    ENDIF
                    IFSET "PS1"
                        SET "BP"
                    ELSE
                        //no PMBus or incorrect PS FRU
                        //detect fan to decide chassis
                        PROBE FAN_SIGNAL 00
                        FOUND "FAN_2" ""
                        PROBE FAN_SIGNAL 01
                        FOUND "PROC_FAN" ""
                        PROBE FAN_SIGNAL 02
                        FOUND "FAN_4" ""
                        PROBE FAN_SIGNAL 03
                        FOUND "FAN_1" ""
                        PROBE FAN_SIGNAL 04
                        FOUND "FAN_3" ""
                        
                        IFSET "FAN_4"
                            IFSET "FAN_1"
                                // invalid fan configuration
                            ELSE
                                IFSET "FAN_2"
                                    // invalid fan configuration
                                ELSE
                                    IFSET "PROC_FAN"
                                        //proc fan and sys fan4 for UP FSC curve
                                        SET "UP" 
                                    ENDIF
                                ENDIF
                            ENDIF
                        ELSE // no FAN4
                            IFSET "FAN_1"
                                IFSET "FAN_2"
                                    IFSET "FAN_3"
                                        IFSET "PROC_FAN"
                                           // invalid fan configuration
                                        ELSE
                                           //sys fan 1 & 2 & 3 for BP FSC curve
                                           SET "BP"
                                        ENDIF
                                    ENDIF    
                                ENDIF
                            ENDIF
                        ENDIF

                        //Clear FAN tags since it's for detecting chassis only
                        CLEAR "PROC_FAN"
                        CLEAR "FAN_1"
                        CLEAR "FAN_2"
                        CLEAR "FAN_3"
                        CLEAR "FAN_4"
                    ENDIF //End of IFSET "PS1"
                ELSE
                    //dedicate to other chassis
                    SET "OTHER"                
                ENDIF //End of IFSET "FP_FRU"

                //Decide chassis by HSC
                //Detect HSC
                PROBE  "PING" "0B" "D0"
                FOUND "HSC" ""
                IFSET "UP"
                    IFSET "HSC"
                        SET "UP_HS"
                        DISPLAY ""
                        DISPLAY "UP4304XXSHCN Chassis is Detected"
                    ELSE
                        SET "UP_FIX"
                        DISPLAY ""
                        DISPLAY "P4304XXSFCN Chassis is Detected"
                    ENDIF
                ELSE
                    IFSET "BP"
                        IFSET "HSC"
                            SET "BP_HS"
                            DISPLAY ""
                            DISPLAY "R1304BTLSHBN Chassis is Detected"      
                        ELSE
                            SET "BP_FIX"
                            DISPLAY ""
                            DISPLAY "R1304BTLSFAN Chassis is Detected"
                        ENDIF
                    ELSE
                        SET "USER_SELECT"
                        DISPLAY ""
                        DISPLAY "Fan configuration is not valid or front panel FRU is not detected, falling back to user selection as auto-detection is not possible."
                    ENDIF
                ENDIF
            ENDIF //End of IFSET "AUTO_DETECTION"
            
            IFSET "USER_SELECT"
                DISPLAY ""
                MENUTITLE   "Select the SKUs:"
                    MENU    "UP_FIX"      "Intel(R) Entry Server Chassis P4304XXSFCN"
                    MENU    "UP_HS"       "Intel(R) Entry Server Chassis P4304XXSHCN"
                    MENU    "BP_FIX"      "Intel(R) Entry Server Chassis R1304BTLSFAN"
                    MENU    "BP_HS"       "Intel(R) Entry Server Chassis R1304BTLSHBN"
                    MENU    "OTHER"       "Other Chassis"
                MENUPROMPT
                DISPLAY ""
            ENDIF //"USER_SELECT"

            IFSET "FACTORY_MODE"
                DISPLAY     ""
                MENUTITLE   "Select the Chassis:"
                MENU        "SHIP"      "Only Shipping use"
                MENU        "FCT"       "Only for FCT use"
                MENU        "FOQM"      "Functional Outgoing Manufacturing Test (FOQM)"
                MENUPROMPT
                DISPLAY     ""
            ENDIF

            IFSET "OTHER"
                DISPLAY     ""
                DISPLAY     "The options provided are intended for OEMs and system integrators to allow the"
                DISPLAY     "thermal control of fans in a third-party chassis. OEMs and system integrators"
                DISPLAY     "must perform their own thermal testing for any changes made using these"
                DISPLAY     "options. Intel cannot provide support for any changes made to fan settings to"
                DISPLAY     "support third-party chassis. Third-party chassis vendors may have recommended"
                DISPLAY     "settings for these configuration options for specific chassis."
                DISPLAY     " "
                DISPLAY     "INTEL ASSUMES NO RESPONSIBILITY FOR UNDESIRED RESULTS WHEN USING ANY CUSTOM FAN CONTROL CONFIGURATION ON INTEL(R) SERVER PRODUCTS"
                DISPLAY     " "
                MENUTITLE   "Select the fan speed for the chassis"
                    MENU    "OTHER_SR"     "Slow Ramp"
                    MENU    "OTHER_MR"     "Medium Ramp"
                    MENU    "OTHER_FR"     "Fast Ramp"
                    MENU    "OTHER_FS"     "Full Speed Fans"
                MENUPROMPT
                DISPLAY ""
            ENDIF //"OTHER"
                        
            //Probe for sensors and FRU device
            DISPLAY ""
            DISPLAY "Probing system for sensors and FRU device hardware..."

            IFSET "FACTORY_MODE"
                //Do nothing, default load SDB for factory
                SET "SDB"
            ELSE
                DISPLAY ""
                //Support different stepping for IVB
                PROBE PROCESSOR 01 B3 00 03 06 A2
                FOUND "IVB"
                PROBE PROCESSOR 01 B3 00 03 06 A4
                FOUND "IVB"
                PROBE PROCESSOR 01 B3 00 03 06 A5
                FOUND "IVB"
                PROBE PROCESSOR 01 B3 00 03 06 A6
                FOUND "IVB"
                PROBE PROCESSOR 01 B3 00 03 06 A8
                FOUND "IVB"
                PROBE PROCESSOR 01 B3 00 03 06 A9
                FOUND "IVB"
                PROBE PROCESSOR 01 B3 00 03 06 AA
                FOUND "IVB"
                PROBE PROCESSOR 01 B3 00 03 06 AB
                FOUND "IVB"
                PROBE PROCESSOR 01 B3 00 03 06 AC
                FOUND "IVB"
                PROBE PROCESSOR 01 B3 00 03 06 AD
                FOUND "IVB"
                PROBE PROCESSOR 01 B3 00 03 06 AE
                FOUND "IVB"
                PROBE PROCESSOR 01 B3 00 03 06 AF
                FOUND "IVB"
                IFSET "IVB"
                    DISPLAY ""
                ELSE
                    //Default as SDB
                    SET "SDB"
                ENDIF
            ENDIF
            
            DISPLAY ""
           
            //Set SDR tags for items that are standard on specific SKU *******************************

            //P4304XXSFCN ----------------------------------------------------
            IFSET "UP_FIX"
                //UP chassis FSC, set tag for user selection
                SET "UP"
                
                //System Fans
                SET "PROC_FAN"
                SET "FAN_4" 
                
                //Front Panel Temp
                SET "FP_TEMP"
                SET "FP_NMI"
                
                //Chassis intrusion
                SET "CHASSIS_INTRU"  
                
            ENDIF //IFSET "UP_FIX"

            //P4304XXSHCN ----------------------------------------------------
            IFSET "UP_HS"
                //UP chassis FSC, set tag for user selection
                SET "UP"
            
                //System Fans
                SET "PROC_FAN"
                SET "FAN_4" 
                
                //Front Panel Temp
                SET "FP_TEMP"
                SET "FP_NMI"
                
                //Chassis intrusion
                SET "CHASSIS_INTRU"  

                //HSC
                SET "HSC" 
                
            ENDIF //IFSET "UP_FIX"
                        
            //R1304BTLSFAN ---------------------------------------------------
            IFSET "BP_FIX"
                //Check PS FRU is 350W PS FRU, since only 350W PSU has PBMus
                //Auto detect has done this
                IFSET "USER_SELECT"
                    PROBE "IMBDEVICE" "02"
                    FOUND "PS1_FRU" ""
                    IFSET "PS1_FRU"
                        FRUNAME "SYSTEM"
                        FRUADDRESS 02
                        FRUAREA "PRODUCT"
                        PROBE FRUFIELD "PN" "DPS-350AB-12 A"
                        FOUND "PS1" ""
                    ENDIF            
                ENDIF
                
                //BP chassis FSC, set tag for user selection
                SET "BP"
                
                //System Fans
                SET "FAN_1"
                SET "FAN_2"
                SET "FAN_3"
                
                //Front Panel Temp
                SET "FP_TEMP"
                SET "FP_NMI"
                
            ENDIF //IFSET "BP_FIX"

            //R1304BTLSHBN ---------------------------------------------------
            IFSET "BP_HS"
                //BP chassis FSC, set tag for user selection
                SET "BP"
            
                //System Fans
                SET "FAN_1"
                SET "FAN_2"
                SET "FAN_3"
                
                //Front Panel Temp
                SET "FP_TEMP"
                SET "FP_NMI"
                
                //350W PS with PMBUS
                SET "PS1"
                   
                //HSC
                SET "HSC"   
                
            ENDIF //IFSET "BP_HS"
            
            //OTHER chassis ----------------------------------------------------------------------------
            IFSET "OTHER"
                //Set Power Supply
                SET "PS1"
                
                //System Fans
                DISPLAY ""
                PROMPT "Is Processor Fan installed?"
                YES "PROC_FAN_FCT"
                NO ""

                DISPLAY ""                
                PROMPT "Is System Fan 1 installed?"
                YES "FAN_1_FCT"
                NO ""

                DISPLAY ""                
                PROMPT "Is System Fan 2 installed?"
                YES "FAN_2_FCT"
                NO ""

                DISPLAY ""                
                PROMPT "Is System Fan 3 installed?"
                YES "FAN_3_FCT"
                NO ""
                                                
                DISPLAY ""                
                PROMPT "Is System Fan 4 installed?"
                YES "FAN_4_FCT"
                NO ""

                //Chassis intrusion
                DISPLAY ""
                PROMPT "Does the system have chassis intrusion?"
                YES "CHASSIS_INTRU"
                NO "NO_CHASSIS_INTRU"                                      

                //Front panel NMI
                DISPLAY ""
                PROMPT "Does the front panel support a NMI button?"
                YES "FP_NMI"
                NO  ""

            ENDIF //IFSET "OTHER"

            //Shipping ---------------------------------------------------------------------------------
            IFSET "SHIP"
                //Default support SDB
                SET "SDB"

                //Physical Security Sensor with lan leash lost event mask only
                SET "NO_CHASSIS_INTRU"

            ENDIF //IFSET "SHIP"

            //FCT --------------------------------------------------------------------------------------
            IFSET "FCT"
                //Default support SDB
                SET "SDB"
                
                //System Fans
                SET "PROC_FAN_FCT"
                SET "FAN_1_FCT"
                SET "FAN_2_FCT"
                SET "FAN_3_FCT"
                SET "FAN_4_FCT"
                
                SET "CHASSIS_INTRU"
                             
            ENDIF //IFSET "FCT"

            //FOQM -------------------------------------------------------------------------------------
            IFSET "FOQM"
                //Default support SDB
                SET "SDB"
                
                //System Fans
                SET "PROC_FAN_FCT"
                SET "FAN_1_FCT"
                SET "FAN_2_FCT"
                SET "FAN_3_FCT"
                SET "FAN_4_FCT"

                SET "CHASSIS_INTRU"
              
            ENDIF //IFSET "FOQM"

            SDRNAME "BTP_BMC.sdr"        // Update SDR Repository
            BMC_REFRESH
        ENDIF     // IFSET "SDR"

        IFSET "FRU"

            // ******************************
            //   Update Base Board FRU areas
            // ******************************
            IFSET "BTP"
                DISPLAY     ""
                DISPLAY     "Updating FRU areas"

                //Update Baseboard FRU data
                FRUNAME     "BTP_BMC.FRU"
                FRUAREA     "HEADER"
                FRUAREA     "INTERNALUSE"
                FRUAREA     "CHASSIS"
                FRUFIELD    "CT"
                
                PROMPT      "Do you want to update the chassis info area of the FRU?"
                YES         "UPD_CHS"
                NO          ""
                IFSET   "UPD_CHS"
                
//                    IFSET "OTHER"
//                        DISPLAY     ""
//                        PROMPT      "Do you want to enter chassis type (HEX byte)? 03h: Desktop; 11h Main Server Chassis; 17h: Rackmount chassis"
//                            YES     "CHASS_T"
//                            NO      ""
//                            
//                        IFSET "CHASS_T"
//                            FRUFIELD    "CT" "@STDIN:ASCII"
//                        ENDIF
//                    ENDIF 
                                   
                    PROMPT      "Do you want to enter the chassis serial number?"
                    YES         "CHASSN"
                    NO          ""
                    DISPLAY     ""
                    IFSET       "CHASSN"
                        FRUFIELD    "S#" "@STDIN:ASCII"
                    ENDIF
                
                    PROMPT      "Do you want to enter the chassis part number?"
                    YES         "CHASPN"
                    NO          ""
                    DISPLAY     " "
                    IFSET       "CHASPN"
                        FRUFIELD    "P#" "@STDIN:ASCII"
                    ENDIF
                ENDIF //END IFSET "UPD_CHS"
                
                PROMPT      "Do you want to enter the chassis manufacturer name (Additional Field 1)?"
                YES         "CHASMN"
                NO          ""
                DISPLAY     ""
                IFSET       "CHASMN"
                    FRUFIELD     "AM1" "@STDIN:ASCII"
                ENDIF
                
                FRUAREA     "BOARD"
                FRUFIELD    "MN"
                FRUFIELD    "PN"
                FRUFIELD    "ID"
                DISPLAY     ""
                
                FRUAREA     "PRODUCT"
                PROMPT      "Do you want to update the system info area of the FRU?"
                YES         "UPD_PRD"
                NO          ""
                IFSET       "UPD_PRD"
                     FRUFIELD    "MN"
                     FRUFIELD    "PN"
                     FRUFIELD    "PV"
                     PROMPT     "Do you want to enter system part number?"
                     YES        "PROD_PN"
                     NO         ""
                     IFSET      "PROD_PN"
                        FRUFIELD    "P#" "@STDIN:ASCII"
                     ENDIF
                
                     PROMPT     "Do you want to enter the system serial number?"
                     YES        "PROD_SN"
                     NO         ""
                     IFSET      "PROD_SN"
                        FRUFIELD    "S#" "@STDIN:ASCII"
                     ENDIF
                
                     PROMPT      "Do you want to enter the product asset tag?"
                     YES         "ASSET"
                     NO          ""
                     DISPLAY     ""
                     IFSET   "ASSET"
                         FRUFIELD    "AT" "@STDIN:ASCII"
                     ENDIF
               ENDIF // END IFSET "UPD_PRD"
            ENDIF //END IFSET "ER"

        ENDIF   //END IFSET "FRU"
    ENDIF // ASSET TAG
ENDIF // IFSET "EXIT1"