amba_device.cc (8245:a9d06c894afe) amba_device.cc (9806:3f262c18ad5d)
1/*
2 * Copyright (c) 2010 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

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

44#include "debug/AMBA.hh"
45#include "dev/arm/amba_device.hh"
46#include "dev/arm/amba_fake.hh"
47#include "mem/packet.hh"
48#include "mem/packet_access.hh"
49
50const uint64_t AmbaVendor = ULL(0xb105f00d00000000);
51
1/*
2 * Copyright (c) 2010 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

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

44#include "debug/AMBA.hh"
45#include "dev/arm/amba_device.hh"
46#include "dev/arm/amba_fake.hh"
47#include "mem/packet.hh"
48#include "mem/packet_access.hh"
49
50const uint64_t AmbaVendor = ULL(0xb105f00d00000000);
51
52AmbaDevice::AmbaDevice(const Params *p)
52AmbaPioDevice::AmbaPioDevice(const Params *p)
53 : BasicPioDevice(p), ambaId(AmbaVendor | p->amba_id)
54{
55}
56
57AmbaIntDevice::AmbaIntDevice(const Params *p)
53 : BasicPioDevice(p), ambaId(AmbaVendor | p->amba_id)
54{
55}
56
57AmbaIntDevice::AmbaIntDevice(const Params *p)
58 : AmbaDevice(p), intNum(p->int_num), gic(p->gic), intDelay(p->int_delay)
58 : AmbaPioDevice(p), intNum(p->int_num), gic(p->gic), intDelay(p->int_delay)
59{
60}
61
62
63
64AmbaDmaDevice::AmbaDmaDevice(const Params *p)
65 : DmaDevice(p), ambaId(AmbaVendor | p->amba_id),
66 pioAddr(p->pio_addr), pioSize(0),
67 pioDelay(p->pio_latency),intNum(p->int_num), gic(p->gic)
68{
69}
70
59{
60}
61
62
63
64AmbaDmaDevice::AmbaDmaDevice(const Params *p)
65 : DmaDevice(p), ambaId(AmbaVendor | p->amba_id),
66 pioAddr(p->pio_addr), pioSize(0),
67 pioDelay(p->pio_latency),intNum(p->int_num), gic(p->gic)
68{
69}
70
71namespace AmbaDev {
72bool
71bool
73readId(PacketPtr pkt, uint64_t amba_id, Addr pio_addr)
72AmbaDevice::readId(PacketPtr pkt, uint64_t amba_id, Addr pio_addr)
74{
75 Addr daddr = pkt->getAddr() - pio_addr;
76 if (daddr < AMBA_PER_ID0 || daddr > AMBA_CEL_ID3)
77 return false;
78
79 pkt->allocate();
80
81 int byte = (daddr - AMBA_PER_ID0) << 1;
82 // Too noisy right now
73{
74 Addr daddr = pkt->getAddr() - pio_addr;
75 if (daddr < AMBA_PER_ID0 || daddr > AMBA_CEL_ID3)
76 return false;
77
78 pkt->allocate();
79
80 int byte = (daddr - AMBA_PER_ID0) << 1;
81 // Too noisy right now
83 DPRINTF(AMBA, "Returning %#x for offset %#x(%d)\n", (amba_id >> byte) & 0xFF,
82 DPRINTF(AMBA, "Returning %#x for offset %#x(%d)\n",
83 (amba_id >> byte) & 0xFF,
84 pkt->getAddr() - pio_addr, byte);
85 assert(pkt->getSize() == 4);
86 pkt->set<uint32_t>((amba_id >> byte) & 0xFF);
87 return true;
88}
84 pkt->getAddr() - pio_addr, byte);
85 assert(pkt->getSize() == 4);
86 pkt->set<uint32_t>((amba_id >> byte) & 0xFF);
87 return true;
88}
89
90} // namespace AmbaDev