In message <[EMAIL PROTECTED]> YAMAMOTO Shigeru writes:
: + alignment_size = (1u << ((flags & RF_ALIGNMENT_MASK) >>
:RF_ALIGNMENT_SHIFT));
alignment_size = (1u << (RF_ALIGNMENT(flags)));
: + aligned_rstart = (rstart & (~alignment_size + 1u));
: + if ((rstart & (~(~alignment_size + 1u))) != 0) {
: + aligned_rstart += alignment_size;
: + }
: + rstart = aligned_rstart;
: + }
: + rend = min(s->r_end, max(max(start + count, end), rstart + count));
: #ifdef RMAN_DEBUG
: printf("truncated region: [%#lx, %#lx]; size %#lx (requested %#lx)\n",
: rstart, rend, (rend - rstart + 1), count);
: @@ -608,4 +620,19 @@
: rv = int_rman_release_resource(rm, r);
: simple_unlock(rm->rm_slock);
: return (rv);
: +}
I believe that this looks good.
: +u_int32_t
: +rman_make_alignment_flags(int size) {
: + int i;
: +
: + for (i = 0; i < 32 && size > 0x01; i ++) {
: + size = (size >> 1);
: + }
: +
: + if (i > 31) {
: + i = 0;
: + }
: +
: + return(RF_ALIGNMENT_LOG2(i));
: }
This could more simply be stated as RF_ALIGNMENT_LOG2(ffs(size)). I
don't think that it is really needed.
: +#define RF_PCCARD_ATTR 0x10000 /* PCCARD attribute memory */
Please leave this in. It doesn't have anything to do with the changes
you are making. Actually, I should remove it in an independent
commit. I'll do it a different way for the WaveGear Avaitor driver
I'm porting from NetBSD. Also for the XE driver.
: +#define RF_ALIGNMENT_SHIFT 10 /* alignment size bit starts bit 10 */
: +#define RF_ALIGNMENT_MASK (0x003F << RF_ALIGNMENT_SHIFT) /* resource
:address alignemnt size bit mask */
: +#define RF_ALIGNMENT_LOG2(x) ((x) << RF_ALIGNMENT_SHIFT)
You might want to add:
#define RF_ALIGNMENT(x) (((x) & RF_ALIGNMENT_MASK) >> RF_ALIGNMENT_SHIFT)
Warner
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message