History log of /openbmc/phosphor-mboxd/mboxd.c (Results 1 – 25 of 25)
Revision Date Author Comments
# 8fe809ee 16-May-2018 Andrew Jeffery <andrew@aj.id.au>

vpnor: Catch ReasonedError in vpnor_copy_bootloader_partition

It was observed that mboxd cored on systems that didn't have a virtual
PNOR deployed:

```
May 09 10:53:48 witherspoon systemd[1]: Start

vpnor: Catch ReasonedError in vpnor_copy_bootloader_partition

It was observed that mboxd cored on systems that didn't have a virtual
PNOR deployed:

```
May 09 10:53:48 witherspoon systemd[1]: Starting Updates symlinks for active PNOR version...
May 09 10:53:49 witherspoon obmc-flash-bios[1238]: ls: /media/pnor-ro-*: No such file or directory
May 09 10:53:49 witherspoon systemd[1]: Started Updates symlinks for active PNOR version.
May 09 10:53:49 witherspoon systemd[1]: Started Phosphor MBOX Daemon.
May 09 10:53:51 witherspoon mboxd[1242]: terminate called after throwing an instance of 'openpower::virtual_pnor::UnknownPartition'
May 09 10:53:51 witherspoon mboxd[1242]: what(): Partition HBB is not listed in the table of contents
May 09 10:53:51 witherspoon systemd[1]: Created slice system-systemd\x2dcoredump.slice.
May 09 10:53:51 witherspoon systemd[1]: Started Process Core Dump (PID 1243/UID 0).
May 09 10:53:51 witherspoon phosphor-host-state-manager[1237]: Initial Host State will be Off
May 09 10:53:51 witherspoon phosphor-host-state-manager[1237]: External request to reset reboot count
May 09 10:53:51 witherspoon systemd[1]: Started Phosphor Host State Manager.
May 09 10:53:51 witherspoon systemd[1]: Started Witherspoon UART render controller.
May 09 10:53:53 witherspoon systemd[1]: Started Wait for /xyz/openbmc_project/state/host0.
May 09 10:53:53 witherspoon systemd[1]: Starting Reset host sensors...
May 09 10:53:53 witherspoon systemd[1]: Starting Reboot If Enabled...
May 09 10:53:53 witherspoon systemd[1]: Starting Phosphor Time Manager daemon...
May 09 10:53:55 witherspoon systemd[1]: mboxd.service: Main process exited, code=dumped, status=6/ABRT
May 09 10:53:56 witherspoon systemd[1]: mboxd.service: Unit entered failed state.
May 09 10:53:56 witherspoon systemd[1]: mboxd.service: Failed with result 'core-dump'.
```

The ToC parsing and partition lookup functions can throw a variety of
exceptions, though the ones we care about are all derived from
ReasonedError. Catch ReasonedError to avoid core-dumping mboxd when it is
launched without a virtual PNOR available or symlinks in place th point it to
the virtual PNOR root directory.

Further, explicitly ignore the failure in the start-up path. This keeps
mboxd alive, which will recover on receiving a RESET if the appropriate
images and symlinks have been put in place.

Change-Id: I1f753d1944d29499e360cbdf5a27a3531f37eed6
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>

show more ...


# 53c21aaa 25-Mar-2018 Andrew Jeffery <andrew@aj.id.au>

vpnor: Isolate relevant code in vpnor directory

This is prepatory work for introducing more vpnor-specific behaviours to
window handling. We will be introducing more objects to link, in order
to hoo

vpnor: Isolate relevant code in vpnor directory

This is prepatory work for introducing more vpnor-specific behaviours to
window handling. We will be introducing more objects to link, in order
to hook some of the window command handlers.

This change takes the opportunity to revert back to the upstream names
for some of the original C files.

Change-Id: I6b67ae466a2695054035e65ba752881be9c32d1a
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>

show more ...


# 4fe996c2 26-Feb-2018 Andrew Jeffery <andrew@aj.id.au>

misc: Replace license blurb with kernel-style SPDX markers

This was roughly achieved by the following shell script:

$ git ls-files |
grep '\.[ch]p*$' |
while read F; do EXT=${F##*.}; cat spdx.$EX

misc: Replace license blurb with kernel-style SPDX markers

This was roughly achieved by the following shell script:

$ git ls-files |
grep '\.[ch]p*$' |
while read F; do EXT=${F##*.}; cat spdx.$EXT <(sed '/^\/\*$/,/^ \*\/$/d' $F) > ${F}.tmp; mv ${F}.tmp $F; done

With the following context:

$ cat spdx.c
// SPDX-License-Identifier: Apache-2.0
// Copyright (C) 2018 IBM Corp.
$ cat spdx.h
/* SPDX-License-Identifier: Apache-2.0 */
/* Copyright (C) 2018 IBM Corp. */
$ ls -l spdx.*
-rw-r--r-- 1 andrew andrew 71 Feb 27 12:02 spdx.c
lrwxrwxrwx 1 andrew andrew 6 Feb 27 12:02 spdx.cpp -> spdx.c
-rw-r--r-- 1 andrew andrew 77 Feb 27 12:02 spdx.h
lrwxrwxrwx 1 andrew andrew 6 Feb 27 12:02 spdx.hpp -> spdx.h

The `sed` invocation catches a lot of function documentation, so the
hunks were manually added to avoid removing information that we want to
keep.

Change-Id: I63e49ca2593aa0db0568c7a63bfdead388642e76
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>

show more ...


# 64ec3e45 17-Jul-2017 Deepak Kodihalli <dkodihal@in.ibm.com>

vpnor: rename APIs

To maintain consistency, rename vpnor_create_partition_table to
init_vpnor and vpnor_destroy_partition_table to destroy_vpnor. Also move
a bunch of vpnor specific string copy code

vpnor: rename APIs

To maintain consistency, rename vpnor_create_partition_table to
init_vpnor and vpnor_destroy_partition_table to destroy_vpnor. Also move
a bunch of vpnor specific string copy code from main() to init_vpnor().

Change-Id: Ia1b6598d4d308dd727916dc79be9b3b733f314f2
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>

show more ...


# 017e45c3 12-Jul-2017 Deepak Kodihalli <dkodihal@in.ibm.com>

vpnor: create hostboot bootloader partition

The hostboot bootloader code doesn't use mbox.

It has specific requirements:
- The PNOR TOC should be at the 'PNOR end - TOC size - page size'
offset.

vpnor: create hostboot bootloader partition

The hostboot bootloader code doesn't use mbox.

It has specific requirements:
- The PNOR TOC should be at the 'PNOR end - TOC size - page size'
offset. It searches for the TOC here, if not found, the search moves
down page by page.
- The PNOR should be 64M. The page size and erase block should be 4K.
The TOC should be 32K.

Copy what the bootloader expects to the LPC memory when mboxd starts up.
The same needs to be done in the case of an mbox reset (irrespective of
where the reset comes from).

Skiboot expects that the TOC should be at offset 0, but it uses mbox to
read the TOC. So this commit doesn't impact skiboot requirements.

Change-Id: I7de556dccfea85f2faa5f401177006a3a562494e
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>

show more ...


# d1d7930d 11-Jul-2017 Deepak Kodihalli <dkodihal@in.ibm.com>

vpnor: make PNOR block size configurable

The vpnor code would assume a PNOR FFS block size of 4K. Make it
possible to supply this value, since it needn't always be 4K.

Change-Id: I21463b05f1047e937

vpnor: make PNOR block size configurable

The vpnor code would assume a PNOR FFS block size of 4K. Make it
possible to supply this value, since it needn't always be 4K.

Change-Id: I21463b05f1047e93705ba82d46f746056568dcc5
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>

show more ...


# c0ef9877 06-Jun-2017 Ratan Gupta <ratagupt@in.ibm.com>

Read/write window property defines FFS partition file location.

The BMC loads the PNOR partitions in a read-only volume.

So after that there are following two cases:

Read: Tries to open the file i

Read/write window property defines FFS partition file location.

The BMC loads the PNOR partitions in a read-only volume.

So after that there are following two cases:

Read: Tries to open the file in read only mode from
the partition(READONLY/READWRITE/PRESERVED), Partition
Table tells the partition type depends on the offset.
if file is not there in the mapped partition
then tries to open the file from the read only partition.

Write: Tries to open the file in write mode from the
partition(READWRITE/PRESERVED), if file is not there
in the mapped partition then mailbox daemon will copy
the requested partition to the read-write volume to
make changes to it.

Change-Id: Ic0ef882380b56536ac55feae3ec563de95fdd4a6
Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>

show more ...


# 8441a395 05-May-2017 Ratan Gupta <ratagupt@in.ibm.com>

Load the partitions into virtual pnor

Change-Id: I709c410009fb0047d7e59ddd3a681f25e49341a0
Signed-off-by: Ratan Gupta <ratagupt@in.ibm.com>


# 6c2fa90d 01-May-2017 Deepak Kodihalli <dkodihal@in.ibm.com>

msg: handle partition table read request

Map host's request to read the flash at offset less than the partition
table length as a request to read the pnor partition table.

Resolves openbmc/openbmc#

msg: handle partition table read request

Map host's request to read the flash at offset less than the partition
table length as a request to read the pnor partition table.

Resolves openbmc/openbmc#1439.

Change-Id: I0f5b98f073d983b0d4749b0aba84b37d7f42f884
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>

show more ...


# 8d65bb44 01-May-2017 Suraj Jitindar Singh <sjitindarsingh@gmail.com>

version: Update to version 2.1.0

Update to package version V2.1.0 to reflect that a backwards compatible
API change was made. This API change was the introduction of the timeout
to the GET_MBOX_INFO

version: Update to version 2.1.0

Update to package version V2.1.0 to reflect that a backwards compatible
API change was made. This API change was the introduction of the timeout
to the GET_MBOX_INFO command.

This version update also encompasses previous bug fixes.

The versioning scheme is now aligned to semver.

Use the version from config.h for both mboxd and mboxctl instead of an
independant value for the daemon and control programs.

Change-Id: I12d7fe8e40697801594b1727054342613923a784
Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>

show more ...


# 28519598 26-Apr-2017 Suraj Jitindar Singh <sjitindarsingh@gmail.com>

mboxd: Introduce a new DEBUG log level

Currently there is no output on the console unless -v is specified on
the command line which enables error output. A second -v will provide
info output.

We pr

mboxd: Introduce a new DEBUG log level

Currently there is no output on the console unless -v is specified on
the command line which enables error output. A second -v will provide
info output.

We probably want error output irrespective of whether a -v was given
on the command line because people generally want to know why their
program stopped working.

Make error output unconditional.

A single -v will give minimal informational output which is a good
level to see what the daemon is doing without barfing all over the
console.

A second -v will enable debug output which will print highly verbose
information which will be useful for debugging. Probably don't enable
this under normal circumstances.

Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
Change-Id: I3da25f7e4e9e976c17389fcceb1d85ef98de7e0a

show more ...


# 0aff80c0 11-Apr-2017 Suraj Jitindar Singh <sjitindarsingh@gmail.com>

mboxd: Check that window size is indeed a power of 2

The window size can be specified on the command line however we restrict
this to being a power of 2 due to the internal working of the daemon.

C

mboxd: Check that window size is indeed a power of 2

The window size can be specified on the command line however we restrict
this to being a power of 2 due to the internal working of the daemon.

Currently we specify that this is the case in the help message but don't
explicitly verify this when parsing the command line.

Check that if the window size parameter is provided that the value is
indeed a power of 2 and error out if this is not the case.

Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
Change-Id: I0cb36222d53830996380702802373d862010f503

show more ...


# c29172e1 11-Apr-2017 Suraj Jitindar Singh <sjitindarsingh@gmail.com>

mboxd: Make window size and number optional command line parameters

The window size and number command line parameters are used to control
the number of windows and the size of each of the windows i

mboxd: Make window size and number optional command line parameters

The window size and number command line parameters are used to control
the number of windows and the size of each of the windows in the window
cache which the reserved memory region is divided between.

Most people won't care about tuning these or just won't know what they
refer to. Additionally in the event we change how the window cache
works or allow a non-constant window size then the meaning of these
becomes unclear.

Daemon implementations may also choose to just not implement a cache so
making these required parameters may hurt portability.

Make the window size and number command line parameters optional rather
than required so that they can be largly ignored while people who really
care about tuning them can still do so.

The default for now is to have windows of size 1MB and to map the entire
reserved memory region. That is:
number of windows = size of memory region / size of windows

This means that the size of the reserved memory region can be reduced
and the daemon will adapt to this.

Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
Change-Id: I7c7bbef6e5d31d1372ec3a755877cacc6c135cce

show more ...


# e39c9163 27-Mar-2017 Suraj Jitindar Singh <sjitindarsingh@gmail.com>

mboxd: Update mboxd to implement protocol V2 and add dbus support

Version 2 of the mbox protocol contains a few changes such as:
- All sizes are in block size
- Adds an erase command
- Adds new r

mboxd: Update mboxd to implement protocol V2 and add dbus support

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

show more ...


# 1974c6f9 22-Feb-2017 Suraj Jitindar Singh <sjitindarsingh@gmail.com>

mboxd: Fix MBOX_C_GET_FLASH_INFO to return size specified on command line

The MBOX_C_GET_FLASH_INFO command is supposed to return the size of the
file which was specified by the "flash" option on th

mboxd: Fix MBOX_C_GET_FLASH_INFO to return size specified on command line

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>

show more ...


# f0409b99 24-Jan-2017 Cyril Bur <cyril.bur@au1.ibm.com>

mboxd: Workaround buggy kernel flash driver

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 un

mboxd: Workaround buggy kernel flash driver

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>

show more ...


# ef315c17 18-Jan-2017 Cyril Bur <cyril.bur@au1.ibm.com>

mboxd: Zero ioctl() map struct

Change-Id: I5528432af3e211bbac7d86cdf7e57beb0d1a6c0b
Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>


# 622992b4 17-Jan-2017 Michael Neuling <mikey@neuling.org>

Fix MBOX_C_RESET_STATE command crash

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 MBO

Fix MBOX_C_RESET_STATE command crash

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>

show more ...


# e8f2de1f 16-Jan-2017 Cyril Bur <cyril.bur@au1.ibm.com>

mboxd: Add command-line option to specify platform flash size


# 899ebaca 14-Jan-2017 Michael Neuling <mikey@neuling.org>

Enable SIGHUP to reset point to flash are reread flash.


# 46233678 15-Jan-2017 Cyril Bur <cyril.bur@au1.ibm.com>

mboxd: Use MAP ioctl() to reset to flash


# d7a15b8f 12-Jan-2017 Andrew Jeffery <andrew@aj.id.au>

mboxd: Whitespace cleanups

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>


# 78210b9b 12-Jan-2017 Andrew Jeffery <andrew@aj.id.au>

mboxd: Fixup unused-result compilation warning

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 v

mboxd: Fixup unused-result compilation warning

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>

show more ...


# d8f6d7a4 10-Jan-2017 Cyril Bur <cyril.bur@au1.ibm.com>

mboxd: Test the single write functionality


# c85e34d1 14-Nov-2016 Cyril Bur <cyril.bur@au1.ibm.com>

mboxd: Stripped down super simple daemon

This daemon may prove useful for debugging and for adding features.

Production daemons will likely need to be better designed