From: Gabe Black Date: Fri, 12 Oct 2018 12:06:26 +0000 (-0700) Subject: dev: Explicitly specify the endianness for packet accessors. X-Git-Tag: v19.0.0.0~1477 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2bcb2b031d4419e87337b25936a09228955dc715;p=gem5.git dev: Explicitly specify the endianness for packet accessors. Generally speaking, the endianness of the data devices provide or accept is dependent on the device and not the ISA the system executes. This change makes the devices in dev pick an endianness rather than using the guest's. For the ISA bus and the UART, accesses are byte sized and so endianness doesn't matter. The ISA and PCI busses and the devices which use them are defined to be little endian. Change-Id: Ib0aa70f192e1d6f3b886d9f3ad41ae03bddb583f Reviewed-on: https://gem5-review.googlesource.com/c/13462 Reviewed-by: Andreas Sandberg Maintainer: Andreas Sandberg --- diff --git a/src/dev/i2c/bus.cc b/src/dev/i2c/bus.cc index bf8cb8701..ede9d525b 100644 --- a/src/dev/i2c/bus.cc +++ b/src/dev/i2c/bus.cc @@ -72,7 +72,7 @@ I2CBus::read(PacketPtr pkt) { assert(pkt->getAddr() == pioAddr + SB_CONTROLS); - pkt->set((sda << 1) | scl); + pkt->setRaw((sda << 1) | scl); pkt->makeAtomicResponse(); return pioDelay; } @@ -172,7 +172,7 @@ I2CBus::write(PacketPtr pkt) void I2CBus::updateSignals(PacketPtr pkt) { - uint8_t msg = pkt->get(); + uint8_t msg = pkt->getRaw(); Addr daddr = pkt->getAddr() - pioAddr; switch (daddr) { @@ -192,7 +192,7 @@ I2CBus::updateSignals(PacketPtr pkt) bool I2CBus::isClockSet(PacketPtr pkt) const { - uint8_t msg = pkt->get(); + uint8_t msg = pkt->getRaw(); Addr daddr = pkt->getAddr() - pioAddr; return daddr == SB_CONTROLS && (msg & 1); } @@ -200,7 +200,7 @@ I2CBus::isClockSet(PacketPtr pkt) const bool I2CBus::isStart(PacketPtr pkt) const { - uint8_t msg = pkt->get(); + uint8_t msg = pkt->getRaw(); Addr daddr = pkt->getAddr() - pioAddr; return scl && (msg & 2) && daddr == SB_CONTROLC; } @@ -208,7 +208,7 @@ I2CBus::isStart(PacketPtr pkt) const bool I2CBus::isEnd(PacketPtr pkt) const { - uint8_t msg = pkt->get(); + uint8_t msg = pkt->getRaw(); Addr daddr = pkt->getAddr() - pioAddr; return scl && (msg & 2) && daddr == SB_CONTROLS; } diff --git a/src/dev/isa_fake.cc b/src/dev/isa_fake.cc index 92ee19a97..407d08ca4 100644 --- a/src/dev/isa_fake.cc +++ b/src/dev/isa_fake.cc @@ -69,16 +69,16 @@ IsaFake::read(PacketPtr pkt) pkt->getAddr(), pkt->getSize()); switch (pkt->getSize()) { case sizeof(uint64_t): - pkt->set(retData64); + pkt->setLE(retData64); break; case sizeof(uint32_t): - pkt->set(retData32); + pkt->setLE(retData32); break; case sizeof(uint16_t): - pkt->set(retData16); + pkt->setLE(retData16); break; case sizeof(uint8_t): - pkt->set(retData8); + pkt->setLE(retData8); break; default: if (params()->fake_mem) @@ -98,16 +98,16 @@ IsaFake::write(PacketPtr pkt) uint64_t data; switch (pkt->getSize()) { case sizeof(uint64_t): - data = pkt->get(); + data = pkt->getLE(); break; case sizeof(uint32_t): - data = pkt->get(); + data = pkt->getLE(); break; case sizeof(uint16_t): - data = pkt->get(); + data = pkt->getLE(); break; case sizeof(uint8_t): - data = pkt->get(); + data = pkt->getLE(); break; default: panic("invalid access size: %u\n", pkt->getSize()); @@ -126,16 +126,16 @@ IsaFake::write(PacketPtr pkt) if (params()->update_data) { switch (pkt->getSize()) { case sizeof(uint64_t): - retData64 = pkt->get(); + retData64 = pkt->getLE(); break; case sizeof(uint32_t): - retData32 = pkt->get(); + retData32 = pkt->getLE(); break; case sizeof(uint16_t): - retData16 = pkt->get(); + retData16 = pkt->getLE(); break; case sizeof(uint8_t): - retData8 = pkt->get(); + retData8 = pkt->getLE(); break; default: panic("invalid access size!\n"); diff --git a/src/dev/net/i8254xGBe.cc b/src/dev/net/i8254xGBe.cc index 88528c4b7..2d55603f1 100644 --- a/src/dev/net/i8254xGBe.cc +++ b/src/dev/net/i8254xGBe.cc @@ -194,27 +194,27 @@ IGbE::read(PacketPtr pkt) switch (daddr) { case REG_CTRL: - pkt->set(regs.ctrl()); + pkt->setLE(regs.ctrl()); break; case REG_STATUS: - pkt->set(regs.sts()); + pkt->setLE(regs.sts()); break; case REG_EECD: - pkt->set(regs.eecd()); + pkt->setLE(regs.eecd()); break; case REG_EERD: - pkt->set(regs.eerd()); + pkt->setLE(regs.eerd()); break; case REG_CTRL_EXT: - pkt->set(regs.ctrl_ext()); + pkt->setLE(regs.ctrl_ext()); break; case REG_MDIC: - pkt->set(regs.mdic()); + pkt->setLE(regs.mdic()); break; case REG_ICR: DPRINTF(Ethernet, "Reading ICR. ICR=%#x IMR=%#x IAM=%#x IAME=%d\n", regs.icr(), regs.imr, regs.iam, regs.ctrl_ext.iame()); - pkt->set(regs.icr()); + pkt->setLE(regs.icr()); if (regs.icr.int_assert() || regs.imr == 0) { regs.icr = regs.icr() & ~mask(30); DPRINTF(Ethernet, "Cleared ICR. ICR=%#x\n", regs.icr()); @@ -226,55 +226,55 @@ IGbE::read(PacketPtr pkt) case REG_EICR: // This is only useful for MSI, but the driver reads it every time // Just don't do anything - pkt->set(0); + pkt->setLE(0); break; case REG_ITR: - pkt->set(regs.itr()); + pkt->setLE(regs.itr()); break; case REG_RCTL: - pkt->set(regs.rctl()); + pkt->setLE(regs.rctl()); break; case REG_FCTTV: - pkt->set(regs.fcttv()); + pkt->setLE(regs.fcttv()); break; case REG_TCTL: - pkt->set(regs.tctl()); + pkt->setLE(regs.tctl()); break; case REG_PBA: - pkt->set(regs.pba()); + pkt->setLE(regs.pba()); break; case REG_WUC: case REG_WUFC: case REG_WUS: case REG_LEDCTL: - pkt->set(0); // We don't care, so just return 0 + pkt->setLE(0); // We don't care, so just return 0 break; case REG_FCRTL: - pkt->set(regs.fcrtl()); + pkt->setLE(regs.fcrtl()); break; case REG_FCRTH: - pkt->set(regs.fcrth()); + pkt->setLE(regs.fcrth()); break; case REG_RDBAL: - pkt->set(regs.rdba.rdbal()); + pkt->setLE(regs.rdba.rdbal()); break; case REG_RDBAH: - pkt->set(regs.rdba.rdbah()); + pkt->setLE(regs.rdba.rdbah()); break; case REG_RDLEN: - pkt->set(regs.rdlen()); + pkt->setLE(regs.rdlen()); break; case REG_SRRCTL: - pkt->set(regs.srrctl()); + pkt->setLE(regs.srrctl()); break; case REG_RDH: - pkt->set(regs.rdh()); + pkt->setLE(regs.rdh()); break; case REG_RDT: - pkt->set(regs.rdt()); + pkt->setLE(regs.rdt()); break; case REG_RDTR: - pkt->set(regs.rdtr()); + pkt->setLE(regs.rdtr()); if (regs.rdtr.fpd()) { rxDescCache.writeback(0); DPRINTF(EthernetIntr, @@ -284,65 +284,65 @@ IGbE::read(PacketPtr pkt) } break; case REG_RXDCTL: - pkt->set(regs.rxdctl()); + pkt->setLE(regs.rxdctl()); break; case REG_RADV: - pkt->set(regs.radv()); + pkt->setLE(regs.radv()); break; case REG_TDBAL: - pkt->set(regs.tdba.tdbal()); + pkt->setLE(regs.tdba.tdbal()); break; case REG_TDBAH: - pkt->set(regs.tdba.tdbah()); + pkt->setLE(regs.tdba.tdbah()); break; case REG_TDLEN: - pkt->set(regs.tdlen()); + pkt->setLE(regs.tdlen()); break; case REG_TDH: - pkt->set(regs.tdh()); + pkt->setLE(regs.tdh()); break; case REG_TXDCA_CTL: - pkt->set(regs.txdca_ctl()); + pkt->setLE(regs.txdca_ctl()); break; case REG_TDT: - pkt->set(regs.tdt()); + pkt->setLE(regs.tdt()); break; case REG_TIDV: - pkt->set(regs.tidv()); + pkt->setLE(regs.tidv()); break; case REG_TXDCTL: - pkt->set(regs.txdctl()); + pkt->setLE(regs.txdctl()); break; case REG_TADV: - pkt->set(regs.tadv()); + pkt->setLE(regs.tadv()); break; case REG_TDWBAL: - pkt->set(regs.tdwba & mask(32)); + pkt->setLE(regs.tdwba & mask(32)); break; case REG_TDWBAH: - pkt->set(regs.tdwba >> 32); + pkt->setLE(regs.tdwba >> 32); break; case REG_RXCSUM: - pkt->set(regs.rxcsum()); + pkt->setLE(regs.rxcsum()); break; case REG_RLPML: - pkt->set(regs.rlpml); + pkt->setLE(regs.rlpml); break; case REG_RFCTL: - pkt->set(regs.rfctl()); + pkt->setLE(regs.rfctl()); break; case REG_MANC: - pkt->set(regs.manc()); + pkt->setLE(regs.manc()); break; case REG_SWSM: - pkt->set(regs.swsm()); + pkt->setLE(regs.swsm()); regs.swsm.smbi(1); break; case REG_FWSM: - pkt->set(regs.fwsm()); + pkt->setLE(regs.fwsm()); break; case REG_SWFWSYNC: - pkt->set(regs.sw_fw_sync); + pkt->setLE(regs.sw_fw_sync); break; default: if (!IN_RANGE(daddr, REG_VFTA, VLAN_FILTER_TABLE_SIZE*4) && @@ -351,7 +351,7 @@ IGbE::read(PacketPtr pkt) !IN_RANGE(daddr, REG_CRCERRS, STATS_REGS_SIZE)) panic("Read request to unknown register number: %#x\n", daddr); else - pkt->set(0); + pkt->setLE(0); }; pkt->makeAtomicResponse(); @@ -375,12 +375,12 @@ IGbE::write(PacketPtr pkt) assert(pkt->getSize() == sizeof(uint32_t)); DPRINTF(Ethernet, "Wrote device register %#X value %#X\n", - daddr, pkt->get()); + daddr, pkt->getLE()); // // Handle write of register here // - uint32_t val = pkt->get(); + uint32_t val = pkt->getLE(); Regs::RCTL oldrctl; Regs::TCTL oldtctl; diff --git a/src/dev/net/ns_gige.cc b/src/dev/net/ns_gige.cc index e1289b4b1..1a5adb275 100644 --- a/src/dev/net/ns_gige.cc +++ b/src/dev/net/ns_gige.cc @@ -209,7 +209,7 @@ NSGigE::read(PacketPtr pkt) // don't implement all the MIB's. hopefully the kernel // doesn't actually DEPEND upon their values // MIB are just hardware stats keepers - pkt->set(0); + pkt->setLE(0); pkt->makeAtomicResponse(); return pioDelay; } else if (daddr > 0x3FC) @@ -427,7 +427,7 @@ NSGigE::write(PacketPtr pkt) panic("Something is messed up!\n"); if (pkt->getSize() == sizeof(uint32_t)) { - uint32_t reg = pkt->get(); + uint32_t reg = pkt->getLE(); uint16_t rfaddr; DPRINTF(EthernetPIO, "write data=%d data=%#x\n", reg, reg); diff --git a/src/dev/net/sinic.cc b/src/dev/net/sinic.cc index 50341a4d3..ce9fbb6a3 100644 --- a/src/dev/net/sinic.cc +++ b/src/dev/net/sinic.cc @@ -248,13 +248,13 @@ Device::read(PacketPtr pkt) uint64_t value M5_VAR_USED = 0; if (pkt->getSize() == 4) { uint32_t reg = regData32(raddr); - pkt->set(reg); + pkt->setLE(reg); value = reg; } if (pkt->getSize() == 8) { uint64_t reg = regData64(raddr); - pkt->set(reg); + pkt->setLE(reg); value = reg; } @@ -333,26 +333,28 @@ Device::write(PacketPtr pkt) DPRINTF(EthernetPIO, "write %s vnic %d: cpu=%d val=%#x da=%#x pa=%#x size=%d\n", - info.name, index, cpu, info.size == 4 ? pkt->get() : - pkt->get(), daddr, pkt->getAddr(), pkt->getSize()); + info.name, index, cpu, info.size == 4 ? + pkt->getLE() : pkt->getLE(), + daddr, pkt->getAddr(), pkt->getSize()); prepareWrite(cpu, index); switch (raddr) { case Regs::Config: - changeConfig(pkt->get()); + changeConfig(pkt->getLE()); break; case Regs::Command: - command(pkt->get()); + command(pkt->getLE()); break; case Regs::IntrStatus: - devIntrClear(regs.IntrStatus & pkt->get()); + devIntrClear(regs.IntrStatus & + pkt->getLE()); break; case Regs::IntrMask: - devIntrChangeMask(pkt->get()); + devIntrChangeMask(pkt->getLE()); break; case Regs::RxData: @@ -362,10 +364,10 @@ Device::write(PacketPtr pkt) vnic.rxUnique = rxUnique++; vnic.RxDone = Regs::RxDone_Busy; - vnic.RxData = pkt->get(); + vnic.RxData = pkt->getLE(); rxBusyCount++; - if (Regs::get_RxData_Vaddr(pkt->get())) { + if (Regs::get_RxData_Vaddr(pkt->getLE())) { panic("vtophys not implemented in newmem"); #ifdef SINIC_VTOPHYS Addr vaddr = Regs::get_RxData_Addr(reg64); @@ -403,7 +405,7 @@ Device::write(PacketPtr pkt) vnic.txUnique = txUnique++; vnic.TxDone = Regs::TxDone_Busy; - if (Regs::get_TxData_Vaddr(pkt->get())) { + if (Regs::get_TxData_Vaddr(pkt->getLE())) { panic("vtophys won't work here in newmem.\n"); #ifdef SINIC_VTOPHYS Addr vaddr = Regs::get_TxData_Addr(reg64); diff --git a/src/dev/pci/copy_engine.cc b/src/dev/pci/copy_engine.cc index 7c87da1c0..7f8959aca 100644 --- a/src/dev/pci/copy_engine.cc +++ b/src/dev/pci/copy_engine.cc @@ -193,20 +193,20 @@ CopyEngine::read(PacketPtr pkt) switch (daddr) { case GEN_CHANCOUNT: assert(size == sizeof(regs.chanCount)); - pkt->set(regs.chanCount); + pkt->setLE(regs.chanCount); break; case GEN_XFERCAP: assert(size == sizeof(regs.xferCap)); - pkt->set(regs.xferCap); + pkt->setLE(regs.xferCap); break; case GEN_INTRCTRL: assert(size == sizeof(uint8_t)); - pkt->set(regs.intrctrl()); + pkt->setLE(regs.intrctrl()); regs.intrctrl.master_int_enable(0); break; case GEN_ATTNSTATUS: assert(size == sizeof(regs.attnStatus)); - pkt->set(regs.attnStatus); + pkt->setLE(regs.attnStatus); regs.attnStatus = 0; break; default: @@ -244,42 +244,42 @@ CopyEngine::CopyEngineChannel::channelRead(Packet *pkt, Addr daddr, int size) switch (daddr) { case CHAN_CONTROL: assert(size == sizeof(uint16_t)); - pkt->set(cr.ctrl()); + pkt->setLE(cr.ctrl()); cr.ctrl.in_use(1); break; case CHAN_STATUS: assert(size == sizeof(uint64_t)); - pkt->set(cr.status() | (busy ? 0 : 1)); + pkt->setLE(cr.status() | (busy ? 0 : 1)); break; case CHAN_CHAINADDR: assert(size == sizeof(uint64_t) || size == sizeof(uint32_t)); if (size == sizeof(uint64_t)) - pkt->set(cr.descChainAddr); + pkt->setLE(cr.descChainAddr); else - pkt->set(bits(cr.descChainAddr,0,31)); + pkt->setLE(bits(cr.descChainAddr,0,31)); break; case CHAN_CHAINADDR_HIGH: assert(size == sizeof(uint32_t)); - pkt->set(bits(cr.descChainAddr,32,63)); + pkt->setLE(bits(cr.descChainAddr,32,63)); break; case CHAN_COMMAND: assert(size == sizeof(uint8_t)); - pkt->set(cr.command()); + pkt->setLE(cr.command()); break; case CHAN_CMPLNADDR: assert(size == sizeof(uint64_t) || size == sizeof(uint32_t)); if (size == sizeof(uint64_t)) - pkt->set(cr.completionAddr); + pkt->setLE(cr.completionAddr); else - pkt->set(bits(cr.completionAddr,0,31)); + pkt->setLE(bits(cr.completionAddr,0,31)); break; case CHAN_CMPLNADDR_HIGH: assert(size == sizeof(uint32_t)); - pkt->set(bits(cr.completionAddr,32,63)); + pkt->setLE(bits(cr.completionAddr,32,63)); break; case CHAN_ERROR: assert(size == sizeof(uint32_t)); - pkt->set(cr.error()); + pkt->setLE(cr.error()); break; default: panic("Read request to unknown channel register number: (%d)%#x\n", @@ -308,17 +308,21 @@ CopyEngine::write(PacketPtr pkt) /// if (size == sizeof(uint64_t)) { - uint64_t val M5_VAR_USED = pkt->get(); - DPRINTF(DMACopyEngine, "Wrote device register %#X value %#X\n", daddr, val); + uint64_t val M5_VAR_USED = pkt->getLE(); + DPRINTF(DMACopyEngine, "Wrote device register %#X value %#X\n", + daddr, val); } else if (size == sizeof(uint32_t)) { - uint32_t val M5_VAR_USED = pkt->get(); - DPRINTF(DMACopyEngine, "Wrote device register %#X value %#X\n", daddr, val); + uint32_t val M5_VAR_USED = pkt->getLE(); + DPRINTF(DMACopyEngine, "Wrote device register %#X value %#X\n", + daddr, val); } else if (size == sizeof(uint16_t)) { - uint16_t val M5_VAR_USED = pkt->get(); - DPRINTF(DMACopyEngine, "Wrote device register %#X value %#X\n", daddr, val); + uint16_t val M5_VAR_USED = pkt->getLE(); + DPRINTF(DMACopyEngine, "Wrote device register %#X value %#X\n", + daddr, val); } else if (size == sizeof(uint8_t)) { - uint8_t val M5_VAR_USED = pkt->get(); - DPRINTF(DMACopyEngine, "Wrote device register %#X value %#X\n", daddr, val); + uint8_t val M5_VAR_USED = pkt->getLE(); + DPRINTF(DMACopyEngine, "Wrote device register %#X value %#X\n", + daddr, val); } else { panic("Unknown size for MMIO access: %d\n", size); } @@ -332,7 +336,7 @@ CopyEngine::write(PacketPtr pkt) daddr); break; case GEN_INTRCTRL: - regs.intrctrl.master_int_enable(bits(pkt->get(),0,1)); + regs.intrctrl.master_int_enable(bits(pkt->getLE(), 0, 1)); break; default: panic("Read request to unknown register number: %#x\n", daddr); @@ -370,7 +374,7 @@ CopyEngine::CopyEngineChannel::channelWrite(Packet *pkt, Addr daddr, int size) assert(size == sizeof(uint16_t)); int old_int_disable; old_int_disable = cr.ctrl.interrupt_disable(); - cr.ctrl(pkt->get()); + cr.ctrl(pkt->getLE()); if (cr.ctrl.interrupt_disable()) cr.ctrl.interrupt_disable(0); else @@ -384,39 +388,39 @@ CopyEngine::CopyEngineChannel::channelWrite(Packet *pkt, Addr daddr, int size) case CHAN_CHAINADDR: assert(size == sizeof(uint64_t) || size == sizeof(uint32_t)); if (size == sizeof(uint64_t)) - cr.descChainAddr = pkt->get(); + cr.descChainAddr = pkt->getLE(); else - cr.descChainAddr = (uint64_t)pkt->get() | + cr.descChainAddr = (uint64_t)pkt->getLE() | (cr.descChainAddr & ~mask(32)); DPRINTF(DMACopyEngine, "Chain Address %x\n", cr.descChainAddr); break; case CHAN_CHAINADDR_HIGH: assert(size == sizeof(uint32_t)); - cr.descChainAddr = ((uint64_t)pkt->get() <<32) | + cr.descChainAddr = ((uint64_t)pkt->getLE() << 32) | (cr.descChainAddr & mask(32)); DPRINTF(DMACopyEngine, "Chain Address %x\n", cr.descChainAddr); break; case CHAN_COMMAND: assert(size == sizeof(uint8_t)); - cr.command(pkt->get()); + cr.command(pkt->getLE()); recvCommand(); break; case CHAN_CMPLNADDR: assert(size == sizeof(uint64_t) || size == sizeof(uint32_t)); if (size == sizeof(uint64_t)) - cr.completionAddr = pkt->get(); + cr.completionAddr = pkt->getLE(); else - cr.completionAddr = pkt->get() | + cr.completionAddr = pkt->getLE() | (cr.completionAddr & ~mask(32)); break; case CHAN_CMPLNADDR_HIGH: assert(size == sizeof(uint32_t)); - cr.completionAddr = ((uint64_t)pkt->get() <<32) | + cr.completionAddr = ((uint64_t)pkt->getLE() <<32) | (cr.completionAddr & mask(32)); break; case CHAN_ERROR: assert(size == sizeof(uint32_t)); - cr.error(~pkt->get() & cr.error()); + cr.error(~pkt->getLE() & cr.error()); break; default: panic("Read request to unknown channel register number: (%d)%#x\n", diff --git a/src/dev/pci/device.cc b/src/dev/pci/device.cc index 4d9d29b1d..1097573f8 100644 --- a/src/dev/pci/device.cc +++ b/src/dev/pci/device.cc @@ -228,13 +228,13 @@ PciDevice::readConfig(PacketPtr pkt) "not implemented for %s!\n", this->name()); switch (pkt->getSize()) { case sizeof(uint8_t): - pkt->set(0); + pkt->setLE(0); break; case sizeof(uint16_t): - pkt->set(0); + pkt->setLE(0); break; case sizeof(uint32_t): - pkt->set(0); + pkt->setLE(0); break; default: panic("invalid access size(?) for PCI configspace!\n"); @@ -245,25 +245,25 @@ PciDevice::readConfig(PacketPtr pkt) switch (pkt->getSize()) { case sizeof(uint8_t): - pkt->set(config.data[offset]); + pkt->setLE(config.data[offset]); DPRINTF(PciDevice, "readConfig: dev %#x func %#x reg %#x 1 bytes: data = %#x\n", _busAddr.dev, _busAddr.func, offset, - (uint32_t)pkt->get()); + (uint32_t)pkt->getLE()); break; case sizeof(uint16_t): - pkt->set(*(uint16_t*)&config.data[offset]); + pkt->setLE(*(uint16_t*)&config.data[offset]); DPRINTF(PciDevice, "readConfig: dev %#x func %#x reg %#x 2 bytes: data = %#x\n", _busAddr.dev, _busAddr.func, offset, - (uint32_t)pkt->get()); + (uint32_t)pkt->getLE()); break; case sizeof(uint32_t): - pkt->set(*(uint32_t*)&config.data[offset]); + pkt->setLE(*(uint32_t*)&config.data[offset]); DPRINTF(PciDevice, "readConfig: dev %#x func %#x reg %#x 4 bytes: data = %#x\n", _busAddr.dev, _busAddr.func, offset, - (uint32_t)pkt->get()); + (uint32_t)pkt->getLE()); break; default: panic("invalid access size(?) for PCI configspace!\n"); @@ -310,13 +310,13 @@ PciDevice::writeConfig(PacketPtr pkt) case sizeof(uint8_t): switch (offset) { case PCI0_INTERRUPT_LINE: - config.interruptLine = pkt->get(); + config.interruptLine = pkt->getLE(); break; case PCI_CACHE_LINE_SIZE: - config.cacheLineSize = pkt->get(); + config.cacheLineSize = pkt->getLE(); break; case PCI_LATENCY_TIMER: - config.latencyTimer = pkt->get(); + config.latencyTimer = pkt->getLE(); break; /* Do nothing for these read-only registers */ case PCI0_INTERRUPT_PIN: @@ -331,18 +331,18 @@ PciDevice::writeConfig(PacketPtr pkt) DPRINTF(PciDevice, "writeConfig: dev %#x func %#x reg %#x 1 bytes: data = %#x\n", _busAddr.dev, _busAddr.func, offset, - (uint32_t)pkt->get()); + (uint32_t)pkt->getLE()); break; case sizeof(uint16_t): switch (offset) { case PCI_COMMAND: - config.command = pkt->get(); + config.command = pkt->getLE(); break; case PCI_STATUS: - config.status = pkt->get(); + config.status = pkt->getLE(); break; case PCI_CACHE_LINE_SIZE: - config.cacheLineSize = pkt->get(); + config.cacheLineSize = pkt->getLE(); break; default: panic("writing to a read only register"); @@ -350,7 +350,7 @@ PciDevice::writeConfig(PacketPtr pkt) DPRINTF(PciDevice, "writeConfig: dev %#x func %#x reg %#x 2 bytes: data = %#x\n", _busAddr.dev, _busAddr.func, offset, - (uint32_t)pkt->get()); + (uint32_t)pkt->getLE()); break; case sizeof(uint32_t): switch (offset) { @@ -366,7 +366,7 @@ PciDevice::writeConfig(PacketPtr pkt) if (!legacyIO[barnum]) { // convert BAR values to host endianness uint32_t he_old_bar = letoh(config.baseAddr[barnum]); - uint32_t he_new_bar = letoh(pkt->get()); + uint32_t he_new_bar = letoh(pkt->getLE()); uint32_t bar_mask = BAR_IO_SPACE(he_old_bar) ? BAR_IO_MASK : BAR_MEM_MASK; @@ -393,17 +393,17 @@ PciDevice::writeConfig(PacketPtr pkt) break; case PCI0_ROM_BASE_ADDR: - if (letoh(pkt->get()) == 0xfffffffe) + if (letoh(pkt->getLE()) == 0xfffffffe) config.expansionROM = htole((uint32_t)0xffffffff); else - config.expansionROM = pkt->get(); + config.expansionROM = pkt->getLE(); break; case PCI_COMMAND: // This could also clear some of the error bits in the Status // register. However they should never get set, so lets ignore // it for now - config.command = pkt->get(); + config.command = pkt->getLE(); break; default: @@ -412,7 +412,7 @@ PciDevice::writeConfig(PacketPtr pkt) DPRINTF(PciDevice, "writeConfig: dev %#x func %#x reg %#x 4 bytes: data = %#x\n", _busAddr.dev, _busAddr.func, offset, - (uint32_t)pkt->get()); + (uint32_t)pkt->getLE()); break; default: panic("invalid access size(?) for PCI configspace!\n"); diff --git a/src/dev/serial/uart8250.cc b/src/dev/serial/uart8250.cc index 43300f5e8..6b0d01980 100644 --- a/src/dev/serial/uart8250.cc +++ b/src/dev/serial/uart8250.cc @@ -108,9 +108,9 @@ Uart8250::read(PacketPtr pkt) case 0x0: if (!(LCR & 0x80)) { // read byte if (device->dataAvailable()) - pkt->set(device->readData()); + pkt->setRaw(device->readData()); else { - pkt->set((uint8_t)0); + pkt->setRaw((uint8_t)0); // A limited amount of these are ok. DPRINTF(Uart, "empty read of RX register\n"); } @@ -125,7 +125,7 @@ Uart8250::read(PacketPtr pkt) break; case 0x1: if (!(LCR & 0x80)) { // Intr Enable Register(IER) - pkt->set(IER); + pkt->setRaw(IER); } else { // DLM divisor latch MSB ; } @@ -134,20 +134,20 @@ Uart8250::read(PacketPtr pkt) DPRINTF(Uart, "IIR Read, status = %#x\n", (uint32_t)status); if (status & RX_INT) /* Rx data interrupt has a higher priority */ - pkt->set(IIR_RXID); + pkt->setRaw(IIR_RXID); else if (status & TX_INT) { - pkt->set(IIR_TXID); + pkt->setRaw(IIR_TXID); //Tx interrupts are cleared on IIR reads status &= ~TX_INT; } else - pkt->set(IIR_NOPEND); + pkt->setRaw(IIR_NOPEND); break; case 0x3: // Line Control Register (LCR) - pkt->set(LCR); + pkt->setRaw(LCR); break; case 0x4: // Modem Control Register (MCR) - pkt->set(MCR); + pkt->setRaw(MCR); break; case 0x5: // Line Status Register (LSR) uint8_t lsr; @@ -156,13 +156,13 @@ Uart8250::read(PacketPtr pkt) if (device->dataAvailable()) lsr = UART_LSR_DR; lsr |= UART_LSR_TEMT | UART_LSR_THRE; - pkt->set(lsr); + pkt->setRaw(lsr); break; case 0x6: // Modem Status Register (MSR) - pkt->set((uint8_t)0); + pkt->setRaw((uint8_t)0); break; case 0x7: // Scratch Register (SCR) - pkt->set((uint8_t)0); // doesn't exist with at 8250. + pkt->setRaw((uint8_t)0); // doesn't exist with at 8250. break; default: panic("Tried to access a UART port that doesn't exist\n"); @@ -184,12 +184,13 @@ Uart8250::write(PacketPtr pkt) Addr daddr = pkt->getAddr() - pioAddr; - DPRINTF(Uart, " write register %#x value %#x\n", daddr, pkt->get()); + DPRINTF(Uart, " write register %#x value %#x\n", daddr, + pkt->getRaw()); switch (daddr) { case 0x0: if (!(LCR & 0x80)) { // write byte - device->writeData(pkt->get()); + device->writeData(pkt->getRaw()); platform->clearConsoleInt(); status &= ~TX_INT; if (UART_IER_THRI & IER) @@ -200,10 +201,11 @@ Uart8250::write(PacketPtr pkt) break; case 0x1: if (!(LCR & 0x80)) { // Intr Enable Register(IER) - IER = pkt->get(); + IER = pkt->getRaw(); if (UART_IER_THRI & IER) { - DPRINTF(Uart, "IER: IER_THRI set, scheduling TX intrrupt\n"); + DPRINTF(Uart, + "IER: IER_THRI set, scheduling TX intrrupt\n"); if (curTick() - lastTxInt > 225 * SimClock::Int::ns) { DPRINTF(Uart, "-- Interrupting Immediately... %d,%d\n", curTick(), lastTxInt); @@ -216,7 +218,8 @@ Uart8250::write(PacketPtr pkt) } else { - DPRINTF(Uart, "IER: IER_THRI cleared, descheduling TX intrrupt\n"); + DPRINTF(Uart, "IER: IER_THRI cleared, " + "descheduling TX intrrupt\n"); if (txIntrEvent.scheduled()) deschedule(txIntrEvent); if (status & TX_INT) @@ -225,10 +228,12 @@ Uart8250::write(PacketPtr pkt) } if ((UART_IER_RDI & IER) && device->dataAvailable()) { - DPRINTF(Uart, "IER: IER_RDI set, scheduling RX intrrupt\n"); + DPRINTF(Uart, + "IER: IER_RDI set, scheduling RX intrrupt\n"); scheduleIntr(&rxIntrEvent); } else { - DPRINTF(Uart, "IER: IER_RDI cleared, descheduling RX intrrupt\n"); + DPRINTF(Uart, "IER: IER_RDI cleared, " + "descheduling RX intrrupt\n"); if (rxIntrEvent.scheduled()) deschedule(rxIntrEvent); if (status & RX_INT) @@ -242,10 +247,10 @@ Uart8250::write(PacketPtr pkt) case 0x2: // FIFO Control Register (FCR) break; case 0x3: // Line Control Register (LCR) - LCR = pkt->get(); + LCR = pkt->getRaw(); break; case 0x4: // Modem Control Register (MCR) - if (pkt->get() == (UART_MCR_LOOP | 0x0A)) + if (pkt->getRaw() == (UART_MCR_LOOP | 0x0A)) MCR = 0x9A; break; case 0x7: // Scratch Register (SCR) diff --git a/src/dev/storage/ide_ctrl.cc b/src/dev/storage/ide_ctrl.cc index 12d606bee..91f27bea3 100644 --- a/src/dev/storage/ide_ctrl.cc +++ b/src/dev/storage/ide_ctrl.cc @@ -185,67 +185,67 @@ IdeController::readConfig(PacketPtr pkt) case sizeof(uint8_t): switch (offset) { case DeviceTiming: - pkt->set(deviceTiming); + pkt->setLE(deviceTiming); break; case UDMAControl: - pkt->set(udmaControl); + pkt->setLE(udmaControl); break; case PrimaryTiming + 1: - pkt->set(bits(htole(primaryTiming), 15, 8)); + pkt->setLE(bits(htole(primaryTiming), 15, 8)); break; case SecondaryTiming + 1: - pkt->set(bits(htole(secondaryTiming), 15, 8)); + pkt->setLE(bits(htole(secondaryTiming), 15, 8)); break; case IDEConfig: - pkt->set(bits(htole(ideConfig), 7, 0)); + pkt->setLE(bits(htole(ideConfig), 7, 0)); break; case IDEConfig + 1: - pkt->set(bits(htole(ideConfig), 15, 8)); + pkt->setLE(bits(htole(ideConfig), 15, 8)); break; default: panic("Invalid PCI configuration read for size 1 at offset: %#x!\n", offset); } DPRINTF(IdeCtrl, "PCI read offset: %#x size: 1 data: %#x\n", offset, - (uint32_t)pkt->get()); + (uint32_t)pkt->getLE()); break; case sizeof(uint16_t): switch (offset) { case UDMAControl: - pkt->set(udmaControl); + pkt->setLE(udmaControl); break; case PrimaryTiming: - pkt->set(primaryTiming); + pkt->setLE(primaryTiming); break; case SecondaryTiming: - pkt->set(secondaryTiming); + pkt->setLE(secondaryTiming); break; case UDMATiming: - pkt->set(udmaTiming); + pkt->setLE(udmaTiming); break; case IDEConfig: - pkt->set(ideConfig); + pkt->setLE(ideConfig); break; default: panic("Invalid PCI configuration read for size 2 offset: %#x!\n", offset); } DPRINTF(IdeCtrl, "PCI read offset: %#x size: 2 data: %#x\n", offset, - (uint32_t)pkt->get()); + (uint32_t)pkt->getLE()); break; case sizeof(uint32_t): switch (offset) { case PrimaryTiming: - pkt->set(primaryTiming); + pkt->setLE(primaryTiming); break; case IDEConfig: - pkt->set(ideConfig); + pkt->setLE(ideConfig); break; default: panic("No 32bit reads implemented for this device."); } DPRINTF(IdeCtrl, "PCI read offset: %#x size: 4 data: %#x\n", offset, - (uint32_t)pkt->get()); + (uint32_t)pkt->getLE()); break; default: panic("invalid access size(?) for PCI configspace!\n"); @@ -266,40 +266,40 @@ IdeController::writeConfig(PacketPtr pkt) case sizeof(uint8_t): switch (offset) { case DeviceTiming: - deviceTiming = pkt->get(); + deviceTiming = pkt->getLE(); break; case UDMAControl: - udmaControl = pkt->get(); + udmaControl = pkt->getLE(); break; case IDEConfig: - replaceBits(ideConfig, 7, 0, pkt->get()); + replaceBits(ideConfig, 7, 0, pkt->getLE()); break; case IDEConfig + 1: - replaceBits(ideConfig, 15, 8, pkt->get()); + replaceBits(ideConfig, 15, 8, pkt->getLE()); break; default: panic("Invalid PCI configuration write " "for size 1 offset: %#x!\n", offset); } DPRINTF(IdeCtrl, "PCI write offset: %#x size: 1 data: %#x\n", - offset, (uint32_t)pkt->get()); + offset, (uint32_t)pkt->getLE()); break; case sizeof(uint16_t): switch (offset) { case UDMAControl: - udmaControl = pkt->get(); + udmaControl = pkt->getLE(); break; case PrimaryTiming: - primaryTiming = pkt->get(); + primaryTiming = pkt->getLE(); break; case SecondaryTiming: - secondaryTiming = pkt->get(); + secondaryTiming = pkt->getLE(); break; case UDMATiming: - udmaTiming = pkt->get(); + udmaTiming = pkt->getLE(); break; case IDEConfig: - ideConfig = pkt->get(); + ideConfig = pkt->getLE(); break; default: panic("Invalid PCI configuration write " @@ -307,15 +307,15 @@ IdeController::writeConfig(PacketPtr pkt) offset); } DPRINTF(IdeCtrl, "PCI write offset: %#x size: 2 data: %#x\n", - offset, (uint32_t)pkt->get()); + offset, (uint32_t)pkt->getLE()); break; case sizeof(uint32_t): switch (offset) { case PrimaryTiming: - primaryTiming = pkt->get(); + primaryTiming = pkt->getLE(); break; case IDEConfig: - ideConfig = pkt->get(); + ideConfig = pkt->getLE(); break; default: panic("Write of unimplemented PCI config. register: %x\n", offset); @@ -537,11 +537,11 @@ IdeController::dispatchAccess(PacketPtr pkt, bool read) #ifndef NDEBUG uint32_t data; if (pkt->getSize() == 1) - data = pkt->get(); + data = pkt->getLE(); else if (pkt->getSize() == 2) - data = pkt->get(); + data = pkt->getLE(); else - data = pkt->get(); + data = pkt->getLE(); DPRINTF(IdeCtrl, "%s from offset: %#x size: %#x data: %#x\n", read ? "Read" : "Write", pkt->getAddr(), pkt->getSize(), data); #endif diff --git a/src/dev/virtio/pci.cc b/src/dev/virtio/pci.cc index 783b43e65..d1b8ea117 100644 --- a/src/dev/virtio/pci.cc +++ b/src/dev/virtio/pci.cc @@ -88,43 +88,43 @@ PciVirtIO::read(PacketPtr pkt) case OFF_DEVICE_FEATURES: DPRINTF(VIOIface, " DEVICE_FEATURES request\n"); assert(size == sizeof(uint32_t)); - pkt->set(vio.deviceFeatures); + pkt->setLE(vio.deviceFeatures); break; case OFF_GUEST_FEATURES: DPRINTF(VIOIface, " GUEST_FEATURES request\n"); assert(size == sizeof(uint32_t)); - pkt->set(vio.getGuestFeatures()); + pkt->setLE(vio.getGuestFeatures()); break; case OFF_QUEUE_ADDRESS: DPRINTF(VIOIface, " QUEUE_ADDRESS request\n"); assert(size == sizeof(uint32_t)); - pkt->set(vio.getQueueAddress()); + pkt->setLE(vio.getQueueAddress()); break; case OFF_QUEUE_SIZE: DPRINTF(VIOIface, " QUEUE_SIZE request\n"); assert(size == sizeof(uint16_t)); - pkt->set(vio.getQueueSize()); + pkt->setLE(vio.getQueueSize()); break; case OFF_QUEUE_SELECT: DPRINTF(VIOIface, " QUEUE_SELECT\n"); assert(size == sizeof(uint16_t)); - pkt->set(vio.getQueueSelect()); + pkt->setLE(vio.getQueueSelect()); break; case OFF_QUEUE_NOTIFY: DPRINTF(VIOIface, " QUEUE_NOTIFY request\n"); assert(size == sizeof(uint16_t)); - pkt->set(queueNotify); + pkt->setLE(queueNotify); break; case OFF_DEVICE_STATUS: DPRINTF(VIOIface, " DEVICE_STATUS request\n"); assert(size == sizeof(uint8_t)); - pkt->set(vio.getDeviceStatus()); + pkt->setLE(vio.getDeviceStatus()); break; case OFF_ISR_STATUS: { @@ -135,7 +135,7 @@ PciVirtIO::read(PacketPtr pkt) interruptDeliveryPending = false; intrClear(); } - pkt->set(isr_status); + pkt->setLE(isr_status); } break; default: @@ -173,13 +173,13 @@ PciVirtIO::write(PacketPtr pkt) case OFF_GUEST_FEATURES: DPRINTF(VIOIface, " WRITE GUEST_FEATURES request\n"); assert(size == sizeof(uint32_t)); - vio.setGuestFeatures(pkt->get()); + vio.setGuestFeatures(pkt->getLE()); break; case OFF_QUEUE_ADDRESS: DPRINTF(VIOIface, " WRITE QUEUE_ADDRESS\n"); assert(size == sizeof(uint32_t)); - vio.setQueueAddress(pkt->get()); + vio.setQueueAddress(pkt->getLE()); break; case OFF_QUEUE_SIZE: @@ -189,19 +189,19 @@ PciVirtIO::write(PacketPtr pkt) case OFF_QUEUE_SELECT: DPRINTF(VIOIface, " WRITE QUEUE_SELECT\n"); assert(size == sizeof(uint16_t)); - vio.setQueueSelect(pkt->get()); + vio.setQueueSelect(pkt->getLE()); break; case OFF_QUEUE_NOTIFY: DPRINTF(VIOIface, " WRITE QUEUE_NOTIFY\n"); assert(size == sizeof(uint16_t)); - queueNotify = pkt->get(); + queueNotify = pkt->getLE(); vio.onNotify(queueNotify); break; case OFF_DEVICE_STATUS: { assert(size == sizeof(uint8_t)); - uint8_t status(pkt->get()); + uint8_t status(pkt->getLE()); DPRINTF(VIOIface, "VirtIO set status: 0x%x\n", status); vio.setDeviceStatus(status); } break;