astlpc.c (92a10a6b3b76621f075cab2f7830709a1f7742a4) astlpc.c (b214c6430f7a4b8a99b1977d21d2e3e3a79e3071)
1/* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */
2
3#include <assert.h>
4#include <endian.h>
5#include <stdbool.h>
6#include <stdlib.h>
7#include <string.h>
8#include <unistd.h>
9
10#define pr_fmt(x) "astlpc: " x
11
12#include "libmctp.h"
13#include "libmctp-alloc.h"
14#include "libmctp-log.h"
15#include "libmctp-astlpc.h"
16
1/* SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later */
2
3#include <assert.h>
4#include <endian.h>
5#include <stdbool.h>
6#include <stdlib.h>
7#include <string.h>
8#include <unistd.h>
9
10#define pr_fmt(x) "astlpc: " x
11
12#include "libmctp.h"
13#include "libmctp-alloc.h"
14#include "libmctp-log.h"
15#include "libmctp-astlpc.h"
16
17#ifndef MCTP_WITHOUT_FILEIO
17#ifdef MCTP_HAVE_FILEIO
18
19#include <fcntl.h>
20#include <sys/ioctl.h>
21#include <sys/mman.h>
22#include <linux/aspeed-lpc-ctrl.h>
23
24/* kernel interface */
25static const char *kcs_path = "/dev/mctp0";

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

380 if (rc) {
381 free(astlpc);
382 return NULL;
383 }
384
385 return astlpc;
386}
387
18
19#include <fcntl.h>
20#include <sys/ioctl.h>
21#include <sys/mman.h>
22#include <linux/aspeed-lpc-ctrl.h>
23
24/* kernel interface */
25static const char *kcs_path = "/dev/mctp0";

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

380 if (rc) {
381 free(astlpc);
382 return NULL;
383 }
384
385 return astlpc;
386}
387
388#ifndef MCTP_WITHOUT_FILEIO
388#ifdef MCTP_HAVE_FILEIO
389static int mctp_astlpc_init_fileio_lpc(struct mctp_binding_astlpc *astlpc)
390{
391 struct aspeed_lpc_ctrl_mapping map = {
392 .window_type = ASPEED_LPC_CTRL_WINDOW_MEMORY,
393 .window_id = 0, /* There's only one */
394 .flags = 0,
395 .addr = 0,
396 .offset = 0,

--- 118 unchanged lines hidden ---
389static int mctp_astlpc_init_fileio_lpc(struct mctp_binding_astlpc *astlpc)
390{
391 struct aspeed_lpc_ctrl_mapping map = {
392 .window_type = ASPEED_LPC_CTRL_WINDOW_MEMORY,
393 .window_id = 0, /* There's only one */
394 .flags = 0,
395 .addr = 0,
396 .offset = 0,

--- 118 unchanged lines hidden ---