2004-02-05 08:25:45 +01:00
|
|
|
/*
|
2005-06-05 11:16:00 +02:00
|
|
|
* Copyright (c) 2004-2005 The Regents of The University of Michigan
|
2004-02-05 08:25:45 +01:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are
|
|
|
|
* met: redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer;
|
|
|
|
* redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution;
|
|
|
|
* neither the name of the copyright holders nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived from
|
|
|
|
* this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
2006-06-01 01:26:56 +02:00
|
|
|
*
|
|
|
|
* Authors: Andrew Schultz
|
|
|
|
* Ali Saidi
|
2004-02-05 08:25:45 +01:00
|
|
|
*/
|
2004-02-04 21:03:50 +01:00
|
|
|
|
|
|
|
/* @file
|
|
|
|
* PCI Configspace implementation
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "base/trace.hh"
|
2011-04-15 19:44:32 +02:00
|
|
|
#include "debug/PciConfigAll.hh"
|
2004-02-04 21:03:50 +01:00
|
|
|
#include "dev/pciconfigall.hh"
|
2004-11-23 04:32:37 +01:00
|
|
|
#include "dev/pcireg.h"
|
2006-04-11 19:42:47 +02:00
|
|
|
#include "dev/platform.hh"
|
|
|
|
#include "mem/packet.hh"
|
2006-10-20 08:38:45 +02:00
|
|
|
#include "mem/packet_access.hh"
|
2007-07-24 06:51:38 +02:00
|
|
|
#include "params/PciConfigAll.hh"
|
2004-02-04 21:03:50 +01:00
|
|
|
#include "sim/system.hh"
|
|
|
|
|
2007-08-30 21:16:59 +02:00
|
|
|
PciConfigAll::PciConfigAll(const Params *p)
|
2013-07-12 04:57:04 +02:00
|
|
|
: BasicPioDevice(p, p->size)
|
2004-02-04 21:03:50 +01:00
|
|
|
{
|
2013-07-12 04:56:24 +02:00
|
|
|
// the pio_addr Python parameter is ignored, and overridden by
|
|
|
|
// this caluclated value
|
2009-02-01 09:02:21 +01:00
|
|
|
pioAddr = p->platform->calcPciConfigAddr(params()->bus,0,0);
|
2004-02-04 21:03:50 +01:00
|
|
|
}
|
|
|
|
|
2004-11-23 04:32:37 +01:00
|
|
|
|
2006-04-11 19:42:47 +02:00
|
|
|
Tick
|
2006-10-20 09:10:12 +02:00
|
|
|
PciConfigAll::read(PacketPtr pkt)
|
2004-02-04 21:03:50 +01:00
|
|
|
{
|
2006-07-06 20:41:01 +02:00
|
|
|
DPRINTF(PciConfigAll, "read va=%#x size=%d\n", pkt->getAddr(),
|
2006-05-26 20:17:33 +02:00
|
|
|
pkt->getSize());
|
2006-04-11 19:42:47 +02:00
|
|
|
|
2006-05-26 20:17:33 +02:00
|
|
|
switch (pkt->getSize()) {
|
2006-04-11 19:42:47 +02:00
|
|
|
case sizeof(uint32_t):
|
2006-07-06 20:41:01 +02:00
|
|
|
pkt->set<uint32_t>(0xFFFFFFFF);
|
2006-04-11 19:42:47 +02:00
|
|
|
break;
|
|
|
|
case sizeof(uint16_t):
|
2006-07-06 20:41:01 +02:00
|
|
|
pkt->set<uint16_t>(0xFFFF);
|
2006-04-11 19:42:47 +02:00
|
|
|
break;
|
|
|
|
case sizeof(uint8_t):
|
2006-07-06 20:41:01 +02:00
|
|
|
pkt->set<uint8_t>(0xFF);
|
2006-04-11 19:42:47 +02:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
panic("invalid access size(?) for PCI configspace!\n");
|
2004-02-04 21:03:50 +01:00
|
|
|
}
|
2007-06-30 19:16:18 +02:00
|
|
|
pkt->makeAtomicResponse();
|
2013-07-12 04:56:24 +02:00
|
|
|
return pioDelay;
|
2004-02-04 21:03:50 +01:00
|
|
|
}
|
|
|
|
|
2006-04-11 19:42:47 +02:00
|
|
|
Tick
|
2006-10-20 09:10:12 +02:00
|
|
|
PciConfigAll::write(PacketPtr pkt)
|
2004-02-04 21:03:50 +01:00
|
|
|
{
|
2013-07-12 04:56:24 +02:00
|
|
|
panic("Attempting to write to config space on non-existent device\n");
|
2007-01-27 00:48:51 +01:00
|
|
|
M5_DUMMY_RETURN
|
2004-02-04 21:03:50 +01:00
|
|
|
}
|
|
|
|
|
2007-01-27 00:48:51 +01:00
|
|
|
|
2004-02-05 08:25:45 +01:00
|
|
|
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
|
|
|
|
2007-07-24 06:51:38 +02:00
|
|
|
PciConfigAll *
|
|
|
|
PciConfigAllParams::create()
|
2004-02-04 21:03:50 +01:00
|
|
|
{
|
2007-08-30 21:16:59 +02:00
|
|
|
return new PciConfigAll(this);
|
2004-02-04 21:03:50 +01:00
|
|
|
}
|
|
|
|
|
2004-02-05 08:25:45 +01:00
|
|
|
#endif // DOXYGEN_SHOULD_SKIP_THIS
|