2 * Copyright (c) 2004-2005 The Regents of The University of Michigan
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;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 * Isa Fake Device implementation
37 #include "base/trace.hh"
38 #include "cpu/exec_context.hh"
39 #include "dev/isa_fake.hh"
40 #include "mem/bus/bus.hh"
41 #include "mem/bus/pio_interface.hh"
42 #include "mem/bus/pio_interface_impl.hh"
43 #include "mem/functional/memory_control.hh"
44 #include "sim/builder.hh"
45 #include "sim/system.hh"
49 IsaFake::IsaFake(const string
&name
, Addr a
, MemoryController
*mmu
,
50 HierParams
*hier
, Bus
*bus
, Addr size
)
51 : PioDevice(name
, NULL
), addr(a
)
53 mmu
->add_child(this, RangeSize(addr
, size
));
56 pioInterface
= newPioInterface(name
+ ".pio", hier
, bus
, this,
57 &IsaFake::cacheAccess
);
58 pioInterface
->addAddrRange(RangeSize(addr
, size
));
63 IsaFake::read(MemReqPtr
&req
, uint8_t *data
)
65 DPRINTF(Tsunami
, "read va=%#x size=%d\n",
66 req
->vaddr
, req
->size
);
69 Addr daddr
= (req
->paddr
- (addr
& EV5::PAddrImplMask
)) >> 6;
74 case sizeof(uint64_t):
75 *(uint64_t*)data
= 0xFFFFFFFFFFFFFFFFULL
;
77 case sizeof(uint32_t):
78 *(uint32_t*)data
= 0xFFFFFFFF;
80 case sizeof(uint16_t):
81 *(uint16_t*)data
= 0xFFFF;
84 *(uint8_t*)data
= 0xFF;
88 panic("invalid access size(?) for PCI configspace!\n");
90 DPRINTFN("Isa FakeSMC ERROR: read daddr=%#x size=%d\n", daddr
, req
->size
);
96 IsaFake::write(MemReqPtr
&req
, const uint8_t *data
)
98 DPRINTF(Tsunami
, "write - va=%#x size=%d \n",
99 req
->vaddr
, req
->size
);
101 //:Addr daddr = (req->paddr & addr_mask) >> 6;
107 IsaFake::cacheAccess(MemReqPtr
&req
)
112 BEGIN_DECLARE_SIM_OBJECT_PARAMS(IsaFake
)
114 SimObjectParam
<MemoryController
*> mmu
;
116 SimObjectParam
<Bus
*> io_bus
;
117 Param
<Tick
> pio_latency
;
118 SimObjectParam
<HierParams
*> hier
;
121 END_DECLARE_SIM_OBJECT_PARAMS(IsaFake
)
123 BEGIN_INIT_SIM_OBJECT_PARAMS(IsaFake
)
125 INIT_PARAM(mmu
, "Memory Controller"),
126 INIT_PARAM(addr
, "Device Address"),
127 INIT_PARAM_DFLT(io_bus
, "The IO Bus to attach to", NULL
),
128 INIT_PARAM_DFLT(pio_latency
, "Programmed IO latency", 1000),
129 INIT_PARAM_DFLT(hier
, "Hierarchy global variables", &defaultHierParams
),
130 INIT_PARAM_DFLT(size
, "Size of address range", 0x8)
132 END_INIT_SIM_OBJECT_PARAMS(IsaFake
)
134 CREATE_SIM_OBJECT(IsaFake
)
136 return new IsaFake(getInstanceName(), addr
, mmu
, hier
, io_bus
, size
);
139 REGISTER_SIM_OBJECT("IsaFake", IsaFake
)