summaryrefslogtreecommitdiffstats
path: root/src/include/runtime/README.md
blob: 8a4e7298a4eb4da57311d9f3818f6da6eb24ac13 (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
# interface.h::hostInterfaces::hbrt_fw_msg
How to create an HBRT to FW request message interface
    0) If passing an HBRT to FSP via MBOX or receiving a firmware notify message,
       then use instruction 'generic_hbrt_fsp_message.H::GenericFspMboxMessage_t'
       below.
    1) The biggest part will be defining the interface.  Inspect the current
       interfaces (req_hcode_update, error_log, etc) for inspiration.
    2) Once an interface has been designed, add it to the anonymous
       hbrt_fw_msg::union, among the other interfaces.
    3) Append a new hbrt_fw_msg::io_type, that will be used to
       identify the interface.
    4) How to use the new interface to pass a message
       a) Make sure 'g_hostInterfaces' and 'g_hostInterfaces->firmware_request'
          are not NULL.
       b) Create the firmware_request request struct (hostInterfaces::hbrt_fw_msg)
          to send data.
       c) Populate the firmware_request request struct with data.
       b) Create the firmware_request response struct (hostInterfaces::hbrt_fw_msg)
          to retrieve data. 'Zero' it out.  Currently, this appears to be not
          used, but is needed for the firmware request call.
       d) Make the firmware_request call via method 'firmware_request_helper'
       Examples:
            ~/src/usr/sbeio/runtime/sbeio_vital_attn.C::vital_attn_inform_opal
            ~/src/usr/isteps/nvdimm/runtime/nvdimm_rt.C::notifyNvdimmProtectionChange
            ~/src/usr/isteps/pm/runtime/rt_pm.C::hcode_update
            ~/src/usr/errl/runtime/rt_errlmanager.C::sendMboxMsg
    5) Update /hostboot/src/usr/util/runtime/rt_fwreq_helper.C::firmware_request_helper,
       to capture data from the request if an error occurs.  Capture data in the
       TWO switch statements 'switch (l_req_fw_msg->io_type)'.  Look at others
       for examples.

# generic_hbrt_fsp_message.H::GenericFspMboxMessage_t
# How to create an HBRT Generic FSP Firmware request
    Firmware request:
        1) The biggest part will be defining the interface.  Inspect the current
           interfaces (AttributeSetter_t, SingleScomOpHbrtFspData_t,
           TargetDeconfigHbrtFspData_t, etc) for inspiration.
        2) Once an interface has been designed, add the structure to this file
           with the other interfaces.
        3) Create an MBOX message queue enum for the interface and add to:
           /hostboot/src/include/usr/mbox/mbox_queues.H::queue_id_t
           see current message queues for example
        4) Add a new message type for the interface to:
           enum generic_hbrt_fsp_message.H::GENERIC_FSP_MBOX_MESSAGE_MSG_TYPE.
        5) How to use the new interface to pass a message
           a) Make sure g_hostInterfaces and g_hostInterfaces->firmware_request
              are not NULL.
           b) Determine size of data.  It could be as simple as the size of the
              structure itself.
           c) Use createGenericFspMsg to create the messages for you.
           c) Populate the firmware_request request struct with data.
           d) Make the firmware_request call via method
              firmware_request_helper
           Examples:
                ~/src/usr/hwas/hwasPlatDeconfigGard.C::platPostDeconfigureTarget
                ~/src/usr/fsiscom/runtime/rt_fsiscom.C::sendScomOpToFsp
                ~/src/usr/fsiscom/runtime/rt_fsiscom.C::sendMultiScomReadToFsp
                ~/src/usr/hwas/hwasPlatDeconfigGard.C::DeconfigGard::platPostDeconfigureTarget

# How to create an HBRT Firmware Notify message
    Firmware notify:
        1) The biggest part will be defining the interface.  Inspect the current
           interfaces (sbeRetryReqData_t, HbrtAttrSyncData_t, etc) for inspiration.
        2) Once an interface has been designed, add the structure to this file
           with the other interfaces.
        3) Since this is a message sent from the HWSV team, you will need for
           them to provide the message queue and message type, once you have
           this info
           a) Add the message queue to:
              /hostboot/src/include/usr/mbox/mbox_queues.H::queue_id_t
           b) Add the message type to:
              enum generic_hbrt_fsp_message.H::GENERIC_FSP_MBOX_MESSAGE_MSG_TYPE
        4) Create a method to process the notify call in file:
           ~/src/usr/util/runtime/rt_fwnotify.C.  This method is where the
           interface in step 1 will be used.
           Examples:
                ~/src/usr/util/runtime/rt_fwnotify.C::sbeAttemptRecovery
                ~/src/usr/util/runtime/rt_fwnotify.C::occActiveNotification
                ~/src/usr/util/runtime/rt_fwnotify.C::attrSyncRequest
        5) Update the case statement 'switch (l_hbrt_fw_msg->io_type)' found in
           method ~/src/usr/util/runtime/rt_fwnotify.C::firmware_notify to
           call method created in step 4.

# Integration testing the Firmware Request/Notify Message
    This is not a true integration test but a verification that the data is
    being sent, via the firmware request, in the format that the caller
    intended.  Ensuring that the data is in the correct format and is correct
    in of itself.

    Add a test case to the file:
         ~/src/usr/isteps/pm/runtime/test/firmwareRequestTest.H
    This is where the message will being sent via the
    hostInterfaces::firmware_request(...) method.  Here, is where you will
    create a unique test case for your interface.  Follow the examples in
    this file.  There are plenty of examples.

    Add stub test code to the file/method:
         ~/src/usr/testcore/rtloader/loader.H::rt_firmware_request(...)
    This is where the message will be received and can be tested for
    correctness. Follow the examples in this file.  There are plenty of
    examples.





OpenPOWER on IntegriCloud