summaryrefslogtreecommitdiffstats
path: root/src/usr/diag/prdf/common/framework/service/iipServiceDataCollector.h
blob: 66b524b1462195b5863571ef18178f924ba38f17 (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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/usr/diag/prdf/common/framework/service/iipServiceDataCollector.h $ */
/*                                                                        */
/* OpenPOWER HostBoot Project                                             */
/*                                                                        */
/* COPYRIGHT International Business Machines Corp. 1998,2014              */
/*                                                                        */
/* Licensed under the Apache License, Version 2.0 (the "License");        */
/* you may not use this file except in compliance with the License.       */
/* You may obtain a copy of the License at                                */
/*                                                                        */
/*     http://www.apache.org/licenses/LICENSE-2.0                         */
/*                                                                        */
/* Unless required by applicable law or agreed to in writing, software    */
/* distributed under the License is distributed on an "AS IS" BASIS,      */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or        */
/* implied. See the License for the specific language governing           */
/* permissions and limitations under the License.                         */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */

#ifndef iipServiceDataCollector_h
#define iipServiceDataCollector_h
// Class Description *************************************************
//
//  Name:  ServiceDataCollector
//  Base class: None
//
//  Description:
//  Usage:
//
// End Class Description *********************************************

#ifndef PRDF_SDC_FLAGS_MAP_ONLY
    #define PRDF_SDC_FLAGS_MAP \
        enum Flag {
    #define PRDF_SDC_FLAG(name, value) \
            name = value,
    #define PRDF_SDC_FLAGS_MAP_END \
        };
#endif

#ifndef PRDF_SDC_FLAGS_MAP_ONLY

#include <prdfErrorSignature.H>
#include <iipCaptureData.h>
#include <vector>
#include <time.h>
#include <prdfCallouts.H>
#include <prdfMain.H>
#if !defined(PRDFTIMER_H)
#include <prdfTimer.H>
#endif
#include <xspprdGardResolution.h>     // for ErrorType
#include <prdfAssert.h>
#if( !defined(CONTEXT_x86_nfp) && !defined(_NFP) ) //only for ppc context (@54)
#include <prdfPlatServices.H>
#include <iipsdbug.h>
#endif

#ifdef __HOSTBOOT_MODULE
#include <prdfGlobal.H>
#else
#include <hdctContent.H>
#endif
#include <list>
#include <prdfExtensibleChip.H>

namespace PRDF
{

struct SdcCallout {
  PRDcallout callout;
  PRDpriority priority;
  //bool gard;
  SdcCallout() : callout(NULL), priority(MRU_LOW) {}
  SdcCallout(PRDcallout & mru, PRDpriority p)
    : callout(mru), priority(p)
  {}
  SdcCallout(TARGETING::TargetHandle_t i_pcalloutHandle , PRDpriority p)
    : callout(i_pcalloutHandle), priority(p)
  {}
};

typedef std::vector<SdcCallout> SDC_MRU_LIST;

struct SignatureList
{
    TARGETING::TargetHandle_t target;
    uint32_t                  signature;

    SignatureList() : target(NULL), signature(0) {}

    SignatureList( TARGETING::TargetHandle_t i_target, uint32_t i_signature ) :
        target(i_target), signature(i_signature)
    {}
};

typedef std::vector<SignatureList> PRDF_SIGNATURES;

//--------------------------------------------------------------------
//  Forward References
//--------------------------------------------------------------------
/**
 Collecter of service data
 @version fips1
 @author Douglas R. Gilbert
 */
class ServiceDataCollector
{
public:

#endif // PRDF_SDC_FLAGS_MAP_ONLY


  //mk03c
  PRDF_SDC_FLAGS_MAP        // flag positions
    PRDF_SDC_FLAG(USING_SAVED_SDC,         0x40000)                // mp05
    PRDF_SDC_FLAG(PROC_CORE_CS,            0x20000)                // mp03
    PRDF_SDC_FLAG(UNIT_CS,                 0x20000)                // mp06 a (Note this is intentionally the same value as PROC_CORE_CS)
    PRDF_SDC_FLAG(THERMAL_EVENT,           0x10000)                // pw01
    PRDF_SDC_FLAG(DONT_COMMIT_ERRL,        0x01000)        // mp02
    PRDF_SDC_FLAG(DUMP,                    0x00800)              // dg04
    PRDF_SDC_FLAG(UERE,                    0x00400)              // dg02
    PRDF_SDC_FLAG(SUE,                     0x00200)              // dg02
    PRDF_SDC_FLAG(AT_THRESHOLD,            0x00080)
    PRDF_SDC_FLAG(DEGRADED,                0x00040)
    PRDF_SDC_FLAG(SERVICE_CALL,            0x00020)
    PRDF_SDC_FLAG(TRACKIT,                 0x00010)
    PRDF_SDC_FLAG(TERMINATE,               0x00008)
    PRDF_SDC_FLAG(LOGIT,                   0x00004)
    PRDF_SDC_FLAG(FLOODING,                0x00001)
  PRDF_SDC_FLAGS_MAP_END

   /** Defines Analysis pass related properties.
     * Flags defined here will be used in framework Analyze leg */
   enum AnalysisFlags
   {
       /** If this flag is set, We are mainly interested in getting signature
        *  for attention. */
       PASS_ISOLATION_ONLY = 0x01,
   };
#ifndef PRDF_SDC_FLAGS_MAP_ONLY


  /**
   CTOR
   <ul>
   <br><b>Parameters:  </b> none
   <br><b>Returns:     </b> none
   <br><b>Requirements:</b> none
   <br><b>Promises:    </b> Object created
   <ul><li>             IsServiceCall() == false
   <li>                 IsAtThreshold() == false
   <li>                 terminate() == false
   <li>                 IsDegraded() == false
   <li>                 IsServiceCall() == false
   <li>                 IsMfgTracking() == true
   <li>                 IsLogging() == true
   </ul>
   <br><b>Exceptions:  </b> None.
   </ul><br>
   */
  ServiceDataCollector();

  // Function Specification ********************************************
  //
  // Purpose:      Destruction
  // Parameters:   None.
  // Returns:      No value returned
  // Requirements: None.
  // Promises:     None.
  // Exceptions:   None.
  // Concurrency:  Reentrant
  // Notes: Default destructor is sufficient  (for now)
  //
  // End Function Specification ****************************************
  //~ServiceDataCollector();

  /**
   Get access to the error signature object
   <ul>
   <br><b>Parameters:  </b> None.
   <br><b>Returns:     </b> ErrorSignature *
   <br><b>Requirements:</b> none
   <br><b>Promises:    </b> none
   <br><b>Exceptions:  </b> None.
   </ul><br>
   */
  ErrorSignature * GetErrorSignature() {return(&error_signature);}

    /**
     * @brief Sets a new signature in the error signature object.
     * @param i_signature The new signature.
     */
    void SetErrorSig( uint32_t i_signature )
    {  error_signature.setSigId( i_signature );  }

  /**
   Get access to the captureData object
   <ul>
   <br><b>Parameters:  </b> None.
   <br><b>Returns:     </b> Capture Data *
   <br><b>Requirements:</b> none
   <br><b>Promises:    </b> none
   <br><b>Exceptions:  </b> None.
   </ul><br>
   */
  CaptureData & GetCaptureData() {return(captureData);}

  /**
   Add a mru to the Callout list
   <ul>
   <br><b>Parameters:  </b> a valid PRDcallout & PRDpriority
   <br><b>Returns:     </b> None.
   <br><b>Requirements:</b> None
   <br><b>Promises:    </b> GetMruList().GetCount()++
   <br><b>Exceptions:  </b> None.
   <br><b>Notes:       </b> No implementation for Apache or Northstar
   </ul><br>
   */
  void SetCallout( PRDcallout mru, PRDpriority priority = MRU_MED );

  /**
   Add a change to the prd signature List
   */
  void AddSignatureList(TARGETING::TargetHandle_t i_ptargetHandle =NULL,
                          uint32_t  i_signature = 0x00000000);

    /**
     * @brief Add input signature to signature list.
     * @param i_sig Signature Object.
     * @note  This is a costly operation as it uses reverse lookup from HUID
     *        to target handle. If possible, use another variant of this
     *        function which takes TargetHandle_t as input.
     */
    void AddSignatureList( ErrorSignature & i_sig );

  /**
   Access the list of Mrus
   <ul>
   <br><b>Parameters:  </b> None.
   <br><b>Returns:     </b> SDC_MRU_LIST
   @see MruListClass
   <br><b>Requirements:</b> None.
   <br><b>Promises:    </b> None
   <br><b>Exceptions:  </b> None.
   <br><b>Notes:       </b> No implementation for Apache or Northstar
   </ul><br>
   */
  SDC_MRU_LIST & GetMruList(void);  // dg07

  PRDF_SIGNATURES & GetSignatureList(void);  // jl00

  /**
   Clear the list of MruCallouts
   <ul>
   <br><b>Parameters:  </b> None.
   <br><b>Returns:     </b> None.
   <br><b>Requirements:</b>
   <br><b>Promises:    </b> GetCallouts().size() == 0
   <br><b>Exceptions:  </b> None.
   </ul><br>
   */
  void ClearCallouts(void);

  void ClearSignatureList(void);
  /**
   Query for threshold
   <ul>
   <br><b>Parameters:  </b> None.
   <br><b>Returns:     </b> [true | false]
   <br><b>Requirements:</b> None.
   <br><b>Promises:    </b> None.
   <br><b>Exceptions:  </b> None.
   </ul><br>
   */
  bool IsAtThreshold(void) const { return (flags & AT_THRESHOLD)!=0 ? true:false; }

  /**
   Query for need to terminate is machine
   <ul>
   <br><b>Parameters:  </b> None.
   <br><b>Returns:     </b> [true | false]
   <br><b>Requirements:</b> None.
   <br><b>Promises:    </b> None.
   <br><b>Exceptions:  </b> None.
   </ul><br>
   */
  bool Terminate(void) const { return (flags & TERMINATE) != 0 ? true:false; }

  /**
   Set the global attention type
   <ul>
   <br><b>Parameters:  </b> attention type.
   <br><b>Returns:     </b> None.
   <br><b>Requirements:</b> None.
   <br><b>Promises:    </b> GetAttentionType() == attention,
                            If(attention == MACHINE_CHECK) IsServiceCall() == true
   <br><b>Exceptions:  </b> None.
   </ul><br>
   */
  void SetAttentionType(ATTENTION_TYPE attention);

  /**
   Set the cause attention type
   <ul>
   <br><b>Parameters:  </b> attention type.
   <br><b>Returns:     </b> None.
   <br><b>Requirements:</b> None.
   <br><b>Promises:    </b> GetCauseAttentionType() == attention
   <br><b>Exceptions:  </b> None.
   </ul><br>
   */
  void SetCauseAttentionType(ATTENTION_TYPE attention);  // rc09a

  /**
   Get the global attention type
   <ul>
   <br><b>Parameters:  </b> None.
   <br><b>Returns:     </b> Attention type [MACHINE_CHECK | RECOVERABLE | SPECIAL]
   <br><b>Requirements:</b> SetAttentionType()
   <br><b>Promises:    </b> None.
   <br><b>Exceptions:  </b> None.
   </ul><br>
   */
  ATTENTION_TYPE GetAttentionType(void) const { return attentionType; }

  /**
   Get the cause attention type
   <ul>
   <br><b>Parameters:  </b> None.
   <br><b>Returns:     </b> Attention type [MACHINE_CHECK | RECOVERABLE | SPECIAL]
   <br><b>Requirements:</b> SetCauseAttentionType()
   <br><b>Promises:    </b> None.
   <br><b>Exceptions:  </b> None.
   </ul><br>
   */
  ATTENTION_TYPE GetCauseAttentionType(void) const { return causeAttentionType; }  // rc09a

  /**
   Set the mask id of the error to mask at threshold
   <ul>
   <br><b>Parameters:  </b> Mask id
   <br><b>Returns:     </b> None.
   <br><b>Requirements:</b> None
   <br><b>Promises:    </b> GetThresholdMaskId() == mask_id,
                            IsDegraded() == true,
                            IsAtThreshold() == true,
                            IsServiceCall() == true
   <br><b>Exceptions:  </b> None.
   </ul><br>
   */
  void SetThresholdMaskId(uint32_t mask_id);

  /**
   Query for Hardware running deraded
   <ul>
   <br><b>Parameters:  </b> None.
   <br><b>Returns:     </b> [true | false]
   <br><b>Requirements:</b> None.
   <br><b>Promises:    </b> None.
   <br><b>Exceptions:  </b> None.
   </ul><br>
   */
  bool IsDegraded(void) const { return (flags & DEGRADED)!=0 ? true:false; }

  /**
   Get the mask ID to mask off the error when thresholding
   <ul>
   <br><b>Parameters:  </b> none
   <br><b>Returns:     </b> Mask id
   <br><b>Requirements:</b> SetThresholdMaskId(...)
   <br><b>Promises:    </b> none.
   <br><b>Exceptions:  </b> None.
   </ul><br>
   */
  uint32_t GetThresholdMaskId(void) const;

  /**
   Indicate that no tracking is needed in the manufacturing log
   <ul>
   <br><b>Parameters:  </b> None.
   <br><b>Returns:     </b> None.
   <br><b>Requirements:</b> None.
   <br><b>Promises:    </b> IsMfgTracking() == false
   <br><b>Exceptions:  </b> None.
   </ul><br>
   */
  void NoMfgTracking(void) { flags &= ~TRACKIT; }

  /**
   Query for need to track in manufacturing log
   <ul>
   <br><b>Parameters:  </b> None.
   <br><b>Returns:     </b> [true | false]
   <br><b>Requirements:</b> None.
   <br><b>Promises:    </b> None.
   <br><b>Exceptions:  </b> None.
   </ul><br>
   */
  bool IsMfgTracking(void) const { return (flags & TRACKIT)!=0 ? true:false; }

  /**
   Indicate that no system log should be generated
   <ul>
   <br><b>Parameters:  </b> None
   <br><b>Returns:     </b> none.
   <br><b>Requirements:</b> None.
   <br><b>Promises:    </b> IsLogging() == false
   <br><b>Exceptions:  </b> None.
   </ul><br>
   */
  void Nologging(void) { flags &= ~LOGIT; }

  /**
   Query for need to make a system error log
   <ul>
   <br><b>Parameters:  </b> None.
   <br><b>Returns:     </b> [true | false]
   <br><b>Requirements:</b> None.
   <br><b>Promises:    </b> None.
   <br><b>Exceptions:  </b> None.
   </ul><br>
   */
  bool IsLogging(void) const { return (flags & LOGIT)!=0 ? true:false; }

    /**
     * @brief Sets flag to indicate not to commit the error log.
     */
    void DontCommitErrorLog() { flags |= DONT_COMMIT_ERRL; }

    /**
     * @brief  Queries if the 'Don't Commit Error Log' flag is on.
     * @return TRUE if DONT_COMMIT_ERRL flag is set, FALSE otherwise.
     */
    bool IsDontCommitErrl() const
    {
        #ifndef ESW_SIM_COMPILE
        return ( 0 != (flags & DONT_COMMIT_ERRL) );
        #else
        return false;
        #endif
    }

  /**
   Indicate that a service is needed
   <ul>
   <br><b>Parameters:  </b> None
   <br><b>Returns:     </b> none.
   <br><b>Requirements:</b> None.
   <br><b>Promises:    </b> IsServiceCall() == true
   <br><b>Exceptions:  </b> None.
   </ul><br>
   */
  void SetServiceCall(void) { flags |= SERVICE_CALL; }

  /**
   Query for need of a Service Call
   <ul>
   <br><b>Parameters:  </b> None.
   <br><b>Returns:     </b> [true | false]
   <br><b>Requirements:</b> None.
   <br><b>Promises:    </b> None.
   <br><b>Exceptions:  </b> None.
   </ul><br>
   */
  bool IsServiceCall(void) const { return (flags & SERVICE_CALL)!=0 ? true:false; }

  /**
   Indicate the chip where analysis begain
   <ul>
   <br><b>Parameters:  </b> i_pchipHandle
   <br><b>Returns:     </b> none.
   <br><b>Requirements:</b> none.
   <br><b>Promises:    </b> GetStartingChip() == chid
   <br><b>Exceptions:  </b> None.
   </ul><br>
   */
  void SetStartingChip(TARGETING::TargetHandle_t i_pchipHandle)
  {
    startingPoint =  i_pchipHandle;
  }

  /**
   Get the chip id of the chip PRD picked as a starting point
   <ul>
   <br><b>Parameters:  </b> None.
   <br><b>Returns:     </b> chip id
   <br><b>Requirements:</b> SetStartingChip()
   <br><b>Promises:    </b> None.
   <br><b>Exceptions:  </b> None.
   </ul><br>
   */
  TARGETING::TargetHandle_t GetStartingChip(void) const {return startingPoint;}

  /**
   Set the number of times this error has been seen since IPL
   <ul>
   <br><b>Parameters:  </b> hit count
   <br><b>Returns:     </b> None.
   <br><b>Requirements:</b> None.
   <br><b>Promises:    </b> GetHits() == inhits
   <br><b>Exceptions:  </b> None.
   </ul><br>
   */
  void SetHits(uint8_t inhits) { hitCount = inhits; }

  /**
   Get the number of times this error has been seen since IPL
   <ul>
   <br><b>Parameters:  </b> None.
   <br><b>Returns:     </b> hit count
   <br><b>Requirements:</b> SetHits()
   <br><b>Promises:    </b> None
   <br><b>Exceptions:  </b> None.
   </ul><br>
   */
  uint8_t GetHits(void) const { return hitCount; }

  /**
   Indicate the threshold for this error
   <ul>
   <br><b>Parameters:  </b> threshold
   <br><b>Returns:     </b> None.
   <br><b>Requirements:</b> None.
   <br><b>Promises:    </b> GetThreshold() == inthold
   <br><b>Exceptions:  </b> None.
   </ul><br>
   */
  void SetThreshold(uint8_t inthold) { threshold = inthold; }

  /**
   Get the threshold value for this error
   <ul>
   <br><b>Parameters:  </b> None.
   <br><b>Returns:     </b> threshold value
   <br><b>Requirements:</b> SetThreshold()
   <br><b>Promises:    </b> None.
   <br><b>Exceptions:  </b> None.
   <br><b>Notes:       </b> optional
   </ul><br>
   */
  uint8_t GetThreshold(void) const { return threshold; }

  /**
   Indicate that PRD is being called faster than SP can send error logs
   <ul>
   <br><b>Parameters:  </b> None.
   <br><b>Returns:     </b> None.
   <br><b>Requirements:</b> None.
   <br><b>Promises:    </b> IsFlooding() == true
   <br><b>Exceptions:  </b> None.
   </ul><br>
   */
  void SetFlooding(void) { flags |= FLOODING; }

  /**
   Query for flooding
   <ul>
   <br><b>Parameters:  </b> None.
   <br><b>Returns:     </b> [true | false]
   <br><b>Requirements:</b> None.
   <br><b>Promises:    </b> None.
   <br><b>Exceptions:  </b> None.
   </ul><br>
   */
  bool IsFlooding(void) const { return (flags & FLOODING)!=0 ? true:false; }

    /**
     * @brief returns true if code is in isolation only pass.
     */
    bool IsIsolationOnlyPass(void) const { return ( ( analysisFlags &
                                        PASS_ISOLATION_ONLY )!=0 ); }
    /**
     * @brief Sets isolation only flag.
     */
    void setIsolationOnlyPass() { analysisFlags |= PASS_ISOLATION_ONLY ;}

    /**
     * @brief Clears isolation only flag.
     */
    void clearIsolationOnlyPass() { analysisFlags &= !PASS_ISOLATION_ONLY ;}

  /**
   Set ErrorType for Gard
   <ul>
   <br><b>Parameter    </b> GardAction::ErrorType
   <br><b>Returns:     </b> None.
   <br><b>Requirements:</b> None
   <br><b>Promises     </b> QueryRepeatGard() == et
   <br><b>Notes:       </b>
   </ul><br>
   */
  void Gard(GardAction::ErrorType et) { errorType = et; }

  /**
   Query for RepeatGard ErrorType
   <ul>
   <br><b>Paramters    </b> None.
   <br><b>Returns:     </b> GardAction::ErrorType
   <br><b>Requirements:</b> SetAttentionType()
   <br><b>Promises     </b> ErrorType set by Gard or NoGard
   <br><b>Notes:       </b>
   </ul><br>
   */
  GardAction::ErrorType QueryGard(void);

  /**
   Set Error type as Special Uncorrectable Error SUE
   <ul>
   <br><b>Parameters:  </b> None
   <br><b>Returns:     </b> Nothing.
   <br><b>Requirements:</b> None
   <br><b>Promises:    </b> IsSUE() == true
   <br><b>Exceptions:  </b> None.
   </ul><br>
   */
  void SetSUE(void) { flags |= SUE; }

  /**
   Query for Special Uncorrectable Error (SUE)
   <ul>
   <br><b>Parameters:  </b> None
   <br><b>Returns:     </b> Nothing.
   <br><b>Requirements:</b> None
   <br><b>Promises:    </b> None.
   <br><b>Exceptions:  </b> None.
   </ul><br>
   */
  bool IsSUE(void) const { return (flags & SUE)!=0 ? true:false; }

  /**
   Set Error type as Uncorrectable Recoverable Error
   <ul>
   <br><b>Parameters:  </b> None
   <br><b>Returns:     </b> Nothing.
   <br><b>Requirements:</b> None
   <br><b>Promises:    </b> IsUERE() == true
   <br><b>Exceptions:  </b> None.
   </ul><br>
   */
  void SetUERE(void) { flags |= UERE; }

  /**
   Query for Uncorrectable Recoverable Error (UERE)
   <ul>
   <br><b>Parameters:  </b> None
   <br><b>Returns:     </b> Nothing.
   <br><b>Requirements:</b> None
   <br><b>Promises:    </b> None.
   <br><b>Exceptions:  </b> None.
   </ul><br>
   */
  bool IsUERE(void) const { return (flags & UERE)!=0 ? true:false;}

  /**
   Set a flag
   <ul>
   <br><b>Parameters:  </b> ServiceDataCollector::Flag
   <br><b>Returns:     </b> Nothing.
   <br><b>Requirements:</b> None
   <br><b>Promises:    </b> ServiceDataCollector::Flag is true
   <br><b>Exceptions:  </b> None.
   </ul><br>
   */
  void SetFlag(Flag flag) { flags |= flag ;}  //mk03a

  /**
   Get a flag
   <ul>
   <br><b>Parameters:  </b> ServiceDataCollector::Flag
   <br><b>Returns:     </b> boolean.
   <br><b>Requirements:</b> None
   <br><b>Exceptions:  </b> None.
   </ul><br>
   */
  bool GetFlag(Flag flag) { return ((flags & flag)!=0);}

  /**
   Clear a flag
   <ul>
   <br><b>Parameters:  </b> ServiceDataCollector::Flag
   <br><b>Returns:     </b> Nothing.
   <br><b>Requirements:</b> None
   <br><b>Promises:    </b> ServiceDataCollector::Flag is false
   <br><b>Exceptions:  </b> None.
   </ul><br>
   */
  void ClearFlag(Flag flag) { flags &= ~flag ;}  // rc09a

  // dg08 - start
  /**
   Get a PRD timer value based on the time of this error
   <ul>
   <br><b>Paramter:    </b> None
   <br><b>Returns:     </b> Timer
   <br><b>Requirments: </b> None.
   <br><b>Promises:    </b> None.
   <br><b>Exceptions:  </b> None.
   </ul><br>
   */
  Timer GetTOE(void) { return ivCurrentEventTime; }

  /**
   Set Time of Error
   @parm set PRD timer value
   @returns nothing
   */
  void SetTOE(Timer& theTime) { ivCurrentEventTime = theTime; }

  /** Is an Thermal Event Flag on? */
  bool IsThermalEvent(void) const { return (flags & THERMAL_EVENT) != 0 ? true:false; }

  /** Is a Proc Core CS flag on? */
  bool IsProcCoreCS (void) const { return (flags & PROC_CORE_CS) != 0 ? true:false; }

  /** Is a Unit CS flag on? */
  bool IsUnitCS (void) const { return (flags & UNIT_CS) != 0 ? true:false; }

  /** Is a Using Saved SDC on? */
  bool IsUsingSavedSdc (void) const { return (flags & USING_SAVED_SDC) != 0 ? true:false; }

  /** Is a Force Lantent Check Stop flag on? */

#ifndef __HOSTBOOT_MODULE

  /**
   Flatten the service data collector
   <ul>
   <br><b>Paramter:    </b> i_buffer ptr to buffer
   <br><b>Paramter:    </b> io_size = buffer size
   <br><b>Returns:     </b> [SUCCESS(0) | returncode]; io_size = # bytes written to buffer
   <br><b>Requirments: </b> None.
   <br><b>Promises:    </b> None.
   <br><b>Notes:       </b>
   return != SUCCESS means buffer size was insufficient to save enough data for reconstruction.
   return == SUCCESS means enough data is available for reconstruction, but some data could
   have been truncated if there was not enough space.
   Flattened data is network byte ordered
   </ul><br>
   */
  uint32_t Flatten(uint8_t * i_buffer, uint32_t & io_size) const;

  ServiceDataCollector & operator=(const uint8_t * i_flatdata);
  // ServiceDataCollector & operator=(const ServiceDataCollector &scd)-compiler default is sufficent

#endif

  /**
   * Get the Handle of the chip/core that detected the thermal event.
   */
  TARGETING::TargetHandle_t  GetThermalChipId() { return ivpThermalChipHandle; }; //pw01

  /**
   * Set the Handle of the chip/core that detected the thermal event.
   * @note As a side effect, the THERMAL_EVENT flag is set.
   */
  void SetThermalChipId(TARGETING::TargetHandle_t i_pchipHandle) // pw01
  {
      ivpThermalChipHandle = i_pchipHandle;
      SetFlag(THERMAL_EVENT);
  };

private:  // functions
  friend class TerminateResolution;

  /**
   Indicate that the machine should be taken down for this error
   <ul>
   <br><b>Parameters:  </b> None.
   <br><b>Returns:     </b> None.
   <br><b>Requirements:</b> None.
   <br><b>Promises:    </b> Terminate() == true, IsServiceCall() == true
   <br><b>Exceptions:  </b> None.
   </ul><br>
   */
  void SetTerminate(void);
  int32_t getxMRUListSizeinMem(void)const ;

private:  // Data

  hwTableContent ivDumpRequestContent;

  ErrorSignature     error_signature;
  CaptureData        captureData;
  SDC_MRU_LIST       xMruList;          // dg07
  PRDF_SIGNATURES    iv_SignatureList; // jl00
  uint32_t           maskId;
  ATTENTION_TYPE     attentionType;    // MCK,REC,SPCL

  uint32_t       flags;        //mp01 c from  uint16_t
  uint8_t       hitCount;
  uint8_t       threshold;
  uint8_t       analysisFlags;
  TARGETING::TargetHandle_t   startingPoint;
  GardAction::ErrorType errorType;
  Timer ivCurrentEventTime;
  TARGETING::TargetHandle_t ivpDumpRequestChipHandle;
  ATTENTION_TYPE causeAttentionType;    // MCK,REC,SPCL

  TARGETING::TargetHandle_t ivpThermalChipHandle;
  //RTC: 60553 Eventually we shall use hostboot implementation of stack istead
  //of std:list
  static std::list< ExtensibleChip *> cv_ruleChipStack ;
public:

  /**
   * @brief   get the rulechip  under analysis
   * @param   None
   * @return  RuleChip currently under analysis
   */
  static  ExtensibleChip* getChipAnalyzed()
  {
    return cv_ruleChipStack.back( );
  }
  /**
   * @brief   pushes the rulechip under analysis in a list
   * @param   i_analyzingChip RuleChip under analysis
   * @return  None
   */
  static void  pushChipAnalyzed( ExtensibleChip* i_analyzingChip )
  {
    cv_ruleChipStack.push_back( i_analyzingChip );
  }
  /**
   * @brief   pops the last rulechip under analysis from  list
   * @param   i_analyzingChip RuleChip under analysis
   * @return  None
   */
  static void popChipAnalyzed( )
  {
    cv_ruleChipStack.pop_back();
  }

  /**
   * @brief     Clears the list containing pointers to all the RuleChip under
   *            analysis
   */
  static void clearChipStack( )
  {
      cv_ruleChipStack.clear();
  }

  /**
   * @brief       get Target pointer pertaining to RuleChip under analysis
   * @return      target pointer
   * @note        Should be called only in Analyze leg of code
   */

   static TARGETING::TargetHandle_t  getTargetAnalyzed( );

// --------------------------------------
// FSP only functions begin
// --------------------------------------

  /**
   SetDump - Specifiy dump of a callout
   <ul>
   <br><b>Paramter:    </b> dumpRequestContent
   <br><b>Returns:     </b> Nothing
   <br><b>Requirments: </b> None.
   <br><b>Promises:    </b> IsDump() == true
   <br><b>Exceptions:  </b> None.
   </ul><br>
   */
  void SetDump( hwTableContent iDumpRequestContent,
                TARGETING::TargetHandle_t iDumpRequestChipHandle = NULL )
  {
    SetFlag(DUMP);
    ivDumpRequestContent = iDumpRequestContent;
    ivpDumpRequestChipHandle = iDumpRequestChipHandle;
  }

  /**
   Has a Dump been requested
   <ul>
   <br><b>Paramter:    </b> None
   <br><b>Returns:     </b> [true | false]
   <br><b>Requirments: </b> None.
   <br><b>Promises:    </b> None.
   <br><b>Exceptions:  </b> None.
   </ul><br>
   */
  bool IsDump(void) const { return (flags & DUMP)!=0 ? true:false; }

  /**
   Get the dump Id
   <ul>
   <br><b>Paramter:    </b> None
   <br><b>Return:      </b> dumpRequestType [DUMP_HARDWARE_ONLY | DUMP_HARDWARE_MAINSTORE | DUMP_NO_DUMP]
   <br><b>Return:      </b> dumpRequestContent [DUMP_HW_ABBR | DUMP_SW_ABBR]
   <br><b>Return:      </b> oDumpRequestChipId [Handle]
   <br><b>Requirments: </b> none
   <br><b>Promises:    </b> None.
   <br><b>Notes:       </b> If IsDump()==false than dumpRequestType returned is DUMP_NO_DUMP
   </ul><br>
   */
  void GetDumpRequest(  hwTableContent & oDumpRequestContent,
                        TARGETING::TargetHandle_t&
                        opDumpRequestChipHandle ) const
  {
    oDumpRequestContent = ivDumpRequestContent;
    opDumpRequestChipHandle = ivpDumpRequestChipHandle;
  }

// --------------------------------------
// FSP only functions end
// --------------------------------------

};


/**
 * @brief   limits the scope of RuleChip pointer in stack to a given scope.
 *
 * This class basically binds the scope of a given RuleChip pointer in SDC chip
 * stack to certain scope. When an instance of this class is created, RuleChip
 * is pushed to stack.In destructor,same gets popped.As a result, the scpoe of
 * this  RuleChip pointer gets tied to scope of ChipScopeLock instance.
 * PRDF_DEFINE_CHIP_SCOPE encapsulates instantiation of ScopeChipLock.

 */

#define PRDF_DEFINE_CHIP_SCOPE( ARG ) \
                                ChipScopeLock csl( ARG )
class ChipScopeLock
{
    public:
    /**
     * @brief     Constructor
     * @param     i_pChipAnalyzed    Chip for which scope is to be locked
     */
    ChipScopeLock( ExtensibleChip * i_pChipAnalyzed )
    {
        ServiceDataCollector::pushChipAnalyzed( i_pChipAnalyzed );
    }
    /**
     * @brief     Destructor
     */
    ~ChipScopeLock()
    {
        ServiceDataCollector::popChipAnalyzed( );
    }
};




} // end namespace PRDF

#include "iipServiceDataCollector.inl"

#endif // PRDF_SDC_FLAGS_MAP_ONLY

#endif /* iipServiceDataCollector_h */
OpenPOWER on IntegriCloud