io_device.hh (2901:f9a45473ab55) io_device.hh (2914:2c524dc023d2)
1/*
2 * Copyright (c) 2004-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 23 unchanged lines hidden (view full) ---

32#ifndef __DEV_IO_DEVICE_HH__
33#define __DEV_IO_DEVICE_HH__
34
35#include "base/chunk_generator.hh"
36#include "mem/mem_object.hh"
37#include "mem/packet_impl.hh"
38#include "sim/eventq.hh"
39#include "sim/sim_object.hh"
1/*
2 * Copyright (c) 2004-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 23 unchanged lines hidden (view full) ---

32#ifndef __DEV_IO_DEVICE_HH__
33#define __DEV_IO_DEVICE_HH__
34
35#include "base/chunk_generator.hh"
36#include "mem/mem_object.hh"
37#include "mem/packet_impl.hh"
38#include "sim/eventq.hh"
39#include "sim/sim_object.hh"
40#include "mem/tport.hh"
40
41class Platform;
42class PioDevice;
43class DmaDevice;
44class System;
45
46/**
47 * The PioPort class is a programmed i/o port that all devices that are
48 * sensitive to an address range use. The port takes all the memory
49 * access types and roles them into one read() and write() call that the device
50 * must respond to. The device must also provide the addressRanges() function
41
42class Platform;
43class PioDevice;
44class DmaDevice;
45class System;
46
47/**
48 * The PioPort class is a programmed i/o port that all devices that are
49 * sensitive to an address range use. The port takes all the memory
50 * access types and roles them into one read() and write() call that the device
51 * must respond to. The device must also provide the addressRanges() function
51 * with which it returns the address ranges it is interested in. An extra
52 * sendTiming() function is implemented which takes an delay. In this way the
53 * device can immediatly call sendTiming(pkt, time) after processing a request
54 * and the request will be handled by the port even if the port bus the device
55 * connects to is blocked.
56 */
57class PioPort : public Port
52 * with which it returns the address ranges it is interested in. */
53
54class PioPort : public SimpleTimingPort
58{
59 protected:
60 /** The device that this port serves. */
61 PioDevice *device;
62
63 /** The system that device/port are in. This is used to select which mode
64 * we are currently operating in. */
65 System *sys;
66
55{
56 protected:
57 /** The device that this port serves. */
58 PioDevice *device;
59
60 /** The system that device/port are in. This is used to select which mode
61 * we are currently operating in. */
62 System *sys;
63
67 /** A list of outgoing timing response packets that haven't been serviced
68 * yet. */
69 std::list<Packet*> transmitList;
70
71 /** The current status of the peer(bus) that we are connected to. */
72 Status peerStatus;
73
74 virtual bool recvTiming(Packet *pkt);
75
76 virtual Tick recvAtomic(Packet *pkt);
77
78 virtual void recvFunctional(Packet *pkt) ;
79
80 virtual void recvStatusChange(Status status)
81 { peerStatus = status; }
82
83 virtual void getDeviceAddressRanges(AddrRangeList &resp, AddrRangeList &snoop);
84
64 /** The current status of the peer(bus) that we are connected to. */
65 Status peerStatus;
66
67 virtual bool recvTiming(Packet *pkt);
68
69 virtual Tick recvAtomic(Packet *pkt);
70
71 virtual void recvFunctional(Packet *pkt) ;
72
73 virtual void recvStatusChange(Status status)
74 { peerStatus = status; }
75
76 virtual void getDeviceAddressRanges(AddrRangeList &resp, AddrRangeList &snoop);
77
85 void resendNacked(Packet *pkt);
86
87 /**
88 * This class is used to implemented sendTiming() with a delay. When a delay
89 * is requested a new event is created. When the event time expires it
90 * attempts to send the packet. If it cannot, the packet is pushed onto the
91 * transmit list to be sent when recvRetry() is called. */
92 class SendEvent : public Event
93 {
94 PioPort *port;
95 Packet *packet;
96
97 SendEvent(PioPort *p, Packet *pkt, Tick t)
98 : Event(&mainEventQueue), port(p), packet(pkt)
99 { schedule(curTick + t); }
100
101 virtual void process();
102
103 virtual const char *description()
104 { return "Future scheduled sendTiming event"; }
105
106 friend class PioPort;
107 };
108
109 /** Number of timing requests that are emulating the device timing before
110 * attempting to end up on the bus.
111 */
112 int outTiming;
113
114 /** If we need to drain, keep the drain event around until we're done
115 * here.*/
116 Event *drainEvent;
117
118 /** Schedule a sendTiming() event to be called in the future. */
119 void sendTiming(Packet *pkt, Tick time)
120 { outTiming++; new PioPort::SendEvent(this, pkt, time); }
121
122 /** This function is notification that the device should attempt to send a
123 * packet again. */
124 virtual void recvRetry();
125
126 public:
127 PioPort(PioDevice *dev, System *s, std::string pname = "-pioport");
128
78 public:
79 PioPort(PioDevice *dev, System *s, std::string pname = "-pioport");
80
129 unsigned int drain(Event *de);
130
131 friend class PioPort::SendEvent;
132};
133
134
135class DmaPort : public Port
136{
137 protected:
138 struct DmaReqState : public Packet::SenderState
139 {

--- 219 unchanged lines hidden ---
81};
82
83
84class DmaPort : public Port
85{
86 protected:
87 struct DmaReqState : public Packet::SenderState
88 {

--- 219 unchanged lines hidden ---