mbox
if (mbox.mb_msg)
afree((void *)mbox.mb_msg, APERM);
if (mbox.mb_path)
afree((void *)mbox.mb_path, APERM);
mbox.mb_path = str_save(p, APERM);
mbox.mb_msg = NULL;
mbox.mb_mtime = stbuf.st_mtime;
mbox.mb_mtime = 0;
struct mbox *mb_next; /* next mbox in list */
static mbox_t mbox;
mbp = &mbox;
uint32_t mbox, chan, data;
mbox = bus_space_read_4(sc->sc_iot, sc->sc_ioh,
chan = BCM2835_MBOX_CHAN(mbox);
data = BCM2835_MBOX_DATA(mbox);
uint32_t mbox;
mbox = bus_space_read_4(iot, ioh, BCM2835_MBOX0_READ);
rchan = BCM2835_MBOX_CHAN(mbox);
rdata = BCM2835_MBOX_DATA(mbox);
mbox = kmem_alloc(sizeof(*mbox), KM_SLEEP);
mbox->mb_ctlr = mc;
mbox->mb_priv = mbox_priv;
return mbox;
fdtbus_mbox_put(struct fdtbus_mbox_channel *mbox)
struct fdtbus_mbox_controller *mc = mbox->mb_ctlr;
mc->mc_funcs->mc_release(mc->mc_dev, mbox->mb_priv);
kmem_free(mbox, sizeof(*mbox));
fdtbus_mbox_send(struct fdtbus_mbox_channel *mbox, const void *data, size_t len)
struct fdtbus_mbox_controller * const mc = mbox->mb_ctlr;
return mc->mc_funcs->mc_send(mc->mc_dev, mbox->mb_priv, data, len);
fdtbus_mbox_recv(struct fdtbus_mbox_channel *mbox, void *data, size_t len)
struct fdtbus_mbox_controller * const mc = mbox->mb_ctlr;
return mc->mc_funcs->mc_recv(mc->mc_dev, mbox->mb_priv, data, len);
struct fdtbus_mbox_channel *mbox = NULL;
isp_intr(ispsoftc_t *isp, uint32_t isr, uint16_t sema, uint16_t mbox)
if (mbox & MBOX_COMMAND_COMPLETE) {
isp->isp_mboxtmp[0] = mbox;
isp_prt(isp, ISP_LOGWARN, "mailbox cmd (0x%x) with no waiters", mbox);
i = IS_FC(isp)? isp_parse_async_fc(isp, mbox) : isp_parse_async(isp, mbox);
if ((IS_FC(isp) && mbox != ASYNC_RIOZIO_STALL) || isp->isp_state != ISP_RUNSTATE) {
mbox = ISP_READ(isp, OUTMAILBOX0);
if ((sema & 0x3) && (mbox & 0x8000)) {
isp_parse_async(ispsoftc_t *isp, uint16_t mbox)
if (mbox != ASYNC_RIO32_2) {
isp_prt(isp, ISP_LOGDEBUG2, "Async Mbox 0x%x", mbox);
switch (mbox) {
if (isp_target_async(isp, chan, mbox)) {
mbox = ISP_READ(isp, isp->isp_rqstoutrp);
if (isp_target_async(isp, chan, mbox)) {
if (isp_target_async(isp, chan, mbox)) {
mbox = ISP_READ(isp, OUTMAILBOX2);
switch (mbox & SXP_PINS_MODE_MASK) {
"Transition to Unknown Mode 0x%x", mbox);
isp_prt(isp, ISP_LOGWARN, "%s: unhandled async code 0x%x", __func__, mbox);
isp_parse_async_fc(ispsoftc_t *isp, uint16_t mbox)
isp_prt(isp, ISP_LOGDEBUG2, "Async Mbox 0x%x", mbox);
switch (mbox) {
if (isp_target_async(isp, (ISP_READ(isp, OUTMAILBOX2) << 16) | ISP_READ(isp, OUTMAILBOX1), mbox)) {
if (isp_target_async(isp, chan, mbox)) {
if (isp_target_async(isp, chan, mbox)) {
if (isp_target_async(isp, chan, mbox)) {
if (isp_target_async(isp, chan, mbox)) {
mbox = ISP_READ(isp, OUTMAILBOX1);
switch (mbox) {
"Unknown connection mode (0x%x)", mbox);
isp_prt(isp, ISP_LOGWARN, "Unknown Async Code 0x%x", mbox);
if (mbox != ASYNC_CTIO_DONE && mbox != ASYNC_CMD_CMPLT) {
uint16_t sema, mbox;
if (ISP_READ_ISR(isp, &isr, &sema, &mbox)) {
isp_intr(isp, isr, sema, mbox);
uint16_t sema, mbox;
if (ISP_READ_ISR(isp, &isr, &sema, &mbox)) {
isp_intr(isp, isr, sema, mbox);
uint16_t mbox, sema;
if (ISP_READ_ISR(isp, &isr, &sema, &mbox)) {
isp_intr(isp, isr, sema, mbox);
union mfi_mbox mbox;
memset(&mbox, 0, sizeof(mbox));
mbox.b[0] = MR_FLUSH_CTRL_CACHE | MR_FLUSH_DISK_CACHE;
MR_DCMD_CTRL_CACHE_FLUSH, MFI_DATA_NONE, 0, NULL, &mbox)) {
uint32_t len, void *buf, const union mfi_mbox *mbox, bool poll)
rv = mfi_mgmt(ccb, NULL, opc, dir, len, buf, mbox);
uint32_t dir, uint32_t len, void *buf, const union mfi_mbox *mbox)
if (mbox)
memcpy(dcmd->mdf_mbox.b, mbox, MFI_MBOX_SIZE);
union mfi_mbox mbox;
memset(&mbox, 0, sizeof(mbox));
mbox.b[0] = sc->sc_ld_list.mll_list[i].mll_ld.mld_target;
DEVNAME(sc), mbox.b[0]);
sizeof(sc->sc_ld_details), &sc->sc_ld_details, &mbox, false))
union mfi_mbox mbox;
memset(&mbox, 0, sizeof(mbox));
mbox.s[0] = ar[arr].pd[disk].mar_pd.mfp_id;
sizeof *pd, pd, &mbox, false))
union mfi_mbox mbox;
memset(&mbox, 0, sizeof(mbox));
mbox.s[0] = pd->mpl_address[i].mpa_pd_id;
if (mfi_mgmt_internal(sc, cmd, MFI_DATA_NONE, 0, NULL, &mbox, false))
union mfi_mbox mbox;
memset(&mbox, 0, sizeof(mbox));
mbox.s[0] = pd->mpl_address[i].mpa_pd_id;
mbox.b[4] = MFI_PD_ONLINE;
mbox.b[4] = MFI_PD_OFFLINE;
mbox.b[4] = MFI_PD_HOTSPARE;
0, NULL, &mbox, false))
union mfi_mbox mbox;
memset(&mbox, 0, sizeof(mbox));
mbox.s[0] = hs[i].mhs_pd.mfp_id;
sizeof *pd, pd, &mbox, false)) {
union mfi_mbox mbox;
memset(&mbox, 0, sizeof(mbox));
mbox.b[0] = sc->sc_ld_list.mll_no_ld;
mbox.b[1] = MFI_DCMD_MBOX_PEND_FLAG;
ld_size, ld_sync, &mbox)) {
union mfi_mbox mbox;
memset(&mbox, 0, sizeof(mbox));
mbox.b[0] = MR_FLUSH_CTRL_CACHE | MR_FLUSH_DISK_CACHE;
MFI_DATA_NONE, 0, NULL, &mbox, true)) {
mbox.b[0] = 0;
MFI_DATA_NONE, 0, NULL, &mbox, true)) {
u_int32_t mbox[4], sema[2];
struct amr_mailbox_resp mbox;
while ((*amr->amr_get_work)(amr, &mbox) == 0) {
for (i = 0; i < mbox.mb_nstatus; i++) {
idx = mbox.mb_completed[i] - 1;
ac->ac_status = mbox.mb_status;
struct aq_mailbox_header mbox;
(uint32_t *)&mbox, sizeof(mbox) / sizeof(uint32_t));
tid0 = mbox.transaction_id;
} else if (mbox.transaction_id != tid0) {
struct mcx_cmdq_mailbox *mbox = (struct mcx_cmdq_mailbox *)kva;
be32enc(&mbox->mb_block_number, i);
mbox->mb_token = token;
ptr = &mbox->mb_next_ptr;
int mbox, mbox_pages, i;
mbox = offset / MCX_CMDQ_MAILBOX_DATASIZE;
pas = mcx_cq_mbox_data(mcx_cq_mbox(mxm, mbox));
mbox++;
pas = mcx_cq_mbox_data(mcx_cq_mbox(mxm, mbox));
struct mcx_cmdq_mailbox *mbox;
mbox = mcx_cq_mbox(mboxes, i);
d = mcx_cq_mbox_data(mbox);
uint16_t sema, mbox;
if (ISP_READ_ISR(isp, &isr, &sema, &mbox) == 0) {
isp_intr(isp, isr, sema, mbox);
union mfi_mbox mbox;
memset(&mbox, 0, sizeof(mbox));
mbox.b[0] = MR_FLUSH_CTRL_CACHE | MR_FLUSH_DISK_CACHE;
if (mfii_do_mgmt(sc, ccb, MR_DCMD_CTRL_CACHE_FLUSH, &mbox,
mbox.b[0] = 0;
if (mfii_do_mgmt(sc, ccb, MR_DCMD_CTRL_SHUTDOWN, &mbox,
union mfi_mbox mbox;
memset(&mbox, 0, sizeof(mbox));
mbox.b[0] = 1;
if (mfii_mgmt(sc, MR_DCMD_LD_GET_LIST, &mbox, &sc->sc_ld_list,
mfii_mgmt(struct mfii_softc *sc, uint32_t opc, const union mfi_mbox *mbox,
rv = mfii_do_mgmt(sc, ccb, opc, mbox, buf, len, dir, poll);
const union mfi_mbox *mbox, void *buf, size_t len, mfii_direction_t dir,
if (mbox != NULL)
memcpy(&dcmd->mdf_mbox, mbox, sizeof(dcmd->mdf_mbox));
union mfi_mbox mbox;
memset(&mbox, 0, sizeof(mbox));
mbox.s[0] = htole16(link->target);
rv = mfii_mgmt(sc, MR_DCMD_PD_GET_INFO, &mbox, &mpd, sizeof(mpd),
union mfi_mbox mbox;
memset(&mbox, 0, sizeof(mbox));
mbox.b[0] = 1;
if (mfii_mgmt(sc, MR_DCMD_LD_GET_LIST, &mbox, &sc->sc_ld_list,
memset(&mbox, 0, sizeof(mbox));
mbox.b[0] = sc->sc_ld_list.mll_list[i].mll_ld.mld_target;
if (mfii_mgmt(sc, MR_DCMD_LD_GET_INFO, &mbox,
union mfi_mbox mbox;
memset(&mbox, 0, sizeof(mbox));
mbox.s[0] = pl->mpl_address[i].mpa_pd_id;
if (mfii_mgmt(sc, MR_DCMD_PD_GET_INFO, &mbox,
memset(&mbox, 0, sizeof(mbox));
mbox.s[0] = ar[arr].pd[disk].mar_pd.mfp_id;
if (mfii_mgmt(sc, MR_DCMD_PD_GET_INFO, &mbox, pd, sizeof(*pd),
union mfi_mbox mbox;
memset(&mbox, 0, sizeof(mbox));
mbox.s[0] = pd->mpl_address[i].mpa_pd_id;
if (mfii_mgmt(sc, cmd, &mbox, NULL, 0, MFII_DATA_NONE, false))
union mfi_mbox mbox;
memset(&mbox, 0, sizeof mbox);
mbox.s[0] = pd_id;
rv = mfii_mgmt(sc, MR_DCMD_PD_GET_INFO, &mbox, pd, sizeof(*pd),
mbox.s[0] = pd_id;
mbox.s[1] = pd->mpd_pd.mfp_seq;
mbox.b[4] = MFI_PD_UNCONFIG_GOOD;
rv = mfii_mgmt(sc, MR_DCMD_PD_SET_STATE, &mbox, NULL, 0,
memset(&mbox, 0, sizeof mbox);
mbox.s[0] = pd_id;
rv = mfii_mgmt(sc, MR_DCMD_PD_GET_INFO, &mbox, pd, sizeof(*pd),
memset(&mbox, 0, sizeof mbox);
mbox.s[0] = pd_id;
rv = mfii_mgmt(sc, MR_DCMD_PD_GET_INFO, &mbox, pd, sizeof(*pd),
union mfi_mbox mbox;
memset(&mbox, 0, sizeof mbox);
mbox.s[0] = pd_id;
rv = mfii_mgmt(sc, MR_DCMD_PD_GET_INFO, &mbox, pd, sizeof(*pd),
union mfi_mbox mbox;
memset(&mbox, 0, sizeof(mbox));
mbox.s[0] = pl->mpl_address[i].mpa_pd_id;
if (mfii_mgmt(sc, MR_DCMD_PD_GET_INFO, &mbox, pd, sizeof(*pd),
mbox.s[0] = pl->mpl_address[i].mpa_pd_id;
mbox.s[1] = pd->mpd_pd.mfp_seq;
mbox.b[4] = MFI_PD_ONLINE;
mbox.b[4] = MFI_PD_OFFLINE;
mbox.b[4] = MFI_PD_HOTSPARE;
memset(&mbox, 0, sizeof(mbox));
mbox.s[0] = pl->mpl_address[i].mpa_pd_id;
rv = mfii_mgmt(sc, MR_DCMD_PD_GET_INFO, &mbox,
mbox.s[0] = pl->mpl_address[i].mpa_pd_id;
mbox.s[1] = pd->mpd_pd.mfp_seq;
mbox.b[4] = MFI_PD_REBUILD;
rv = mfii_mgmt(sc, MR_DCMD_PD_SET_STATE, &mbox, NULL, 0,
union mfi_mbox mbox;
memset(&mbox, 0, sizeof(mbox));
mbox.s[0] = hs[i].mhs_pd.mfp_id;
if (mfii_mgmt(sc, MR_DCMD_PD_GET_INFO, &mbox, pd, sizeof(*pd),
union mfi_mbox mbox;
memset(&mbox, 0, sizeof(mbox));
mbox.b[0] = 1;
if (mfii_mgmt(sc, MR_DCMD_LD_GET_LIST, &mbox, &sc->sc_ld_list,
uint16_t sema, mbox;
if (ISP_READ_ISR(isp, &isr, &sema, &mbox) == 0) {
isp_intr(isp, isr, sema, mbox);
put_msg(ipi_mbox_t *mbox, ipi_msg_t *msg)
if (atomic_cas_ptr(&mbox->msg[i], NULL, msg) == NULL) {
ipi_mbox_t *mbox = &ipi_mboxes[cpu_index(ci)];
if ((msg = atomic_load_acquire(&mbox->msg[i])) == NULL) {
atomic_store_relaxed(&mbox->msg[i], NULL);
const char *mbox;
mbox = expand("&");
if ((abuf = Fopen(mbox, "ref")) != NULL) {
if ((fd = creat(mbox, 0600)) != -1)
if ((obuf = Fopen(mbox, "ref+")) == NULL) {
warn("%s", mbox);
if ((obuf = Fopen(mbox, "aef")) == NULL) {
warn("%s", mbox);
warn("%s", mbox);
warn("%s", mbox);
char *mbox;
if (!(mbox = getenv("MAIL")))
(void)strlcpy(buf, mbox, bufsize);