104e8ffdaSSuraj Jitindar SinghCopyright 2017 IBM 2c442b710SCyril Bur 3c442b710SCyril BurLicensed under the Apache License, Version 2.0 (the "License"); 4c442b710SCyril Buryou may not use this file except in compliance with the License. 5c442b710SCyril BurYou may obtain a copy of the License at 6c442b710SCyril Bur 7c442b710SCyril Bur http://www.apache.org/licenses/LICENSE-2.0 8c442b710SCyril Bur 9c442b710SCyril BurUnless required by applicable law or agreed to in writing, software 10c442b710SCyril Burdistributed under the License is distributed on an "AS IS" BASIS, 11c442b710SCyril BurWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12c442b710SCyril BurSee the License for the specific language governing permissions and 13c442b710SCyril Burlimitations under the License. 14c442b710SCyril Bur 15*25eca77fSAndrew JefferyMBOX 16*25eca77fSAndrew Jeffery==== 1757b0bca4SAndrew Jeffery 1804e8ffdaSSuraj Jitindar SinghThis repo contains the protocol definition for the host to BMC mailbox 1904e8ffdaSSuraj Jitindar Singhcommunication specification which can be found in 2004e8ffdaSSuraj Jitindar SinghDocumentation/mbox_procotol.md. 212dff340aSSuraj Jitindar Singh 2204e8ffdaSSuraj Jitindar SinghThere is also a reference implementation of a BMC mailbox daemon, the details 2304e8ffdaSSuraj Jitindar Singhof which can be found in Documentation/mboxd.md. 242dff340aSSuraj Jitindar Singh 2504e8ffdaSSuraj Jitindar SinghFinally there is also an implementation of a mailbox daemon control program, the 2604e8ffdaSSuraj Jitindar Singhdetails of which can be found in Documentation/mboxctl.md. 27*25eca77fSAndrew Jeffery 28*25eca77fSAndrew JefferyStyle Guide 29*25eca77fSAndrew Jeffery=========== 30*25eca77fSAndrew Jeffery 31*25eca77fSAndrew JefferyPreamble 32*25eca77fSAndrew Jeffery-------- 33*25eca77fSAndrew Jeffery 34*25eca77fSAndrew JefferyThis codebase is a mix of C (due to its heritage) and C++. This is an ugly 35*25eca77fSAndrew Jefferysplit: message logging and error handling can be vastly different inside the 36*25eca77fSAndrew Jefferysame codebase. The aim is to remove the split one way or the other over time 37*25eca77fSAndrew Jefferyand have consistent approaches to solving problems. 38*25eca77fSAndrew Jeffery 39*25eca77fSAndrew Jefferyphosphor-mboxd is developed as part of the OpenBMC project, which also leads to 40*25eca77fSAndrew Jefferyintegration of frameworks such as 41*25eca77fSAndrew Jeffery[phosphor-logging](https://github.com/openbmc/phosphor-logging). Specifically 42*25eca77fSAndrew Jefferyon phosphor-logging, it's noted that without care we can achieve absurd 43*25eca77fSAndrew Jefferyduplication or irritating splits in where errors are reported, as the C code is 44*25eca77fSAndrew Jefferynot capable of making use of the interfaces provided. 45*25eca77fSAndrew Jeffery 46*25eca77fSAndrew JefferyRules 47*25eca77fSAndrew Jeffery----- 48*25eca77fSAndrew Jeffery 49*25eca77fSAndrew Jeffery1. Message logging MUST be done to stdout or stderr, and MUST NOT be done 50*25eca77fSAndrew Jeffery directly via journal APIs or wrappers of the journal APIs. 51*25eca77fSAndrew Jeffery 52*25eca77fSAndrew Jeffery Rationale: 53*25eca77fSAndrew Jeffery 54*25eca77fSAndrew Jeffery We have two scenarios where we care about output, with the important 55*25eca77fSAndrew Jeffery restriction that the method must be consistent between C and C++: 56*25eca77fSAndrew Jeffery 57*25eca77fSAndrew Jeffery 1. Running in-context on an OpenBMC-based system 58*25eca77fSAndrew Jeffery 2. Running the test suite 59*25eca77fSAndrew Jeffery 60*25eca77fSAndrew Jeffery In the first case it is desirable that the messages appear in the system 61*25eca77fSAndrew Jeffery journal. To this end, systemd will by default capture stdout and stderr of 62*25eca77fSAndrew Jeffery the launched binary and redirect it to the journal. 63*25eca77fSAndrew Jeffery 64*25eca77fSAndrew Jeffery In the second case it is *desirable* that messages be captured by the test 65*25eca77fSAndrew Jeffery runner (`make check`) for test failure analysis, and it is *undesirable* for 66*25eca77fSAndrew Jeffery messages to appear in the system journal (as these are tests, not issues 67*25eca77fSAndrew Jeffery affecting the health of the system they are being executed on). 68*25eca77fSAndrew Jeffery 69*25eca77fSAndrew Jeffery Therefore direct calls to the journal MUST be avoided for the purpose of 70*25eca77fSAndrew Jeffery message logging. 71*25eca77fSAndrew Jeffery 72*25eca77fSAndrew Jeffery Note: This section specifically targets the use of phosphor-logging's 73*25eca77fSAndrew Jeffery `log<T>()`. It does not prevent the use of `elog<T>()`. 74