dev/ns_gige.cc
dev/pciconfigall.cc
dev/pcidev.cc
+ dev/pcifake.cc
dev/pktfifo.cc
- dev/platform.cc
+ dev/platform.cc
dev/sinic.cc
dev/simple_disk.cc
dev/tsunami.cc
switch (size) {
case sizeof(uint8_t):
- case sizeof(uint16_t):
- case sizeof(uint32_t):
memcpy(&byte, &pci_config_regs.data[config_offset], size);
- break;
-
- default:
- panic("Invalid PCI configuration read size!\n");
- }
-
- switch (size) {
- case sizeof(uint8_t):
*data = byte;
break;
case sizeof(uint16_t):
+ memcpy(&byte, &pci_config_regs.data[config_offset], size);
*(uint16_t*)data = htoa(word);
break;
case sizeof(uint32_t):
+ memcpy(&byte, &pci_config_regs.data[config_offset], size);
*(uint32_t*)data = htoa(dword);
break;
+ default:
+ panic("Invalid PCI configuration read size!\n");
}
DPRINTF(IdeCtrl, "PCI read offset: %#x size: %#x data: %#x\n",
RegType_t type;
int disk;
+
+ /* union
+ * +-- --+-- --+-- --+-- --+
+ * | 0 | 1 | 2 | 3 |
+ * +-- --+-- --+-- --+-- --+
+ * | byte | .. | .. | .. |
+ * +-- --+-- --+-- --+-- --+
+ * | word0 | word1 |
+ * +-- --+-- --+
+ * | dword |
+ * +-- --+
+ */
union {
uint8_t byte;
uint16_t word[2];
uint32_t dword;
};
+ dword = 0;
+
parseAddr(req->paddr, offset, primary, type);
if (!io_enabled)
return No_Fault;
- // sanity check the size (allows byte, word, or dword access)
- switch (req->size) {
- case sizeof(uint8_t):
- case sizeof(uint16_t):
- case sizeof(uint32_t):
- break;
- default:
- panic("IDE controller read of invalid size: %#x\n", req->size);
- }
-
switch (type) {
case BMI_BLOCK:
- memcpy(&byte, &bmi_regs[offset], req->size);
switch (req->size) {
case sizeof(uint8_t):
+ memcpy(&byte, &bmi_regs[offset], sizeof(uint8_t));
*data = byte;
break;
case sizeof(uint16_t):
+ memcpy(&byte, &bmi_regs[offset], sizeof(uint16_t));
*(uint16_t*)data = htoa(word[0]);
break;
case sizeof(uint32_t):
+ memcpy(&byte, &bmi_regs[offset], sizeof(uint32_t));
*(uint32_t*)data = htoa(dword);
break;
+ default:
+ panic("IDE read of BMI reg invalid size: %#x\n", req->size);
}
break;
byte = (req->size == sizeof(uint8_t)) ? true : false;
cmdBlk = (type == COMMAND_BLOCK) ? true : false;
- DPRINTF(IdeCtrl, "write from offset: %#x size: %#x data: %#x\n",
+ DPRINTF(IdeCtrl, "write to offset: %#x size: %#x data: %#x\n",
offset, req->size,
(*(uint32_t *)data) & (0xffffffff >> 8 * (4 - req->size)));
switch (offset) {
// Data transfers occur 16 bits at a time
case DATA_OFFSET:
- // use memcpy to preserve little-endianess
+ // use memcpy to preserve IDE's little-endianess
memcpy(data, &cmdReg.data, sizeof(uint16_t));
break;
- // All other transfers are 8 bit
+ // All other transfers are 8-bit
case ERROR_OFFSET:
*data = cmdReg.error;
break;
else {
switch (req->size) {
case sizeof(uint8_t):
- word_value = *(uint8_t*)data & 0x000000FF;
+ word_value = *(uint8_t*)data;
break;
case sizeof(uint16_t):
- word_value = *(uint16_t*)data & 0x0000FFFF;
+ word_value = *(uint16_t*)data;
break;
case sizeof(uint32_t):
word_value = *(uint32_t*)data;
PciDev::ReadConfig(int offset, int size, uint8_t *data)
{
union {
- uint8_t byte;
- uint16_t word;
- uint32_t dword;
+ uint8_t byte;
+ uint16_t word;
+ uint32_t dword;
};
- dword = 0;
-
if (offset >= PCI_DEVICE_SPECIFIC)
panic("Device specific PCI config space not implemented!\n");
- switch(size) {
- case sizeof(uint8_t):
- case sizeof(uint16_t):
- case sizeof(uint32_t):
- memcpy(&byte, &config.data[offset], size);
- break;
-
- default:
- panic("Invalid PCI configuration read size!\n");
- }
+ dword = 0;
switch(size) {
case sizeof(uint8_t):
+ memcpy(&byte, &config.data[offset], size);
*data = byte;
break;
case sizeof(uint16_t):
+ memcpy(&byte, &config.data[offset], size);
*(uint16_t*)data = htoa(word);
break;
case sizeof(uint32_t):
+ memcpy(&byte, &config.data[offset], size);
*(uint32_t*)data = htoa(dword);
break;
+ default:
+ panic("Invalid PCI configuration read size!\n");
}
DPRINTF(PCIDEV,
uint32_t barnum;
- uint8_t byte_value = data;
- uint16_t half_value = data;
- uint32_t word_value = data;
+ uint8_t byte_value;
+ uint16_t half_value;
+ uint32_t word_value;
DPRINTF(PCIDEV,
"write device: %#x function: %#x reg: %#x size: %d data: %#x\n",
switch (size) {
case sizeof(uint8_t): // 1-byte access
+ byte_value = data;
switch (offset) {
case PCI0_INTERRUPT_LINE:
case PCI_CACHE_LINE_SIZE:
break;
case sizeof(uint16_t): // 2-byte access
+ half_value = data;
switch (offset) {
case PCI_COMMAND:
case PCI_STATUS:
break;
case sizeof(uint32_t): // 4-byte access
+ word_value = data;
switch (offset) {
case PCI0_BASE_ADDR0:
case PCI0_BASE_ADDR1:
tm.tm_sec = (tm.tm_sec + 1) % 60;
intr_count = (intr_count + 1) % 1024;
-
}
const char *
return No_Fault;
case RTC_CNTRL_REGD:
panic("RTC Control Register D not implemented");
- case RTC_SEC:
- *(uint8_t *)data = tm.tm_sec;
- return No_Fault;
case RTC_SEC_ALRM:
case RTC_MIN_ALRM:
case RTC_HR_ALRM:
// RTC alarm functionality is not currently implemented
*(uint8_t *)data = 0x00;
return No_Fault;
+ case RTC_SEC:
+ *(uint8_t *)data = tm.tm_sec;
+ return No_Fault;
case RTC_MIN:
*(uint8_t *)data = tm.tm_min;
return No_Fault;
void
Uart8250::IntrEvent::scheduleIntr()
{
- static const Tick interval = (Tick)((Clock::Float::s / 2e9) * 600);
+ static const Tick interval = (Tick)((Clock::Float::s / 2e9) * 450);
DPRINTF(Uart, "Scheduling IER interrupt for %#x, at cycle %lld\n", intrBit,
curTick + interval);
if (!scheduled())
pci_func = Param.Int("PCI function code")
configdata = Param.PciConfigData(Parent.any, "PCI Config data")
configspace = Param.PciConfigAll(Parent.any, "PCI Configspace")
+
+class PciFake(PciDevice):
+ type = 'PciFake'