Exemplo n.º 1
0
static void controller_smart_access_complete (controller *currctlr, ioreq_event *curr)
{
   struct ioq *queue = currctlr->devices[curr->devno].queue;
   ioreq_event *done = ioreq_copy(curr);
   int devno = curr->devno;
   int numout;

   /* Responds to completion interrupt */

   done->type = IO_INTERRUPT_COMPLETE;
   currctlr->outbusowned = controller_get_downward_busno(currctlr, done, NULL);
   controller_send_event_down_path(currctlr, done, currctlr->ovrhd_disk_complete);
   currctlr->outbusowned = -1;

   /* Handles request completion, including call-backs into cache */

   curr = ioqueue_physical_access_done(queue, curr);
   while ((done = curr)) {
      curr = curr->next;
      /* call back into cache with completion -- let it do request_complete */
      controller_smart_wakeup(currctlr, currctlr->cache->cache_disk_access_complete(currctlr->cache, done));
   }

   /* Initiate another request, if any pending */

   numout = ioqueue_get_reqoutstanding(queue);
   if ((numout < currctlr->devices[devno].maxoutstanding) && (curr = ioqueue_get_next_request(queue))) {
      controller_send_event_down_path(currctlr, curr, currctlr->ovrhd_disk_request);
   }
}
Exemplo n.º 2
0
static void controller_smart_reconnect_to_transfer (controller *currctlr, ioreq_event *curr)
{
   curr->type = IO_INTERRUPT_COMPLETE;
   currctlr->outbusowned = controller_get_downward_busno(currctlr, curr, NULL);
   controller_send_event_down_path(currctlr, curr, currctlr->ovrhd_disk_reconnect);
   currctlr->outbusowned = -1;
}
Exemplo n.º 3
0
static void controller_53c700_disconnect (controller *currctlr, ioreq_event *curr)
{
    ioreq_event *ret;

#ifdef DEBUG_CTLRDUMB
    fprintf (outputfile, "*** %f: controller_53c700_disconnect - devno %d, blkno %d\n, bcount %d, flags 0x%x\n", simtime, curr->devno, curr->blkno, curr->bcount, curr->flags );
#endif

    switch (currctlr->state) {
    case READ_DATA_TRANSFER:
    case WRITE_DATA_TRANSFER:
    case REQUEST_PENDING:
        break;
    default:
        fprintf(stderr, "Completing request not transfering in controller_53c700_request_complete\n");
        exit(1);
    }
    ret = ioreq_copy(curr);
    ret->type = IO_INTERRUPT_COMPLETE;
    currctlr->outbusowned = controller_get_downward_busno(currctlr, curr, NULL);
    controller_send_event_down_path(currctlr, ret, currctlr->ovrhd_disk_disconnect);
    currctlr->outbusowned = -1;
    currctlr->state = DISCONNECT_PENDING;
    controller_send_event_up_path(currctlr, curr, currctlr->ovrhd_disconnect);
}
Exemplo n.º 4
0
void controller_passthru_event_arrive (controller *currctlr, ioreq_event *curr)
{
    int busno;
    int slotno;

#ifdef DEBUG_CTLRDUMB
    dumpIOReq("controller_passthru_event_arrive", curr );
    fflush(outputfile );
#endif

    switch (curr->type) {

    case IO_INTERRUPT_COMPLETE:
        currctlr->outbusowned = controller_get_downward_busno(currctlr, curr, NULL);
        controller_send_event_down_path(currctlr, curr, PASSTHRU_DELAY);
        currctlr->outbusowned = -1;
        break;

    case IO_ACCESS_ARRIVE:
        /*
        fprintf (outputfile, "Following passthru_event path, and passing access down\n");
        */
        controller_send_event_down_path(currctlr, curr, PASSTHRU_DELAY);
        break;

    case IO_INTERRUPT_ARRIVE:
        if (curr->cause == READY_TO_TRANSFER) {
            curr->cause = RECONNECT;
        }
        controller_send_event_up_path(currctlr, curr, PASSTHRU_DELAY);
        break;

    case DEVICE_DATA_TRANSFER_COMPLETE:
        controller_send_event_up_path(currctlr, curr, (double) 0.0);
        break;

    case IO_QLEN_MAXCHECK:
        busno = controller_get_downward_busno(currctlr, curr, &slotno);
        bus_deliver_event(busno, slotno, curr);
        break;

    default:
        fprintf(stderr, "Unknown event type arriving at passthru controller: %d\n", curr->type);
        exit(1);
    }
}
Exemplo n.º 5
0
static void controller_53c700_reconnection_complete (controller *currctlr, ioreq_event *curr)
{
    int read = curr->flags & READ;

#ifdef DEBUG_CTLRDUMB
    fprintf (outputfile, "*** %f: controller_53c700_reconnection_complete - devno %d, blkno %d\n, bcount %d, flags 0x%x\n", simtime, curr->devno, curr->blkno, curr->bcount, curr->flags );
    fflush( outputfile );
#endif

    ASSERT(currctlr->state == RECONNECTING);
    currctlr->outbusowned = controller_get_downward_busno(currctlr, curr, NULL);
    controller_send_event_down_path(currctlr, curr, currctlr->ovrhd_disk_reconnect);
    currctlr->outbusowned = -1;
    currctlr->state = (read) ? READ_DATA_TRANSFER : WRITE_DATA_TRANSFER;
}
Exemplo n.º 6
0
static void controller_53c700_ready_to_transfer (controller *currctlr, ioreq_event *curr)
{
#ifdef DEBUG_CTLRDUMB
    fprintf (outputfile, "*** %f: controller_53c700_ready_to_transfer - devno %d, blkno %d\n, bcount %d, flags 0x%x\n", simtime, curr->devno, curr->blkno, curr->bcount, curr->flags );
    fflush( outputfile );
#endif

    ASSERT(currctlr->state == REQUEST_PENDING);
    currctlr->state = (curr->flags & READ) ? READ_DATA_TRANSFER : WRITE_DATA_TRANSFER;
    curr->type = IO_INTERRUPT_COMPLETE;
    curr->cause = RECONNECT;
    currctlr->outbusowned = controller_get_downward_busno(currctlr, curr, NULL);
    controller_send_event_down_path(currctlr, curr, currctlr->ovrhd_disk_ready);
    /* shouldn't we also be sending a message up the path?? ovrhd_ready?? */
    currctlr->outbusowned = -1;
}
Exemplo n.º 7
0
void controller_53c700_event_arrive (controller *currctlr, ioreq_event *curr)
{
    int busno;
    int slotno;

#ifdef DEBUG_CTLRDUMB
    dumpIOReq("controller_53c700_event_arrive", curr );
    fflush(outputfile );
#endif

    switch (curr->type) {

    case IO_ACCESS_ARRIVE:
        controller_53c700_request_arrive(currctlr, curr);
        break;

    case IO_INTERRUPT_ARRIVE:
        controller_53c700_interrupt_arrive(currctlr, curr);
        break;

    case IO_INTERRUPT_COMPLETE:
        controller_53c700_interrupt_complete(currctlr, curr);
        break;

    case DEVICE_DATA_TRANSFER_COMPLETE:
        controller_53c700_data_transfer(currctlr, curr);
        break;

    case CONTROLLER_DATA_TRANSFER_COMPLETE:
        controller_53c700_data_transfer_complete(currctlr, curr);
        break;

    case IO_QLEN_MAXCHECK:
        busno = controller_get_downward_busno(currctlr, curr, &slotno);
        bus_deliver_event(busno, slotno, curr);
        break;

    default:
        fprintf(stderr, "Unknown event type arriving at 53c700 controller: %d\n", curr->type);
        exit(1);
    }
}