summaryrefslogtreecommitdiffstats
path: root/mboxd.c
Commit message (Collapse)AuthorAgeFilesLines
* mboxd: Update mboxd to implement protocol V2 and add dbus supportSuraj Jitindar Singh2017-04-111-487/+273
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Version 2 of the mbox protocol contains a few changes such as: - All sizes are in block size - Adds an erase command - Adds new response codes - Adds new BMC events - Open windows commands now take a size directive Update the mailbox daemon to support version 2 of the protocol which includes implementing all of the V2 functionality. Also entirely refactor the mboxd.c code to make it more modular improving readability and maintainability. At the same time improve the functionality by adding: - Multiple windows in the daemon (still only one active window) to cache flash contents - Implement a dbus interface to allow interaction with the daemon - Handle sigterm and sigint and terminate cleanly The previous implementation utilised the entire reserved memory region. Update the daemon so that on the command line the number of windows and the size of each which the reserved memory region will be split into can be specified. The reserved memory region is then divided between the windows, however there can still only be one "active" window at a time. The daemon uses these windows to cache the flash contents meaning the flash doesn't have to be copied when the host requests access assuming the daemon already has a copy. A dbus interface is added so that commands can be sent to the daemon to control it's operation from the bmc. These include suspending and resuming the daemon to synchronise flash access, telling the daemon to point the lpc mapping back to flash and telling the daemon when the flash has been modified out from under it. Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com> Change-Id: I10be01a395c2bec437cf2c825fdd144580b60dbc
* mboxd: Fix MBOX_C_GET_FLASH_INFO to return size specified on command lineSuraj Jitindar Singh2017-03-091-1/+1
| | | | | | | | | | | | The MBOX_C_GET_FLASH_INFO command is supposed to return the size of the file which was specified by the "flash" option on the command line. However currently the actual size of the flash chip its self is being reported. Fix the MBOX_C_GET_FLASH_INFO command to correctly return the size of the file rather than the whole flash size. Change-Id: Ic7425dde8eca187a85e9bcec4084d5abc501c8da Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
* mboxd: Workaround buggy kernel flash driverCyril Bur2017-01-251-5/+16
| | | | | | | | | | | | | | | Currently when mboxd starts (and on every SIGHUP) it reads the entire flash into RAM (typically 32 or 64M). This large read causes the kernel to become unresponsive for an extended period of time (in the order of 10s of seconds). This period of unresponsiveness can cause misbehaviour by the BMC, in particular it often causes SSH sessions to drop. This patch is a temporary workaround until the kernel driver has been fixed, at that point this patch should be reverted! Patch originally from Michael Neuling <mikey@neuling.org>. Change-Id: Ibd848a4074fc7bdcab194d669806589f9d274c93 Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
* mboxd: Zero ioctl() map structCyril Bur2017-01-251-4/+5
| | | | | Change-Id: I5528432af3e211bbac7d86cdf7e57beb0d1a6c0b Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
* Fix MBOX_C_RESET_STATE command crashMichael Neuling2017-01-181-17/+9
| | | | | | | | | | | | | | | | Currently MBOX_C_RESET_STATE tries to access context->fds[LPC_CTRL_FD].fd but it's set to a negative value to avoid being part of the poll loop. This causes MBOX_C_RESET_STATE command crashes with: [MBOXD 1479755597.524480127] Couldn't MAP the host LPC bus to the platform flash [MBOXD 1479755597.524710309] Couldn't point the LPC BUS back to actual flash [MBOXD 1479755597.525068895] Error handling MBOX event: Bad file descriptor This patches removes the negative FDs and setups up a polls FD number for the number of FDs to poll. Signed-off-by: Michael Neuling <mikey@neuling.org>
* mboxd: Add command-line option to specify platform flash sizeCyril Bur2017-01-181-8/+40
|
* Enable SIGHUP to reset point to flash are reread flash.Michael Neuling2017-01-171-13/+63
|
* mboxd: Use MAP ioctl() to reset to flashCyril Bur2017-01-171-38/+20
|
* mboxd: Whitespace cleanupsAndrew Jeffery2017-01-171-1/+1
| | | | Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* mboxd: Fixup unused-result compilation warningAndrew Jeffery2017-01-171-2/+8
| | | | | | | | | | cc -Wall -O2 -g -I. -DPREFIX="\"MBOXD\"" mboxd.c common.o -o mboxd mboxd.c: In function ‘dispatch_mbox’: mboxd.c:170:5: warning: ignoring return value of ‘read’, declared with attribute warn_unused_result [-Wunused-result] read(-context->fds[MTD_FD].fd, context->lpc_mem, context->size); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* mboxd: Test the single write functionalityCyril Bur2017-01-171-0/+26
|
* mboxd: Stripped down super simple daemonCyril Bur2017-01-161-0/+508
This daemon may prove useful for debugging and for adding features. Production daemons will likely need to be better designed
OpenPOWER on IntegriCloud