intdev.hh (5633:e1605152cc54) intdev.hh (5651:7f0c8006c3d7)
1/*
2 * Copyright (c) 2008 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;

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

27 *
28 * Authors: Gabe Black
29 */
30
31#ifndef __DEV_X86_INTDEV_HH__
32#define __DEV_X86_INTDEV_HH__
33
34#include <assert.h>
1/*
2 * Copyright (c) 2008 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;

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

27 *
28 * Authors: Gabe Black
29 */
30
31#ifndef __DEV_X86_INTDEV_HH__
32#define __DEV_X86_INTDEV_HH__
33
34#include <assert.h>
35#include <string>
35
36
37#include "arch/x86/x86_traits.hh"
38#include "mem/mem_object.hh"
39#include "mem/mport.hh"
36#include "sim/sim_object.hh"
37#include "params/X86IntPin.hh"
38
39namespace X86ISA {
40
41class IntDev
42{
40#include "sim/sim_object.hh"
41#include "params/X86IntPin.hh"
42
43namespace X86ISA {
44
45class IntDev
46{
47 protected:
48 class IntPort : public MessagePort
49 {
50 IntDev * device;
51 Tick latency;
52 Addr intAddr;
53 public:
54 IntPort(const std::string &_name, MemObject * _parent,
55 IntDev *dev, Tick _latency) :
56 MessagePort(_name, _parent), device(dev), latency(_latency)
57 {
58 }
59
60 void getDeviceAddressRanges(AddrRangeList &resp, bool &snoop)
61 {
62 snoop = false;
63 device->getIntAddrRange(resp);
64 }
65
66 Tick recvMessage(PacketPtr pkt)
67 {
68 return device->recvMessage(pkt);
69 }
70
71 void recvStatusChange(Status status)
72 {
73 if (status == RangeChange) {
74 sendStatusChange(Port::RangeChange);
75 }
76 }
77
78 };
79
80 IntPort * intPort;
81
43 public:
82 public:
83 IntDev(MemObject * parent, Tick latency = 0)
84 {
85 if (parent != NULL) {
86 intPort = new IntPort(parent->name() + ".int_port",
87 parent, this, latency);
88 } else {
89 intPort = NULL;
90 }
91 }
92
44 virtual ~IntDev()
45 {}
93 virtual ~IntDev()
94 {}
95
46 virtual void
96 virtual void
47 signalInterrupt(int line) = 0;
97 signalInterrupt(int line)
98 {
99 panic("signalInterrupt not implemented.\n");
100 }
101
102 virtual Tick
103 recvMessage(PacketPtr pkt)
104 {
105 panic("recvMessage not implemented.\n");
106 return 0;
107 }
108
109 virtual void
110 getIntAddrRange(AddrRangeList &range_list)
111 {
112 panic("intAddrRange not implemented.\n");
113 }
48};
49
50class IntPin : public SimObject
51{
52 protected:
53 IntDev * device;
54 int line;
55

--- 25 unchanged lines hidden ---
114};
115
116class IntPin : public SimObject
117{
118 protected:
119 IntDev * device;
120 int line;
121

--- 25 unchanged lines hidden ---