Merge zizzer:/bk/linux into zower.eecs.umich.edu:/z/hsul/work/bk/linux
--HG-- extra : convert_revision : 7af5650ceae277ce838e778bba1fba86285d6dca
This commit is contained in:
commit
b45fd9c541
2 changed files with 20 additions and 19 deletions
|
@ -40,7 +40,6 @@
|
||||||
#include "base/str.hh" // for to_number
|
#include "base/str.hh" // for to_number
|
||||||
#include "base/trace.hh"
|
#include "base/trace.hh"
|
||||||
#include "dev/pciareg.h"
|
#include "dev/pciareg.h"
|
||||||
#include "dev/scsi_ctrl.hh"
|
|
||||||
#include "dev/pcidev.hh"
|
#include "dev/pcidev.hh"
|
||||||
#include "dev/pciconfigall.hh"
|
#include "dev/pciconfigall.hh"
|
||||||
#include "mem/functional_mem/memory_control.hh"
|
#include "mem/functional_mem/memory_control.hh"
|
||||||
|
@ -53,8 +52,8 @@ using namespace std;
|
||||||
|
|
||||||
PciDev::PciDev(const string &name, MemoryController *mmu, PciConfigAll *cf,
|
PciDev::PciDev(const string &name, MemoryController *mmu, PciConfigAll *cf,
|
||||||
PciConfigData *cd, uint32_t bus, uint32_t dev, uint32_t func)
|
PciConfigData *cd, uint32_t bus, uint32_t dev, uint32_t func)
|
||||||
: FunctionalMemory(name), MMU(mmu), configSpace(cf), configData(cd),
|
: DmaDevice(name), mmu(mmu), configSpace(cf), configData(cd), busNum(bus),
|
||||||
bus(bus), device(dev), function(func)
|
deviceNum(dev), functionNum(func)
|
||||||
{
|
{
|
||||||
// copy the config data from the PciConfigData object
|
// copy the config data from the PciConfigData object
|
||||||
if (cd) {
|
if (cd) {
|
||||||
|
@ -79,21 +78,24 @@ PciDev::ReadConfig(int offset, int size, uint8_t *data)
|
||||||
memcpy((uint32_t*)data, config.data + offset, sizeof(uint32_t));
|
memcpy((uint32_t*)data, config.data + offset, sizeof(uint32_t));
|
||||||
DPRINTF(PCIDEV,
|
DPRINTF(PCIDEV,
|
||||||
"read device: %#x function: %#x register: %#x data: %#x\n",
|
"read device: %#x function: %#x register: %#x data: %#x\n",
|
||||||
device, function, offset, *(uint32_t*)(config.data + offset));
|
deviceNum, functionNum, offset,
|
||||||
|
*(uint32_t*)(config.data + offset));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case sizeof(uint16_t):
|
case sizeof(uint16_t):
|
||||||
memcpy((uint16_t*)data, config.data + offset, sizeof(uint16_t));
|
memcpy((uint16_t*)data, config.data + offset, sizeof(uint16_t));
|
||||||
DPRINTF(PCIDEV,
|
DPRINTF(PCIDEV,
|
||||||
"read device: %#x function: %#x register: %#x data: %#x\n",
|
"read device: %#x function: %#x register: %#x data: %#x\n",
|
||||||
device, function, offset, *(uint16_t*)(config.data + offset));
|
deviceNum, functionNum, offset,
|
||||||
|
*(uint16_t*)(config.data + offset));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case sizeof(uint8_t):
|
case sizeof(uint8_t):
|
||||||
memcpy((uint8_t*)data, config.data + offset, sizeof(uint8_t));
|
memcpy((uint8_t*)data, config.data + offset, sizeof(uint8_t));
|
||||||
DPRINTF(PCIDEV,
|
DPRINTF(PCIDEV,
|
||||||
"read device: %#x function: %#x register: %#x data: %#x\n",
|
"read device: %#x function: %#x register: %#x data: %#x\n",
|
||||||
device, function, offset, (uint16_t)(*(uint8_t*)(config.data + offset)));
|
deviceNum, functionNum, offset,
|
||||||
|
(uint16_t)(*(uint8_t*)(config.data + offset)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -115,7 +117,7 @@ PciDev::WriteConfig(int offset, int size, uint32_t data)
|
||||||
|
|
||||||
DPRINTF(PCIDEV,
|
DPRINTF(PCIDEV,
|
||||||
"write device: %#x function: %#x reg: %#x size: %#x data: %#x\n",
|
"write device: %#x function: %#x reg: %#x size: %#x data: %#x\n",
|
||||||
device, function, offset, size, word_value);
|
deviceNum, functionNum, offset, size, word_value);
|
||||||
|
|
||||||
barnum = (offset - PCI0_BASE_ADDR0) >> 2;
|
barnum = (offset - PCI0_BASE_ADDR0) >> 2;
|
||||||
|
|
||||||
|
@ -184,11 +186,11 @@ PciDev::WriteConfig(int offset, int size, uint32_t data)
|
||||||
|
|
||||||
// It's never been set
|
// It's never been set
|
||||||
if (BARAddrs[barnum] == 0)
|
if (BARAddrs[barnum] == 0)
|
||||||
MMU->add_child(this,
|
mmu->add_child((FunctionalMemory *)this,
|
||||||
Range<Addr>(base_addr,
|
Range<Addr>(base_addr,
|
||||||
base_addr + base_size));
|
base_addr + base_size));
|
||||||
else
|
else
|
||||||
MMU->update_child(this,
|
mmu->update_child((FunctionalMemory *)this,
|
||||||
Range<Addr>(BARAddrs[barnum],
|
Range<Addr>(BARAddrs[barnum],
|
||||||
BARAddrs[barnum] +
|
BARAddrs[barnum] +
|
||||||
base_size),
|
base_size),
|
||||||
|
@ -212,11 +214,11 @@ PciDev::WriteConfig(int offset, int size, uint32_t data)
|
||||||
|
|
||||||
// It's never been set
|
// It's never been set
|
||||||
if (BARAddrs[barnum] == 0)
|
if (BARAddrs[barnum] == 0)
|
||||||
MMU->add_child(this,
|
mmu->add_child((FunctionalMemory *)this,
|
||||||
Range<Addr>(base_addr,
|
Range<Addr>(base_addr,
|
||||||
base_addr + base_size));
|
base_addr + base_size));
|
||||||
else
|
else
|
||||||
MMU->update_child(this,
|
mmu->update_child((FunctionalMemory *)this,
|
||||||
Range<Addr>(BARAddrs[barnum],
|
Range<Addr>(BARAddrs[barnum],
|
||||||
BARAddrs[barnum] +
|
BARAddrs[barnum] +
|
||||||
base_size),
|
base_size),
|
||||||
|
|
|
@ -27,15 +27,14 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* @file
|
/* @file
|
||||||
* PCI configspace devices
|
* Interface for devices using PCI configuration
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __PCI_DEV_HH__
|
#ifndef __PCI_DEV_HH__
|
||||||
#define __PCI_DEV_HH__
|
#define __PCI_DEV_HH__
|
||||||
|
|
||||||
#include "dev/pcireg.h"
|
#include "dev/pcireg.h"
|
||||||
#include "sim/sim_object.hh"
|
#include "dev/io_device.hh"
|
||||||
#include "mem/functional_mem/functional_memory.hh"
|
|
||||||
|
|
||||||
class PciConfigAll;
|
class PciConfigAll;
|
||||||
class MemoryController;
|
class MemoryController;
|
||||||
|
@ -63,15 +62,15 @@ class PciConfigData : public SimObject
|
||||||
* register with it. This object registers with the PCIConfig space
|
* register with it. This object registers with the PCIConfig space
|
||||||
* object.
|
* object.
|
||||||
*/
|
*/
|
||||||
class PciDev : public FunctionalMemory
|
class PciDev : public DmaDevice
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
MemoryController *MMU;
|
MemoryController *mmu;
|
||||||
PciConfigAll *configSpace;
|
PciConfigAll *configSpace;
|
||||||
PciConfigData *configData;
|
PciConfigData *configData;
|
||||||
uint32_t bus;
|
uint32_t busNum;
|
||||||
uint32_t device;
|
uint32_t deviceNum;
|
||||||
uint32_t function;
|
uint32_t functionNum;
|
||||||
|
|
||||||
PCIConfig config;
|
PCIConfig config;
|
||||||
uint32_t BARSize[6];
|
uint32_t BARSize[6];
|
||||||
|
|
Loading…
Reference in a new issue