[SLOF] [PATCH slof] pci-phb: Reimplement dma-map-in/out
segher at kernel.crashing.org
Thu Nov 14 22:47:30 AEDT 2019
On Thu, Nov 14, 2019 at 02:33:41PM +1100, Alexey Kardashevskiy wrote:
> +: align-4k
> + fff not and
This is aligning down. "align" means "align upwards" normally. The word
"align" aligns the data space, while "aligned" aligns a pointer. SLOF also
has a utility word "#aligned" to align to some certain boundary. So you
: align-4k ( a - a ) 1000 #aligned ;
but that sligns *upwards*.
: trunc-4k ( a - a ) -1000 and ;
if you want a lower address, instead (less often useful, btw).
(OF always is two's complement, you can write -1000 instead of fff invert).
> +\ grub does not align allocated addresses to the size
> +\ so when mapping in dma-map-in, sometime we call H_PUT_TCE more than
> +\ bm-alloc allocated
> +: dma-align ( virt size -- virt aligned-size )
> + over fff and + fff + fff not and
: dma-align ( virt size -- virt a-size ) over fff and + 1000 @aligned ;
fff + fff not and is just 1000 #aligned .
I don't understand why you are adding the low twelve bits of the address
to the size as well?
More information about the SLOF