bridge.hh (4450:54dbcf524f0b) bridge.hh (4451:bfb7c7c0b7ea)
1/*
2 * Copyright (c) 2006 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

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

103 delete oldPkt;
104 }
105
106 void partialWriteFix(Port *port)
107 {
108 assert(!partialWriteFixed);
109 assert(expectResponse);
110
1/*
2 * Copyright (c) 2006 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

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

103 delete oldPkt;
104 }
105
106 void partialWriteFix(Port *port)
107 {
108 assert(!partialWriteFixed);
109 assert(expectResponse);
110
111 int pbs = port->peerBlockSize();
111 Addr pbs = port->peerBlockSize();
112 Addr blockAddr = pkt->getAddr() & ~(pbs-1);
112 partialWriteFixed = true;
113 PacketDataPtr data;
114
115 data = new uint8_t[pbs];
113 partialWriteFixed = true;
114 PacketDataPtr data;
115
116 data = new uint8_t[pbs];
116 PacketPtr funcPkt = new Packet(pkt->req, MemCmd::ReadReq,
117 Packet::Broadcast, pbs);
118
119 funcPkt->dataStatic(data);
120 port->sendFunctional(funcPkt);
121 assert(funcPkt->result == Packet::Success);
117 RequestPtr funcReq = new Request(blockAddr, 4, 0);
118 PacketPtr funcPkt = new Packet(funcReq, MemCmd::ReadReq,
119 Packet::Broadcast);
120 for (int x = 0; x < pbs; x+=4) {
121 funcReq->setPhys(blockAddr + x, 4, 0);
122 funcPkt->reinitFromRequest();
123 funcPkt->dataStatic(data + x);
124 port->sendFunctional(funcPkt);
125 assert(funcPkt->result == Packet::Success);
126 }
122 delete funcPkt;
127 delete funcPkt;
128 delete funcReq;
123
124 oldPkt = pkt;
125 memcpy(data + oldPkt->getOffset(pbs), pkt->getPtr<uint8_t>(),
126 pkt->getSize());
127 pkt = new Packet(oldPkt->req, MemCmd::WriteInvalidateReq,
128 Packet::Broadcast, pbs);
129 pkt->dataDynamicArray(data);
130 pkt->senderState = oldPkt->senderState;

--- 135 unchanged lines hidden ---
129
130 oldPkt = pkt;
131 memcpy(data + oldPkt->getOffset(pbs), pkt->getPtr<uint8_t>(),
132 pkt->getSize());
133 pkt = new Packet(oldPkt->req, MemCmd::WriteInvalidateReq,
134 Packet::Broadcast, pbs);
135 pkt->dataDynamicArray(data);
136 pkt->senderState = oldPkt->senderState;

--- 135 unchanged lines hidden ---