Deleted Added
sdiff udiff text old ( 3814:33bd4ec9d66a ) new ( 4762:c94e103c83ad )
full compact
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;

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

31/** @file
32 * Isa Fake Device implementation
33 */
34
35#include "base/trace.hh"
36#include "dev/isa_fake.hh"
37#include "mem/packet.hh"
38#include "mem/packet_access.hh"
39#include "sim/system.hh"
40
41using namespace std;
42
43IsaFake::IsaFake(Params *p)
44 : BasicPioDevice(p)
45{
46 if (!p->ret_bad_addr)
47 pioSize = p->pio_size;
48
49 retData8 = p->ret_data8;
50 retData16 = p->ret_data16;
51 retData32 = p->ret_data32;
52 retData64 = p->ret_data64;
53}
54
55Tick
56IsaFake::read(PacketPtr pkt)
57{
58 assert(pkt->result == Packet::Unknown);
59
60 if (params()->warn_access != "")
61 warn("Device %s accessed by read to address %#x size=%d\n",
62 name(), pkt->getAddr(), pkt->getSize());
63 if (params()->ret_bad_addr) {
64 DPRINTF(Tsunami, "read to bad address va=%#x size=%d\n",
65 pkt->getAddr(), pkt->getSize());
66 pkt->result = Packet::BadAddress;
67 } else {
68 assert(pkt->getAddr() >= pioAddr && pkt->getAddr() < pioAddr + pioSize);
69 DPRINTF(Tsunami, "read va=%#x size=%d\n",
70 pkt->getAddr(), pkt->getSize());
71 switch (pkt->getSize()) {

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

87 pkt->result = Packet::Success;
88 }
89 return pioDelay;
90}
91
92Tick
93IsaFake::write(PacketPtr pkt)
94{
95 if (params()->warn_access != "") {
96 uint64_t data;
97 switch (pkt->getSize()) {
98 case sizeof(uint64_t):
99 data = pkt->get<uint64_t>();
100 break;
101 case sizeof(uint32_t):
102 data = pkt->get<uint32_t>();
103 break;

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

108 data = pkt->get<uint8_t>();
109 break;
110 default:
111 panic("invalid access size!\n");
112 }
113 warn("Device %s accessed by write to address %#x size=%d data=%#x\n",
114 name(), pkt->getAddr(), pkt->getSize(), data);
115 }
116 if (params()->ret_bad_addr) {
117 DPRINTF(Tsunami, "write to bad address va=%#x size=%d \n",
118 pkt->getAddr(), pkt->getSize());
119 pkt->result = Packet::BadAddress;
120 } else {
121 DPRINTF(Tsunami, "write - va=%#x size=%d \n",
122 pkt->getAddr(), pkt->getSize());
123
124 if (params()->update_data) {
125 switch (pkt->getSize()) {
126 case sizeof(uint64_t):
127 retData64 = pkt->get<uint64_t>();
128 break;
129 case sizeof(uint32_t):
130 retData32 = pkt->get<uint32_t>();
131 break;
132 case sizeof(uint16_t):

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

139 panic("invalid access size!\n");
140 }
141 }
142 pkt->result = Packet::Success;
143 }
144 return pioDelay;
145}
146
147IsaFake *
148IsaFakeParams::create()
149{
150 return new IsaFake(this);
151}