Hello Anjaneya "Reddy" Chagam,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/coreboot/+/38727
to review the following change.
Change subject: device: Expose round() ......................................................................
device: Expose round()
This function is needed by Skylake-SP SOC code, so exposing it.
Signed-off-by: Jonathan Zhang jonzhang@fb.com Signed-off-by: Reddy Chagam anjaneya.chagam@intel.com Change-Id: I317dad18176fc2339072f02a5bcdcc8859596df9 --- M src/device/device.c M src/include/device/device.h 2 files changed, 10 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/27/38727/1
diff --git a/src/device/device.c b/src/device/device.c index 236b768..9bd8f45 100644 --- a/src/device/device.c +++ b/src/device/device.c @@ -162,7 +162,7 @@ * @param pow Alignment as a power of two. * @return Rounded up number. */ -static resource_t round(resource_t val, unsigned long pow) +resource_t round(resource_t val, unsigned long pow) { resource_t mask; mask = (1ULL << pow) - 1ULL; diff --git a/src/include/device/device.h b/src/include/device/device.h index 2d7400b..9a7bacd 100644 --- a/src/include/device/device.h +++ b/src/include/device/device.h @@ -322,4 +322,13 @@ void scan_generic_bus(struct device *bus); void scan_static_bus(struct device *bus);
+/** + * Round a number up to an alignment. + * + * @param val The starting value. + * @param pow Alignment as a power of two. + * @return Rounded up number. + */ +resource_t round(resource_t val, unsigned long pow); + #endif /* DEVICE_H */
Julius Werner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38727 )
Change subject: device: Expose round() ......................................................................
Patch Set 1:
(2 comments)
https://review.coreboot.org/c/coreboot/+/38727/1/src/include/device/device.h File src/include/device/device.h:
https://review.coreboot.org/c/coreboot/+/38727/1/src/include/device/device.h... PS1, Line 330: * @return Rounded up number. Isn't this just the same as ALIGN_UP(val, 1 << pow)? Why not just get rid of the custom function and use that?
https://review.coreboot.org/c/coreboot/+/38727/1/src/include/device/device.h... PS1, Line 332: resource_t round(resource_t val, unsigned long pow); This needs to be way better namespaced if you want it globally visible (e.g. resource_round_up() or something).
Jonathan Zhang has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/38727 )
Change subject: device: Expose round() ......................................................................
Patch Set 1:
(2 comments)
Thanks Julius for reviewing. I am going to abandon this patch accordingly.
https://review.coreboot.org/c/coreboot/+/38727/1/src/include/device/device.h File src/include/device/device.h:
https://review.coreboot.org/c/coreboot/+/38727/1/src/include/device/device.h... PS1, Line 330: * @return Rounded up number.
Isn't this just the same as ALIGN_UP(val, 1 << pow)? Why not just get rid of the custom function and […]
Thank you Julius. Makes total sense. I will do that and withdraw this patch.
https://review.coreboot.org/c/coreboot/+/38727/1/src/include/device/device.h... PS1, Line 332: resource_t round(resource_t val, unsigned long pow);
This needs to be way better namespaced if you want it globally visible (e.g. […]
makes total sense.
Jonathan Zhang has abandoned this change. ( https://review.coreboot.org/c/coreboot/+/38727 )
Change subject: device: Expose round() ......................................................................
Abandoned
Not needed any more.