Adding a "-1" into https://reviews.freebsd.org/D25219 's code looks to make uefi/ACPI handle USB3 SSD reliably

Mark Millard via freebsd-arm <[email protected]>
Newsgroups gmane.os.freebsd.devel.arm
Message-ID <[email protected]>
https://reviews.freebsd.org/D25219 has (in part)

> +	if (bus_dma_tag_create(NULL, 1, 0,
> +		limits.lowaddr, BUS_SPACE_MAXADDR, NULL, NULL,

Based on sysctl hw.busdma output and testing a change for the u-boot/DTB/fdt code context that worked in testing so far, I've tried using limits.lowaddr-1 in the above ACPI handling code instead.

It has worked so far.

So both existing implementations have the same basic
problem as far as I can tell: limits.lowaddr too large
by one, so identifying the wrong page.



What sysctl showed me was the likes of (before
changes that lead to lack of zone2 for u-boot/dtb/fdt):

. . .
hw.busdma.zone2.lowaddr: 0x3c000fff
. . .
hw.busdma.zone1.lowaddr: 0x3fffffff
. . .
hw.busdma.zone0.lowaddr: 0xffffffff
. . .

So I've guessed that lowaddr should identify the
end page of the possibly-use-it-directly region,
not the first do-not-use-it-directly page. If I've
guessed wrong, at most it would bounce one page
that it could avoid bouncing. But, if I guessed
correct, it might bounce a page that it should
instead of not doing so. Thus the "-1" addition.

For reference, after the first duplicate-and-diff test
for uefi/ACPI:

# sysctl hw.busdma
hw.busdma.zone0.alignment: 4096
hw.busdma.zone0.lowaddr: 0xbfffffff
hw.busdma.zone0.total_deferred: 0
hw.busdma.zone0.total_bounced: 762568
hw.busdma.zone0.active_bpages: 12
hw.busdma.zone0.reserved_bpages: 0
hw.busdma.zone0.free_bpages: 824
hw.busdma.zone0.total_bpages: 836
hw.busdma.total_bpages: 836

I'll note that "total_bounced" need not be the
a page count: it is incremented by 1 after
the loop for a bounce, not inside the loop.
Lots of pages of data were bounced.

===
Mark Millard
marklmi at yahoo.com
( dsl-only.net went
away in early 2018-Mar)

_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-arm
To unsubscribe, send any mail to "[email protected]"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.