?? RIGHT := 110 ??
?? NEWTITLE := 'NOS/VE Dump Analyzer : Display Alternate IOU Configuration Command' ??
MODULE dum$display_alternate_iou_conf;

{ PURPOSE:
{   This module contains the command which displays the alternate IOU configuration information
{   that is stored in the AIC record.

?? NEWTITLE := 'Global Declarations Referenced by This Module', EJECT ??
?? PUSH (LISTEXT := ON) ??
*copyc due$exception_condition_codes
?? POP ??
*copyc clp$close_display
*copyc clp$convert_integer_to_rjstring
*copyc clp$evaluate_parameters
*copyc clp$open_display_reference
*copyc clp$put_display
*copyc dup$find_record_list_entry
*copyc dup$new_page_procedure
*copyc osp$disestablish_cond_handler
*copyc osp$establish_block_exit_hndlr
*copyc osp$set_status_abnormal
?? EJECT ??
*copyc duv$dump_environment_p
*copyc duv$execution_environment
*copyc duv$title_data
?? OLDTITLE ??
?? NEWTITLE := 'dup$display_alternate_iou_conf', EJECT ??

{ PURPOSE:
{   This procedure displays the alternate iou configuration information.

  PROCEDURE [XDCL] dup$display_alternate_iou_conf
    (    parameter_list: clt$parameter_list;
     VAR status: ost$status);

{ PROCEDURE display_alternate_iou_config, disaic (
{   output, o: file = $optional
{   title, t: string 1..31 = 'display_alternate_iou_config'
{   status)

?? PUSH (LISTEXT := ON) ??
?? FMT (FORMAT := OFF) ??
  VAR
    pdt: [STATIC, READ, cls$declaration_section] record
      header: clt$pdt_header,
      names: array [1 .. 5] of clt$pdt_parameter_name,
      parameters: array [1 .. 3] of clt$pdt_parameter,
      type1: record
        header: clt$type_specification_header,
      recend,
      type2: record
        header: clt$type_specification_header,
        qualifier: clt$string_type_qualifier,
        default_value: string (30),
      recend,
      type3: record
        header: clt$type_specification_header,
      recend,
    recend := [
    [1,
    [90, 8, 31, 11, 48, 53, 171],
    clc$command, 5, 3, 0, 0, 0, 0, 3, ''], [
    ['O                              ',clc$abbreviation_entry, 1],
    ['OUTPUT                         ',clc$nominal_entry, 1],
    ['STATUS                         ',clc$nominal_entry, 3],
    ['T                              ',clc$abbreviation_entry, 2],
    ['TITLE                          ',clc$nominal_entry, 2]],
    [
{ PARAMETER 1
    [2, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation,
  clc$standard_parameter_checking, 3, clc$optional_parameter, 0, 0],
{ PARAMETER 2
    [5, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name, clc$specify_positionally],
    clc$pass_by_value, clc$immediate_evaluation,
  clc$standard_parameter_checking, 8, clc$optional_default_parameter, 0, 30],
{ PARAMETER 3
    [3, clc$normal_usage_entry, clc$non_secure_parameter,
    $clt$parameter_spec_methods[clc$specify_by_name],
    clc$pass_by_reference, clc$immediate_evaluation,
  clc$standard_parameter_checking, 3, clc$optional_parameter, 0, 0]],
{ PARAMETER 1
    [[1, 0, clc$file_type]],
{ PARAMETER 2
    [[1, 0, clc$string_type], [1, 31, FALSE],
    '''display_alternate_iou_config'''],
{ PARAMETER 3
    [[1, 0, clc$status_type]]];
?? FMT (FORMAT := ON) ??
?? POP ??

    CONST
      p$output = 1,
      p$title = 2,
      p$status = 3;

    VAR
      pvt: array [1 .. 3] of clt$parameter_value;

    TYPE
      t$bits_or_byte = PACKED RECORD
        CASE boolean OF
        = TRUE =
          bit_part: PACKED ARRAY [56 .. 63] OF boolean,
        = FALSE =
          byte_part: 0 .. 0ff(16),
        CASEND,
      RECEND,

      t$record_data = PACKED RECORD
        general_status: t$record_data_entry,
        configuration_status: t$record_data_entry,
        iou_power_on_status: t$record_data_entry,
        iou_present_status: t$record_data_entry,
        last_initiated_ds_status: t$record_data_entry,
        reserved_1: t$record_data_entry,
        reserved_2: t$record_data_entry,
        iou0_model_number: t$record_data_entry,
        reserved_3: t$record_data_entry,
        iou1_model_number: t$record_data_entry,
        reserved_4: t$record_data_entry,
        iou0_tpm_revision_msb: t$record_data_entry,
        iou0_tpm_revision_lsb: t$record_data_entry,
        iou1_tpm_revision_msb: t$record_data_entry,
        iou1_tpm_revision_lsb: t$record_data_entry,
      RECEND,

      t$record_data_entry = PACKED RECORD
        unused: 0 .. 0f(16),
        data: t$bits_or_byte,
      RECEND;

    VAR
      cell_p: ^cell,
      data_value: clt$data_value,
      display_control: clt$display_control,
      display_string: string (osc$max_string_size),
      entry_p: ^dut$de_other_record_entry,
      ignore_status: ost$status,
      output_display_opened: boolean,
      record_data_p: ^t$record_data,
      restart_file_seq_p: ^SEQ ( * ),
      ring_attributes: amt$ring_attributes,
      string_6: string (6),
      string_length: integer;

*copy dup$abort_handler
?? NEWTITLE := 'clean_up', EJECT ??

{ PURPOSE:
{   This procedure is called from the abort handler to close the file.

    PROCEDURE [INLINE] clean_up;

      VAR
        ignore_status: ost$status;

      IF output_display_opened THEN
        clp$close_display (display_control, ignore_status);
      IFEND;

    PROCEND clean_up;
?? OLDTITLE, EJECT ??

    status.normal := TRUE;

    clp$evaluate_parameters (parameter_list, #SEQ (pdt), NIL, ^pvt, status);
    IF NOT status.normal THEN
      RETURN;  {---->
    IFEND;

    IF duv$dump_environment_p = NIL THEN
      osp$set_status_abnormal (duc$dump_analyzer_id, due$no_restart_file, '', status);
      RETURN;  {---->
    IFEND;

    output_display_opened := FALSE;
    osp$establish_block_exit_hndlr (^abort_handler);

   /display_opened/
    BEGIN

    { Prepare the output display file.

      IF pvt [p$output].specified THEN
        ring_attributes.r1 := #RING (^ring_attributes);
        ring_attributes.r2 := #RING (^ring_attributes);
        ring_attributes.r3 := #RING (^ring_attributes);
        clp$open_display_reference (pvt [p$output].value^.file_value^, ^dup$new_page_procedure, fsc$list,
              ring_attributes, display_control, status);
        IF NOT status.normal THEN
          EXIT /display_opened/;  {---->
        IFEND;
        output_display_opened := TRUE;
      ELSE
        display_control := duv$execution_environment.output_file.display_control;
        display_control.line_number := display_control.page_length + 1;
      IFEND;

      duv$title_data.build_title := TRUE;
      duv$title_data.command_name := pvt [p$title].value^.string_value^;

      data_value.kind := clc$name;
      data_value.name_value := 'AIC';
      dup$find_record_list_entry (data_value, entry_p);
      IF entry_p = NIL THEN
        osp$set_status_abnormal (duc$dump_analyzer_id, due$data_not_on_dump, 'The AIC record is',
              status);
        EXIT /display_opened/;  {---->
      IFEND;

      restart_file_seq_p := duv$execution_environment.data_file_p^.segment_pointer.sequence_pointer;
      cell_p := #ADDRESS (#RING (restart_file_seq_p), #SEGMENT (restart_file_seq_p), entry_p^.first_byte);
      RESET restart_file_seq_p TO cell_p;

      IF #SIZE (t$record_data) > entry_p^.size THEN
        clp$put_display (display_control, 'ERROR - Not enough data in the record, data not displayed.',
              clc$trim, ignore_status);
        EXIT /display_opened/;  {---->
      IFEND;

      NEXT record_data_p IN restart_file_seq_p;

      clp$put_display (display_control, 'AIC - Alternate IOU Configuration Record:', clc$trim,
            ignore_status);
      clp$put_display (display_control, ' ', clc$trim, ignore_status);

      clp$convert_integer_to_rjstring (record_data_p^.general_status.data.byte_part, 16, TRUE, '0',
            string_6, ignore_status);
      STRINGREP (display_string, string_length, ' General Status Byte = ', string_6);
      clp$put_display (display_control, display_string (1, string_length), clc$trim, ignore_status);
      IF record_data_p^.general_status.data.bit_part [63] THEN
        clp$put_display (display_control, '   bit 63 = 1; CMSE Load Only', clc$trim, ignore_status);
      ELSE
        clp$put_display (display_control, '   bit 63 = 0; Default System Load', clc$trim, ignore_status);
      IFEND;

      clp$convert_integer_to_rjstring (record_data_p^.configuration_status.data.byte_part, 16, TRUE, '0',
            string_6, ignore_status);
      STRINGREP (display_string, string_length, ' Configuration/Status Byte = ', string_6);
      clp$put_display (display_control, display_string (1, string_length), clc$trim, ignore_status);
      IF record_data_p^.configuration_status.data.bit_part [56] THEN
        clp$put_display (display_control, '   bit 56 = 1; Identifies Multiple IOU Configuration', clc$trim,
              ignore_status);
      IFEND;
      IF record_data_p^.configuration_status.data.bit_part [60] THEN
        clp$put_display (display_control, '   bit 60 = 1; Identifies IOU3', clc$trim, ignore_status);
      IFEND;
      IF record_data_p^.configuration_status.data.bit_part [61] THEN
        clp$put_display (display_control, '   bit 61 = 1; Identifies IOU2', clc$trim, ignore_status);
      IFEND;
      IF record_data_p^.configuration_status.data.bit_part [62] THEN
        clp$put_display (display_control, '   bit 62 = 1; Identifies IOU1', clc$trim, ignore_status);
      IFEND;
      IF record_data_p^.configuration_status.data.bit_part [63] THEN
        clp$put_display (display_control, '   bit 63 = 1; Identifies IOU0', clc$trim, ignore_status);
      IFEND;

      clp$convert_integer_to_rjstring (record_data_p^.iou_power_on_status.data.byte_part, 16, TRUE, '0',
            string_6, ignore_status);
      STRINGREP (display_string, string_length, ' IOU Power-On Status Byte = ', string_6);
      clp$put_display (display_control, display_string (1, string_length), clc$trim, ignore_status);
      IF record_data_p^.iou_power_on_status.data.bit_part [60] THEN
        clp$put_display (display_control, '   bit 60 = 1; IOU3 Power On', clc$trim, ignore_status);
      IFEND;
      IF record_data_p^.iou_power_on_status.data.bit_part [61] THEN
        clp$put_display (display_control, '   bit 61 = 1; IOU2 Power On', clc$trim, ignore_status);
      IFEND;
      IF record_data_p^.iou_power_on_status.data.bit_part [62] THEN
        clp$put_display (display_control, '   bit 62 = 1; IOU1 Power On', clc$trim, ignore_status);
      IFEND;
      IF record_data_p^.iou_power_on_status.data.bit_part [63] THEN
        clp$put_display (display_control, '   bit 63 = 1; IOU0 Power On', clc$trim, ignore_status);
      IFEND;

      clp$convert_integer_to_rjstring (record_data_p^.iou_present_status.data.byte_part, 16, TRUE, '0',
            string_6, ignore_status);
      STRINGREP (display_string, string_length, ' IOU Present Status Byte = ', string_6);
      clp$put_display (display_control, display_string (1, string_length), clc$trim, ignore_status);
      IF record_data_p^.iou_present_status.data.bit_part [60] THEN
        clp$put_display (display_control, '   bit 60 = 1; IOU3 Present', clc$trim, ignore_status);
      IFEND;
      IF record_data_p^.iou_present_status.data.bit_part [61] THEN
        clp$put_display (display_control, '   bit 61 = 1; IOU2 Present', clc$trim, ignore_status);
      IFEND;
      IF record_data_p^.iou_present_status.data.bit_part [62] THEN
        clp$put_display (display_control, '   bit 62 = 1; IOU1 Present', clc$trim, ignore_status);
      IFEND;
      IF record_data_p^.iou_present_status.data.bit_part [63] THEN
        clp$put_display (display_control, '   bit 63 = 1; IOU0 Present', clc$trim, ignore_status);
      IFEND;

      clp$convert_integer_to_rjstring (record_data_p^.last_initiated_ds_status.data.byte_part, 16, TRUE, '0',
            string_6, ignore_status);
      STRINGREP (display_string, string_length, ' Last Initiated DS Status Byte = ', string_6);
      clp$put_display (display_control, display_string (1, string_length), clc$trim, ignore_status);
      IF record_data_p^.last_initiated_ds_status.data.bit_part [60] THEN
        clp$put_display (display_control, '   bit 60 = 1; Remote Terminal Initiated Deadstart', clc$trim,
              ignore_status);
      IFEND;
      IF record_data_p^.last_initiated_ds_status.data.bit_part [61] THEN
        clp$put_display (display_control, '   bit 61 = 1; Alternate Console Initiated Deadstart', clc$trim,
              ignore_status);
      IFEND;
      IF record_data_p^.last_initiated_ds_status.data.bit_part [62] THEN
        clp$put_display (display_control, '   bit 62 = 1; PC Console Initiated Deadstart', clc$trim,
              ignore_status);
      IFEND;
      IF record_data_p^.last_initiated_ds_status.data.bit_part [63] THEN
        clp$put_display (display_control, '   bit 63 = 1; CC545 Initiated Deadstart', clc$trim,
              ignore_status);
      IFEND;

      clp$convert_integer_to_rjstring (record_data_p^.reserved_1.data.byte_part, 16, TRUE, '0',
            string_6, ignore_status);
      STRINGREP (display_string, string_length, ' Reserved Byte = ', string_6);
      clp$put_display (display_control, display_string (1, string_length), clc$trim, ignore_status);

      clp$convert_integer_to_rjstring (record_data_p^.reserved_2.data.byte_part, 16, TRUE, '0',
            string_6, ignore_status);
      STRINGREP (display_string, string_length, ' Reserved Byte = ', string_6);
      clp$put_display (display_control, display_string (1, string_length), clc$trim, ignore_status);

      clp$convert_integer_to_rjstring (record_data_p^.iou0_model_number.data.byte_part, 16, TRUE, '0',
            string_6, ignore_status);
      STRINGREP (display_string, string_length, ' IOU0 Model Number = ', string_6);
      clp$put_display (display_control, display_string (1, string_length), clc$trim, ignore_status);

      clp$convert_integer_to_rjstring (record_data_p^.reserved_3.data.byte_part, 16, TRUE, '0',
            string_6, ignore_status);
      STRINGREP (display_string, string_length, ' Reserved Byte = ', string_6);
      clp$put_display (display_control, display_string (1, string_length), clc$trim, ignore_status);

      clp$convert_integer_to_rjstring (record_data_p^.iou1_model_number.data.byte_part, 16, TRUE, '0',
            string_6, ignore_status);
      STRINGREP (display_string, string_length, ' IOU1 Model Number = ', string_6);
      clp$put_display (display_control, display_string (1, string_length), clc$trim, ignore_status);

      clp$convert_integer_to_rjstring (record_data_p^.reserved_4.data.byte_part, 16, TRUE, '0',
            string_6, ignore_status);
      STRINGREP (display_string, string_length, ' Reserved Byte = ', string_6);
      clp$put_display (display_control, display_string (1, string_length), clc$trim, ignore_status);

      clp$convert_integer_to_rjstring (record_data_p^.iou0_tpm_revision_msb.data.byte_part, 16, TRUE, '0',
            string_6, ignore_status);
      STRINGREP (display_string, string_length, ' IOU0 TPM Firmware Revision Number (MSB) = ', string_6);
      clp$put_display (display_control, display_string (1, string_length), clc$trim, ignore_status);

      clp$convert_integer_to_rjstring (record_data_p^.iou0_tpm_revision_lsb.data.byte_part, 16, TRUE, '0',
            string_6, ignore_status);
      STRINGREP (display_string, string_length, ' IOU0 TPM Firmware Revision Number (LSB) = ', string_6);
      clp$put_display (display_control, display_string (1, string_length), clc$trim, ignore_status);

      clp$convert_integer_to_rjstring (record_data_p^.iou1_tpm_revision_msb.data.byte_part, 16, TRUE, '0',
            string_6, ignore_status);
      STRINGREP (display_string, string_length, ' IOU1 TPM Firmware Revision Number (MSB) = ', string_6);
      clp$put_display (display_control, display_string (1, string_length), clc$trim, ignore_status);

      clp$convert_integer_to_rjstring (record_data_p^.iou1_tpm_revision_lsb.data.byte_part, 16, TRUE, '0',
            string_6, ignore_status);
      STRINGREP (display_string, string_length, ' IOU1 TPM Firmware Revision Number (LSB) = ', string_6);
      clp$put_display (display_control, display_string (1, string_length), clc$trim, ignore_status);

    END /display_opened/;

    IF output_display_opened THEN
      clp$close_display (display_control, ignore_status);
    IFEND;
    osp$disestablish_cond_handler;

  PROCEND dup$display_alternate_iou_conf;
MODEND dum$display_alternate_iou_conf;
