mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-06-06 06:41:40 +00:00
pci: sandbox: swap_case: Preserve space indicator bit in BAR registers
With the newly added testing of more than one device, we get: => ut dm pci_swapcase Test: dm_test_pci_swapcase: pci.c test/dm/pci.c:88, dm_test_pci_swapcase(): "tHIS IS A tESt" = ptr: Expected "tHIS IS A tESt", got "this is a test" Test: dm_test_pci_swapcase: pci.c (flat tree) test/dm/pci.c:88, dm_test_pci_swapcase(): "tHIS IS A tESt" = ptr: Expected "tHIS IS A tESt", got "this is a test" Failures: 2 The failure only happens on the 2nd swap_case device on the PCI bus. The case passes on the 1st device. It turns out the swap_case driver does not emulate bit#0 in BAR registers as a read-only bit. This corrects the implementation. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
2db7f2b722
commit
76330ae67d
1 changed files with 5 additions and 3 deletions
|
@ -142,6 +142,8 @@ static int sandbox_swap_case_write_config(struct udevice *emul, uint offset,
|
|||
|
||||
debug("w bar %d=%lx\n", barnum, value);
|
||||
*bar = value;
|
||||
/* space indicator (bit#0) is read-only */
|
||||
*bar |= barinfo[barnum].type;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -157,11 +159,11 @@ static int sandbox_swap_case_find_bar(struct udevice *emul, unsigned int addr,
|
|||
|
||||
for (barnum = 0; barnum < ARRAY_SIZE(barinfo); barnum++) {
|
||||
unsigned int size = barinfo[barnum].size;
|
||||
u32 base = plat->bar[barnum] & ~PCI_BASE_ADDRESS_SPACE;
|
||||
|
||||
if (addr >= plat->bar[barnum] &&
|
||||
addr < plat->bar[barnum] + size) {
|
||||
if (addr >= base && addr < base + size) {
|
||||
*barnump = barnum;
|
||||
*offsetp = addr - plat->bar[barnum];
|
||||
*offsetp = addr - base;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue