gem5  v22.1.0.0
lupio_blk.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021 The Regents of the University of California
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;
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.
15  *
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.
27  */
28 
29 #ifndef __DEV_LUPIO_LUPIO_BLK_HH__
30 #define __DEV_LUPIO_LUPIO_BLK_HH__
31 
32 #include "debug/LupioBLK.hh"
33 #include "dev/dma_device.hh"
34 #include "dev/io_device.hh"
35 #include "dev/lupio/lupio_pic.hh"
36 #include "dev/platform.hh"
38 #include "params/LupioBLK.hh"
39 #include "sim/system.hh"
40 
41 namespace gem5
42 {
43 
50 class LupioBLK : public DmaDevice
51 {
52  protected:
53  const ByteOrder byteOrder = ByteOrder::little;
61 
62  void dmaEventDone();
63 
64  // Register map
65  private:
66  enum
67  {
69 
73 
76  };
77 
78  int reqLen = 0;
79  uint8_t *reqData = nullptr;
80 
81  uint64_t nbBlocks = 0;
82  uint32_t nblk = 0;
83  uint32_t lba = 0;
84  Addr mem = 0;
85 
86  bool writeOp = false;
87  bool err = false;
88  bool busy = false;
92  uint64_t lupioBLKRead(const uint8_t addr);
97  void lupioBLKWrite(const uint8_t addr, uint64_t val64);
102  void lupioBLKCmd(void);
103 
104  public:
106  LupioBLK(const Params &params);
107 
111  AddrRangeList getAddrRanges() const override;
112  Tick read(PacketPtr pkt) override;
113  Tick write(PacketPtr pkt) override;
114 };
115 
116 } // namespace gem5
117 
118 #endif // __DEV_LUPIO_LUPIO_BLK_HH_
Basic interface for accessing a disk image.
Definition: disk_image.hh:53
DmaDeviceParams Params
Definition: dma_device.hh:209
LupioBLK: A virtual block device which aims to provide a disk-like interface for second-level storage...
Definition: lupio_blk.hh:51
uint32_t lba
Definition: lupio_blk.hh:83
void dmaEventDone()
Definition: lupio_blk.cc:71
void lupioBLKCmd(void)
Function to initiate and direct the transfer of data by the DMA device.
Definition: lupio_blk.cc:172
uint32_t nblk
Definition: lupio_blk.hh:82
AddrRangeList getAddrRanges() const override
Implement BasicPioDevice virtual functions.
Definition: lupio_blk.cc:200
uint64_t nbBlocks
Definition: lupio_blk.hh:81
uint8_t * reqData
Definition: lupio_blk.hh:79
void lupioBLKWrite(const uint8_t addr, uint64_t val64)
Function to write to registers containing data pertaining to block transfers.
Definition: lupio_blk.cc:134
Tick write(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: lupio_blk.cc:223
LupioBLK(const Params &params)
Definition: lupio_blk.cc:53
const ByteOrder byteOrder
Definition: lupio_blk.hh:53
uint64_t lupioBLKRead(const uint8_t addr)
Function to return data pertaining to blocks being transferred.
Definition: lupio_blk.cc:88
DiskImage & image
Definition: lupio_blk.hh:59
PARAMS(LupioBLK)
Tick read(PacketPtr pkt) override
Pure virtual function that the device must implement.
Definition: lupio_blk.cc:207
Platform * platform
Definition: lupio_blk.hh:54
EventFunctionWrapper dmaEvent
Definition: lupio_blk.hh:55
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:294
Disk Image Interfaces.
const Params & params() const
Definition: sim_object.hh:176
Bitfield< 3 > addr
Definition: types.hh:84
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
uint64_t Tick
Tick count type.
Definition: types.hh:58
Generic interface for platforms.

Generated on Wed Dec 21 2022 10:22:33 for gem5 by doxygen 1.9.1