Author SHA1 Message Date
Richard Acayan 92237debf1 fastrpc: hexagonrpcd: listener: switch to interp3
For a proper transition to version 3 of the method definitions, switch
the reverse tunnel to version 3.
2024-12-30 18:11:00 -05:00
Richard Acayan 64bff607fe fastrpc: hexagonrpcd: use interface-defined inline functions
The inline functions are convenient, but shouldn't be defined in every
source file that uses them. Use the new functions defined in the
interface definitions.
2024-12-30 18:11:00 -05:00
Richard Acayan b15e721660 fastrpc: chrecd: interfaces: convert to interp3
Add the remote method definitions for the CHRE interface according to
the 3rd format version.
2024-12-30 18:11:00 -05:00
Richard Acayan eee667b6cc fastrpc: hexagonrpcd: interfaces: convert to interp3
Add the remote method definitions for interfaces used by HexagonRPCD
according to the 3rd format version.
2024-12-30 18:11:00 -05:00
Richard Acayan 13c14c1611 fastrpc: libhexagonrpc: add error API
When the kernel side of FastRPC fails, the return value is -1 and errno
is set. When the remote side of FastRPC fails, the return value is an
AEE error code. It is not specialized for the reverse tunnel. Add an
error API that can convert the return value to a string-based error.
2024-12-30 18:11:00 -05:00
Richard Acayan 916db473b4 fastrpc: libhexagonrpc: interfaces: remotectl: add interp3 definitions
Add the remote method definitions according to the 3rd format version.
2024-12-30 18:10:44 -05:00
Richard Acayan 09add3eecc fastrpc: libhexagonrpc: add interpretation three of method call format
The method call format as interpreted last time had some limitations.
First, input words could not appear after the input buffers, making it
impossible to represent the apps_std_mkdir method accurately. Second, it
was assumed that the lengths in the primary input buffer represent the
number of bytes. In reality, the lengths represent the number of
elements, which just happened to be octets in the majority of remote
methods found, and the adsp_perf_get_usecs remote method could not be
represented. Update the format for the third time to remove these
limitations.

This format allows the mixing of words and lengths of other buffers in
the primary buffer by using 0 to denote words in an array of arguments.
It also allows a greater size of elements, denoted by any non-zero
value.
2024-10-16 19:43:41 -04:00
28 changed files with 693 additions and 964 deletions

No files matched your search

-29
View File
@@ -1,29 +0,0 @@
name: Buildtest
on:
pull_request:
push:
jobs:
build-linux:
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-24.04
# 22.04 has old meson
# - runner: ubuntu-22.04
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Dependencies
run: |
sudo apt update
sudo apt install -y meson ninja-build libjson-c-dev
- name: build
run: |
meson setup build
ninja -C build
+8 -15
View File
@@ -125,26 +125,19 @@ Interfaces are initialized in the `start_reverse_tunnel` function, in hexagonrpc
## HexagonFS
The reverse tunnel's `apps_std` interface serves files to the remote processor.
These files are searched for in a directory tree, starting at the location
defined by the `-R` option, or in `/usr/share/qcom` by default:
These files are searched for in:
HexagonRPCD file/dir Android file/dir
acdb /vendor/etc/acdbdata
dsp /vendor/dsp
sensors/config /vendor/etc/sensors/config
sensors/registry /mnt/vendor/persist/sensors/registry/registry
sensors/sns_reg.conf /vendor/etc/sensors/sns_reg_config
socinfo /sys/devices/soc0
Physical file/dir Android file/dir
/usr/share/qcom/acdb /vendor/etc/acdbdata
/usr/share/qcom/dsp /vendor/dsp
/usr/share/qcom/sensors/config /vendor/etc/sensors/config
/usr/share/qcom/sensors/registry /mnt/vendor/persist/sensors/registry/registry
/usr/share/qcom/sensors/sns_reg.conf /vendor/etc/sensors/sns_reg_config
/usr/share/qcom/socinfo /sys/devices/soc0
These files and directories should be populated with files from your device's
Android firmware.
If you can pass the `-R` option, the convention is to pass `-R
/usr/share/qcom/SOC/VENDOR/DEVICE`, where SOC is the SoC name in lowercase,
VENDOR is the capitalized name of the device vendor, and DEVICE is the device
name (e.g. `-R /usr/share/qcom/sdm845/SHIFT/axolotl` or `-R
/usr/share/qcom/sdm845/Thundercomm/db845c`).
# Future plans
Reverse tunnels are separated by the process that opens the file descriptor and
+14
View File
@@ -27,4 +27,18 @@
HEXAGONRPC_DEFINE_REMOTE_METHOD(0, chre_slpi_start_thread, 0, 0, 0, 0)
HEXAGONRPC_DEFINE_REMOTE_METHOD(1, chre_slpi_wait_on_thread_exit, 0, 0, 0, 0)
HEXAGONRPC_DEFINE_REMOTE_METHOD3_EMPTY(0, chre_slpi3_start_thread)
static inline int chre_slpi3_start_thread(const struct fastrpc_context *ctx)
{
return hexagonrpc(&chre_slpi3_start_thread_def, ctx);
}
HEXAGONRPC_DEFINE_REMOTE_METHOD3_EMPTY(1, chre_slpi3_wait_on_thread_exit)
static inline int chre_slpi3_wait_on_thread_exit(const struct fastrpc_context *ctx)
{
return hexagonrpc(&chre_slpi3_wait_on_thread_exit_def, ctx);
}
#endif /* INTERFACE_CHRE_SLPI_DEF */
-143
View File
@@ -1,143 +0,0 @@
/*
* FastRPC memory mapping interface implementation
*
* Copyright (C) 2024 The Sensor Shell Contributors
*
* This file is part of sensh.
*
* Sensh is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <misc/fastrpc.h>
#include <sys/ioctl.h>
#include "aee_error.h"
#include "apps_mem.h"
#include "interfaces/apps_mem.def"
#include "listener.h"
// See fastrpc.git/src/apps_mem_imp.c
#define ADSP_MMAP_HEAP_ADDR 4
#define ADSP_MMAP_REMOTE_HEAP_ADDR 8
#define ADSP_MMAP_ADD_PAGES 0x1000
struct apps_mem_ctx {
int fd;
};
static uint32_t apps_mem_request_map64(void *data,
const struct fastrpc_io_buffer *inbufs,
struct fastrpc_io_buffer *outbufs)
{
struct apps_mem_ctx *ctx = data;
const struct {
uint32_t heap_id;
uint32_t lflags;
uint32_t rflags;
uint32_t padding;
uint64_t vin;
uint64_t len;
} *first_in = inbufs[0].p;
struct {
uint64_t vapps;
uint64_t vadsp;
} *first_out = outbufs[0].p;
struct fastrpc_req_mmap mmap;
int ret;
if (!(first_in->rflags & ADSP_MMAP_ADD_PAGES)) {
fprintf(stderr, "Unsupported mmap operation: DMA buffer request\n");
return AEE_EUNSUPPORTED;
}
mmap.fd = -1;
mmap.flags = first_in->rflags;
mmap.vaddrin = 0;
mmap.size = first_in->len;
ret = ioctl(ctx->fd, FASTRPC_IOCTL_MMAP, &mmap);
if (ret == -1) {
perror("Memory map failed");
return AEE_EFAILED;
} else if (ret) {
fprintf(stderr, "Memory map failed: %s\n", aee_strerror[ret]);
return ret;
}
#if HEXAGONRPC_VERBOSE
printf("mmap(%d, %x, %x, %lu, %lu) -> %" PRIx64 "\n",
first_in->heap_id,
first_in->lflags,
first_in->rflags,
first_in->vin,
first_in->len,
mmap.vaddrout);
#endif
first_out->vapps = 0;
first_out->vadsp = mmap.vaddrout & 0xFFFFFFFF;
return 0;
}
struct fastrpc_interface *fastrpc_apps_mem_init(int fd)
{
struct fastrpc_interface *iface;
struct apps_mem_ctx *ctx;
iface = malloc(sizeof(*iface));
if (iface == NULL)
return NULL;
ctx = calloc(1, sizeof(*ctx));
if (ctx == NULL)
goto err_free_iface;
memcpy(iface, &apps_mem_interface, sizeof(*iface));
ctx->fd = fd;
iface->data = ctx;
return iface;
err_free_iface:
free(iface);
return NULL;
}
void fastrpc_apps_mem_deinit(struct fastrpc_interface *iface)
{
free(iface->data);
free(iface);
}
static const struct fastrpc_function_impl apps_mem_procs[] = {
{ .def = NULL, .impl = NULL, },
{ .def = NULL, .impl = NULL, },
{ .def = &apps_mem_request_map64_def, .impl = apps_mem_request_map64, },
{ .def = NULL, .impl = NULL, },
{ .def = NULL, .impl = NULL, },
{ .def = NULL, .impl = NULL, },
};
const struct fastrpc_interface apps_mem_interface = {
.name = "apps_mem",
.n_procs = 6,
.procs = apps_mem_procs,
};
-30
View File
@@ -1,30 +0,0 @@
/*
* FastRPC operating system interface - context initialization
*
* Copyright (C) 2024 The Sensor Shell Contributors
*
* This file is part of HexagonRPC.
*
* HexagonRPC is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef APPS_MEM_H
#define APPS_MEM_H
#include "listener.h"
struct fastrpc_interface *fastrpc_apps_mem_init(int fd);
void fastrpc_apps_mem_deinit(struct fastrpc_interface *iface);
#endif
+11 -11
View File
@@ -20,13 +20,13 @@
*/
#include <errno.h>
#include <libhexagonrpc/error.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <sys/stat.h>
#include <unistd.h>
#include "aee_error.h"
#include "interfaces/apps_std.def"
#include "hexagonfs.h"
#include "iobuffer.h"
@@ -312,7 +312,7 @@ static uint32_t apps_std_stat(void *data,
if (((const char *) inbufs[1].p)[inbufs[1].s - 1] != 0)
return AEE_EBADPARM;
fd = hexagonfs_openat(ctx->fds, ctx->rootfd, ctx->adsp_library_dirfd, pathname);
fd = hexagonfs_openat(ctx->fds, ctx->rootfd, ctx->rootfd, pathname);
if (fd < 0) {
fprintf(stderr, "Could not open %s: %s\n",
pathname, strerror(-fd));
@@ -408,15 +408,15 @@ static const struct fastrpc_function_impl apps_std_procs[] = {
{ .def = NULL, .impl = NULL, },
{ .def = NULL, .impl = NULL, },
{
.def = &apps_std_fflush_def,
.def = &apps_std3_fflush_def,
.impl = apps_std_fflush,
},
{
.def = &apps_std_fclose_def,
.def = &apps_std3_fclose_def,
.impl = apps_std_fclose,
},
{
.def = &apps_std_fread_def,
.def = &apps_std3_fread_def,
.impl = apps_std_fread,
},
{ .def = NULL, .impl = NULL, },
@@ -424,7 +424,7 @@ static const struct fastrpc_function_impl apps_std_procs[] = {
{ .def = NULL, .impl = NULL, },
{ .def = NULL, .impl = NULL, },
{
.def = &apps_std_fseek_def,
.def = &apps_std3_fseek_def,
.impl = apps_std_fseek,
},
{ .def = NULL, .impl = NULL, },
@@ -437,7 +437,7 @@ static const struct fastrpc_function_impl apps_std_procs[] = {
{ .def = NULL, .impl = NULL, },
{ .def = NULL, .impl = NULL, },
{
.def = &apps_std_fopen_with_env_def,
.def = &apps_std3_fopen_with_env_def,
.impl = apps_std_fopen_with_env,
},
{ .def = NULL, .impl = NULL, },
@@ -447,21 +447,21 @@ static const struct fastrpc_function_impl apps_std_procs[] = {
{ .def = NULL, .impl = NULL, },
{ .def = NULL, .impl = NULL, },
{
.def = &apps_std_opendir_def,
.def = &apps_std3_opendir_def,
.impl = apps_std_opendir,
},
{
.def = &apps_std_closedir_def,
.def = &apps_std3_closedir_def,
.impl = apps_std_closedir,
},
{
.def = &apps_std_readdir_def,
.def = &apps_std3_readdir_def,
.impl = apps_std_readdir,
},
{ .def = NULL, .impl = NULL, },
{ .def = NULL, .impl = NULL, },
{
.def = &apps_std_stat_def,
.def = &apps_std3_stat_def,
.impl = apps_std_stat,
},
};
-66
View File
@@ -1,66 +0,0 @@
'\" t
.TH HEXAGONRPCD 1 "2024-09-28" "hexagonrpcd" "Server for FastRPC remote procedure calls from Qualcomm DSPs"
.SH NAME
hexagonrpcd - Server for FastRPC remote procedure calls from Qualcomm DSPs
.SH SYNOPSIS
\fBhexagonrpcd\fP [\fIoptions\&.\&.\&.\fP] -f \fIDEVICE
.SH DESCRIPTION
Server for FastRPC remote procedure calls from Qualcomm DSPs\&.
.PP
.SH OPTIONS
.TP
\fB\-c \fISHELL\fP
Create a new pd running the specified ELF
\fB\-d \fIDSP\fP
DSP name (default: )
.TP
\fB\-f \fIDEVICE\fP
FastRPC device node to attach to
.TP
\fB\-p \fIPROGRAM\fP
Run client program with shared file descriptor
.TP
\fB\-R \fIDIR\fP
Root directory of served files (default: /usr/share/qcom/)
.TP
\fB\-s\fP
Attach to sensorspd
.PP
.SH NOTES
Hexagonrpcd serves files to the remote processor via a reverse tunnel interface
to the remote processor. These files are by default searched for in:
These files are searched for in a directory tree, starting at the location
defined by the -R option, or in /usr/share/qcom by default:
.TS
l l
---
l l.
HexagonRPCD file/dir Android file/dir
acdb /vendor/etc/acdbdata
dsp /vendor/dsp
sensors/config /vendor/etc/sensors/config
sensors/registry /mnt/vendor/persist/sensors/registry/registry
sensors/sns_reg.conf /vendor/etc/sensors/sns_reg_config
socinfo /sys/devices/soc0
.TE
These files and directories should be populated with files from your device's
Android firmware.
If you can pass the -R option, the convention is to pass -R
/usr/share/qcom/SOC/VENDOR/DEVICE, where SOC is the SoC name in lowercase,
VENDOR is the capitalized name of the device vendor, and DEVICE is the device
name (e.g. -R /usr/share/qcom/sdm845/SHIFT/axolotl or -R
/usr/share/qcom/sdm845/Thundercomm/db845c).
.SH AUTHORS
hexagonrpcd was written by The HexagonRPC Contributors <https://github.com/linux-msm/hexagonrpc>
.SH COPYRIGHT
Copyright (C) 2024 The HexagonRPC Contributors <https://github.com/linux-msm/hexagonrpc>
Copyright (C) 2023 The Sensor Shell Contributors <https://github.com/linux-msm/hexagonrpc>
.PP
Released under GPL-3+ license\&.
-1
View File
@@ -22,6 +22,5 @@
#define HEXAGONRPC_BUILD_METHOD_DEFINITIONS 1
#include "interfaces/adsp_default_listener.def"
#include "interfaces/apps_mem.def"
#include "interfaces/apps_std.def"
#include "interfaces/adsp_listener.def"
@@ -26,4 +26,11 @@
HEXAGONRPC_DEFINE_REMOTE_METHOD(0, adsp_default_listener_register, 0, 0, 0, 0)
HEXAGONRPC_DEFINE_REMOTE_METHOD3_EMPTY(0, adsp_default_listener3_register)
static inline int adsp_default_listener3_register(const struct fastrpc_context *ctx)
{
return hexagonrpc(&adsp_default_listener3_register_def, ctx);
}
#endif /* INTERFACE_ADSP_DEFAULT_LISTENER_DEF */
+25
View File
@@ -29,4 +29,29 @@
HEXAGONRPC_DEFINE_REMOTE_METHOD(3, adsp_listener_init2, 0, 0, 0, 0)
HEXAGONRPC_DEFINE_REMOTE_METHOD(4, adsp_listener_next2, 2, 1, 4, 1)
HEXAGONRPC_DEFINE_REMOTE_METHOD3_EMPTY(3, adsp_listener3_init2)
static inline int adsp_listener3_init2(int fd)
{
return hexagonrpc2(&adsp_listener3_init2_def, fd, ADSP_LISTENER_HANDLE);
}
HEXAGONRPC_DEFINE_REMOTE_METHOD3(4, adsp_listener3_next2, true,
0, 0, 1, HEXAGONRPC_DELIMITER, 0, 0, 0, 0, 1)
static inline int adsp_listener3_next2(int fd,
uint32_t ret_rctx,
uint32_t ret_res,
uint32_t ret_outbufs_len, const void *ret_outbufs,
uint32_t *rctx,
uint32_t *handle,
uint32_t *sc,
uint32_t *inbufs_len,
uint32_t inbufs_size, void *inbufs)
{
return hexagonrpc2(&adsp_listener3_next2_def, fd, ADSP_LISTENER_HANDLE,
ret_rctx, ret_res, ret_outbufs_len, ret_outbufs,
rctx, handle, sc, inbufs_len, inbufs_size, inbufs);
}
#endif /* INTERFACE_ADSP_LISTENER_DEF */
-29
View File
@@ -1,29 +0,0 @@
/*
* FastRPC operating system interface
*
* Copyright (C) 2024 The Sensor Shell Contributors
*
* This file is part of sensh.
*
* Sensh is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef INTERFACE_APPS_MEM_DEF
#define INTERFACE_APPS_MEM_DEF
#include <libhexagonrpc/interface.h>
HEXAGONRPC_DEFINE_REMOTE_METHOD(2, apps_mem_request_map64, 8, 0, 4, 0)
#endif /* INTERFACE_APPS_MEM_DEF */
+158
View File
@@ -35,4 +35,162 @@ HEXAGONRPC_DEFINE_REMOTE_METHOD(27, apps_std_closedir, 2, 0, 0, 0)
HEXAGONRPC_DEFINE_REMOTE_METHOD(28, apps_std_readdir, 2, 0, 66, 0)
HEXAGONRPC_DEFINE_REMOTE_METHOD(31, apps_std_stat, 1, 1, 24, 0)
HEXAGONRPC_DEFINE_REMOTE_METHOD3(1, apps_std3_freopen, true,
0, HEXAGONRPC_DELIMITER, 0, 1)
HEXAGONRPC_DEFINE_REMOTE_METHOD3(2, apps_std3_fflush, false,
0, HEXAGONRPC_DELIMITER)
static inline int apps_std3_fflush(struct fastrpc_context *ctx, uint32_t stream)
{
return hexagonrpc(&apps_std3_fflush_def, ctx, stream);
}
HEXAGONRPC_DEFINE_REMOTE_METHOD3(3, apps_std3_fclose, false,
0, HEXAGONRPC_DELIMITER)
static inline int apps_std3_fclose(struct fastrpc_context *ctx, uint32_t stream)
{
return hexagonrpc(&apps_std3_fclose_def, ctx, stream);
}
HEXAGONRPC_DEFINE_REMOTE_METHOD3(4, apps_std3_fread, true,
0, HEXAGONRPC_DELIMITER, 0, 0, 1)
static inline int apps_std3_fread(struct fastrpc_context *ctx,
uint32_t stream,
uint32_t *written, uint32_t *is_eof,
uint32_t size, void *buf)
{
return hexagonrpc(&apps_std3_fread_def, ctx,
stream, written, is_eof, size, buf);
}
HEXAGONRPC_DEFINE_REMOTE_METHOD3(9, apps_std3_fseek, false,
0, 0, 0, HEXAGONRPC_DELIMITER)
static inline int apps_std3_fseek(struct fastrpc_context *ctx,
uint32_t stream, uint32_t pos, uint32_t whence)
{
return hexagonrpc(&apps_std3_fseek_def, ctx, stream, pos, whence);
}
HEXAGONRPC_DEFINE_REMOTE_METHOD3(19, apps_std3_fopen_with_env, true,
1, 1, 1, 1, HEXAGONRPC_DELIMITER, 0)
static inline int apps_std3_fopen_with_env(struct fastrpc_context *ctx,
uint32_t envvar_len, const char *envvar,
uint32_t delim_len, const char *delim,
uint32_t name_len, const char *name,
uint32_t mode_len, const char *mode)
{
return hexagonrpc(&apps_std3_fopen_with_env_def, ctx,
envvar_len, (const void *) envvar,
delim_len, (const void *) delim,
name_len, (const void *) name,
mode_len, (const void *) mode);
}
HEXAGONRPC_DEFINE_REMOTE_METHOD3(26, apps_std3_opendir, true,
1, HEXAGONRPC_DELIMITER, 0, 0)
static inline int apps_std3_opendir(struct fastrpc_context *ctx,
uint32_t path_len, const char *path,
uint32_t *handle_lo, uint32_t *handle_hi)
{
return hexagonrpc(&apps_std3_opendir_def, ctx,
path_len, (const void *) path,
handle_lo, handle_hi);
}
HEXAGONRPC_DEFINE_REMOTE_METHOD3(27, apps_std3_closedir, false,
0, 0, HEXAGONRPC_DELIMITER)
static inline int apps_std3_closedir(struct fastrpc_context *ctx,
uint32_t handle_lo, uint32_t handle_hi)
{
return hexagonrpc(&apps_std3_closedir_def, ctx, handle_lo, handle_hi);
}
HEXAGONRPC_DEFINE_REMOTE_METHOD3(28, apps_std3_readdir, true,
0, 0, HEXAGONRPC_DELIMITER,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0)
static inline int apps_std3_readdir(struct fastrpc_context *ctx,
uint32_t handle_lo, uint32_t handle_hi,
uint32_t *inode, char *path, uint32_t *eof)
{
uint32_t *buf = (uint32_t *) path;
return hexagonrpc(&apps_std3_readdir_def, ctx,
handle_lo, handle_hi, inode,
&buf[0], &buf[1], &buf[2], &buf[3],
&buf[4], &buf[5], &buf[6], &buf[7],
&buf[8], &buf[9], &buf[10], &buf[11],
&buf[12], &buf[13], &buf[14], &buf[15],
&buf[16], &buf[17], &buf[18], &buf[19],
&buf[20], &buf[21], &buf[22], &buf[23],
&buf[24], &buf[25], &buf[26], &buf[27],
&buf[28], &buf[29], &buf[30], &buf[31],
&buf[32], &buf[33], &buf[34], &buf[35],
&buf[36], &buf[37], &buf[38], &buf[39],
&buf[40], &buf[41], &buf[42], &buf[43],
&buf[44], &buf[45], &buf[46], &buf[47],
&buf[48], &buf[49], &buf[50], &buf[51],
&buf[52], &buf[53], &buf[54], &buf[55],
&buf[56], &buf[57], &buf[58], &buf[57],
&buf[60], &buf[61], &buf[62], &buf[63], eof);
}
HEXAGONRPC_DEFINE_REMOTE_METHOD3(29, apps_std3_mkdir, false,
1, 0, HEXAGONRPC_DELIMITER)
static inline int apps_std3_mkdir(struct fastrpc_context *ctx,
uint32_t path_size, const char *path,
uint32_t mode)
{
return hexagonrpc(&apps_std3_mkdir_def, ctx,
path_size, (const void *) path, mode);
}
HEXAGONRPC_DEFINE_REMOTE_METHOD3(31, apps_std3_stat, true,
1, HEXAGONRPC_DELIMITER,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0)
static inline int apps_std3_stat(struct fastrpc_context *ctx,
uint32_t path_size, const char *path,
uint32_t *tsz_lo, uint32_t *tsz_hi,
uint32_t *dev_lo, uint32_t *dev_hi,
uint32_t *ino_lo, uint32_t *ino_hi,
uint32_t *mode, uint32_t *nlink,
uint32_t *rdev_lo, uint32_t *rdev_hi,
uint32_t *size_lo, uint32_t *size_hi,
uint32_t *atime_sec_lo, uint32_t *atime_sec_hi,
uint32_t *atime_nsec_lo, uint32_t *atime_nsec_hi,
uint32_t *mtime_sec_lo, uint32_t *mtime_sec_hi,
uint32_t *mtime_nsec_lo, uint32_t *mtime_nsec_hi,
uint32_t *ctime_sec_lo, uint32_t *ctime_sec_hi,
uint32_t *ctime_nsec_lo, uint32_t *ctime_nsec_hi)
{
return hexagonrpc(&apps_std3_stat_def, ctx,
path_size, (const void *) path,
tsz_lo, tsz_hi,
dev_lo, dev_hi,
ino_lo, ino_hi,
mode, nlink,
rdev_lo, rdev_hi,
size_lo, size_hi,
atime_sec_lo, atime_sec_hi,
atime_nsec_lo, atime_nsec_hi,
mtime_sec_lo, mtime_sec_hi,
mtime_nsec_lo, mtime_nsec_hi,
ctime_sec_lo, ctime_sec_hi,
ctime_nsec_lo, ctime_nsec_hi);
}
#endif /* INTERFACE_APPS_STD_DEF */
+124 -101
View File
@@ -20,119 +20,148 @@
*/
#include <inttypes.h>
#include <libhexagonrpc/error.h>
#include <libhexagonrpc/fastrpc.h>
#include <libhexagonrpc/interfaces/remotectl.def>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include "aee_error.h"
#include "interfaces/adsp_listener.def"
#include "iobuffer.h"
#include "listener.h"
static int adsp_listener_init2(int fd)
static int check_buf_sizes(const struct hrpc_method_def_interp3 *def,
uint8_t n_inbufs, uint8_t n_outbufs,
const struct fastrpc_io_buffer *inbufs)
{
return fastrpc2(&adsp_listener_init2_def, fd, ADSP_LISTENER_HANDLE);
const uint32_t *prim_in = inbufs[0].p;
uint8_t n_def_outbufs;
size_t i, j = 1;
size_t off;
size_t n_prim_in;
if (def->msg_id < 31)
off = 0;
else
off = 1;
for (i = 0; i < def->n_args; i++) {
if (def->args[i] == HEXAGONRPC_DELIMITER)
break;
if (!def->args[i])
continue;
/*
* We can't check the size because the primary input buffer is
* too small, so skip checking and print an error later.
*/
if ((off + i) * sizeof(uint32_t) >= inbufs[0].s)
continue;
if (j >= n_inbufs) {
fprintf(stderr, "listener: not enough input buffers\n");
return 1;
}
if ((size_t) prim_in[off + i] * def->args[i] > inbufs[j].s) {
fprintf(stderr, "listener: input buffer too small\n");
return 1;
}
j++;
}
n_prim_in = i;
if (def->args[i] == HEXAGONRPC_DELIMITER)
i++;
if (def->has_prim_out)
n_def_outbufs = 1;
else
n_def_outbufs = 0;
for (; i < def->n_args; i++) {
if (def->args[i]) {
n_def_outbufs++;
n_prim_in++;
}
}
if (n_def_outbufs != n_outbufs) {
fprintf(stderr, "listener: wrong amount of output buffers\n");
return 1;
}
if ((off + n_prim_in) * sizeof(uint32_t) > inbufs[0].s) {
fprintf(stderr, "listener: primary input buffer too small\n");
return 1;
}
return 0;
}
static int adsp_listener_next2(int fd,
uint32_t ret_rctx,
uint32_t ret_res,
uint32_t ret_outbuf_len, void *ret_outbuf,
uint32_t *rctx,
uint32_t *handle,
uint32_t *sc,
uint32_t *inbufs_len,
uint32_t inbufs_size, void *inbufs)
{
return fastrpc2(&adsp_listener_next2_def, fd, ADSP_LISTENER_HANDLE,
ret_rctx,
ret_res,
ret_outbuf_len, ret_outbuf,
rctx,
handle,
sc,
inbufs_len,
inbufs_size, inbufs);
}
static struct fastrpc_io_buffer *allocate_outbufs(const struct fastrpc_function_def_interp2 *def,
uint32_t *first_inbuf)
static struct fastrpc_io_buffer *allocate_outbufs(const struct hrpc_method_def_interp3 *def,
const uint32_t *prim_in)
{
struct fastrpc_io_buffer *out;
size_t out_count;
size_t i, j;
off_t off;
uint32_t *sizes;
// This is only used when there is a delimiter.
const uint32_t *size = NULL;
size_t n_outbufs, n_prim_out = 0;
size_t i;
out_count = def->out_bufs + (def->out_nums && 1);
/*
* POSIX allows malloc to return a non-NULL pointer to a zero-size area
* in memory. Since the code below assumes non-zero size if the pointer
* is non-NULL, exit early if we do not need to allocate anything.
*/
if (out_count == 0)
return NULL;
out = malloc(sizeof(struct fastrpc_io_buffer) * out_count);
out = malloc(sizeof(struct fastrpc_io_buffer) * def->n_args);
if (out == NULL)
return NULL;
out[0].s = def->out_nums * 4;
if (out[0].s) {
out[0].p = malloc(def->out_nums * 4);
if (out[0].p == NULL)
goto err_free_out;
if (def->has_prim_out)
n_outbufs = 1;
else
n_outbufs = 0;
for (i = 0; i < def->n_args; i++) {
if (def->args[i] == HEXAGONRPC_DELIMITER) {
size = &prim_in[i];
i++;
break;
}
}
off = def->out_nums && 1;
sizes = &first_inbuf[def->in_nums + def->in_bufs];
for (; i < def->n_args; i++) {
if (def->args[i]) {
out[n_outbufs].s = (size_t) def->args[i] * *size;
out[n_outbufs].p = malloc(out[n_outbufs].s);
if (out[n_outbufs].p == NULL && out[n_outbufs].s)
goto err_free_outbufs;
for (i = 0; i < def->out_bufs; i++) {
out[off + i].s = sizes[i];
out[off + i].p = malloc(sizes[i]);
if (out[off + i].p == NULL)
goto err_free_prev;
n_outbufs++;
size = &size[1];
} else {
n_prim_out++;
}
}
if (def->has_prim_out) {
out[0].s = sizeof(uint32_t) * n_prim_out;
out[0].p = malloc(out[0].s);
if (out[0].p == NULL && out[0].s)
goto err_free_outbufs;
}
return out;
err_free_prev:
for (j = 0; j < i; j++)
free(out[off + j].p);
err_free_outbufs:
if (!def->has_prim_out)
free(out[0].p);
for (i = 1; i < n_outbufs; i++)
free(out[i].p);
err_free_out:
free(out);
return NULL;
}
static int check_inbuf_sizes(const struct fastrpc_function_def_interp2 *def,
const struct fastrpc_io_buffer *inbufs)
{
uint8_t i;
const uint32_t *sizes = &((const uint32_t *) inbufs[0].p)[def->in_nums];
if (inbufs[0].s != 4U * (def->in_nums
+ def->in_bufs
+ def->out_bufs)) {
fprintf(stderr, "Invalid number of input numbers: %" PRIu32 " (expected %u)\n",
inbufs[0].s,
4 * (def->in_nums
+ def->in_bufs
+ def->out_bufs));
return -1;
}
for (i = 0; i < def->in_bufs; i++) {
if (inbufs[i + 1].s != sizes[i]) {
fprintf(stderr, "Invalid buffer size\n");
return -1;
}
}
return 0;
}
static int return_for_next_invoke(int fd,
uint32_t result,
uint32_t *rctx,
@@ -160,7 +189,7 @@ static int return_for_next_invoke(int fd,
outbufs_encode(REMOTE_SCALARS_OUTBUFS(*sc), returned, outbufs);
}
ret = adsp_listener_next2(fd,
ret = adsp_listener3_next2(fd,
*rctx, result,
outbufs_len, outbufs,
rctx, handle, sc,
@@ -215,11 +244,16 @@ static int invoke_requested_procedure(size_t n_ifaces,
struct fastrpc_io_buffer **returned)
{
const struct fastrpc_function_impl *impl;
uint8_t in_count;
uint8_t out_count;
uint32_t method = REMOTE_SCALARS_METHOD(sc);
int ret;
if (method < 31)
method = REMOTE_SCALARS_METHOD(sc);
else if (decoded[0].s >= sizeof(uint32_t))
method = *(const uint32_t *) decoded[0].p;
else
method = UINT32_MAX;
if (sc & 0xff) {
fprintf(stderr, "Handles are not supported, but got %u in, %u out\n",
(sc & 0xf0) >> 4, sc & 0xf);
@@ -247,26 +281,15 @@ static int invoke_requested_procedure(size_t n_ifaces,
return 1;
}
in_count = impl->def->in_bufs + ((impl->def->in_nums
|| impl->def->in_bufs
|| impl->def->out_bufs) && 1);
out_count = impl->def->out_bufs + (impl->def->out_nums && 1);
if (REMOTE_SCALARS_INBUFS(sc) != in_count
|| REMOTE_SCALARS_OUTBUFS(sc) != out_count) {
fprintf(stderr, "Unexpected buffer count: %08x\n", sc);
*result = AEE_EBADPARM;
return 1;
}
ret = check_inbuf_sizes(impl->def, decoded);
ret = check_buf_sizes(impl->def, REMOTE_SCALARS_INBUFS(sc),
REMOTE_SCALARS_OUTBUFS(sc), decoded);
if (ret) {
*result = AEE_EBADPARM;
return 1;
}
*returned = allocate_outbufs(impl->def, decoded[0].p);
if (*returned == NULL && out_count > 0) {
if (*returned == NULL && impl->def->n_args > 0) {
perror("Could not allocate output buffers");
*result = AEE_ENOMEMORY;
return 1;
@@ -290,7 +313,7 @@ int run_fastrpc_listener(int fd,
uint32_t n_outbufs = 0;
int ret;
ret = adsp_listener_init2(fd);
ret = adsp_listener3_init2(fd);
if (ret) {
fprintf(stderr, "Could not initialize the listener: %u\n", ret);
return ret;
+1 -2
View File
@@ -29,7 +29,7 @@
#include "iobuffer.h"
struct fastrpc_function_impl {
const struct fastrpc_function_def_interp2 *def;
const struct hrpc_method_def_interp3 *def;
uint32_t (*impl)(void *data,
const struct fastrpc_io_buffer *inbufs,
struct fastrpc_io_buffer *outbufs);
@@ -44,7 +44,6 @@ struct fastrpc_interface {
extern const struct fastrpc_interface localctl_interface;
extern const struct fastrpc_interface apps_mem_interface;
extern const struct fastrpc_interface apps_std_interface;
int run_fastrpc_listener(int fd,
+9 -3
View File
@@ -19,13 +19,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <libhexagonrpc/error.h>
#include <libhexagonrpc/interfaces/remotectl.def>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "aee_error.h"
#include "iobuffer.h"
#include "listener.h"
#include "localctl.h"
@@ -145,8 +145,14 @@ void fastrpc_localctl_deinit(struct fastrpc_interface *iface)
}
static const struct fastrpc_function_impl localctl_procs[] = {
{ .def = &remotectl_open_def, .impl = localctl_open, },
{ .def = &remotectl_close_def, .impl = localctl_close, },
{
.def = &remotectl3_open_def,
.impl = localctl_open,
},
{
.def = &remotectl3_close_def,
.impl = localctl_close,
},
};
const struct fastrpc_interface localctl_interface = {
-3
View File
@@ -1,6 +1,4 @@
executable('hexagonrpcd',
'aee_error.c',
'apps_mem.c',
'apps_std.c',
'interfaces.c',
'hexagonfs.c',
@@ -18,4 +16,3 @@ executable('hexagonrpcd',
link_with : libhexagonrpc,
install_dir : get_option('bindir'),
)
install_man('hexagonrpcd.1')
+10 -202
View File
@@ -21,6 +21,7 @@
#include <errno.h>
#include <fcntl.h>
#include <libhexagonrpc/error.h>
#include <libhexagonrpc/fastrpc.h>
#include <libhexagonrpc/interfaces/remotectl.def>
#include <misc/fastrpc.h>
@@ -30,12 +31,8 @@
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "aee_error.h"
#include "apps_mem.h"
#include "apps_std.h"
#include "hexagonfs.h"
#include "interfaces/adsp_default_listener.def"
@@ -56,17 +53,14 @@ static int remotectl_open(int fd, char *name, struct fastrpc_context **ctx, void
&dlret,
256, err);
if (ret == -1) {
err_cb(strerror(errno));
if (ret) {
err_cb(hexagonrpc_strerror(errno));
return ret;
}
if (dlret == -5) {
if (dlret) {
err_cb(err);
return dlret;
} else if (dlret) {
err_cb(aee_strerror[dlret]);
return dlret;
}
*ctx = fastrpc_create_context(fd, handle);
@@ -85,13 +79,13 @@ static int remotectl_close(struct fastrpc_context *ctx, void (*err_cb)(const cha
&dlret,
256, err);
if (ret == -1) {
err_cb(strerror(errno));
if (ret) {
err_cb(hexagonrpc_strerror(errno));
return ret;
}
if (dlret) {
err_cb(aee_strerror[dlret]);
err_cb(err);
return dlret;
}
@@ -100,11 +94,6 @@ static int remotectl_close(struct fastrpc_context *ctx, void (*err_cb)(const cha
return ret;
}
static int adsp_default_listener_register(struct fastrpc_context *ctx)
{
return fastrpc(&adsp_default_listener_register_def, ctx);
}
static void remotectl_err(const char *err)
{
fprintf(stderr, "Could not remotectl: %s\n", err);
@@ -119,7 +108,7 @@ static int register_fastrpc_listener(int fd)
if (ret)
return 1;
ret = adsp_default_listener_register(ctx);
ret = adsp_default_listener3_register(ctx);
if (ret) {
fprintf(stderr, "Could not register ADSP default listener\n");
goto err;
@@ -135,7 +124,6 @@ static void print_usage(const char *argv0)
printf("Usage: %s [options] -f DEVICE\n\n", argv0);
printf("Server for FastRPC remote procedure calls from Qualcomm DSPs\n\n"
"Options:\n"
"\t-c SHELL\t\tCreate a new pd running the specified ELF\n"
"\t-d DSP\t\tDSP name (default: "")\n"
"\t-f DEVICE\tFastRPC device node to attach to\n"
"\t-p PROGRAM\tRun client program with shared file descriptor\n"
@@ -143,60 +131,6 @@ static void print_usage(const char *argv0)
"\t-s\t\tAttach to sensorspd\n");
}
static int create_shell_pd(int fd, const char *create_shell)
{
char *buf;
int shellfd, ret;
struct stat stats;
struct fastrpc_alloc_dma_buf dmabuf;
long page_size;
struct fastrpc_init_create init = {
.attrs = 0,
.siglen = 0,
};
shellfd = open(create_shell, O_RDONLY);
if (shellfd == -1) {
fprintf(stderr, "Could not open %s: %s\n",
create_shell, strerror(errno));
return -1;
}
ret = fstat(shellfd, &stats);
if (ret == -1)
goto err_close_fd;
page_size = sysconf(_SC_PAGE_SIZE);
dmabuf.size = (stats.st_size + page_size - 1) & ~(page_size - 1);
dmabuf.flags = 0;
ret = ioctl(fd, FASTRPC_IOCTL_ALLOC_DMA_BUFF, &dmabuf);
if (ret)
goto err_close_fd;
buf = mmap(NULL, dmabuf.size, PROT_WRITE, MAP_SHARED, dmabuf.fd, 0);
if (buf == MAP_FAILED) {
ret = -1;
goto err_close_dmabuf;
}
read(shellfd, buf, stats.st_size);
init.file = (__u64) buf;
init.filefd = dmabuf.fd;
init.filelen = stats.st_size;
ret = ioctl(fd, FASTRPC_IOCTL_INIT_CREATE, &init);
munmap(buf, dmabuf.size);
err_close_dmabuf:
close(dmabuf.fd);
err_close_fd:
close(shellfd);
return ret;
}
static int setup_environment(int fd)
{
char *buf;
@@ -254,7 +188,7 @@ static void *start_reverse_tunnel(int fd, const char *device_dir, const char *ds
{
struct fastrpc_interface **ifaces;
struct hexagonfs_dirent *root_dir;
size_t n_ifaces = 3;
size_t n_ifaces = 2;
int ret;
ifaces = malloc(sizeof(struct fastrpc_interface) * n_ifaces);
@@ -272,7 +206,6 @@ static void *start_reverse_tunnel(int fd, const char *device_dir, const char *ds
// Dynamic interfaces with no hardcoded handle
ifaces[1] = fastrpc_apps_std_init(root_dir);
ifaces[2] = fastrpc_apps_mem_init(fd);
ret = register_fastrpc_listener(fd);
if (ret)
@@ -292,127 +225,11 @@ err:
return NULL;
}
static char *read_sysfs_file(const char *path, struct stat *file_stat)
{
char *contents = NULL;
int fd, res, n_bytes;
fd = open(path, O_RDONLY);
if (fd == -1)
return NULL;
res = fstat(fd, file_stat);
if (res)
goto close_fd;
contents = malloc(file_stat->st_size);
if (contents == NULL)
goto close_fd;
n_bytes = read(fd, contents, file_stat->st_size);
if (n_bytes != file_stat->st_size) {
free(contents);
contents = NULL;
}
close_fd:
close(fd);
return contents;
}
/*
* Guesses the device's HexagonFS directory from the model and compatible
* properties in the device-tree.
*
* The vendor name is guessed by splitting the model property at the first
* space to preserve the canonical capitalization of the name.
*
* The SoC name is assumed to be part of the first property in the compatible
* list that starts with "qcom,".
*
* Finally, all compatible entries are split at the first , and the all
* right-hand sides of the entry considered as the codename.
*
* It returns the first guessed combination of all 3 for which a path exists
* at /usr/share/qcom/{soc}/{vendor}/{codename}.
* If no match is found, a null pointer is returned.
*/
static char *guess_device_directory_from_compatible(void)
{
char *compatible_ptr, *device_name, *model_ptr, *orig_compatible_ptr,
*end_of_vendor_name, *vendor_name;
char *chipset_name = NULL;
char *ret = NULL;
struct stat compatible_stat, model_stat;
compatible_ptr = read_sysfs_file("/proc/device-tree/compatible",
&compatible_stat);
if (compatible_ptr == NULL)
return NULL;
orig_compatible_ptr = compatible_ptr;
model_ptr = read_sysfs_file("/proc/device-tree/model", &model_stat);
if (model_ptr == NULL)
goto free_compatible;
end_of_vendor_name = strchr(model_ptr, ' ');
if (end_of_vendor_name == NULL)
end_of_vendor_name = model_ptr + model_stat.st_size - 1;
vendor_name = strndup(model_ptr, end_of_vendor_name - model_ptr);
if (vendor_name == NULL)
goto free_model;
while (compatible_ptr < orig_compatible_ptr + compatible_stat.st_size) {
if (strncmp("qcom,", compatible_ptr, sizeof("qcom,") - 1) == 0) {
chipset_name = compatible_ptr + sizeof("qcom,") - 1;
break;
}
compatible_ptr += strlen(compatible_ptr) + 1;
}
if (chipset_name == NULL)
goto free_model;
compatible_ptr = orig_compatible_ptr;
while (compatible_ptr < orig_compatible_ptr + compatible_stat.st_size) {
char *try_path = NULL;
device_name = strchr(compatible_ptr, ',');
if (device_name == NULL)
continue;
device_name += 1;
if (asprintf(&try_path, "/usr/share/qcom/%s/%s/%s",
chipset_name, vendor_name, device_name) < 0)
goto free_model;
if (!access(try_path, R_OK)) {
ret = try_path;
break;
}
free(try_path);
compatible_ptr += strlen(compatible_ptr) + 1;
}
free_model:
free(model_ptr);
free_compatible:
free(orig_compatible_ptr);
return ret;
}
int main(int argc, char* argv[])
{
char *fastrpc_node = NULL;
const char *device_dir = "/usr/share/qcom/";
const char *dsp = "";
const char *create_shell = NULL;
const char *guessed_device_dir;
const char **progs;
pid_t *pids;
size_t n_progs = 0;
@@ -431,15 +248,8 @@ int main(int argc, char* argv[])
goto err_free_progs;
}
guessed_device_dir = guess_device_directory_from_compatible();
if (guessed_device_dir != NULL)
device_dir = guessed_device_dir;
while ((opt = getopt(argc, argv, "c:d:f:p:R:s")) != -1) {
while ((opt = getopt(argc, argv, "d:f:p:R:s")) != -1) {
switch (opt) {
case 'c':
create_shell = optarg;
break;
case 'd':
dsp = optarg;
break;
@@ -477,8 +287,6 @@ int main(int argc, char* argv[])
if (attach_sns)
ret = ioctl(fd, FASTRPC_IOCTL_INIT_ATTACH_SNS, NULL);
else if (create_shell != NULL)
ret = create_shell_pd(fd, create_shell);
else
ret = ioctl(fd, FASTRPC_IOCTL_INIT_ATTACH, NULL);
if (ret) {
@@ -2,6 +2,7 @@
* Imported FastRPC error numbers
*
* Copyright (c) 2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2023, The Sensor Shell Contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -83,6 +84,6 @@
#define AEE_ECPUEXCEPTION 48
#define AEE_EREADONLY 49
extern const char *aee_strerror[];
const char *hexagonrpc_strerror(int ret);
#endif
+20
View File
@@ -23,6 +23,7 @@
#define FASTRPC_H
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
@@ -41,6 +42,8 @@
#define REMOTE_SCALARS_INBUFS(sc) (((sc) >> 16) & 0xff)
#define REMOTE_SCALARS_OUTBUFS(sc) (((sc) >> 8) & 0xff)
#define HEXAGONRPC_DELIMITER 0xFFFFFFFF
struct fastrpc_context {
int fd;
uint32_t handle;
@@ -54,6 +57,13 @@ struct fastrpc_function_def_interp2 {
uint8_t out_bufs;
};
struct hrpc_method_def_interp3 {
uint32_t msg_id;
bool has_prim_out;
size_t n_args;
const uint32_t *args;
};
struct fastrpc_context *fastrpc_create_context(int fd, uint32_t handle);
static inline void fastrpc_destroy_context(struct fastrpc_context *ctx)
@@ -70,4 +80,14 @@ int fastrpc2(const struct fastrpc_function_def_interp2 *def,
int fastrpc(const struct fastrpc_function_def_interp2 *def,
const struct fastrpc_context *ctx, ...);
int vhexagonrpc2(const struct hrpc_method_def_interp3 *def,
int fd, uint32_t handle, va_list list);
int vhexagonrpc(const struct hrpc_method_def_interp3 *def,
const struct fastrpc_context *ctx, va_list list);
int hexagonrpc2(const struct hrpc_method_def_interp3 *def,
int fd, uint32_t handle, ...);
int hexagonrpc(const struct hrpc_method_def_interp3 *def,
const struct fastrpc_context *ctx, ...);
#endif
+23
View File
@@ -36,6 +36,12 @@
outnums, outbufs) \
extern const struct fastrpc_function_def_interp2 name##_def;
#define HEXAGONRPC_DEFINE_REMOTE_METHOD3_EMPTY(mid, name) \
extern const struct hrpc_method_def_interp3 name##_def;
#define HEXAGONRPC_DEFINE_REMOTE_METHOD3(mid, name, has_oprim, ...) \
HEXAGONRPC_DEFINE_REMOTE_METHOD3_EMPTY(mid, name)
#else /* HEXAGONRPC_BUILD_METHOD_DEFINITIONS */
#define HEXAGONRPC_DEFINE_REMOTE_METHOD(mid, name, \
@@ -49,6 +55,23 @@
.out_bufs = outbufs, \
};
#define HEXAGONRPC_DEFINE_REMOTE_METHOD3_EMPTY(mid, name) \
const struct hrpc_method_def_interp3 name##_def = { \
.msg_id = mid, \
.has_prim_out = false, \
.n_args = 0, \
.args = NULL, \
};
#define HEXAGONRPC_DEFINE_REMOTE_METHOD3(mid, name, has_oprim, ...) \
static const uint32_t name##_args[] = { __VA_ARGS__ }; \
const struct hrpc_method_def_interp3 name##_def = { \
.msg_id = mid, \
.has_prim_out = has_oprim, \
.n_args = sizeof(name##_args) / sizeof(*name##_args), \
.args = name##_args, \
};
#endif /* HEXAGONRPC_BUILD_METHOD_DEFINITIONS */
#endif /* LIBHEXAGONRPC_INTERFACE_H */
Loaded 20 of 28 files, more files were not shown because too many files have changed in this diff. Show more