mboxd.c (1e531afd1698c5613004e2bf4e73bda4364fa6d6) mboxd.c (5335f0930db13a19e1c52b4f746e43db8f79fd76)
1// SPDX-License-Identifier: Apache-2.0
2// Copyright (C) 2018 IBM Corp.
3
4#define _GNU_SOURCE
5#include <assert.h>
6#include <errno.h>
7#include <fcntl.h>
8#include <getopt.h>

--- 125 unchanged lines hidden (view full) ---

134 switch (info.ssi_signo) {
135 case SIGINT:
136 case SIGTERM:
137 MSG_INFO("Caught Signal - Exiting...\n");
138 context->terminate = true;
139 break;
140 case SIGHUP:
141 /* Host didn't request reset -> Notify it */
1// SPDX-License-Identifier: Apache-2.0
2// Copyright (C) 2018 IBM Corp.
3
4#define _GNU_SOURCE
5#include <assert.h>
6#include <errno.h>
7#include <fcntl.h>
8#include <getopt.h>

--- 125 unchanged lines hidden (view full) ---

134 switch (info.ssi_signo) {
135 case SIGINT:
136 case SIGTERM:
137 MSG_INFO("Caught Signal - Exiting...\n");
138 context->terminate = true;
139 break;
140 case SIGHUP:
141 /* Host didn't request reset -> Notify it */
142 windows_reset_all(context, SET_BMC_EVENT);
142 windows_reset_all(context, EVENT_TRIGGER);
143 rc = lpc_reset(context);
144 if (rc < 0) {
145 MSG_ERR("WARNING: Failed to point the "
146 "LPC bus back to flash on "
147 "SIGHUP\nIf the host requires "
148 "this expect problems...\n");
149 }
150 break;

--- 21 unchanged lines hidden (view full) ---

172 if (rc < 0) {
173 MSG_ERR("Error handling MBOX event\n");
174 }
175 }
176 }
177
178 /* Best to reset windows and the lpc mapping for safety */
179 /* Host didn't request reset -> Notify it */
143 rc = lpc_reset(context);
144 if (rc < 0) {
145 MSG_ERR("WARNING: Failed to point the "
146 "LPC bus back to flash on "
147 "SIGHUP\nIf the host requires "
148 "this expect problems...\n");
149 }
150 break;

--- 21 unchanged lines hidden (view full) ---

172 if (rc < 0) {
173 MSG_ERR("Error handling MBOX event\n");
174 }
175 }
176 }
177
178 /* Best to reset windows and the lpc mapping for safety */
179 /* Host didn't request reset -> Notify it */
180 windows_reset_all(context, SET_BMC_EVENT);
180 windows_reset_all(context, EVENT_TRIGGER);
181 rc = lpc_reset(context);
182 /* Not much we can do if this fails */
183 if (rc < 0) {
184 MSG_ERR("WARNING: Failed to point the LPC bus back to flash\n"
185 "If the host requires this expect problems...\n");
186 }
187
188 return rc;

--- 200 unchanged lines hidden (view full) ---

389#endif
390
391 /* Set the LPC bus mapping */
392 rc = lpc_reset(context);
393 if (rc) {
394 MSG_ERR("LPC configuration failed, RESET required: %d\n", rc);
395 }
396
181 rc = lpc_reset(context);
182 /* Not much we can do if this fails */
183 if (rc < 0) {
184 MSG_ERR("WARNING: Failed to point the LPC bus back to flash\n"
185 "If the host requires this expect problems...\n");
186 }
187
188 return rc;

--- 200 unchanged lines hidden (view full) ---

389#endif
390
391 /* Set the LPC bus mapping */
392 rc = lpc_reset(context);
393 if (rc) {
394 MSG_ERR("LPC configuration failed, RESET required: %d\n", rc);
395 }
396
397 rc = set_bmc_events(context, BMC_EVENT_DAEMON_READY, SET_BMC_EVENT);
397 rc = protocol_events_set(context, BMC_EVENT_DAEMON_READY, EVENT_TRIGGER);
398 if (rc) {
399 goto finish;
400 }
401
402 MSG_INFO("Entering Polling Loop\n");
403 rc = poll_loop(context);
404
405 MSG_INFO("Exiting Poll Loop: %d\n", rc);
406
407finish:
408 MSG_INFO("Daemon Exiting...\n");
398 if (rc) {
399 goto finish;
400 }
401
402 MSG_INFO("Entering Polling Loop\n");
403 rc = poll_loop(context);
404
405 MSG_INFO("Exiting Poll Loop: %d\n", rc);
406
407finish:
408 MSG_INFO("Daemon Exiting...\n");
409 clr_bmc_events(context, BMC_EVENT_DAEMON_READY, SET_BMC_EVENT);
409 protocol_events_clear(context, BMC_EVENT_DAEMON_READY, EVENT_TRIGGER);
410
411#ifdef VIRTUAL_PNOR_ENABLED
412 destroy_vpnor(context);
413#endif
414 dbus_free(context);
415 flash_dev_free(context);
416 lpc_dev_free(context);
417 free_mbox_dev(context);
418 windows_free(context);
419 protocol_free(context);
420 free(context);
421
422 return rc;
423}
410
411#ifdef VIRTUAL_PNOR_ENABLED
412 destroy_vpnor(context);
413#endif
414 dbus_free(context);
415 flash_dev_free(context);
416 lpc_dev_free(context);
417 free_mbox_dev(context);
418 windows_free(context);
419 protocol_free(context);
420 free(context);
421
422 return rc;
423}