On Mon, Feb 26, 2018 at 05:34:14PM -0800, Eric Snowberg wrote: > decode-unit ( addr len -- phys.lo ... phys.hi ) > > Convert text unit-string to physical address. > > Convert unit-string, the text string representation, to phys.lo ... phys.hi, > the numerical representation of a physical address within the address space > defined by this device node. The number of cells in the list > phys.lo ... phys.hi is determined by the value of the #address-cells > property of this node. > > This function is for devices with #address-cells == 4 > > Signed-off-by: Eric Snowberg <[email protected]>
Reviewed-by: Daniel Kiper <[email protected]> Just one nit pick below... > --- > grub-core/kern/ieee1275/ieee1275.c | 42 > ++++++++++++++++++++++++++++++++++++ > include/grub/ieee1275/ieee1275.h | 8 ++++++ > 2 files changed, 50 insertions(+), 0 deletions(-) > > diff --git a/grub-core/kern/ieee1275/ieee1275.c > b/grub-core/kern/ieee1275/ieee1275.c > index 9821702..4617b36 100644 > --- a/grub-core/kern/ieee1275/ieee1275.c > +++ b/grub-core/kern/ieee1275/ieee1275.c > @@ -483,6 +483,48 @@ grub_ieee1275_close (grub_ieee1275_ihandle_t ihandle) > } > > int > +grub_ieee1275_decode_unit4 (grub_ieee1275_ihandle_t ihandle, > + void *addr, grub_size_t size, > + grub_uint32_t *phy_lo, grub_uint32_t *phy_hi, > + grub_uint32_t *lun_lo, grub_uint32_t *lun_hi) > +{ > + struct decode_args > + { > + struct grub_ieee1275_common_hdr common; > + grub_ieee1275_cell_t method; > + grub_ieee1275_cell_t ihandle; > + grub_ieee1275_cell_t size; > + grub_ieee1275_cell_t addr; > + grub_ieee1275_cell_t catch_result; > + grub_ieee1275_cell_t tgt_h; > + grub_ieee1275_cell_t tgt_l; > + grub_ieee1275_cell_t lun_h; > + grub_ieee1275_cell_t lun_l; > + } > + args; > + > + INIT_IEEE1275_COMMON (&args.common, "call-method", 4, 5); > + args.method = (grub_ieee1275_cell_t) "decode-unit"; > + args.ihandle = ihandle; > + args.size = size; > + args.addr = (grub_ieee1275_cell_t) addr; > + args.catch_result = 1; > + > + if ((IEEE1275_CALL_ENTRY_FN (&args) == -1) || (args.catch_result)) > + { > + grub_error (GRUB_ERR_OUT_OF_RANGE, "decode-unit failed\n"); > + return -1; > + } > + > + *phy_lo = args.tgt_l; > + *phy_hi = args.tgt_h; > + *lun_lo = args.lun_l; > + *lun_hi = args.lun_h; > + return 0; > +} > + > + > +int > grub_ieee1275_claim (grub_addr_t addr, grub_size_t size, unsigned int align, > grub_addr_t *result) > { > diff --git a/include/grub/ieee1275/ieee1275.h > b/include/grub/ieee1275/ieee1275.h > index 8e42513..b1940c2 100644 > --- a/include/grub/ieee1275/ieee1275.h > +++ b/include/grub/ieee1275/ieee1275.h > @@ -211,6 +211,14 @@ int EXPORT_FUNC(grub_ieee1275_set_color) > (grub_ieee1275_ihandle_t ihandle, > int index, int r, int g, int b); > int EXPORT_FUNC(grub_ieee1275_milliseconds) (grub_uint32_t *msecs); > > +int EXPORT_FUNC(grub_ieee1275_decode_unit4) (grub_ieee1275_ihandle_t ihandle, > + void *addr, grub_size_t size, > + grub_uint32_t *phy_lo, > + grub_uint32_t *phy_hi, > + grub_uint32_t *lun_lo, > + grub_uint32_t *lun_hi); > + > + Too many empty lines. I will fix this during commit. Daniel _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
