Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve SCM wrapping #39

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/libosd/cl_scm.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,17 @@ osd_result osd_cl_scm_cpus_stop(struct osd_hostmod_ctx *hostmod_ctx,
OSD_HOSTMOD_BLOCKING);
}

/**
* Read the system information from the device, as stored in the SCM
*/
API_EXPORT
osd_result osd_cl_scm_system_reset(struct osd_hostmod_ctx *hostmod_ctx,
unsigned int subnet_addr, bool reset)
{
return osd_hostmod_reg_setbit(hostmod_ctx, OSD_REG_SCM_SYSRST_SYS_RST_BIT,
reset,
get_scm_diaddr(subnet_addr),
OSD_REG_SCM_SYSRST, 16,
OSD_HOSTMOD_BLOCKING);
}

API_EXPORT
osd_result osd_cl_scm_get_subnetinfo(struct osd_hostmod_ctx *hostmod_ctx,
unsigned int subnet_addr,
Expand Down
12 changes: 12 additions & 0 deletions src/libosd/include/osd/cl_scm.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@ osd_result osd_cl_scm_cpus_start(struct osd_hostmod_ctx *hostmod_ctx,
osd_result osd_cl_scm_cpus_stop(struct osd_hostmod_ctx *hostmod_ctx,
unsigned int subnet_addr);

/**
* Set or unset the system reset in a given subnet
*
* The exact meaning of "system reset" is platform-dependent.
*
* @param hostmod_ctx hostmodule context
* @param subnet_addr target subnet
* @param reset Value of the reset: 1 to set the reset signal, 0 to unset it
*/
osd_result osd_cl_scm_system_reset(struct osd_hostmod_ctx *hostmod_ctx,
unsigned int subnet_addr, bool reset);

/**
* Get a description of a given subnet from the SCM
*/
Expand Down
19 changes: 19 additions & 0 deletions src/python/src/cosd.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,25 @@ cdef extern from "osd/cl_mam.h" nogil:
const void *data, size_t nbyte,
uint64_t start_addr)

cdef extern from "osd/cl_scm.h" nogil:
cdef struct osd_subnet_desc:
uint16_t vendor_id;
uint16_t device_id
uint16_t max_pkt_len

osd_result osd_cl_scm_cpus_start(osd_hostmod_ctx *hostmod_ctx,
unsigned int subnet_addr)

osd_result osd_cl_scm_cpus_stop(osd_hostmod_ctx *hostmod_ctx,
unsigned int subnet_addr)

osd_result osd_cl_scm_system_reset(osd_hostmod_ctx *hostmod_ctx,
unsigned int subnet_addr, bint reset)

osd_result osd_cl_scm_get_subnetinfo(osd_hostmod_ctx *hostmod_ctx,
unsigned int subnet_addr,
osd_subnet_desc *subnet_desc)

cdef extern from "osd/module.h" nogil:
cdef struct osd_module_desc:
uint16_t addr
Expand Down
Loading