VME: Correct read/write alignment algorithm
In order to ensure the correct width cycles on the VME bus, the VME bridge drivers implement an algorithm to utilise the largest possible width reads and writes whilst maintaining natural alignment constraints. The algorithm currently looks at the start address rather than the current read/write address when determining whether a 16-bit width cycle is required to get to 32-bit alignment. This results in incorrect alignment, Reported-by: Jim Strouth <james.strouth@ge.com> Tested-by: Jim Strouth <james.strouth@ge.com> Signed-off-by: Martyn Welch <martyn.welch@ge.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
5cb906c703
commit
f0342e66b3
|
@ -884,7 +884,7 @@ static ssize_t ca91cx42_master_read(struct vme_master_resource *image,
|
|||
if (done == count)
|
||||
goto out;
|
||||
}
|
||||
if ((uintptr_t)addr & 0x2) {
|
||||
if ((uintptr_t)(addr + done) & 0x2) {
|
||||
if ((count - done) < 2) {
|
||||
*(u8 *)(buf + done) = ioread8(addr + done);
|
||||
done += 1;
|
||||
|
@ -938,7 +938,7 @@ static ssize_t ca91cx42_master_write(struct vme_master_resource *image,
|
|||
if (done == count)
|
||||
goto out;
|
||||
}
|
||||
if ((uintptr_t)addr & 0x2) {
|
||||
if ((uintptr_t)(addr + done) & 0x2) {
|
||||
if ((count - done) < 2) {
|
||||
iowrite8(*(u8 *)(buf + done), addr + done);
|
||||
done += 1;
|
||||
|
|
|
@ -1289,7 +1289,7 @@ static ssize_t tsi148_master_read(struct vme_master_resource *image, void *buf,
|
|||
if (done == count)
|
||||
goto out;
|
||||
}
|
||||
if ((uintptr_t)addr & 0x2) {
|
||||
if ((uintptr_t)(addr + done) & 0x2) {
|
||||
if ((count - done) < 2) {
|
||||
*(u8 *)(buf + done) = ioread8(addr + done);
|
||||
done += 1;
|
||||
|
@ -1371,7 +1371,7 @@ static ssize_t tsi148_master_write(struct vme_master_resource *image, void *buf,
|
|||
if (done == count)
|
||||
goto out;
|
||||
}
|
||||
if ((uintptr_t)addr & 0x2) {
|
||||
if ((uintptr_t)(addr + done) & 0x2) {
|
||||
if ((count - done) < 2) {
|
||||
iowrite8(*(u8 *)(buf + done), addr + done);
|
||||
done += 1;
|
||||
|
|
Loading…
Reference in New Issue