[Skiboot] [PATCH 3/5] libflash/mbox-flash: Update to V2 of the protocol
Benjamin Herrenschmidt
benh at kernel.crashing.org
Tue May 2 17:27:58 AEST 2017
On Mon, 2017-04-24 at 19:14 +1000, Cyril Bur wrote:
> + while(len) {
> + uint32_t chunk;
> + uint32_t dat;
> +
> + /* XXX: make this read until it's aligned */
> + if (len > 3 && !(off & 3)) {
> + rc = lpc_read(OPAL_LPC_FW, off, &dat, 4);
> + if (!rc)
> + *(uint32_t *)buf = dat;
> + chunk = 4;
> + } else {
> + rc = lpc_read(OPAL_LPC_FW, off, &dat, 1);
> + if (!rc)
> + *(uint8_t *)buf = dat;
> + chunk = 1;
> + }
> + if (rc) {
You'll acquire/release a lock for every 4 bytes.. In HostBoot, I've
updated the underlying lpc_read to take arbitrary quantities instead
(though only on memory mapped LPC, ie, P9)..
To do that, I'd rework opb_mmio_write() and opb_mmio_read() along
the lines of:
sync();
while (size > 3 && !(offset & 3))
__in/out_be32
while (size > 1 && !(offset & 1))
__in/out_be16
while
(size)
__in/out_8
That will provide correct semantics for all cases and limits the
amount of locks and sync's in bulk transfers which should speed
things up a bit.
Cheers,
Ben.
More information about the Skiboot
mailing list