// Handle events from AFU static void _handle_afu(struct psl *psl) { struct client *client; uint64_t error; uint8_t *buffer; int reset_done; size_t size; reset_done = handle_aux2(psl->job, &(psl->parity_enabled), &(psl->latency), &error); if (error && !directed_mode_support(psl->mmio)) { client = psl->client[0]; size = 1 + sizeof(uint64_t); buffer = (uint8_t *) malloc(size); buffer[0] = PSLSE_AFU_ERROR; error = htonll(error); memcpy((char *)&(buffer[1]), (char *)&error, sizeof(error)); if (put_bytes (client->fd, size, buffer, psl->dbg_fp, psl->dbg_id, 0) < 0) { client_drop(client, PSL_IDLE_CYCLES, CLIENT_NONE); } } handle_mmio_ack(psl->mmio, psl->parity_enabled); if (psl->cmd != NULL) { if (reset_done) psl->cmd->credits = psl->cmd->parms->credits; handle_response(psl->cmd); handle_buffer_write(psl->cmd); handle_buffer_read(psl->cmd); handle_buffer_data(psl->cmd, psl->parity_enabled); handle_mem_write(psl->cmd); handle_touch(psl->cmd); handle_cmd(psl->cmd, psl->parity_enabled, psl->latency); handle_interrupt(psl->cmd); } }
// Handle events from AFU static void _handle_afu(struct psl *psl) { struct client *client; uint64_t error; uint8_t *buffer; int reset_done; int i; size_t size; reset_done = _handle_aux2(psl, &(psl->parity_enabled), &(psl->latency), &error); //printf("after reset_done in handle_afu \n"); if (error) { if (dedicated_mode_support(psl->mmio)) { client = psl->client[0]; size = 1 + sizeof(uint64_t); buffer = (uint8_t *) malloc(size); buffer[0] = PSLSE_AFU_ERROR; error = htonll(error); memcpy((char *)&(buffer[1]), (char *)&error, sizeof(error)); warn_msg("%s: Received JERROR: 0x%016"PRIx64" in afu-dedicated mode", psl->name, error); if (put_bytes (client->fd, size, buffer, psl->dbg_fp, psl->dbg_id, 0) < 0) { client_drop(client, PSL_IDLE_CYCLES, CLIENT_NONE); } } if (directed_mode_support(psl->mmio)) { // afu error gets logged by OS. - print warning message // no interrupt/event is sent up to the application - don't "put_bytes" back to client(s) // all clients lose connection to afu but how is this observered by the client? warn_msg("%s: Received JERROR: 0x%016"PRIx64" in afu-directed mode", psl->name, error); for (i = 0; i < psl->max_clients; i++) { if (psl->client[i] == NULL) continue; client_drop(psl->client[i], PSL_IDLE_CYCLES, CLIENT_NONE); } } } handle_mmio_ack(psl->mmio, psl->parity_enabled); if (psl->cmd != NULL) { if (reset_done) psl->cmd->credits = psl->cmd->parms->credits; #if defined PSL9lite || defined PSL9 handle_caia2_cmds(psl->cmd); #endif /* ifdef PSL9 or PSL9lite */ #ifdef PSL9 handle_dma0_port(psl->cmd); handle_dma0_write(psl->cmd); handle_dma0_sent_sts(psl->cmd); handle_dma0_read(psl->cmd); #endif /* ifdef PSL9 */ handle_response(psl->cmd); handle_buffer_write(psl->cmd); handle_buffer_read(psl->cmd); handle_buffer_data(psl->cmd, psl->parity_enabled); handle_mem_write(psl->cmd); handle_touch(psl->cmd); handle_cmd(psl->cmd, psl->parity_enabled, psl->latency); handle_interrupt(psl->cmd); } }