diff options
author | Jonathan Adams <Jonathan.Adams@Sun.COM> | 2010-01-12 17:06:34 -0800 |
---|---|---|
committer | Jonathan Adams <Jonathan.Adams@Sun.COM> | 2010-01-12 17:06:34 -0800 |
commit | 56f33205c9ed776c3c909e07d52e94610a675740 (patch) | |
tree | 7a0c9fb16d059f20cdf267568985fb237e43c9bf /usr/src | |
parent | 9217f8fd97307134fc9a37e74da9fc2dd246e58a (diff) | |
download | illumos-joyent-56f33205c9ed776c3c909e07d52e94610a675740.tar.gz |
4517853 debug.h should include macros to assert implication and equivalence
6915090 struct memlist should have ml_ member prefixes
Diffstat (limited to 'usr/src')
54 files changed, 1248 insertions, 1249 deletions
diff --git a/usr/src/cmd/mdb/common/modules/genunix/memory.c b/usr/src/cmd/mdb/common/modules/genunix/memory.c index e1b1b93cb4..e9ae1553ea 100644 --- a/usr/src/cmd/mdb/common/modules/genunix/memory.c +++ b/usr/src/cmd/mdb/common/modules/genunix/memory.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -667,8 +667,7 @@ pagelookup_help(void) " %<b>vp%</b>::pagelookup -o %<b>offset%</b>\n" " %<b>offset%</b>::pagelookup -v %<b>vp%</b>\n" "\n" - "The latter two forms are useful in pipelines.\n" - ); + "The latter two forms are useful in pipelines.\n"); } int @@ -863,7 +862,7 @@ memlist_walk_step(mdb_walk_state_t *wsp) return (WALK_ERR); } - wsp->walk_addr = (uintptr_t)ml.next; + wsp->walk_addr = (uintptr_t)ml.ml_next; return (wsp->walk_callback(mlp, &ml, wsp->walk_cbdata)); } @@ -919,7 +918,7 @@ memlist(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) return (DCMD_ERR); } - mdb_printf("%0?lx %16llx %16llx\n", addr, ml.address, ml.size); + mdb_printf("%0?lx %16llx %16llx\n", addr, ml.ml_address, ml.ml_size); return (DCMD_OK); } diff --git a/usr/src/psm/stand/boot/sparc/common/bootprop.c b/usr/src/psm/stand/boot/sparc/common/bootprop.c index 695c40a5c9..c551051c37 100644 --- a/usr/src/psm/stand/boot/sparc/common/bootprop.c +++ b/usr/src/psm/stand/boot/sparc/common/bootprop.c @@ -19,12 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <sys/promif.h> #include <sys/bootconf.h> @@ -135,8 +133,8 @@ bgetproplen(struct bootops *bop, char *name) strequal(name, p->name))) { for (ml = *((struct memlist **)p->val); - ml != NIL; - ml = ml->next) + ml != NIL; + ml = ml->ml_next) /* * subtract out the ptrs for our local @@ -144,7 +142,7 @@ bgetproplen(struct bootops *bop, char *name) * only see an array. */ size += (int)(sizeof (struct memlist) - - 2*sizeof (struct memlist *)); + 2*sizeof (struct memlist *)); return (size); } else if (strequal(name, p->name)) { @@ -209,12 +207,12 @@ bgetprop(struct bootops *bop, char *name, void *buf) u_longlong_t *t = buf; for (ml = *((struct memlist **)p->val); - ml != NIL; - ml = ml->next) { + ml != NIL; + ml = ml->ml_next) { /* copy out into an array */ - *t++ = ml->address; - *t++ = ml->size; + *t++ = ml->ml_address; + *t++ = ml->ml_size; } return (BOOT_SUCCESS); } else if (strequal(name, p->name)) { diff --git a/usr/src/psm/stand/boot/sparc/common/sun4u_memlist.c b/usr/src/psm/stand/boot/sparc/common/sun4u_memlist.c index aca63e393e..e9426fd50d 100644 --- a/usr/src/psm/stand/boot/sparc/common/sun4u_memlist.c +++ b/usr/src/psm/stand/boot/sparc/common/sun4u_memlist.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,12 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <sys/param.h> #include <sys/promif.h> @@ -114,7 +111,7 @@ fill_memlists(char *name, char *prop, struct memlist *old) prom_panic("Cannot get list.\n"); if (links > sizeof (scratch_memlist)) { prom_printf("%s list <%s> exceeds boot capabilities\n", - name, prop); + name, prop); prom_panic("fill_memlists - memlist size"); } links = links / sizeof (struct sun4u_prom_memlist); @@ -203,10 +200,10 @@ reg_to_list(struct sun4u_prom_memlist *ar, size_t n, struct memlist *old) if (!head) head = ptr; if (last) - last->next = ptr; - ptr->address = flag ? addr : start1; - ptr->size = size ? size : ar[i].size; - ptr->prev = last; + last->ml_next = ptr; + ptr->ml_address = flag ? addr : start1; + ptr->ml_size = size ? size : ar[i].size; + ptr->ml_prev = last; last = ptr; size = 0; @@ -214,6 +211,6 @@ reg_to_list(struct sun4u_prom_memlist *ar, size_t n, struct memlist *old) addr = 0; } - last->next = NULL; + last->ml_next = NULL; return (head); } diff --git a/usr/src/stand/lib/sa/memlist.c b/usr/src/stand/lib/sa/memlist.c index 096c097c06..3a1a2ab605 100644 --- a/usr/src/stand/lib/sa/memlist.c +++ b/usr/src/stand/lib/sa/memlist.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,12 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 1992-2003 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <sys/param.h> #include <sys/sysmacros.h> @@ -53,9 +50,9 @@ print_memlist(struct memlist *av) while (p != NULL) { printf("addr = 0x%x:0x%x, size = 0x%x:0x%x\n", - (uint_t)(p->address >> 32), (uint_t)p->address, - (uint_t)(p->size >> 32), (uint_t)p->size); - p = p->next; + (uint_t)(p->ml_address >> 32), (uint_t)p->ml_address, + (uint_t)(p->ml_size >> 32), (uint_t)p->ml_size); + p = p->ml_next; } } @@ -125,11 +122,11 @@ get_memlist_struct(void) sizeof (struct memlist)); bzero(free_memlist_ptr, (ALLOC_SZ * sizeof (struct memlist))); for (i = 0; i < ALLOC_SZ; i++) - ptr[i].next = &ptr[i+1]; - ptr[i-1].next = NULL; + ptr[i].ml_next = &ptr[i+1]; + ptr[i-1].ml_next = NULL; } ptr = free_memlist_ptr; - free_memlist_ptr = ptr->next; + free_memlist_ptr = ptr->ml_next; return (ptr); } @@ -144,8 +141,8 @@ add_to_freelist(struct memlist *ptr) if (free_memlist_ptr == NULL) { free_memlist_ptr = ptr; } else { - for (tmp = free_memlist_ptr; tmp->next; tmp = tmp->next) + for (tmp = free_memlist_ptr; tmp->ml_next; tmp = tmp->ml_next) ; - tmp->next = ptr; + tmp->ml_next = ptr; } } diff --git a/usr/src/uts/common/cpr/cpr_dump.c b/usr/src/uts/common/cpr/cpr_dump.c index 3f264b53d2..e5d35646de 100644 --- a/usr/src/uts/common/cpr/cpr_dump.c +++ b/usr/src/uts/common/cpr/cpr_dump.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -177,8 +177,8 @@ cpr_set_bitmap_size(void) size_t size = 0; memlist_read_lock(); - for (pmem = phys_install; pmem; pmem = pmem->next) - size += pmem->size; + for (pmem = phys_install; pmem; pmem = pmem->ml_next) + size += pmem->ml_size; memlist_read_unlock(); cpr_bitmap_size = BITMAP_BYTES(size); } diff --git a/usr/src/uts/common/crypto/io/swrand.c b/usr/src/uts/common/crypto/io/swrand.c index cb69ab769f..d38d03d310 100644 --- a/usr/src/uts/common/crypto/io/swrand.c +++ b/usr/src/uts/common/crypto/io/swrand.c @@ -701,15 +701,15 @@ physmem_ent_gen(physmem_entsrc_t *entsrc) /* Pick a memory block to read */ block = oblock = srndpool[i] % entsrc->nblocks; - for (pmem = phys_install; pmem != NULL; pmem = pmem->next) { - if (block < pmem->size / MEMBLOCKSIZE) + for (pmem = phys_install; pmem != NULL; pmem = pmem->ml_next) { + if (block < pmem->ml_size / MEMBLOCKSIZE) break; - block -= pmem->size / MEMBLOCKSIZE; + block -= pmem->ml_size / MEMBLOCKSIZE; } ASSERT(pmem != NULL); - offset = pmem->address + block * MEMBLOCKSIZE; + offset = pmem->ml_address + block * MEMBLOCKSIZE; if (!address_in_memlist(phys_install, offset, MEMBLOCKSIZE)) { memlist_read_unlock(); @@ -842,8 +842,8 @@ physmem_count_blocks() memlist_read_lock(); entsrc.nblocks = 0; - for (pmem = phys_install; pmem != NULL; pmem = pmem->next) { - entsrc.nblocks += pmem->size / MEMBLOCKSIZE; + for (pmem = phys_install; pmem != NULL; pmem = pmem->ml_next) { + entsrc.nblocks += pmem->ml_size / MEMBLOCKSIZE; if (entsrc.nblocks > MAXMEMBLOCKS) { entsrc.nblocks = MAXMEMBLOCKS; break; diff --git a/usr/src/uts/common/fs/sockfs/socksubr.c b/usr/src/uts/common/fs/sockfs/socksubr.c index 78ec223fe4..bdd3a81f5f 100644 --- a/usr/src/uts/common/fs/sockfs/socksubr.c +++ b/usr/src/uts/common/fs/sockfs/socksubr.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -1614,7 +1614,7 @@ pr_addr(int family, struct sockaddr *addr, t_uscalar_t addrlen) } /* The logical equivalence operator (a if-and-only-if b) */ -#define EQUIV(a, b) (((a) && (b)) || (!(a) && (!(b)))) +#define EQUIVALENT(a, b) (((a) && (b)) || (!(a) && (!(b)))) /* * Verify limitations and invariants on oob state. @@ -1663,7 +1663,7 @@ so_verify_oobstate(struct sonode *so) havemark = (SOCK_IS_NONSTR(so)) ? so->so_oobmark > 0 : SOTOTPI(so)->sti_oobsigcnt > 0; - if (!EQUIV(havemark || (so->so_state & SS_RCVATMARK), + if (!EQUIVALENT(havemark || (so->so_state & SS_RCVATMARK), so->so_state & SS_OOBPEND)) { printf("Bad oob state 3 (%p): state %s\n", (void *)so, pr_state(so->so_state, so->so_mode)); @@ -1674,7 +1674,7 @@ so_verify_oobstate(struct sonode *so) * Unless SO_OOBINLINE we have so_oobmsg != NULL iff SS_HAVEOOBDATA */ if (!(so->so_options & SO_OOBINLINE) && - !EQUIV(so->so_oobmsg != NULL, so->so_state & SS_HAVEOOBDATA)) { + !EQUIVALENT(so->so_oobmsg != NULL, so->so_state & SS_HAVEOOBDATA)) { printf("Bad oob state 4 (%p): state %s\n", (void *)so, pr_state(so->so_state, so->so_mode)); return (0); @@ -1691,7 +1691,7 @@ so_verify_oobstate(struct sonode *so) return (1); } -#undef EQUIV +#undef EQUIVALENT #endif /* DEBUG */ /* initialize sockfs zone specific kstat related items */ diff --git a/usr/src/uts/common/io/dld/dld_proto.c b/usr/src/uts/common/io/dld/dld_proto.c index 7e52b0e05f..ca1fc10306 100644 --- a/usr/src/uts/common/io/dld/dld_proto.c +++ b/usr/src/uts/common/io/dld/dld_proto.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -301,12 +301,12 @@ proto_info_req(dld_str_t *dsp, mblk_t *mp) } done: - ASSERT(IMPLY(dlp->dl_qos_offset != 0, dlp->dl_qos_length != 0)); - ASSERT(IMPLY(dlp->dl_qos_range_offset != 0, - dlp->dl_qos_range_length != 0)); - ASSERT(IMPLY(dlp->dl_addr_offset != 0, dlp->dl_addr_length != 0)); - ASSERT(IMPLY(dlp->dl_brdcst_addr_offset != 0, - dlp->dl_brdcst_addr_length != 0)); + IMPLY(dlp->dl_qos_offset != 0, dlp->dl_qos_length != 0); + IMPLY(dlp->dl_qos_range_offset != 0, + dlp->dl_qos_range_length != 0); + IMPLY(dlp->dl_addr_offset != 0, dlp->dl_addr_length != 0); + IMPLY(dlp->dl_brdcst_addr_offset != 0, + dlp->dl_brdcst_addr_length != 0); qreply(q, mp); } diff --git a/usr/src/uts/common/io/mem.c b/usr/src/uts/common/io/mem.c index d654270129..7a703c5750 100644 --- a/usr/src/uts/common/io/mem.c +++ b/usr/src/uts/common/io/mem.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -762,9 +762,9 @@ mmmmap(dev_t dev, off_t off, int prot) case M_MEM: pf = btop(off); memlist_read_lock(); - for (pmem = phys_install; pmem != NULL; pmem = pmem->next) { - if (pf >= BTOP(pmem->address) && - pf < BTOP(pmem->address + pmem->size)) { + for (pmem = phys_install; pmem != NULL; pmem = pmem->ml_next) { + if (pf >= BTOP(pmem->ml_address) && + pf < BTOP(pmem->ml_address + pmem->ml_size)) { memlist_read_unlock(); return (impl_obmem_pfnum(pf)); } @@ -983,7 +983,7 @@ mm_kstat_update(kstat_t *ksp, int rw) count = 0; memlist_read_lock(); - for (pmem = phys_install; pmem != NULL; pmem = pmem->next) { + for (pmem = phys_install; pmem != NULL; pmem = pmem->ml_next) { count++; } memlist_read_unlock(); @@ -1010,11 +1010,12 @@ mm_kstat_snapshot(kstat_t *ksp, void *buf, int rw) kspmem = (struct memunit *)buf; memlist_read_lock(); - for (pmem = phys_install; pmem != NULL; pmem = pmem->next, kspmem++) { + for (pmem = phys_install; pmem != NULL; + pmem = pmem->ml_next, kspmem++) { if ((caddr_t)kspmem >= (caddr_t)buf + ksp->ks_data_size) break; - kspmem->address = pmem->address; - kspmem->size = pmem->size; + kspmem->address = pmem->ml_address; + kspmem->size = pmem->ml_size; } memlist_read_unlock(); diff --git a/usr/src/uts/common/io/tl.c b/usr/src/uts/common/io/tl.c index 353d536daf..45897fbe95 100644 --- a/usr/src/uts/common/io/tl.c +++ b/usr/src/uts/common/io/tl.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -911,18 +911,6 @@ optdb_obj_t tl_opt_obj = { }; /* - * Logical operations. - * - * IMPLY(X, Y) means that X implies Y i.e. when X is true, Y - * should also be true. - * - * EQUIV(X, Y) is logical equivalence. Both X and Y should be true or false at - * the same time. - */ -#define IMPLY(X, Y) (!(X) || (Y)) -#define EQUIV(X, Y) (IMPLY(X, Y) && IMPLY(Y, X)) - -/* * LOCAL FUNCTIONS AND DRIVER ENTRY POINTS * --------------------------------------- */ @@ -1082,7 +1070,7 @@ tl_detach(dev_info_t *devi, ddi_detach_cmd_t cmd) if ((i == TL_UNUSED) || (i == TL_SOCK_COTSORD)) continue; - ASSERT(EQUIV(i & TL_TICLTS, t->tr_serializer != NULL)); + EQUIV(i & TL_TICLTS, t->tr_serializer != NULL); if (t->tr_serializer != NULL) { tl_serializer_refrele(t->tr_serializer); t->tr_serializer = NULL; @@ -1692,8 +1680,8 @@ static void tl_close_finish_ser(mblk_t *mp, tl_endpt_t *tep) { ASSERT(tep->te_closing); - ASSERT(IMPLY(IS_CLTS(tep), tep->te_closewait == 0)); - ASSERT(IMPLY(IS_COTS(tep), tep->te_closewait == 1)); + IMPLY(IS_CLTS(tep), tep->te_closewait == 0); + IMPLY(IS_COTS(tep), tep->te_closewait == 1); tep->te_state = -1; /* Uninitialized */ if (IS_COTS(tep)) { @@ -1945,7 +1933,7 @@ tl_wput_data_ser(mblk_t *mp, tl_endpt_t *tep) ASSERT(DB_TYPE(mp) == M_DATA); ASSERT(IS_COTS(tep)); - ASSERT(IMPLY(peer_tep, tep->te_serializer == peer_tep->te_serializer)); + IMPLY(peer_tep, tep->te_serializer == peer_tep->te_serializer); /* * fastpath for data. Ignore flow control if tep is closing. @@ -3958,8 +3946,8 @@ tl_discon_req(mblk_t *mp, tl_endpt_t *tep) * the code below will avoid any action on the client side. */ - ASSERT(IMPLY(tip->ti_tep != NULL, - tip->ti_tep->te_seqno == dr->SEQ_number)); + IMPLY(tip->ti_tep != NULL, + tip->ti_tep->te_seqno == dr->SEQ_number); peer_tep = tip->ti_tep; } @@ -5279,10 +5267,10 @@ tl_find_peer(tl_endpt_t *tep, tl_addr_t *ap) ASSERT(ap != NULL && ap->ta_alen > 0); ASSERT(ap->ta_zoneid == tep->te_zoneid); ASSERT(ap->ta_abuf != NULL); - ASSERT(EQUIV(rc == 0, peer_tep != NULL)); - ASSERT(IMPLY(rc == 0, + EQUIV(rc == 0, peer_tep != NULL); + IMPLY(rc == 0, (tep->te_zoneid == peer_tep->te_zoneid) && - (tep->te_transport == peer_tep->te_transport))); + (tep->te_transport == peer_tep->te_transport)); if ((rc == 0) && (peer_tep->te_closing)) { tl_refrele(peer_tep); @@ -5307,8 +5295,8 @@ tl_sock_find_peer(tl_endpt_t *tep, soux_addr_t *ux_addr) (mod_hash_val_t *)&peer_tep, tl_find_callback); ASSERT(IS_SOCKET(tep)); - ASSERT(EQUIV(rc == 0, peer_tep != NULL)); - ASSERT(IMPLY(rc == 0, (tep->te_transport == peer_tep->te_transport))); + EQUIV(rc == 0, peer_tep != NULL); + IMPLY(rc == 0, (tep->te_transport == peer_tep->te_transport)); if (peer_tep != NULL) { /* Don't attempt to use closing peer. */ diff --git a/usr/src/uts/common/os/dumpsubr.c b/usr/src/uts/common/os/dumpsubr.c index 292ec165d4..7d5c1a9b3f 100644 --- a/usr/src/uts/common/os/dumpsubr.c +++ b/usr/src/uts/common/os/dumpsubr.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -692,9 +692,9 @@ dump_init_memlist_walker(dumpmlw_t *pw) { pw->mp = phys_install; pw->basenum = 0; - pw->mppages = pw->mp->size >> PAGESHIFT; + pw->mppages = pw->mp->ml_size >> PAGESHIFT; pw->mpleft = pw->mppages; - pw->mpaddr = pw->mp->address >> PAGESHIFT; + pw->mpaddr = pw->mp->ml_address >> PAGESHIFT; } /* @@ -713,11 +713,11 @@ dump_bitnum_to_pfn(pgcnt_t bitnum, dumpmlw_t *pw) } bitnum -= pw->mppages; pw->basenum += pw->mppages; - pw->mp = pw->mp->next; + pw->mp = pw->mp->ml_next; if (pw->mp != NULL) { - pw->mppages = pw->mp->size >> PAGESHIFT; + pw->mppages = pw->mp->ml_size >> PAGESHIFT; pw->mpleft = pw->mppages; - pw->mpaddr = pw->mp->address >> PAGESHIFT; + pw->mpaddr = pw->mp->ml_address >> PAGESHIFT; } } return (PFN_INVALID); @@ -729,11 +729,11 @@ dump_pfn_to_bitnum(pfn_t pfn) struct memlist *mp; pgcnt_t bitnum = 0; - for (mp = phys_install; mp != NULL; mp = mp->next) { - if (pfn >= (mp->address >> PAGESHIFT) && - pfn < ((mp->address + mp->size) >> PAGESHIFT)) - return (bitnum + pfn - (mp->address >> PAGESHIFT)); - bitnum += mp->size >> PAGESHIFT; + for (mp = phys_install; mp != NULL; mp = mp->ml_next) { + if (pfn >= (mp->ml_address >> PAGESHIFT) && + pfn < ((mp->ml_address + mp->ml_size) >> PAGESHIFT)) + return (bitnum + pfn - (mp->ml_address >> PAGESHIFT)); + bitnum += mp->ml_size >> PAGESHIFT; } return ((pgcnt_t)-1); } diff --git a/usr/src/uts/common/os/mem_cage.c b/usr/src/uts/common/os/mem_cage.c index 590819f088..74904a0a38 100644 --- a/usr/src/uts/common/os/mem_cage.c +++ b/usr/src/uts/common/os/mem_cage.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -386,20 +386,20 @@ kcage_range_init(struct memlist *ml, kcage_dir_t d, pgcnt_t preferred_size) ASSERT(kcage_arena != NULL); if (d == KCAGE_DOWN) { - while (ml->next != NULL) - ml = ml->next; + while (ml->ml_next != NULL) + ml = ml->ml_next; } rw_enter(&kcage_range_rwlock, RW_WRITER); while (ml != NULL) { - ret = kcage_range_add_internal(btop(ml->address), - btop(ml->size), d); + ret = kcage_range_add_internal(btop(ml->ml_address), + btop(ml->ml_size), d); if (ret) panic("kcage_range_add_internal failed: " "ml=%p, ret=0x%x\n", (void *)ml, ret); - ml = (d == KCAGE_DOWN ? ml->prev : ml->next); + ml = (d == KCAGE_DOWN ? ml->ml_prev : ml->ml_next); } rw_exit(&kcage_range_rwlock); diff --git a/usr/src/uts/common/os/mem_config.c b/usr/src/uts/common/os/mem_config.c index 6e280a9af5..25ebe0a66e 100644 --- a/usr/src/uts/common/os/mem_config.c +++ b/usr/src/uts/common/os/mem_config.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -879,10 +879,10 @@ span_to_install(pfn_t base, pgcnt_t npgs) size = (uint64_t)npgs << PAGESHIFT; while (size != 0) { memlist_read_lock(); - for (mlp = phys_install; mlp != NULL; mlp = mlp->next) { - if (address >= (mlp->address + mlp->size)) + for (mlp = phys_install; mlp != NULL; mlp = mlp->ml_next) { + if (address >= (mlp->ml_address + mlp->ml_size)) continue; - if ((address + size) > mlp->address) + if ((address + size) > mlp->ml_address) break; } if (mlp == NULL) { @@ -890,13 +890,15 @@ span_to_install(pfn_t base, pgcnt_t npgs) size = 0; thislen = 0; } else { - if (address < mlp->address) { - size -= (mlp->address - address); - address = mlp->address; + if (address < mlp->ml_address) { + size -= (mlp->ml_address - address); + address = mlp->ml_address; } - ASSERT(address >= mlp->address); - if ((address + size) > (mlp->address + mlp->size)) { - thislen = mlp->size - (address - mlp->address); + ASSERT(address >= mlp->ml_address); + if ((address + size) > + (mlp->ml_address + mlp->ml_size)) { + thislen = + mlp->ml_size - (address - mlp->ml_address); } else { thislen = size; } diff --git a/usr/src/uts/common/os/memlist_new.c b/usr/src/uts/common/os/memlist_new.c index 358c777111..adef7cb015 100644 --- a/usr/src/uts/common/os/memlist_new.c +++ b/usr/src/uts/common/os/memlist_new.c @@ -19,12 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <sys/cmn_err.h> #include <sys/mutex.h> @@ -48,7 +46,7 @@ memlist_get_one(void) mutex_enter(&memlist_freelist_mutex); mlp = memlist_freelist; if (mlp != NULL) { - memlist_freelist = mlp->next; + memlist_freelist = mlp->ml_next; memlist_freelist_count--; } mutex_exit(&memlist_freelist_mutex); @@ -62,7 +60,7 @@ memlist_free_one(struct memlist *mlp) ASSERT(mlp != NULL); mutex_enter(&memlist_freelist_mutex); - mlp->next = memlist_freelist; + mlp->ml_next = memlist_freelist; memlist_freelist = mlp; memlist_freelist_count++; mutex_exit(&memlist_freelist_mutex); @@ -79,10 +77,10 @@ memlist_free_list(struct memlist *mlp) } count = 1; - for (mlendp = mlp; mlendp->next != NULL; mlendp = mlendp->next) + for (mlendp = mlp; mlendp->ml_next != NULL; mlendp = mlendp->ml_next) count++; mutex_enter(&memlist_freelist_mutex); - mlendp->next = memlist_freelist; + mlendp->ml_next = memlist_freelist; memlist_freelist = mlp; memlist_freelist_count += count; mutex_exit(&memlist_freelist_mutex); @@ -101,11 +99,11 @@ memlist_free_block(caddr_t base, size_t bytes) mlp = (struct memlist *)base; mlendp = &mlp[count - 1]; for (; mlp != mlendp; mlp++) - mlp->next = mlp + 1; - mlendp->next = NULL; + mlp->ml_next = mlp + 1; + mlendp->ml_next = NULL; mlp = (struct memlist *)base; mutex_enter(&memlist_freelist_mutex); - mlendp->next = memlist_freelist; + mlendp->ml_next = memlist_freelist; memlist_freelist = mlp; memlist_freelist_count += count; mutex_exit(&memlist_freelist_mutex); @@ -124,29 +122,29 @@ memlist_insert( struct memlist *cur, *last; uint64_t start, end; - start = new->address; - end = start + new->size; + start = new->ml_address; + end = start + new->ml_size; last = NULL; - for (cur = *curmemlistp; cur; cur = cur->next) { + for (cur = *curmemlistp; cur; cur = cur->ml_next) { last = cur; - if (cur->address >= end) { - new->next = cur; - new->prev = cur->prev; - cur->prev = new; + if (cur->ml_address >= end) { + new->ml_next = cur; + new->ml_prev = cur->ml_prev; + cur->ml_prev = new; if (cur == *curmemlistp) *curmemlistp = new; else - new->prev->next = new; + new->ml_prev->ml_next = new; return; } - if (cur->address + cur->size > start) + if (cur->ml_address + cur->ml_size > start) panic("munged memory list = 0x%p\n", (void *)curmemlistp); } - new->next = NULL; - new->prev = last; + new->ml_next = NULL; + new->ml_prev = last; if (last != NULL) - last->next = new; + last->ml_next = new; } void @@ -159,31 +157,31 @@ memlist_del(struct memlist *memlistp, */ struct memlist *mlp; - for (mlp = *curmemlistp; mlp != NULL; mlp = mlp->next) + for (mlp = *curmemlistp; mlp != NULL; mlp = mlp->ml_next) if (mlp == memlistp) break; ASSERT(mlp == memlistp); #endif /* DEBUG */ if (*curmemlistp == memlistp) { - ASSERT(memlistp->prev == NULL); - *curmemlistp = memlistp->next; + ASSERT(memlistp->ml_prev == NULL); + *curmemlistp = memlistp->ml_next; } - if (memlistp->prev != NULL) { - ASSERT(memlistp->prev->next == memlistp); - memlistp->prev->next = memlistp->next; + if (memlistp->ml_prev != NULL) { + ASSERT(memlistp->ml_prev->ml_next == memlistp); + memlistp->ml_prev->ml_next = memlistp->ml_next; } - if (memlistp->next != NULL) { - ASSERT(memlistp->next->prev == memlistp); - memlistp->next->prev = memlistp->prev; + if (memlistp->ml_next != NULL) { + ASSERT(memlistp->ml_next->ml_prev == memlistp); + memlistp->ml_next->ml_prev = memlistp->ml_prev; } } struct memlist * memlist_find(struct memlist *mlp, uint64_t address) { - for (; mlp != NULL; mlp = mlp->next) - if (address >= mlp->address && - address < (mlp->address + mlp->size)) + for (; mlp != NULL; mlp = mlp->ml_next) + if (address >= mlp->ml_address && + address < (mlp->ml_address + mlp->ml_size)) break; return (mlp); } @@ -214,15 +212,15 @@ memlist_add_span( return (MEML_SPANOP_EALLOC); } - dst->address = address; - dst->size = bytes; + dst->ml_address = address; + dst->ml_size = bytes; /* * First insert. */ if (*curmemlistp == NULL) { - dst->prev = NULL; - dst->next = NULL; + dst->ml_prev = NULL; + dst->ml_next = NULL; *curmemlistp = dst; return (MEML_SPANOP_OK); } @@ -231,8 +229,8 @@ memlist_add_span( * Insert into sorted list. */ for (prev = NULL, next = *curmemlistp; next != NULL; - prev = next, next = next->next) { - if (address > (next->address + next->size)) + prev = next, next = next->ml_next) { + if (address > (next->ml_address + next->ml_size)) continue; /* @@ -242,11 +240,11 @@ memlist_add_span( /* * Prepend to next. */ - if ((address + bytes) == next->address) { + if ((address + bytes) == next->ml_address) { memlist_free_one(dst); - next->address = address; - next->size += bytes; + next->ml_address = address; + next->ml_size += bytes; return (MEML_SPANOP_OK); } @@ -254,45 +252,47 @@ memlist_add_span( /* * Append to next. */ - if (address == (next->address + next->size)) { + if (address == (next->ml_address + next->ml_size)) { memlist_free_one(dst); - if (next->next) { + if (next->ml_next) { /* - * don't overlap with next->next + * don't overlap with next->ml_next */ - if ((address + bytes) > next->next->address) { + if ((address + bytes) > + next->ml_next->ml_address) { return (MEML_SPANOP_ESPAN); } /* - * Concatenate next and next->next + * Concatenate next and next->ml_next */ - if ((address + bytes) == next->next->address) { - struct memlist *mlp = next->next; + if ((address + bytes) == + next->ml_next->ml_address) { + struct memlist *mlp = next->ml_next; if (next == *curmemlistp) - *curmemlistp = next->next; + *curmemlistp = next->ml_next; - mlp->address = next->address; - mlp->size += next->size; - mlp->size += bytes; + mlp->ml_address = next->ml_address; + mlp->ml_size += next->ml_size; + mlp->ml_size += bytes; - if (next->prev) - next->prev->next = mlp; - mlp->prev = next->prev; + if (next->ml_prev) + next->ml_prev->ml_next = mlp; + mlp->ml_prev = next->ml_prev; memlist_free_one(next); return (MEML_SPANOP_OK); } } - next->size += bytes; + next->ml_size += bytes; return (MEML_SPANOP_OK); } /* don't overlap with next */ - if ((address + bytes) > next->address) { + if ((address + bytes) > next->ml_address) { memlist_free_one(dst); return (MEML_SPANOP_ESPAN); } @@ -300,13 +300,13 @@ memlist_add_span( /* * Insert before next. */ - dst->prev = prev; - dst->next = next; - next->prev = dst; + dst->ml_prev = prev; + dst->ml_next = next; + next->ml_prev = dst; if (prev == NULL) { *curmemlistp = dst; } else { - prev->next = dst; + prev->ml_next = dst; } return (MEML_SPANOP_OK); } @@ -314,9 +314,9 @@ memlist_add_span( /* * End of list, prev is valid and next is NULL. */ - prev->next = dst; - dst->prev = prev; - dst->next = NULL; + prev->ml_next = dst; + dst->ml_prev = prev; + dst->ml_next = NULL; return (MEML_SPANOP_OK); } @@ -339,9 +339,9 @@ memlist_delete_span( /* * Find element containing address. */ - for (next = *curmemlistp; next != NULL; next = next->next) { - if ((address >= next->address) && - (address < next->address + next->size)) + for (next = *curmemlistp; next != NULL; next = next->ml_next) { + if ((address >= next->ml_address) && + (address < next->ml_address + next->ml_size)) break; } @@ -355,32 +355,32 @@ memlist_delete_span( /* * Error if size goes off end of this struct memlist. */ - if (address + bytes > next->address + next->size) { + if (address + bytes > next->ml_address + next->ml_size) { return (MEML_SPANOP_ESPAN); } /* * Span at beginning of struct memlist. */ - if (address == next->address) { + if (address == next->ml_address) { /* * If start & size match, delete from list. */ - if (bytes == next->size) { + if (bytes == next->ml_size) { if (next == *curmemlistp) - *curmemlistp = next->next; - if (next->prev != NULL) - next->prev->next = next->next; - if (next->next != NULL) - next->next->prev = next->prev; + *curmemlistp = next->ml_next; + if (next->ml_prev != NULL) + next->ml_prev->ml_next = next->ml_next; + if (next->ml_next != NULL) + next->ml_next->ml_prev = next->ml_prev; memlist_free_one(next); } else { /* * Increment start address by bytes. */ - next->address += bytes; - next->size -= bytes; + next->ml_address += bytes; + next->ml_size -= bytes; } return (MEML_SPANOP_OK); } @@ -388,11 +388,11 @@ memlist_delete_span( /* * Span at end of struct memlist. */ - if (address + bytes == next->address + next->size) { + if (address + bytes == next->ml_address + next->ml_size) { /* * decrement size by bytes */ - next->size -= bytes; + next->ml_size -= bytes; return (MEML_SPANOP_OK); } @@ -413,9 +413,10 @@ memlist_delete_span( * Existing struct memlist gets address * and size up to start of span. */ - dst->address = address + bytes; - dst->size = (next->address + next->size) - dst->address; - next->size = address - next->address; + dst->ml_address = address + bytes; + dst->ml_size = + (next->ml_address + next->ml_size) - dst->ml_address; + next->ml_size = address - next->ml_address; /* * New struct memlist gets address starting @@ -425,12 +426,12 @@ memlist_delete_span( /* * link in new memlist after old */ - dst->next = next->next; - dst->prev = next; + dst->ml_next = next->ml_next; + dst->ml_prev = next; - if (next->next != NULL) - next->next->prev = dst; - next->next = dst; + if (next->ml_next != NULL) + next->ml_next->ml_prev = dst; + next->ml_next = dst; } return (MEML_SPANOP_OK); } diff --git a/usr/src/uts/common/os/strsubr.c b/usr/src/uts/common/os/strsubr.c index c3d928c586..13ccd0263a 100644 --- a/usr/src/uts/common/os/strsubr.c +++ b/usr/src/uts/common/os/strsubr.c @@ -384,17 +384,6 @@ struct qinit passthru_winit = { }; /* - * Special form of assertion: verify that X implies Y i.e. when X is true Y - * should also be true. - */ -#define IMPLY(X, Y) ASSERT(!(X) || (Y)) - -/* - * Logical equivalence. Verify that both X and Y are either TRUE or FALSE. - */ -#define EQUIV(X, Y) { IMPLY(X, Y); IMPLY(Y, X); } - -/* * Verify correctness of list head/tail pointers. */ #define LISTCHECK(head, tail, link) { \ diff --git a/usr/src/uts/common/os/subr.c b/usr/src/uts/common/os/subr.c index 0bcc6f3232..8ca338a986 100644 --- a/usr/src/uts/common/os/subr.c +++ b/usr/src/uts/common/os/subr.c @@ -19,16 +19,13 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ /* All Rights Reserved */ - -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <sys/sysmacros.h> #include <sys/param.h> @@ -383,10 +380,10 @@ int address_in_memlist(struct memlist *mp, uint64_t addr, size_t len) { while (mp != 0) { - if ((addr >= mp->address) && - (addr + len <= mp->address + mp->size)) + if ((addr >= mp->ml_address) && + (addr + len <= mp->ml_address + mp->ml_size)) return (1); /* TRUE */ - mp = mp->next; + mp = mp->ml_next; } return (0); /* FALSE */ } diff --git a/usr/src/uts/common/os/taskq.c b/usr/src/uts/common/os/taskq.c index a39abf6ec6..e4e0aced54 100644 --- a/usr/src/uts/common/os/taskq.c +++ b/usr/src/uts/common/os/taskq.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -1742,8 +1742,6 @@ taskq_create_sysdc(const char *name, int nthreads, int minalloc, maxalloc, proc, dc, flags | TASKQ_NOINSTANCE | TASKQ_DUTY_CYCLE)); } -#define IMPLY(a, b) ASSERT((!(a)) || (b)) /* if (a) { ASSERT (b) } */ - static taskq_t * taskq_create_common(const char *name, int instance, int nthreads, pri_t pri, int minalloc, int maxalloc, proc_t *proc, uint_t dc, uint_t flags) diff --git a/usr/src/uts/common/sys/debug.h b/usr/src/uts/common/sys/debug.h index 7c12ecab01..4de39d255e 100644 --- a/usr/src/uts/common/sys/debug.h +++ b/usr/src/uts/common/sys/debug.h @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -74,6 +74,25 @@ extern int assfail(); #endif /* + * IMPLY and EQUIV are assertions of the form: + * + * if (a) then (b) + * and + * if (a) then (b) *AND* if (b) then (a) + */ +#if DEBUG +#define IMPLY(A, B) \ + ((void)(((!(A)) || (B)) || \ + assfail("(" #A ") implies (" #B ")", __FILE__, __LINE__))) +#define EQUIV(A, B) \ + ((void)((!!(A) == !!(B)) || \ + assfail("(" #A ") is equivalent to (" #B ")", __FILE__, __LINE__))) +#else +#define IMPLY(A, B) ((void)0) +#define EQUIV(A, B) ((void)0) +#endif + +/* * ASSERT3() behaves like ASSERT() except that it is an explicit conditional, * and prints out the values of the left and right hand expressions as part of * the panic message to ease debugging. The three variants imply the type diff --git a/usr/src/uts/common/sys/dld_impl.h b/usr/src/uts/common/sys/dld_impl.h index b2da85ff31..a76a927e59 100644 --- a/usr/src/uts/common/sys/dld_impl.h +++ b/usr/src/uts/common/sys/dld_impl.h @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -306,8 +306,6 @@ typedef struct dld_ap { * Useful macros. */ -#define IMPLY(p, c) (!(p) || (c)) - #define DLD_SETQFULL(dsp) { \ queue_t *q = (dsp)->ds_wq; \ \ diff --git a/usr/src/uts/common/sys/memlist.h b/usr/src/uts/common/sys/memlist.h index c11bbccb5f..1664c42f2f 100644 --- a/usr/src/uts/common/sys/memlist.h +++ b/usr/src/uts/common/sys/memlist.h @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -40,12 +40,12 @@ extern "C" { * Boot programs of version 4 and greater pass a linked list * of struct memlist to the kernel. */ -struct memlist { - uint64_t address; /* starting address of memory segment */ - uint64_t size; /* size of same */ - struct memlist *next; /* link to next list element */ - struct memlist *prev; /* link to previous list element */ -}; +typedef struct memlist { + uint64_t ml_address; /* starting address of memory segment */ + uint64_t ml_size; /* size of same */ + struct memlist *ml_next; /* link to next list element */ + struct memlist *ml_prev; /* link to previous list element */ +} memlist_t; extern int address_in_memlist(struct memlist *, uint64_t, size_t); diff --git a/usr/src/uts/i86pc/io/intel_iommu.c b/usr/src/uts/i86pc/io/intel_iommu.c index 1a5d988fe2..7b457aec74 100644 --- a/usr/src/uts/i86pc/io/intel_iommu.c +++ b/usr/src/uts/i86pc/io/intel_iommu.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Portions Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Portions Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* @@ -1935,16 +1935,16 @@ domain_vmem_init(dmar_domain_state_t *domain) memlist_read_lock(); mp = phys_install; - end = (mp->address + mp->size); + end = (mp->ml_address + mp->ml_size); /* * Skip page 0: vmem_create wont like it for obvious * reasons. */ - if (mp->address == 0) { + if (mp->ml_address == 0) { start = IOMMU_PAGE_SIZE; } else { - start = mp->address; + start = mp->ml_address; } cmn_err(CE_CONT, "?Adding iova [0x%" PRIx64 @@ -1965,17 +1965,17 @@ domain_vmem_init(dmar_domain_state_t *domain) cmn_err(CE_PANIC, "Unable to inialize vmem map\n"); } - mp = mp->next; + mp = mp->ml_next; while (mp) { vmem_ret = vmem_add(domain->dm_dvma_map, - (void *)((uintptr_t)mp->address), - mp->size, VM_NOSLEEP); + (void *)((uintptr_t)mp->ml_address), + mp->ml_size, VM_NOSLEEP); cmn_err(CE_CONT, "?Adding iova [0x%" PRIx64 - " - 0x%" PRIx64 "] to %s\n", mp->address, - mp->address + mp->size, vmem_name); + " - 0x%" PRIx64 "] to %s\n", mp->ml_address, + mp->ml_address + mp->ml_size, vmem_name); if (!vmem_ret) cmn_err(CE_PANIC, "Unable to inialize vmem map\n"); - mp = mp->next; + mp = mp->ml_next; } memlist_read_unlock(); @@ -2834,12 +2834,12 @@ build_dev_identity_map(dev_info_t *dip) mp = phys_install; while (mp != NULL) { (void) iommu_map_page_range(domain, - mp->address & IOMMU_PAGE_MASK, - mp->address & IOMMU_PAGE_MASK, - (mp->address + mp->size - 1) & IOMMU_PAGE_MASK, + mp->ml_address & IOMMU_PAGE_MASK, + mp->ml_address & IOMMU_PAGE_MASK, + (mp->ml_address + mp->ml_size - 1) & IOMMU_PAGE_MASK, DDI_DMA_READ | DDI_DMA_WRITE | IOMMU_PAGE_PROP_NOSYNC); - mp = mp->next; + mp = mp->ml_next; } memlist_read_unlock(); @@ -2870,15 +2870,15 @@ map_bios_rsvd_mem_pool(dev_info_t *dip) mp = bios_rsvd; while (mp != 0) { (void) iommu_map_page_range(domain, - mp->address & IOMMU_PAGE_MASK, - mp->address & IOMMU_PAGE_MASK, - (mp->address + mp->size - 1) & IOMMU_PAGE_MASK, + mp->ml_address & IOMMU_PAGE_MASK, + mp->ml_address & IOMMU_PAGE_MASK, + (mp->ml_address + mp->ml_size - 1) & IOMMU_PAGE_MASK, DDI_DMA_READ | DDI_DMA_WRITE | IOMMU_PAGE_PROP_NOSYNC); cmn_err(CE_CONT, "?Mapping Reservd [0x%" PRIx64 - " - 0x%" PRIx64 "]\n", mp->address, - (mp->address + mp->size)); - mp = mp->next; + " - 0x%" PRIx64 "]\n", mp->ml_address, + (mp->ml_address + mp->ml_size)); + mp = mp->ml_next; } } diff --git a/usr/src/uts/i86pc/os/fakebop.c b/usr/src/uts/i86pc/os/fakebop.c index 0d6e6c0851..ccf091220c 100644 --- a/usr/src/uts/i86pc/os/fakebop.c +++ b/usr/src/uts/i86pc/os/fakebop.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -194,9 +194,9 @@ do_bop_phys_alloc(uint64_t size, uint64_t align) * find the highest available memory in physinstalled */ size = P2ROUNDUP(size, align); - for (; ml; ml = ml->next) { - start = P2ROUNDUP(ml->address, align); - end = P2ALIGN(ml->address + ml->size, align); + for (; ml; ml = ml->ml_next) { + start = P2ROUNDUP(ml->ml_address, align); + end = P2ALIGN(ml->ml_address + ml->ml_size, align); if (start < next_phys) start = P2ROUNDUP(next_phys, align); if (end > high_phys) diff --git a/usr/src/uts/i86pc/os/lgrpplat.c b/usr/src/uts/i86pc/os/lgrpplat.c index 1a76121b3f..1525b7859d 100644 --- a/usr/src/uts/i86pc/os/lgrpplat.c +++ b/usr/src/uts/i86pc/os/lgrpplat.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -492,11 +492,11 @@ plat_build_mem_nodes(struct memlist *list) while (list) { int node; - start = list->address >> PAGESHIFT; - end = (list->address + list->size - 1) >> PAGESHIFT; + start = list->ml_address >> PAGESHIFT; + end = (list->ml_address + list->ml_size - 1) >> PAGESHIFT; if (start > physmax) { - list = list->next; + list = list->ml_next; continue; } if (end > physmax) @@ -507,7 +507,7 @@ plat_build_mem_nodes(struct memlist *list) */ if (max_mem_nodes == 1) { mem_node_add_slice(start, end); - list = list->next; + list = list->ml_next; continue; } @@ -565,7 +565,7 @@ plat_build_mem_nodes(struct memlist *list) cur_start = cur_end + 1; } while (cur_end < end); - list = list->next; + list = list->ml_next; } mem_node_physalign = 0; mem_node_pfn_shift = 0; @@ -1829,14 +1829,14 @@ lgrp_plat_mem_size_default(lgrp_handle_t lgrphand, lgrp_mem_query_t query) return ((pgcnt_t)freemem); case LGRP_MEM_SIZE_AVAIL: memlist_read_lock(); - for (mlist = phys_avail; mlist; mlist = mlist->next) - npgs += btop(mlist->size); + for (mlist = phys_avail; mlist; mlist = mlist->ml_next) + npgs += btop(mlist->ml_size); memlist_read_unlock(); return (npgs); case LGRP_MEM_SIZE_INSTALL: memlist_read_lock(); - for (mlist = phys_install; mlist; mlist = mlist->next) - npgs += btop(mlist->size); + for (mlist = phys_install; mlist; mlist = mlist->ml_next) + npgs += btop(mlist->ml_size); memlist_read_unlock(); return (npgs); default: diff --git a/usr/src/uts/i86pc/os/machdep.c b/usr/src/uts/i86pc/os/machdep.c index 24ead5d6bd..8a2db06a40 100644 --- a/usr/src/uts/i86pc/os/machdep.c +++ b/usr/src/uts/i86pc/os/machdep.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -1196,8 +1196,8 @@ num_phys_pages() return (xpv_nr_phys_pages()); #endif /* __xpv */ - for (mp = phys_install; mp != NULL; mp = mp->next) - npages += mp->size >> PAGESHIFT; + for (mp = phys_install; mp != NULL; mp = mp->ml_next) + npages += mp->ml_size >> PAGESHIFT; return (npages); } diff --git a/usr/src/uts/i86pc/os/memnode.c b/usr/src/uts/i86pc/os/memnode.c index f98b4b8e6d..908b2e8cd2 100644 --- a/usr/src/uts/i86pc/os/memnode.c +++ b/usr/src/uts/i86pc/os/memnode.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -200,14 +200,15 @@ startup_build_mem_nodes(struct memlist *list) * Boot install lists are arranged <addr, len>, ... */ while (list) { - start = list->address >> PAGESHIFT; + start = list->ml_address >> PAGESHIFT; if (start > physmax) continue; - end = (list->address + list->size - 1) >> PAGESHIFT; + end = + (list->ml_address + list->ml_size - 1) >> PAGESHIFT; if (end > physmax) end = physmax; mem_node_add_range(start, end); - list = list->next; + list = list->ml_next; } mem_node_physalign = 0; mem_node_pfn_shift = 0; @@ -267,9 +268,9 @@ mem_node_memlist_pages(int mnode, struct memlist *mlist) memlist_read_lock(); - for (pmem = mlist; pmem; pmem = pmem->next) { - cur_base = btop(pmem->address); - cur_end = cur_base + btop(pmem->size) - 1; + for (pmem = mlist; pmem; pmem = pmem->ml_next) { + cur_base = btop(pmem->ml_address); + cur_end = cur_base + btop(pmem->ml_size) - 1; if (end < cur_base || base > cur_end) continue; npgs = npgs + (MIN(cur_end, end) - diff --git a/usr/src/uts/i86pc/os/memscrub.c b/usr/src/uts/i86pc/os/memscrub.c index 04b7c2801b..c0681bcadb 100644 --- a/usr/src/uts/i86pc/os/memscrub.c +++ b/usr/src/uts/i86pc/os/memscrub.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -182,8 +182,8 @@ memscrub_init() /* * copy phys_install to memscrub_memlist */ - for (src = phys_install; src; src = src->next) { - if (memscrub_add_span(src->address, src->size)) { + for (src = phys_install; src; src = src->ml_next) { + if (memscrub_add_span(src->ml_address, src->ml_size)) { cmn_err(CE_WARN, "Software memory scrubber failed to initialize\n"); return; @@ -278,8 +278,8 @@ memscrubber() } mlp = memscrub_memlist; - mlp_next_addr = mlp->address; - mlp_last_addr = mlp->address + mlp->size; + mlp_next_addr = mlp->ml_address; + mlp_last_addr = mlp->ml_address + mlp->ml_size; deadline = gethrestime_sec() + memscrub_delay_start_sec; @@ -358,13 +358,13 @@ memscrubber() reached_end = 0; if (address + mmu_ptob(pages) >= mlp_last_addr) { pages = mmu_btop(mlp_last_addr - address); - mlp = mlp->next; + mlp = mlp->ml_next; if (mlp == NULL) { reached_end = 1; mlp = memscrub_memlist; } - mlp_next_addr = mlp->address; - mlp_last_addr = mlp->address + mlp->size; + mlp_next_addr = mlp->ml_address; + mlp_last_addr = mlp->ml_address + mlp->ml_size; } else { mlp_next_addr += mmu_ptob(pages); } @@ -477,8 +477,8 @@ memscrub_add_span(uint64_t start, uint64_t bytes) prev = NULL; next = memscrub_memlist; while (next) { - uint64_t ns = next->address; - uint64_t ne = next->address + next->size - 1; + uint64_t ns = next->ml_address; + uint64_t ne = next->ml_address + next->ml_size - 1; /* * If this span overlaps with an existing span, then @@ -496,7 +496,7 @@ memscrub_add_span(uint64_t start, uint64_t bytes) * New span can be appended to an existing one. */ if (start == ne + 1) { - next->size += bytes; + next->ml_size += bytes; goto add_done; } @@ -504,8 +504,8 @@ memscrub_add_span(uint64_t start, uint64_t bytes) * New span can be prepended to an existing one. */ if (end + 1 == ns) { - next->size += bytes; - next->address = start; + next->ml_size += bytes; + next->ml_address = start; goto add_done; } @@ -518,7 +518,7 @@ memscrub_add_span(uint64_t start, uint64_t bytes) break; prev = next; - next = next->next; + next = next->ml_next; } /* @@ -529,18 +529,18 @@ memscrub_add_span(uint64_t start, uint64_t bytes) retval = -1; goto add_done; } - dst->address = start; - dst->size = bytes; - dst->prev = prev; - dst->next = next; + dst->ml_address = start; + dst->ml_size = bytes; + dst->ml_prev = prev; + dst->ml_next = next; if (prev) - prev->next = dst; + prev->ml_next = dst; else memscrub_memlist = dst; if (next) - next->prev = dst; + next->ml_prev = dst; add_done: diff --git a/usr/src/uts/i86pc/os/startup.c b/usr/src/uts/i86pc/os/startup.c index 063ab65acc..913b2bce02 100644 --- a/usr/src/uts/i86pc/os/startup.c +++ b/usr/src/uts/i86pc/os/startup.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -554,8 +554,8 @@ print_memlist(char *title, struct memlist *mp) prom_printf("MEMLIST: %s:\n", title); while (mp != NULL) { prom_printf("\tAddress 0x%" PRIx64 ", size 0x%" PRIx64 "\n", - mp->address, mp->size); - mp = mp->next; + mp->ml_address, mp->ml_size); + mp = mp->ml_next; } } @@ -2388,13 +2388,13 @@ kphysm_init( ASSERT(page_hash != NULL && page_hashsz != 0); cur_memseg = memseg_base; - for (pmem = phys_avail; pmem && npages; pmem = pmem->next) { + for (pmem = phys_avail; pmem && npages; pmem = pmem->ml_next) { /* * In a 32 bit kernel can't use higher memory if we're * not booting in PAE mode. This check takes care of that. */ - addr = pmem->address; - size = pmem->size; + addr = pmem->ml_address; + size = pmem->ml_size; if (btop(addr) > physmax) continue; @@ -2404,7 +2404,7 @@ kphysm_init( if ((addr & MMU_PAGEOFFSET) != 0) { addr += MMU_PAGEOFFSET; addr &= ~(uint64_t)MMU_PAGEOFFSET; - size -= addr - pmem->address; + size -= addr - pmem->ml_address; } /* only process pages below or equal to physmax */ @@ -2824,28 +2824,28 @@ memlist_add( struct memlist *cur; uint64_t end = start + len; - new->address = start; - new->size = len; + new->ml_address = start; + new->ml_size = len; cur = *memlistp; while (cur) { - if (cur->address >= end) { - new->next = cur; + if (cur->ml_address >= end) { + new->ml_next = cur; *memlistp = new; - new->prev = cur->prev; - cur->prev = new; + new->ml_prev = cur->ml_prev; + cur->ml_prev = new; return; } - ASSERT(cur->address + cur->size <= start); - if (cur->next == NULL) { - cur->next = new; - new->prev = cur; - new->next = NULL; + ASSERT(cur->ml_address + cur->ml_size <= start); + if (cur->ml_next == NULL) { + cur->ml_next = new; + new->ml_prev = cur; + new->ml_next = NULL; return; } - memlistp = &cur->next; - cur = cur->next; + memlistp = &cur->ml_next; + cur = cur->ml_next; } } diff --git a/usr/src/uts/i86pc/vm/i86_mmu.c b/usr/src/uts/i86pc/vm/i86_mmu.c index e3c1ff3afb..a8f9c46805 100644 --- a/usr/src/uts/i86pc/vm/i86_mmu.c +++ b/usr/src/uts/i86pc/vm/i86_mmu.c @@ -19,12 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/t_lock.h> #include <sys/memlist.h> #include <sys/cpuvar.h> @@ -333,9 +331,9 @@ hat_kern_alloc( * hypervisor these are made read/only at first. * Later we'll add write permission where possible. */ - for (pmem = phys_install; pmem; pmem = pmem->next) { - paddr = pmem->address; - psize = pmem->size; + for (pmem = phys_install; pmem; pmem = pmem->ml_next) { + paddr = pmem->ml_address; + psize = pmem->ml_size; while (psize >= MMU_PAGESIZE) { /* find the largest page size */ for (l = lpagel; l > 0; l--) { diff --git a/usr/src/uts/intel/ia32/os/sundep.c b/usr/src/uts/intel/ia32/os/sundep.c index ab03886ccf..9aca9f4ea1 100644 --- a/usr/src/uts/intel/ia32/os/sundep.c +++ b/usr/src/uts/intel/ia32/os/sundep.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -27,8 +27,6 @@ /* Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T */ /* All Rights Reserved */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <sys/param.h> #include <sys/sysmacros.h> @@ -130,12 +128,12 @@ installed_top_size( pfn_t highp; /* high page in a chunk */ int cnt = 0; - for (; list; list = list->next) { + for (; list; list = list->ml_next) { ++cnt; - highp = (list->address + list->size - 1) >> PAGESHIFT; + highp = (list->ml_address + list->ml_size - 1) >> PAGESHIFT; if (top < highp) top = highp; - sumpages += btop(list->size); + sumpages += btop(list->ml_size); } *high_pfn = top; @@ -168,24 +166,24 @@ copy_memlist_filter( * each range of memory. Note that we may apply the * filter multiple times against each memlist entry. */ - for (; src; src = src->next) { - addr = P2ROUNDUP(src->address, PAGESIZE); - eaddr = P2ALIGN(src->address + src->size, PAGESIZE); + for (; src; src = src->ml_next) { + addr = P2ROUNDUP(src->ml_address, PAGESIZE); + eaddr = P2ALIGN(src->ml_address + src->ml_size, PAGESIZE); while (addr < eaddr) { size = eaddr - addr; if (filter != NULL) filter(&addr, &size); if (size == 0) break; - dst->address = addr; - dst->size = size; - dst->next = 0; + dst->ml_address = addr; + dst->ml_size = size; + dst->ml_next = 0; if (prev == dst) { - dst->prev = 0; + dst->ml_prev = 0; dst++; } else { - dst->prev = prev; - prev->next = dst; + dst->ml_prev = prev; + prev->ml_next = dst; dst++; prev++; } diff --git a/usr/src/uts/intel/io/pci/pci_boot.c b/usr/src/uts/intel/io/pci/pci_boot.c index 8c4bb1954a..c28d52b227 100644 --- a/usr/src/uts/intel/io/pci/pci_boot.c +++ b/usr/src/uts/intel/io/pci/pci_boot.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -665,8 +665,8 @@ remove_subtractive_res() for (j = 0; j <= pci_bios_maxbus; j++) (void) memlist_remove( &pci_bus_res[j].io_avail, - list->address, list->size); - list = list->next; + list->ml_address, list->ml_size); + list = list->ml_next; } /* remove used mem resource */ list = pci_bus_res[i].mem_used; @@ -674,12 +674,12 @@ remove_subtractive_res() for (j = 0; j <= pci_bios_maxbus; j++) { (void) memlist_remove( &pci_bus_res[j].mem_avail, - list->address, list->size); + list->ml_address, list->ml_size); (void) memlist_remove( &pci_bus_res[j].pmem_avail, - list->address, list->size); + list->ml_address, list->ml_size); } - list = list->next; + list = list->ml_next; } /* remove used prefetchable mem resource */ list = pci_bus_res[i].pmem_used; @@ -687,12 +687,12 @@ remove_subtractive_res() for (j = 0; j <= pci_bios_maxbus; j++) { (void) memlist_remove( &pci_bus_res[j].pmem_avail, - list->address, list->size); + list->ml_address, list->ml_size); (void) memlist_remove( &pci_bus_res[j].mem_avail, - list->address, list->size); + list->ml_address, list->ml_size); } - list = list->next; + list = list->ml_next; } } } @@ -864,11 +864,11 @@ is_vga(struct memlist *elem, enum io_mem io) { if (io == IO) { - if ((elem->address == 0x3b0 && elem->size == 0xc) || - (elem->address == 0x3c0 && elem->size == 0x20)) + if ((elem->ml_address == 0x3b0 && elem->ml_size == 0xc) || + (elem->ml_address == 0x3c0 && elem->ml_size == 0x20)) return (1); } else { - if (elem->address == 0xa0000 && elem->size == 0x20000) + if (elem->ml_address == 0xa0000 && elem->ml_size == 0x20000) return (1); } return (0); @@ -884,7 +884,7 @@ list_is_vga_only(struct memlist *l, enum io_mem io) do { if (!is_vga(l, io)) return (0); - } while ((l = l->next) != NULL); + } while ((l = l->ml_next) != NULL); return (1); } @@ -1117,20 +1117,20 @@ fix_ppb_res(uchar_t secbus, boolean_t prog_sub) if (is_vga(list, IO)) continue; if (!io_base) { - io_base = (uint_t)list->address; - io_limit = (uint_t) - list->address + list->size - 1; + io_base = (uint_t)list->ml_address; + io_limit = (uint_t)list->ml_address + + list->ml_size - 1; io_base = P2ALIGN(io_base, PPB_IO_ALIGNMENT); } else { - if (list->address + list->size > + if (list->ml_address + list->ml_size > io_limit) { io_limit = (uint_t) - (list->address + - list->size - 1); + (list->ml_address + + list->ml_size - 1); } } - } while ((list = list->next) != NULL); + } while ((list = list->ml_next) != NULL); /* 4K aligned */ io_limit = P2ROUNDUP(io_limit, PPB_IO_ALIGNMENT) - 1; io_size = io_limit - io_base + 1; @@ -1199,20 +1199,20 @@ fix_ppb_res(uchar_t secbus, boolean_t prog_sub) if (is_vga(list, MEM)) continue; if (mem_base == 0) { - mem_base = (uint_t)list->address; + mem_base = (uint_t)list->ml_address; mem_base = P2ALIGN(mem_base, PPB_MEM_ALIGNMENT); - mem_limit = (uint_t) - (list->address + list->size - 1); + mem_limit = (uint_t)(list->ml_address + + list->ml_size - 1); } else { - if ((list->address + list->size) > + if ((list->ml_address + list->ml_size) > mem_limit) { mem_limit = (uint_t) - (list->address + - list->size - 1); + (list->ml_address + + list->ml_size - 1); } } - } while ((list = list->next) != NULL); + } while ((list = list->ml_next) != NULL); mem_limit = P2ROUNDUP(mem_limit, PPB_MEM_ALIGNMENT) - 1; mem_size = mem_limit + 1 - mem_base; ASSERT(mem_base <= mem_limit); @@ -1445,10 +1445,10 @@ populate_bus_res(uchar_t bus) entry = pci_bus_res[bus].bus_avail; while (entry != NULL) { - current = entry->address + entry->size - 1; + current = entry->ml_address + entry->ml_size - 1; if (current > pci_bus_res[bus].sub_bus) pci_bus_res[bus].sub_bus = current; - entry = entry->next; + entry = entry->ml_next; } } @@ -3091,25 +3091,25 @@ memlist_to_ranges(void **rp, struct memlist *entry, int type, int ppb) if (ppb) { ppb_rp->child_high = ppb_rp->parent_high = type; ppb_rp->child_mid = ppb_rp->parent_mid = - (uint32_t)(entry->address >> 32); /* XXX */ + (uint32_t)(entry->ml_address >> 32); /* XXX */ ppb_rp->child_low = ppb_rp->parent_low = - (uint32_t)entry->address; + (uint32_t)entry->ml_address; ppb_rp->size_high = - (uint32_t)(entry->size >> 32); /* XXX */ - ppb_rp->size_low = (uint32_t)entry->size; + (uint32_t)(entry->ml_size >> 32); /* XXX */ + ppb_rp->size_low = (uint32_t)entry->ml_size; *rp = ++ppb_rp; } else { pci_rp->child_high = type; pci_rp->child_mid = pci_rp->parent_high = - (uint32_t)(entry->address >> 32); /* XXX */ + (uint32_t)(entry->ml_address >> 32); /* XXX */ pci_rp->child_low = pci_rp->parent_low = - (uint32_t)entry->address; + (uint32_t)entry->ml_address; pci_rp->size_high = - (uint32_t)(entry->size >> 32); /* XXX */ - pci_rp->size_low = (uint32_t)entry->size; + (uint32_t)(entry->ml_size >> 32); /* XXX */ + pci_rp->size_low = (uint32_t)entry->ml_size; *rp = ++pci_rp; } - entry = entry->next; + entry = entry->ml_next; } } @@ -3165,9 +3165,9 @@ static void memlist_remove_list(struct memlist **list, struct memlist *remove_list) { while (list && *list && remove_list) { - (void) memlist_remove(list, remove_list->address, - remove_list->size); - remove_list = remove_list->next; + (void) memlist_remove(list, remove_list->ml_address, + remove_list->ml_size); + remove_list = remove_list->ml_next; } } @@ -3180,11 +3180,11 @@ memlist_to_spec(struct pci_phys_spec *sp, struct memlist *list, int type) /* assume 32-bit addresses */ sp->pci_phys_hi = type; sp->pci_phys_mid = 0; - sp->pci_phys_low = (uint32_t)list->address; + sp->pci_phys_low = (uint32_t)list->ml_address; sp->pci_size_hi = 0; - sp->pci_size_low = (uint32_t)list->size; + sp->pci_size_low = (uint32_t)list->ml_size; - list = list->next; + list = list->ml_next; sp++, i++; } return (i); diff --git a/usr/src/uts/intel/io/pci/pci_memlist.c b/usr/src/uts/intel/io/pci/pci_memlist.c index d6e40c47b8..9dc553c5ba 100644 --- a/usr/src/uts/intel/io/pci/pci_memlist.c +++ b/usr/src/uts/intel/io/pci/pci_memlist.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -46,9 +46,9 @@ memlist_dump(struct memlist *listp) dprintf("memlist 0x%p content", (void *)listp); while (listp) { dprintf("(0x%x%x, 0x%x%x)", - (int)(listp->address >> 32), (int)listp->address, - (int)(listp->size >> 32), (int)listp->size); - listp = listp->next; + (int)(listp->ml_address >> 32), (int)listp->ml_address, + (int)(listp->ml_size >> 32), (int)listp->ml_size); + listp = listp->ml_next; } } @@ -73,7 +73,7 @@ memlist_free_all(struct memlist **list) next = *list; while (next) { buf = next; - next = buf->next; + next = buf->ml_next; kmem_free(buf, sizeof (struct memlist)); } *list = 0; @@ -89,54 +89,54 @@ memlist_insert(struct memlist **listp, uint64_t addr, uint64_t size) /* find the location in list */ next = *listp; - while (next && next->address <= addr) { + while (next && next->ml_address <= addr) { /* * Drop if this entry already exists, in whole * or in part */ - if (next->address <= addr && - next->address + next->size >= addr + size) { + if (next->ml_address <= addr && + next->ml_address + next->ml_size >= addr + size) { /* next already contains this entire element; drop */ return; } /* Is this a "grow block size" request? */ - if (next->address == addr) { + if (next->ml_address == addr) { break; } prev = next; - next = prev->next; + next = prev->ml_next; } - merge_left = (prev && addr == prev->address + prev->size); - merge_right = (next && addr + size == next->address); + merge_left = (prev && addr == prev->ml_address + prev->ml_size); + merge_right = (next && addr + size == next->ml_address); if (merge_left && merge_right) { - prev->size += size + next->size; - prev->next = next->next; + prev->ml_size += size + next->ml_size; + prev->ml_next = next->ml_next; memlist_free(next); return; } if (merge_left) { - prev->size += size; + prev->ml_size += size; return; } if (merge_right) { - next->address = addr; - next->size += size; + next->ml_address = addr; + next->ml_size += size; return; } entry = memlist_alloc(); - entry->address = addr; - entry->size = size; + entry->ml_address = addr; + entry->ml_size = size; if (prev == 0) { - entry->next = *listp; + entry->ml_next = *listp; *listp = entry; } else { - entry->next = next; - prev->next = entry; + entry->ml_next = next; + prev->ml_next = entry; } } @@ -167,8 +167,8 @@ memlist_remove(struct memlist **listp, uint64_t addr, uint64_t size) rem_end = addr + size - 1; chunk = *listp; while (chunk) { - chunk_begin = chunk->address; - chunk_end = chunk->address + chunk->size - 1; + chunk_begin = chunk->ml_address; + chunk_end = chunk->ml_address + chunk->ml_size - 1; begin_in_chunk = IN_RANGE(rem_begin, chunk_begin, chunk_end); end_in_chunk = IN_RANGE(rem_end, chunk_begin, chunk_end); @@ -178,9 +178,9 @@ memlist_remove(struct memlist **listp, uint64_t addr, uint64_t size) /* spans entire chunk - delete chunk */ delete_chunk = chunk; if (prev == 0) - chunk = *listp = chunk->next; + chunk = *listp = chunk->ml_next; else - chunk = prev->next = chunk->next; + chunk = prev->ml_next = chunk->ml_next; memlist_free(delete_chunk); /* skip to start of while-loop */ @@ -190,25 +190,25 @@ memlist_remove(struct memlist **listp, uint64_t addr, uint64_t size) struct memlist *new; /* split chunk */ new = memlist_alloc(); - new->address = rem_end + 1; - new->size = chunk_end - new->address + 1; - chunk->size = rem_begin - chunk_begin; - new->next = chunk->next; - chunk->next = new; + new->ml_address = rem_end + 1; + new->ml_size = chunk_end - new->ml_address + 1; + chunk->ml_size = rem_begin - chunk_begin; + new->ml_next = chunk->ml_next; + chunk->ml_next = new; /* done - break out of while-loop */ break; } else if (begin_in_chunk || end_in_chunk) { /* trim chunk */ - chunk->size -= MIN(chunk_end, rem_end) - + chunk->ml_size -= MIN(chunk_end, rem_end) - MAX(chunk_begin, rem_begin) + 1; if (rem_begin <= chunk_begin) { - chunk->address = rem_end + 1; + chunk->ml_address = rem_end + 1; break; } /* fall-through to next chunk */ } prev = chunk; - chunk = chunk->next; + chunk = chunk->ml_next; } return (0); @@ -227,21 +227,21 @@ memlist_find(struct memlist **listp, uint64_t size, int align) /* find the chunk with sufficient size */ next = *listp; while (next) { - delta = next->address & ((align != 0) ? (align - 1) : 0); + delta = next->ml_address & ((align != 0) ? (align - 1) : 0); if (delta != 0) total_size = size + align - delta; else total_size = size; /* the addr is already aligned */ - if (next->size >= total_size) + if (next->ml_size >= total_size) break; prev = next; - next = prev->next; + next = prev->ml_next; } if (next == 0) return (0); /* Not found */ - paddr = next->address; + paddr = next->ml_address; if (delta) paddr += align - delta; (void) memlist_remove(listp, paddr, size); @@ -263,21 +263,21 @@ memlist_find_with_startaddr(struct memlist **listp, uint64_t address, /* find the chunk starting at 'address' */ next = *listp; - while (next && (next->address != address)) { - next = next->next; + while (next && (next->ml_address != address)) { + next = next->ml_next; } if (next == 0) return (0); /* Not found */ - delta = next->address & ((align != 0) ? (align - 1) : 0); + delta = next->ml_address & ((align != 0) ? (align - 1) : 0); if (delta != 0) total_size = size + align - delta; else total_size = size; /* the addr is already aligned */ - if (next->size < total_size) + if (next->ml_size < total_size) return (0); /* unsufficient size */ - paddr = next->address; + paddr = next->ml_address; if (delta) paddr += align - delta; (void) memlist_remove(listp, paddr, size); @@ -295,9 +295,9 @@ memlist_subsume(struct memlist **src, struct memlist **dest) head = *src; while (head) { - memlist_insert(dest, head->address, head->size); + memlist_insert(dest, head->ml_address, head->ml_size); prev = head; - head = head->next; + head = head->ml_next; memlist_free(prev); } *src = 0; @@ -313,8 +313,8 @@ memlist_merge(struct memlist **src, struct memlist **dest) p = *src; while (p) { - memlist_insert(dest, p->address, p->size); - p = p->next; + memlist_insert(dest, p->ml_address, p->ml_size); + p = p->ml_next; } } @@ -328,15 +328,15 @@ memlist_dup(struct memlist *listp) while (listp) { struct memlist *entry = memlist_alloc(); - entry->address = listp->address; - entry->size = listp->size; - entry->next = 0; + entry->ml_address = listp->ml_address; + entry->ml_size = listp->ml_size; + entry->ml_next = 0; if (prev) - prev->next = entry; + prev->ml_next = entry; else head = entry; prev = entry; - listp = listp->next; + listp = listp->ml_next; } return (head); @@ -348,7 +348,7 @@ memlist_count(struct memlist *listp) int count = 0; while (listp) { count++; - listp = listp->next; + listp = listp->ml_next; } return (count); diff --git a/usr/src/uts/intel/io/pci/pci_resource.c b/usr/src/uts/intel/io/pci/pci_resource.c index 8ebec943f1..21ca552d91 100644 --- a/usr/src/uts/intel/io/pci/pci_resource.c +++ b/usr/src/uts/intel/io/pci/pci_resource.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * pci_resource.c -- routines to retrieve available bus resources from @@ -152,31 +152,31 @@ acpi_trim_bus_ranges() * 'prev' pointer to link existing to new copy */ new = memlist_alloc(); - new->address = orig->address; - new->size = orig->size; - new->prev = orig; + new->ml_address = orig->ml_address; + new->ml_size = orig->ml_size; + new->ml_prev = orig; /* sorted insertion of 'new' into ranges list */ for (current = ranges, prev = NULL; current != NULL; - prev = current, current = current->next) - if (new->address < current->address) + prev = current, current = current->ml_next) + if (new->ml_address < current->ml_address) break; if (prev == NULL) { /* place at beginning of (possibly) empty list */ - new->next = ranges; + new->ml_next = ranges; ranges = new; } else { /* place in list (possibly at end) */ - new->next = current; - prev->next = new; + new->ml_next = current; + prev->ml_next = new; } } /* scan the list, perform trimming */ current = ranges; while (current != NULL) { - struct memlist *next = current->next; + struct memlist *next = current->ml_next; /* done when no range above current */ if (next == NULL) @@ -184,10 +184,11 @@ acpi_trim_bus_ranges() /* * trim size in original range element - * (current->prev points to the original range) + * (current->ml_prev points to the original range) */ - if ((current->address + current->size) > next->address) - current->prev->size = next->address - current->address; + if ((current->ml_address + current->ml_size) > next->ml_address) + current->ml_prev->ml_size = + next->ml_address - current->ml_address; current = next; } @@ -495,7 +496,7 @@ mps_find_bus_res(int bus, int type, struct memlist **res) *extp); while (*res) { struct memlist *tmp = *res; - *res = tmp->next; + *res = tmp->ml_next; memlist_free(tmp); } return (0); diff --git a/usr/src/uts/sun4/os/lgrpplat.c b/usr/src/uts/sun4/os/lgrpplat.c index cb09213451..00cfa61ab6 100644 --- a/usr/src/uts/sun4/os/lgrpplat.c +++ b/usr/src/uts/sun4/os/lgrpplat.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -280,14 +280,14 @@ lgrp_plat_mem_size_default(lgrp_handle_t lgrphand, lgrp_mem_query_t query) return ((pgcnt_t)freemem); case LGRP_MEM_SIZE_AVAIL: memlist_read_lock(); - for (mlist = phys_avail; mlist; mlist = mlist->next) - npgs += btop(mlist->size); + for (mlist = phys_avail; mlist; mlist = mlist->ml_next) + npgs += btop(mlist->ml_size); memlist_read_unlock(); return (npgs); case LGRP_MEM_SIZE_INSTALL: memlist_read_lock(); - for (mlist = phys_install; mlist; mlist = mlist->next) - npgs += btop(mlist->size); + for (mlist = phys_install; mlist; mlist = mlist->ml_next) + npgs += btop(mlist->ml_size); memlist_read_unlock(); return (npgs); default: diff --git a/usr/src/uts/sun4/os/memlist.c b/usr/src/uts/sun4/os/memlist.c index 013b56bc14..f6ba9a2e85 100644 --- a/usr/src/uts/sun4/os/memlist.c +++ b/usr/src/uts/sun4/os/memlist.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -96,8 +96,8 @@ num_phys_pages() pgcnt_t npages = 0; struct memlist *mp; - for (mp = phys_install; mp != NULL; mp = mp->next) - npages += mp->size >> PAGESHIFT; + for (mp = phys_install; mp != NULL; mp = mp->ml_next) + npages += mp->ml_size >> PAGESHIFT; return (npages); } @@ -166,9 +166,9 @@ get_max_phys_size( { uint64_t max_size = 0; - for (; physavail; physavail = physavail->next) { - if (physavail->size > max_size) - max_size = physavail->size; + for (; physavail; physavail = physavail->ml_next) { + if (physavail->ml_size > max_size) + max_size = physavail->ml_size; } return (max_size); @@ -247,24 +247,24 @@ diff_memlists(struct memlist *proto, struct memlist *diff, void (*func)()) * if none, apply func to all of proto item */ while (diff != NULL && - proto->address >= diff->address + diff->size) - diff = diff->next; + proto->ml_address >= diff->ml_address + diff->ml_size) + diff = diff->ml_next; if (diff == NULL) { - (*func)(proto->address, proto->size); - proto = proto->next; + (*func)(proto->ml_address, proto->ml_size); + proto = proto->ml_next; continue; } - if (proto->address == diff->address && - proto->size == diff->size) { - proto = proto->next; - diff = diff->next; + if (proto->ml_address == diff->ml_address && + proto->ml_size == diff->ml_size) { + proto = proto->ml_next; + diff = diff->ml_next; continue; } - p_base = proto->address; - p_end = p_base + proto->size; - d_base = diff->address; - d_end = d_base + diff->size; + p_base = proto->ml_address; + p_end = p_base + proto->ml_size; + d_base = diff->ml_address; + d_end = d_base + diff->ml_size; /* * here p_base < d_end * there are 5 cases @@ -279,8 +279,8 @@ diff_memlists(struct memlist *proto, struct memlist *diff, void (*func)()) * apply func to all of proto item */ if (p_end <= d_base) { - (*func)(p_base, proto->size); - proto = proto->next; + (*func)(p_base, proto->ml_size); + proto = proto->ml_next; continue; } @@ -311,7 +311,7 @@ diff_memlists(struct memlist *proto, struct memlist *diff, void (*func)()) * any non-overlapping ranges applied above, * so just continue */ - proto = proto->next; + proto = proto->ml_next; continue; } @@ -332,10 +332,10 @@ diff_memlists(struct memlist *proto, struct memlist *diff, void (*func)()) * where no overlap occurs. Stop when d_base is above * p_end */ - for (p_base = d_end, diff = diff->next; diff != NULL; - p_base = d_end, diff = diff->next) { - d_base = diff->address; - d_end = d_base + diff->size; + for (p_base = d_end, diff = diff->ml_next; diff != NULL; + p_base = d_end, diff = diff->ml_next) { + d_base = diff->ml_address; + d_end = d_base + diff->ml_size; if (p_end <= d_base) { (*func)(p_base, p_end - p_base); break; @@ -344,7 +344,7 @@ diff_memlists(struct memlist *proto, struct memlist *diff, void (*func)()) } if (diff == NULL) (*func)(p_base, p_end - p_base); - proto = proto->next; + proto = proto->ml_next; } } @@ -412,15 +412,15 @@ copy_memlist( prev = dst; for (i = 0; i < nelems; src++, i++) { - dst->address = src->addr; - dst->size = src->size; - dst->next = 0; + dst->ml_address = src->addr; + dst->ml_size = src->size; + dst->ml_next = 0; if (prev == dst) { - dst->prev = 0; + dst->ml_prev = 0; dst++; } else { - dst->prev = prev; - prev->next = dst; + dst->ml_prev = prev; + prev->ml_next = dst; dst++; prev++; } @@ -618,11 +618,11 @@ installed_top_size( pfn_t highp; /* high page in a chunk */ pgcnt_t sumpages = 0; - for (; list; list = list->next) { - highp = (list->address + list->size - 1) >> PAGESHIFT; + for (; list; list = list->ml_next) { + highp = (list->ml_address + list->ml_size - 1) >> PAGESHIFT; if (top < highp) top = highp; - sumpages += (uint_t)(list->size >> PAGESHIFT); + sumpages += (uint_t)(list->ml_size >> PAGESHIFT); } *topp = top; diff --git a/usr/src/uts/sun4/os/memnode.c b/usr/src/uts/sun4/os/memnode.c index cb97541a20..9d03e14ad9 100644 --- a/usr/src/uts/sun4/os/memnode.c +++ b/usr/src/uts/sun4/os/memnode.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -256,9 +256,9 @@ mem_node_memlist_pages(int mnode, struct memlist *mlist) if (&plat_mem_node_intersect_range != NULL) { memlist_read_lock(); - for (pmem = mlist; pmem; pmem = pmem->next) { - plat_mem_node_intersect_range(btop(pmem->address), - btop(pmem->size), mnode, &pages); + for (pmem = mlist; pmem; pmem = pmem->ml_next) { + plat_mem_node_intersect_range(btop(pmem->ml_address), + btop(pmem->ml_size), mnode, &pages); npgs += pages; } @@ -271,9 +271,9 @@ mem_node_memlist_pages(int mnode, struct memlist *mlist) memlist_read_lock(); - for (pmem = mlist; pmem; pmem = pmem->next) { - cur_base = btop(pmem->address); - cur_end = cur_base + btop(pmem->size) - 1; + for (pmem = mlist; pmem; pmem = pmem->ml_next) { + cur_base = btop(pmem->ml_address); + cur_end = cur_base + btop(pmem->ml_size) - 1; if (end < cur_base || base > cur_end) continue; npgs = npgs + (MIN(cur_end, end) - diff --git a/usr/src/uts/sun4/os/startup.c b/usr/src/uts/sun4/os/startup.c index 7869723891..914451cf4f 100644 --- a/usr/src/uts/sun4/os/startup.c +++ b/usr/src/uts/sun4/os/startup.c @@ -312,9 +312,11 @@ printmemlist(char *title, struct memlist *list) while (list) { prom_printf("\taddr = 0x%x %8x, size = 0x%x %8x\n", - (uint32_t)(list->address >> 32), (uint32_t)list->address, - (uint32_t)(list->size >> 32), (uint32_t)(list->size)); - list = list->next; + (uint32_t)(list->ml_address >> 32), + (uint32_t)list->ml_address, + (uint32_t)(list->ml_size >> 32), + (uint32_t)(list->ml_size)); + list = list->ml_next; } } @@ -1373,17 +1375,18 @@ startup_memlist(void) virt_avail = memlist; copy_memlist(boot_virtavail, boot_virtavail_len, &memlist); - for (cur = virt_avail; cur->next; cur = cur->next) { + for (cur = virt_avail; cur->ml_next; cur = cur->ml_next) { uint64_t range_base, range_size; - if ((range_base = cur->address + cur->size) < (uint64_t)sysbase) + if ((range_base = cur->ml_address + cur->ml_size) < + (uint64_t)sysbase) continue; if (range_base >= (uint64_t)syslimit) break; /* * Limit the range to end at syslimit. */ - range_size = MIN(cur->next->address, + range_size = MIN(cur->ml_next->ml_address, (uint64_t)syslimit) - range_base; (void) vmem_xalloc(heap_arena, (size_t)range_size, PAGESIZE, 0, 0, (void *)range_base, (void *)(range_base + range_size), @@ -2411,8 +2414,8 @@ memlist_new(uint64_t start, uint64_t len, struct memlist **memlistp) struct memlist *new; new = *memlistp; - new->address = start; - new->size = len; + new->ml_address = start; + new->ml_size = len; *memlistp = new + 1; } @@ -2731,8 +2734,8 @@ kphysm_init(void) /* * Free the avail list */ - for (pmem = phys_avail; pmem != NULL; pmem = pmem->next) - kphysm_add(pmem->address, pmem->size, 0); + for (pmem = phys_avail; pmem != NULL; pmem = pmem->ml_next) + kphysm_add(pmem->ml_address, pmem->ml_size, 0); /* * Erase pages that aren't available diff --git a/usr/src/uts/sun4/vm/sfmmu.c b/usr/src/uts/sun4/vm/sfmmu.c index fa16891935..556590bf31 100644 --- a/usr/src/uts/sun4/vm/sfmmu.c +++ b/usr/src/uts/sun4/vm/sfmmu.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -494,10 +494,10 @@ ndata_alloc_init(struct memlist *ndata, uintptr_t base, uintptr_t end) ASSERT(base < end); - ndata->address = base; - ndata->size = end - base; - ndata->next = NULL; - ndata->prev = NULL; + ndata->ml_address = base; + ndata->ml_size = end - base; + ndata->ml_next = NULL; + ndata->ml_prev = NULL; } /* @@ -506,11 +506,11 @@ ndata_alloc_init(struct memlist *ndata, uintptr_t base, uintptr_t end) size_t ndata_maxsize(struct memlist *ndata) { - size_t chunksize = ndata->size; + size_t chunksize = ndata->ml_size; - while ((ndata = ndata->next) != NULL) { - if (chunksize < ndata->size) - chunksize = ndata->size; + while ((ndata = ndata->ml_next) != NULL) { + if (chunksize < ndata->ml_size) + chunksize = ndata->ml_size; } return (chunksize); @@ -540,34 +540,34 @@ ndata_extra_base(struct memlist *ndata, size_t alignment, caddr_t endaddr) */ ASSERT((alignment % ecache_alignsize) == 0); - while (ndata->next != NULL) { - wasteage += ndata->size; - ndata = ndata->next; + while (ndata->ml_next != NULL) { + wasteage += ndata->ml_size; + ndata = ndata->ml_next; } - base = roundup(ndata->address, alignment); + base = roundup(ndata->ml_address, alignment); - if (base >= ndata->address + ndata->size) + if (base >= ndata->ml_address + ndata->ml_size) return (NULL); - if ((caddr_t)(ndata->address + ndata->size) != endaddr) { + if ((caddr_t)(ndata->ml_address + ndata->ml_size) != endaddr) { #ifdef DEBUG ndata_middle_hole_detected = 1; /* see if we hit this again */ #endif return (NULL); } - if (base == ndata->address) { - if (ndata->prev != NULL) - ndata->prev->next = NULL; + if (base == ndata->ml_address) { + if (ndata->ml_prev != NULL) + ndata->ml_prev->ml_next = NULL; else - ndata->size = 0; + ndata->ml_size = 0; bzero((void *)base, sizeof (struct memlist)); } else { - ndata->size = base - ndata->address; - wasteage += ndata->size; + ndata->ml_size = base - ndata->ml_address; + wasteage += ndata->ml_size; } PRM_DEBUG(wasteage); @@ -606,22 +606,22 @@ ndata_select_chunk(struct memlist *ndata, size_t wanted, size_t alignment) * 4. avoid wasting space, take first fitting buffer * 5. take the last buffer in chain */ - for (frlist = ndata; frlist != NULL; frlist = frlist->next) { - base = roundup(frlist->address, alignment); + for (frlist = ndata; frlist != NULL; frlist = frlist->ml_next) { + base = roundup(frlist->ml_address, alignment); end = roundup(base + wanted, ecache_alignsize); - if (end > frlist->address + frlist->size) + if (end > frlist->ml_address + frlist->ml_size) continue; - below = (base - frlist->address) / ecache_alignsize; - above = (frlist->address + frlist->size - end) / + below = (base - frlist->ml_address) / ecache_alignsize; + above = (frlist->ml_address + frlist->ml_size - end) / ecache_alignsize; unused = below + above; if (unused == 0) return (frlist); - if (frlist->next == NULL) + if (frlist->ml_next == NULL) break; if (below < best_below) { @@ -674,52 +674,53 @@ ndata_alloc(struct memlist *ndata, size_t wanted, size_t alignment) /* * Allocate the nucleus data buffer. */ - base = roundup(found->address, alignment); + base = roundup(found->ml_address, alignment); end = roundup(base + wanted, ecache_alignsize); - ASSERT(end <= found->address + found->size); + ASSERT(end <= found->ml_address + found->ml_size); - below = base - found->address; - above = found->address + found->size - end; + below = base - found->ml_address; + above = found->ml_address + found->ml_size - end; ASSERT(above == 0 || (above % ecache_alignsize) == 0); if (below >= ecache_alignsize) { /* * There is free memory below the allocated memory chunk. */ - found->size = below - below % ecache_alignsize; + found->ml_size = below - below % ecache_alignsize; if (above) { fnd_above = (struct memlist *)end; - fnd_above->address = end; - fnd_above->size = above; + fnd_above->ml_address = end; + fnd_above->ml_size = above; - if ((fnd_above->next = found->next) != NULL) - found->next->prev = fnd_above; - fnd_above->prev = found; - found->next = fnd_above; + if ((fnd_above->ml_next = found->ml_next) != NULL) + found->ml_next->ml_prev = fnd_above; + fnd_above->ml_prev = found; + found->ml_next = fnd_above; } return ((void *)base); } - if (found->prev == NULL) { + if (found->ml_prev == NULL) { /* * The first chunk (ndata) is selected. */ ASSERT(found == ndata); if (above) { - found->address = end; - found->size = above; - } else if (found->next != NULL) { - found->address = found->next->address; - found->size = found->next->size; - if ((found->next = found->next->next) != NULL) - found->next->prev = found; - - bzero((void *)found->address, sizeof (struct memlist)); + found->ml_address = end; + found->ml_size = above; + } else if (found->ml_next != NULL) { + found->ml_address = found->ml_next->ml_address; + found->ml_size = found->ml_next->ml_size; + if ((found->ml_next = found->ml_next->ml_next) != NULL) + found->ml_next->ml_prev = found; + + bzero((void *)found->ml_address, + sizeof (struct memlist)); } else { - found->address = end; - found->size = 0; + found->ml_address = end; + found->ml_size = 0; } return ((void *)base); @@ -730,20 +731,20 @@ ndata_alloc(struct memlist *ndata, size_t wanted, size_t alignment) */ if (above) { fnd_above = (struct memlist *)end; - fnd_above->address = end; - fnd_above->size = above; + fnd_above->ml_address = end; + fnd_above->ml_size = above; - if ((fnd_above->next = found->next) != NULL) - fnd_above->next->prev = fnd_above; - fnd_above->prev = found->prev; - found->prev->next = fnd_above; + if ((fnd_above->ml_next = found->ml_next) != NULL) + fnd_above->ml_next->ml_prev = fnd_above; + fnd_above->ml_prev = found->ml_prev; + found->ml_prev->ml_next = fnd_above; } else { - if ((found->prev->next = found->next) != NULL) - found->next->prev = found->prev; + if ((found->ml_prev->ml_next = found->ml_next) != NULL) + found->ml_next->ml_prev = found->ml_prev; } - bzero((void *)found->address, sizeof (struct memlist)); + bzero((void *)found->ml_address, sizeof (struct memlist)); return ((void *)base); } diff --git a/usr/src/uts/sun4u/io/sbd.c b/usr/src/uts/sun4u/io/sbd.c index 4d43c164cf..b676cc8abd 100644 --- a/usr/src/uts/sun4u/io/sbd.c +++ b/usr/src/uts/sun4u/io/sbd.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -3880,9 +3880,9 @@ sbd_check_unit_attached(sbd_board_t *sbp, dev_info_t *dip, int unit, * Check if base address is in phys_install. */ memlist_read_lock(); - for (ml = phys_install; ml; ml = ml->next) - if ((endpa <= ml->address) || - (basepa >= (ml->address + ml->size))) + for (ml = phys_install; ml; ml = ml->ml_next) + if ((endpa <= ml->ml_address) || + (basepa >= (ml->ml_address + ml->ml_size))) continue; else break; @@ -4740,9 +4740,9 @@ sbd_board_discovery(sbd_board_t *sbp) * Check if base address is in phys_install. */ memlist_read_lock(); - for (ml = phys_install; ml; ml = ml->next) - if ((endpa <= ml->address) || - (basepa >= (ml->address + ml->size))) + for (ml = phys_install; ml; ml = ml->ml_next) + if ((endpa <= ml->ml_address) || + (basepa >= (ml->ml_address + ml->ml_size))) continue; else break; diff --git a/usr/src/uts/sun4u/io/sbd_mem.c b/usr/src/uts/sun4u/io/sbd_mem.c index 09738a880f..e2b9058553 100644 --- a/usr/src/uts/sun4u/io/sbd_mem.c +++ b/usr/src/uts/sun4u/io/sbd_mem.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -333,8 +333,9 @@ sbd_post_attach_mem(sbd_handle_t *hp, sbd_devlist_t devlist[], int devnum) } memlist_read_unlock(); - for (ml = mlist; ml != NULL; ml = ml->next) { - (void) sbdp_mem_add_span(hdp, ml->address, ml->size); + for (ml = mlist; ml != NULL; ml = ml->ml_next) { + (void) sbdp_mem_add_span(hdp, ml->ml_address, + ml->ml_size); } memlist_delete(mlist); @@ -489,14 +490,14 @@ sbd_add_memory_spans(sbd_board_t *sbp, struct memlist *ml) #endif hdp = sbd_get_sbdp_handle(NULL, NULL); - for (; ml; ml = ml->next) { + for (; ml; ml = ml->ml_next) { update_membounds_t umb; pfn_t base; pgcnt_t npgs; int rv; - base = _b64top(ml->address); - npgs = _b64top(ml->size); + base = _b64top(ml->ml_address); + npgs = _b64top(ml->ml_size); umb.u_board = sbp->sb_num; umb.u_base = (uint64_t)base << MMU_PAGESHIFT; @@ -505,7 +506,7 @@ sbd_add_memory_spans(sbd_board_t *sbp, struct memlist *ml) lgrp_plat_config(LGRP_CONFIG_MEM_ADD, (uintptr_t)&umb); rv = kphysm_add_memory_dynamic(base, npgs); - (void) sbdp_mem_add_span(hdp, ml->address, ml->size); + (void) sbdp_mem_add_span(hdp, ml->ml_address, ml->ml_size); if (rv != KPHYSM_OK) { cmn_err(CE_WARN, "sbd:%s:" @@ -632,9 +633,9 @@ sbd_post_detach_mem_unit(sbd_mem_unit_t *s_mp, sbderror_t *ep) * memlists accordingly with new base * addresses. */ - for (ml = t_mp->sbm_mlist; ml; ml = ml->next) { - ml->address -= t_basepa; - ml->address += s_new_basepa; + for (ml = t_mp->sbm_mlist; ml; ml = ml->ml_next) { + ml->ml_address -= t_basepa; + ml->ml_address += s_new_basepa; } /* @@ -647,9 +648,9 @@ sbd_post_detach_mem_unit(sbd_mem_unit_t *s_mp, sbderror_t *ep) PR_MEM("%s: renamed target memlist and delete memlist", f); SBD_MEMLIST_DUMP(t_mp->sbm_mlist); - for (ml = s_mp->sbm_mlist; ml; ml = ml->next) { - ml->address -= s_basepa; - ml->address += t_basepa; + for (ml = s_mp->sbm_mlist; ml; ml = ml->ml_next) { + ml->ml_address -= s_basepa; + ml->ml_address += t_basepa; } PR_MEM("%s: renamed source memlist", f); @@ -662,9 +663,9 @@ sbd_post_detach_mem_unit(sbd_mem_unit_t *s_mp, sbderror_t *ep) * list is not used beyond this point, and in fact, is * disposed of at the end of this function. */ - for (ml = s_mp->sbm_del_mlist; ml; ml = ml->next) { - ml->address -= s_basepa; - ml->address += t_basepa; + for (ml = s_mp->sbm_del_mlist; ml; ml = ml->ml_next) { + ml->ml_address -= s_basepa; + ml->ml_address += t_basepa; } PR_MEM("%s: renamed source delete memlist", f); @@ -1454,8 +1455,8 @@ sbd_init_mem_unit_data(sbd_mem_unit_t *mp, sbderror_t *ep) if (mp->sbm_npages == 0) { struct memlist *ml, *mlist; mlist = sbd_get_memlist(mp, ep); - for (ml = mlist; ml; ml = ml->next) - mp->sbm_npages += btop(ml->size); + for (ml = mlist; ml; ml = ml->ml_next) + mp->sbm_npages += btop(ml->ml_size); memlist_delete(mlist); } @@ -1499,9 +1500,9 @@ sbd_reserve_mem_spans(memhandle_t *mhp, struct memlist *ml) * with kphysm_del_span. It is possible that a span may intersect * an area occupied by the cage. */ - for (mc = ml; mc != NULL; mc = mc->next) { - base = _b64top(mc->address); - npgs = _b64top(mc->size); + for (mc = ml; mc != NULL; mc = mc->ml_next) { + base = _b64top(mc->ml_address); + npgs = _b64top(mc->ml_size); err = kphysm_del_span(*mhp, base, npgs); if (err != KPHYSM_OK) { @@ -1825,11 +1826,11 @@ sbd_select_mem_target(sbd_handle_t *hp, #ifdef DEBUG /* sanity check memlist */ d_ml = x_ml; - while (d_ml->next != NULL) - d_ml = d_ml->next; - ASSERT(x_ml->address == _ptob64(s_mp->sbm_basepfn) + + while (d_ml->ml_next != NULL) + d_ml = d_ml->ml_next; + ASSERT(x_ml->ml_address == _ptob64(s_mp->sbm_basepfn) + _ptob64(t_mp->sbm_slice_offset)); - ASSERT(d_ml->address + d_ml->size == + ASSERT(d_ml->ml_address + d_ml->ml_size == _ptob64(s_mq.last_nonrelocatable + 1)); #endif @@ -2087,7 +2088,7 @@ memlist_dup(struct memlist *mlist) prev = NULL; hl = NULL; - for (; mlist; mlist = mlist->next) { + for (; mlist; mlist = mlist->ml_next) { struct memlist *mp; mp = memlist_get_one(); @@ -2097,15 +2098,15 @@ memlist_dup(struct memlist *mlist) hl = NULL; break; } - mp->address = mlist->address; - mp->size = mlist->size; - mp->next = NULL; - mp->prev = prev; + mp->ml_address = mlist->ml_address; + mp->ml_size = mlist->ml_size; + mp->ml_next = NULL; + mp->ml_prev = prev; if (prev == NULL) hl = mp; else - prev->next = mp; + prev->ml_next = mp; prev = mp; } @@ -2120,10 +2121,10 @@ memlist_dump(struct memlist *mlist) if (mlist == NULL) { PR_MEM("memlist> EMPTY\n"); } else { - for (ml = mlist; ml; ml = ml->next) + for (ml = mlist; ml; ml = ml->ml_next) PR_MEM("memlist> 0x%" PRIx64 " " "0x%" PRIx64 " \n", - ml->address, ml->size); + ml->ml_address, ml->ml_size); } } @@ -2135,27 +2136,27 @@ memlist_intersect(struct memlist *al, struct memlist *bl) if ((al == NULL) || (bl == NULL)) return (0); - aend = al->address + al->size; - bstart = bl->address; - bend = bl->address + bl->size; + aend = al->ml_address + al->ml_size; + bstart = bl->ml_address; + bend = bl->ml_address + bl->ml_size; while (al && bl) { while (al && (aend <= bstart)) - if ((al = al->next) != NULL) - aend = al->address + al->size; + if ((al = al->ml_next) != NULL) + aend = al->ml_address + al->ml_size; if (al == NULL) return (0); - if ((astart = al->address) <= bstart) + if ((astart = al->ml_address) <= bstart) return (1); while (bl && (bend <= astart)) - if ((bl = bl->next) != NULL) - bend = bl->address + bl->size; + if ((bl = bl->ml_next) != NULL) + bend = bl->ml_address + bl->ml_size; if (bl == NULL) return (0); - if ((bstart = bl->address) <= astart) + if ((bstart = bl->ml_address) <= astart) return (1); } @@ -2180,26 +2181,26 @@ memlist_canfit(struct memlist *s_mlist, struct memlist *t_mlist) /* * Base both memlists on common base address (0). */ - s_basepa = s_mlist->address; - t_basepa = t_mlist->address; + s_basepa = s_mlist->ml_address; + t_basepa = t_mlist->ml_address; - for (s_ml = s_mlist; s_ml; s_ml = s_ml->next) - s_ml->address -= s_basepa; + for (s_ml = s_mlist; s_ml; s_ml = s_ml->ml_next) + s_ml->ml_address -= s_basepa; - for (t_ml = t_mlist; t_ml; t_ml = t_ml->next) - t_ml->address -= t_basepa; + for (t_ml = t_mlist; t_ml; t_ml = t_ml->ml_next) + t_ml->ml_address -= t_basepa; s_ml = s_mlist; - for (t_ml = t_mlist; t_ml && s_ml; t_ml = t_ml->next) { + for (t_ml = t_mlist; t_ml && s_ml; t_ml = t_ml->ml_next) { uint64_t s_start, s_end; uint64_t t_start, t_end; - t_start = t_ml->address; - t_end = t_start + t_ml->size; + t_start = t_ml->ml_address; + t_end = t_start + t_ml->ml_size; - for (; s_ml; s_ml = s_ml->next) { - s_start = s_ml->address; - s_end = s_start + s_ml->size; + for (; s_ml; s_ml = s_ml->ml_next) { + s_start = s_ml->ml_address; + s_end = s_start + s_ml->ml_size; if ((s_start < t_start) || (s_end > t_end)) break; @@ -2216,11 +2217,11 @@ memlist_canfit(struct memlist *s_mlist, struct memlist *t_mlist) * Need to add base addresses back since memlists * are probably in use by caller. */ - for (s_ml = s_mlist; s_ml; s_ml = s_ml->next) - s_ml->address += s_basepa; + for (s_ml = s_mlist; s_ml; s_ml = s_ml->ml_next) + s_ml->ml_address += s_basepa; - for (t_ml = t_mlist; t_ml; t_ml = t_ml->next) - t_ml->address += t_basepa; + for (t_ml = t_mlist; t_ml; t_ml = t_ml->ml_next) + t_ml->ml_address += t_basepa; return (rv); } @@ -2314,13 +2315,13 @@ error: SBD_MEMLIST_DUMP(ml); err = 0; - for (mc = ml; mc; mc = mc->next) { + for (mc = ml; mc; mc = mc->ml_next) { update_membounds_t umb; pfn_t base; pgcnt_t npgs; - base = (pfn_t)(mc->address >> PAGESHIFT); - npgs = (pgcnt_t)(mc->size >> PAGESHIFT); + base = (pfn_t)(mc->ml_address >> PAGESHIFT); + npgs = (pgcnt_t)(mc->ml_size >> PAGESHIFT); umb.u_board = sbp->sb_num; umb.u_base = (uint64_t)base << MMU_PAGESHIFT; @@ -2366,7 +2367,7 @@ error: } break; } - (void) sbdp_mem_add_span(hdp, mc->address, mc->size); + (void) sbdp_mem_add_span(hdp, mc->ml_address, mc->ml_size); } if (err != 0) { diff --git a/usr/src/uts/sun4u/ngdr/io/dr.c b/usr/src/uts/sun4u/ngdr/io/dr.c index 76641eaa50..56547d5a05 100644 --- a/usr/src/uts/sun4u/ngdr/io/dr.c +++ b/usr/src/uts/sun4u/ngdr/io/dr.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -2994,9 +2994,9 @@ dr_check_unit_attached(dr_common_unit_t *cp) * Check if base address is in phys_install. */ memlist_read_lock(); - for (ml = phys_install; ml; ml = ml->next) - if ((endpa <= ml->address) || - (basepa >= (ml->address + ml->size))) + for (ml = phys_install; ml; ml = ml->ml_next) + if ((endpa <= ml->ml_address) || + (basepa >= (ml->ml_address + ml->ml_size))) continue; else break; diff --git a/usr/src/uts/sun4u/ngdr/io/dr_mem.c b/usr/src/uts/sun4u/ngdr/io/dr_mem.c index 4ec665bccd..ccb70b83cb 100644 --- a/usr/src/uts/sun4u/ngdr/io/dr_mem.c +++ b/usr/src/uts/sun4u/ngdr/io/dr_mem.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -301,13 +301,13 @@ dr_attach_mem(dr_handle_t *hp, dr_common_unit_t *cp) } ml = dr_get_memlist(mp); - for (mc = ml; mc; mc = mc->next) { + for (mc = ml; mc; mc = mc->ml_next) { int rv; sbd_error_t *err; rv = kphysm_add_memory_dynamic( - (pfn_t)(mc->address >> PAGESHIFT), - (pgcnt_t)(mc->size >> PAGESHIFT)); + (pfn_t)(mc->ml_address >> PAGESHIFT), + (pgcnt_t)(mc->ml_size >> PAGESHIFT)); if (rv != KPHYSM_OK) { /* * translate kphysm error and @@ -335,7 +335,7 @@ dr_attach_mem(dr_handle_t *hp, dr_common_unit_t *cp) } err = drmach_mem_add_span( - mp->sbm_cm.sbdev_id, mc->address, mc->size); + mp->sbm_cm.sbdev_id, mc->ml_address, mc->ml_size); if (err) { DRERR_SET_C(&mp->sbm_cm.sbdev_error, &err); break; @@ -376,22 +376,22 @@ dr_mem_ecache_scrub(dr_mem_unit_t *mp, struct memlist *mlist) (cpuid == CPU_CURRENT) ? CPU->cpu_id : cpuid); PR_MEMLIST_DUMP(mlist); - for (ml = mlist; ml; ml = ml->next) { + for (ml = mlist; ml; ml = ml->ml_next) { uint64_t dst_pa; uint64_t nbytes; /* calculate the destination physical address */ - dst_pa = ml->address; - if (ml->address & PAGEOFFSET) + dst_pa = ml->ml_address; + if (ml->ml_address & PAGEOFFSET) cmn_err(CE_WARN, "%s: address (0x%lx) not on " - "page boundary", f, ml->address); + "page boundary", f, ml->ml_address); - nbytes = ml->size; - if (ml->size & PAGEOFFSET) + nbytes = ml->ml_size; + if (ml->ml_size & PAGEOFFSET) cmn_err(CE_WARN, "%s: size (0x%lx) not on " - "page boundary", f, ml->size); + "page boundary", f, ml->ml_size); /*LINTED*/ while (nbytes > 0) { @@ -450,8 +450,8 @@ dr_move_memory(dr_handle_t *hp, dr_mem_unit_t *s_mp, dr_mem_unit_t *t_mp) c_ml = memlist_dup(s_mp->sbm_mlist); d_ml = s_mp->sbm_del_mlist; while (d_ml != NULL) { - c_ml = memlist_del_span(c_ml, d_ml->address, d_ml->size); - d_ml = d_ml->next; + c_ml = memlist_del_span(c_ml, d_ml->ml_address, d_ml->ml_size); + d_ml = d_ml->ml_next; } affinity_set(drmach_mem_cpu_affinity(t_mp->sbm_cm.sbdev_id)); @@ -654,9 +654,10 @@ dr_del_span_query(pfn_t base, pgcnt_t npages, memquery_t *mp) memlist_read_unlock(); again: - for (ml = mlist; ml; ml = ml->next) { - if ((ml->address & sm) != sa) { - mlist = memlist_del_span(mlist, ml->address, ml->size); + for (ml = mlist; ml; ml = ml->ml_next) { + if ((ml->ml_address & sm) != sa) { + mlist = memlist_del_span(mlist, + ml->ml_address, ml->ml_size); goto again; } } @@ -667,11 +668,11 @@ again: mp->first_nonrelocatable = (pfn_t)-1; /* XXX */ mp->last_nonrelocatable = 0; - for (ml = mlist; ml; ml = ml->next) { + for (ml = mlist; ml; ml = ml->ml_next) { memquery_t mq; rv = kphysm_del_span_query( - _b64top(ml->address), _b64top(ml->size), &mq); + _b64top(ml->ml_address), _b64top(ml->ml_size), &mq); if (rv) break; @@ -971,13 +972,13 @@ dr_post_attach_mem(dr_handle_t *hp, dr_common_unit_t **devlist, int devnum) } memlist_read_unlock(); - for (ml = mlist; ml != NULL; ml = ml->next) { + for (ml = mlist; ml != NULL; ml = ml->ml_next) { sbd_error_t *err; err = drmach_mem_add_span( mp->sbm_cm.sbdev_id, - ml->address, - ml->size); + ml->ml_address, + ml->ml_size); if (err) DRERR_SET_C(&mp->sbm_cm.sbdev_error, &err); } @@ -1069,21 +1070,21 @@ dr_add_memory_spans(dr_mem_unit_t *mp, struct memlist *ml) memlist_read_unlock(); #endif - for (; ml; ml = ml->next) { + for (; ml; ml = ml->ml_next) { pfn_t base; pgcnt_t npgs; int rv; sbd_error_t *err; - base = _b64top(ml->address); - npgs = _b64top(ml->size); + base = _b64top(ml->ml_address); + npgs = _b64top(ml->ml_size); rv = kphysm_add_memory_dynamic(base, npgs); err = drmach_mem_add_span( mp->sbm_cm.sbdev_id, - ml->address, - ml->size); + ml->ml_address, + ml->ml_size); if (err) DRERR_SET_C(&mp->sbm_cm.sbdev_error, &err); @@ -1211,9 +1212,9 @@ dr_post_detach_mem_unit(dr_mem_unit_t *s_mp) * Used to add back excess target mem. */ s_copy_mlist = memlist_dup(s_mp->sbm_mlist); - for (ml = s_mp->sbm_del_mlist; ml; ml = ml->next) { + for (ml = s_mp->sbm_del_mlist; ml; ml = ml->ml_next) { s_copy_mlist = memlist_del_span(s_copy_mlist, - ml->address, ml->size); + ml->ml_address, ml->ml_size); } PR_MEM("%s: source copy list:\n:", f); @@ -1224,9 +1225,9 @@ dr_post_detach_mem_unit(dr_mem_unit_t *s_mp) * memlists accordingly with new base * addresses. */ - for (ml = t_mp->sbm_mlist; ml; ml = ml->next) { - ml->address -= t_old_basepa; - ml->address += t_new_basepa; + for (ml = t_mp->sbm_mlist; ml; ml = ml->ml_next) { + ml->ml_address -= t_old_basepa; + ml->ml_address += t_new_basepa; } /* @@ -1239,9 +1240,9 @@ dr_post_detach_mem_unit(dr_mem_unit_t *s_mp) PR_MEM("%s: renamed target memlist and delete memlist:\n", f); PR_MEMLIST_DUMP(t_mp->sbm_mlist); - for (ml = s_mp->sbm_mlist; ml; ml = ml->next) { - ml->address -= s_old_basepa; - ml->address += s_new_basepa; + for (ml = s_mp->sbm_mlist; ml; ml = ml->ml_next) { + ml->ml_address -= s_old_basepa; + ml->ml_address += s_new_basepa; } PR_MEM("%s: renamed source memlist:\n", f); @@ -1283,24 +1284,24 @@ dr_post_detach_mem_unit(dr_mem_unit_t *s_mp) * node. */ t_excess_mlist = memlist_dup(t_mp->sbm_mlist); - for (ml = s_copy_mlist; ml; ml = ml->next) { + for (ml = s_copy_mlist; ml; ml = ml->ml_next) { t_excess_mlist = memlist_del_span(t_excess_mlist, - ml->address, ml->size); + ml->ml_address, ml->ml_size); } /* * Update dynamically added segs */ - for (ml = s_mp->sbm_del_mlist; ml; ml = ml->next) { + for (ml = s_mp->sbm_del_mlist; ml; ml = ml->ml_next) { t_mp->sbm_dyn_segs = memlist_del_span(t_mp->sbm_dyn_segs, - ml->address, ml->size); + ml->ml_address, ml->ml_size); } - for (ml = t_excess_mlist; ml; ml = ml->next) { + for (ml = t_excess_mlist; ml; ml = ml->ml_next) { t_mp->sbm_dyn_segs = memlist_cat_span(t_mp->sbm_dyn_segs, - ml->address, ml->size); + ml->ml_address, ml->ml_size); } PR_MEM("%s: %s: updated dynamic seg list:\n", f, t_mp->sbm_cm.sbdev_path); @@ -1322,9 +1323,9 @@ dr_post_detach_mem_unit(dr_mem_unit_t *s_mp) * list is not used beyond this point, and in fact, is * disposed of at the end of this function. */ - for (ml = s_mp->sbm_del_mlist; ml; ml = ml->next) { - ml->address -= s_old_basepa; - ml->address += s_new_basepa; + for (ml = s_mp->sbm_del_mlist; ml; ml = ml->ml_next) { + ml->ml_address -= s_old_basepa; + ml->ml_address += s_new_basepa; } PR_MEM("%s: renamed source delete memlist", f); @@ -1973,8 +1974,8 @@ dr_init_mem_unit_data(dr_mem_unit_t *mp) f, mp->sbm_cm.sbdev_path); mlist = dr_get_memlist(mp); - for (ml = mlist; ml; ml = ml->next) - mp->sbm_npages += btop(ml->size); + for (ml = mlist; ml; ml = ml->ml_next) + mp->sbm_npages += btop(ml->ml_size); memlist_delete(mlist); } @@ -2021,9 +2022,9 @@ dr_reserve_mem_spans(memhandle_t *mhp, struct memlist *ml) * with kphysm_del_span. It is possible that a span may intersect * an area occupied by the cage. */ - for (mc = ml; mc != NULL; mc = mc->next) { - base = _b64top(mc->address); - npgs = _b64top(mc->size); + for (mc = ml; mc != NULL; mc = mc->ml_next) { + base = _b64top(mc->ml_address); + npgs = _b64top(mc->ml_size); err = kphysm_del_span(*mhp, base, npgs); if (err != KPHYSM_OK) { @@ -2434,10 +2435,10 @@ dr_select_mem_target(dr_handle_t *hp, #ifdef DEBUG /* sanity check memlist */ d_ml = x_ml; - while (d_ml->next != NULL) - d_ml = d_ml->next; + while (d_ml->ml_next != NULL) + d_ml = d_ml->ml_next; - ASSERT(d_ml->address + d_ml->size == + ASSERT(d_ml->ml_address + d_ml->ml_size == _ptob64(s_mq.last_nonrelocatable + 1)); #endif @@ -2544,10 +2545,10 @@ dr_select_mem_target(dr_handle_t *hp, s_del_pa); PR_MEM("%s: checking for split of dyn seg list:\n", f); PR_MEMLIST_DUMP(s_mp->sbm_dyn_segs); - for (ml = s_mp->sbm_dyn_segs; ml; ml = ml->next) { - if (s_del_pa > ml->address && - s_del_pa < ml->address + ml->size) { - s_del_pa = ml->address; + for (ml = s_mp->sbm_dyn_segs; ml; ml = ml->ml_next) { + if (s_del_pa > ml->ml_address && + s_del_pa < ml->ml_address + ml->ml_size) { + s_del_pa = ml->ml_address; break; } } @@ -2681,26 +2682,26 @@ memlist_canfit(struct memlist *s_mlist, struct memlist *t_mlist) /* * Base both memlists on common base address (0). */ - s_basepa = s_mlist->address; - t_basepa = t_mlist->address; + s_basepa = s_mlist->ml_address; + t_basepa = t_mlist->ml_address; - for (s_ml = s_mlist; s_ml; s_ml = s_ml->next) - s_ml->address -= s_basepa; + for (s_ml = s_mlist; s_ml; s_ml = s_ml->ml_next) + s_ml->ml_address -= s_basepa; - for (t_ml = t_mlist; t_ml; t_ml = t_ml->next) - t_ml->address -= t_basepa; + for (t_ml = t_mlist; t_ml; t_ml = t_ml->ml_next) + t_ml->ml_address -= t_basepa; s_ml = s_mlist; - for (t_ml = t_mlist; t_ml && s_ml; t_ml = t_ml->next) { + for (t_ml = t_mlist; t_ml && s_ml; t_ml = t_ml->ml_next) { uint64_t s_start, s_end; uint64_t t_start, t_end; - t_start = t_ml->address; - t_end = t_start + t_ml->size; + t_start = t_ml->ml_address; + t_end = t_start + t_ml->ml_size; - for (; s_ml; s_ml = s_ml->next) { - s_start = s_ml->address; - s_end = s_start + s_ml->size; + for (; s_ml; s_ml = s_ml->ml_next) { + s_start = s_ml->ml_address; + s_end = s_start + s_ml->ml_size; if ((s_start < t_start) || (s_end > t_end)) break; @@ -2717,11 +2718,11 @@ memlist_canfit(struct memlist *s_mlist, struct memlist *t_mlist) * Need to add base addresses back since memlists * are probably in use by caller. */ - for (s_ml = s_mlist; s_ml; s_ml = s_ml->next) - s_ml->address += s_basepa; + for (s_ml = s_mlist; s_ml; s_ml = s_ml->ml_next) + s_ml->ml_address += s_basepa; - for (t_ml = t_mlist; t_ml; t_ml = t_ml->next) - t_ml->address += t_basepa; + for (t_ml = t_mlist; t_ml; t_ml = t_ml->ml_next) + t_ml->ml_address += t_basepa; return (rv); } diff --git a/usr/src/uts/sun4u/ngdr/io/dr_util.c b/usr/src/uts/sun4u/ngdr/io/dr_util.c index 2020a6d658..e201dcd115 100644 --- a/usr/src/uts/sun4u/ngdr/io/dr_util.c +++ b/usr/src/uts/sun4u/ngdr/io/dr_util.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -177,7 +177,7 @@ dr_memlist_delete(struct memlist *mlist) register struct memlist *ml; for (ml = mlist; ml; ml = mlist) { - mlist = ml->next; + mlist = ml->ml_next; FREESTRUCT(ml, struct memlist, 1); } } @@ -190,27 +190,27 @@ dr_memlist_intersect(struct memlist *al, struct memlist *bl) if ((al == NULL) || (bl == NULL)) return (0); - aend = al->address + al->size; - bstart = bl->address; - bend = bl->address + bl->size; + aend = al->ml_address + al->ml_size; + bstart = bl->ml_address; + bend = bl->ml_address + bl->ml_size; while (al && bl) { while (al && (aend <= bstart)) - if ((al = al->next) != NULL) - aend = al->address + al->size; + if ((al = al->ml_next) != NULL) + aend = al->ml_address + al->ml_size; if (al == NULL) return (0); - if ((astart = al->address) <= bstart) + if ((astart = al->ml_address) <= bstart) return (1); while (bl && (bend <= astart)) - if ((bl = bl->next) != NULL) - bend = bl->address + bl->size; + if ((bl = bl->ml_next) != NULL) + bend = bl->ml_address + bl->ml_size; if (bl == NULL) return (0); - if ((bstart = bl->address) <= astart) + if ((bstart = bl->ml_address) <= astart) return (1); } @@ -222,26 +222,27 @@ dr_memlist_coalesce(struct memlist *mlist) { uint64_t end, nend; - if ((mlist == NULL) || (mlist->next == NULL)) + if ((mlist == NULL) || (mlist->ml_next == NULL)) return; - while (mlist->next) { - end = mlist->address + mlist->size; - if (mlist->next->address <= end) { + while (mlist->ml_next) { + end = mlist->ml_address + mlist->ml_size; + if (mlist->ml_next->ml_address <= end) { struct memlist *nl; - nend = mlist->next->address + mlist->next->size; + nend = mlist->ml_next->ml_address + + mlist->ml_next->ml_size; if (nend > end) - mlist->size += (nend - end); - nl = mlist->next; - mlist->next = mlist->next->next; + mlist->ml_size += (nend - end); + nl = mlist->ml_next; + mlist->ml_next = mlist->ml_next->ml_next; if (nl) { FREESTRUCT(nl, struct memlist, 1); } - if (mlist->next) - mlist->next->prev = mlist; + if (mlist->ml_next) + mlist->ml_next->ml_prev = mlist; } else { - mlist = mlist->next; + mlist = mlist->ml_next; } } } @@ -254,8 +255,8 @@ memlist_dump(struct memlist *mlist) if (mlist == NULL) printf("memlist> EMPTY\n"); - else for (ml = mlist; ml; ml = ml->next) - printf("memlist> 0x%lx, 0x%lx\n", ml->address, ml->size); + else for (ml = mlist; ml; ml = ml->ml_next) + printf("memlist> 0x%lx, 0x%lx\n", ml->ml_address, ml->ml_size); } #endif @@ -269,13 +270,13 @@ dr_memlist_dup(struct memlist *mlist) mlp = &hl; tl = *mlp; - for (; mlist; mlist = mlist->next) { + for (; mlist; mlist = mlist->ml_next) { *mlp = GETSTRUCT(struct memlist, 1); - (*mlp)->address = mlist->address; - (*mlp)->size = mlist->size; - (*mlp)->prev = tl; + (*mlp)->ml_address = mlist->ml_address; + (*mlp)->ml_size = mlist->ml_size; + (*mlp)->ml_prev = tl; tl = *mlp; - mlp = &((*mlp)->next); + mlp = &((*mlp)->ml_next); } *mlp = NULL; @@ -292,47 +293,47 @@ dr_memlist_add_span(struct memlist *mlist, uint64_t base, uint64_t len) if (mlist == NULL) { mlist = GETSTRUCT(struct memlist, 1); - mlist->address = base; - mlist->size = len; - mlist->next = mlist->prev = NULL; + mlist->ml_address = base; + mlist->ml_size = len; + mlist->ml_next = mlist->ml_prev = NULL; return (mlist); } - for (tl = ml = mlist; ml; tl = ml, ml = ml->next) { - if (base < ml->address) { - if ((base + len) < ml->address) { + for (tl = ml = mlist; ml; tl = ml, ml = ml->ml_next) { + if (base < ml->ml_address) { + if ((base + len) < ml->ml_address) { nl = GETSTRUCT(struct memlist, 1); - nl->address = base; - nl->size = len; - nl->next = ml; - if ((nl->prev = ml->prev) != NULL) - nl->prev->next = nl; - ml->prev = nl; + nl->ml_address = base; + nl->ml_size = len; + nl->ml_next = ml; + if ((nl->ml_prev = ml->ml_prev) != NULL) + nl->ml_prev->ml_next = nl; + ml->ml_prev = nl; if (mlist == ml) mlist = nl; } else { - ml->size = MAX((base + len), - (ml->address + ml->size)) - base; - ml->address = base; + ml->ml_size = MAX((base + len), + (ml->ml_address + ml->ml_size)) - base; + ml->ml_address = base; } break; - } else if (base <= (ml->address + ml->size)) { - ml->size = MAX((base + len), - (ml->address + ml->size)) - - MIN(ml->address, base); - ml->address = MIN(ml->address, base); + } else if (base <= (ml->ml_address + ml->ml_size)) { + ml->ml_size = MAX((base + len), + (ml->ml_address + ml->ml_size)) - + MIN(ml->ml_address, base); + ml->ml_address = MIN(ml->ml_address, base); break; } } if (ml == NULL) { nl = GETSTRUCT(struct memlist, 1); - nl->address = base; - nl->size = len; - nl->next = NULL; - nl->prev = tl; - tl->next = nl; + nl->ml_address = base; + nl->ml_size = len; + nl->ml_next = NULL; + nl->ml_prev = tl; + tl->ml_next = nl; } dr_memlist_coalesce(mlist); @@ -350,53 +351,53 @@ dr_memlist_del_span(struct memlist *mlist, uint64_t base, uint64_t len) return (NULL); end = base + len; - if ((end <= mlist->address) || (base == end)) + if ((end <= mlist->ml_address) || (base == end)) return (mlist); for (tl = ml = mlist; ml; tl = ml, ml = nlp) { uint64_t mend; - nlp = ml->next; + nlp = ml->ml_next; - if (end <= ml->address) + if (end <= ml->ml_address) break; - mend = ml->address + ml->size; + mend = ml->ml_address + ml->ml_size; if (base < mend) { - if (base <= ml->address) { - ml->address = end; + if (base <= ml->ml_address) { + ml->ml_address = end; if (end >= mend) - ml->size = 0ull; + ml->ml_size = 0ull; else - ml->size = mend - ml->address; + ml->ml_size = mend - ml->ml_address; } else { - ml->size = base - ml->address; + ml->ml_size = base - ml->ml_address; if (end < mend) { struct memlist *nl; /* * splitting an memlist entry. */ nl = GETSTRUCT(struct memlist, 1); - nl->address = end; - nl->size = mend - nl->address; - if ((nl->next = nlp) != NULL) - nlp->prev = nl; - nl->prev = ml; - ml->next = nl; + nl->ml_address = end; + nl->ml_size = mend - nl->ml_address; + if ((nl->ml_next = nlp) != NULL) + nlp->ml_prev = nl; + nl->ml_prev = ml; + ml->ml_next = nl; nlp = nl; } } - if (ml->size == 0ull) { + if (ml->ml_size == 0ull) { if (ml == mlist) { if ((mlist = nlp) != NULL) - nlp->prev = NULL; + nlp->ml_prev = NULL; FREESTRUCT(ml, struct memlist, 1); if (mlist == NULL) break; ml = nlp; } else { - if ((tl->next = nlp) != NULL) - nlp->prev = tl; + if ((tl->ml_next = nlp) != NULL) + nlp->ml_prev = tl; FREESTRUCT(ml, struct memlist, 1); ml = tl; } @@ -420,22 +421,22 @@ dr_memlist_cat_span(struct memlist *mlist, uint64_t base, uint64_t len) if (mlist == NULL) { mlist = GETSTRUCT(struct memlist, 1); - mlist->address = base; - mlist->size = len; - mlist->next = mlist->prev = NULL; + mlist->ml_address = base; + mlist->ml_size = len; + mlist->ml_next = mlist->ml_prev = NULL; return (mlist); } - for (tl = ml = mlist; ml; tl = ml, ml = ml->next) { - if (base < ml->address) { + for (tl = ml = mlist; ml; tl = ml, ml = ml->ml_next) { + if (base < ml->ml_address) { nl = GETSTRUCT(struct memlist, 1); - nl->address = base; - nl->size = len; - nl->next = ml; - if ((nl->prev = ml->prev) != NULL) - nl->prev->next = nl; - ml->prev = nl; + nl->ml_address = base; + nl->ml_size = len; + nl->ml_next = ml; + if ((nl->ml_prev = ml->ml_prev) != NULL) + nl->ml_prev->ml_next = nl; + ml->ml_prev = nl; if (mlist == ml) mlist = nl; break; @@ -444,11 +445,11 @@ dr_memlist_cat_span(struct memlist *mlist, uint64_t base, uint64_t len) if (ml == NULL) { nl = GETSTRUCT(struct memlist, 1); - nl->address = base; - nl->size = len; - nl->next = NULL; - nl->prev = tl; - tl->next = nl; + nl->ml_address = base; + nl->ml_size = len; + nl->ml_next = NULL; + nl->ml_prev = tl; + tl->ml_next = nl; } return (mlist); diff --git a/usr/src/uts/sun4u/opl/io/dr_mem.c b/usr/src/uts/sun4u/opl/io/dr_mem.c index e2aec70b97..e87dd2b3e3 100644 --- a/usr/src/uts/sun4u/opl/io/dr_mem.c +++ b/usr/src/uts/sun4u/opl/io/dr_mem.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -323,13 +323,13 @@ dr_attach_mem(dr_handle_t *hp, dr_common_unit_t *cp) } ml = dr_get_memlist(mp); - for (mc = ml; mc; mc = mc->next) { + for (mc = ml; mc; mc = mc->ml_next) { int rv; sbd_error_t *err; rv = kphysm_add_memory_dynamic( - (pfn_t)(mc->address >> PAGESHIFT), - (pgcnt_t)(mc->size >> PAGESHIFT)); + (pfn_t)(mc->ml_address >> PAGESHIFT), + (pgcnt_t)(mc->ml_size >> PAGESHIFT)); if (rv != KPHYSM_OK) { /* * translate kphysm error and @@ -357,7 +357,7 @@ dr_attach_mem(dr_handle_t *hp, dr_common_unit_t *cp) } err = drmach_mem_add_span( - mp->sbm_cm.sbdev_id, mc->address, mc->size); + mp->sbm_cm.sbdev_id, mc->ml_address, mc->ml_size); if (err) { DRERR_SET_C(&mp->sbm_cm.sbdev_error, &err); break; @@ -459,8 +459,8 @@ dr_move_memory(dr_handle_t *hp, dr_mem_unit_t *s_mp, dr_mem_unit_t *t_mp) c_ml = memlist_dup(s_mp->sbm_mlist); d_ml = s_mp->sbm_del_mlist; while (d_ml != NULL) { - c_ml = memlist_del_span(c_ml, d_ml->address, d_ml->size); - d_ml = d_ml->next; + c_ml = memlist_del_span(c_ml, d_ml->ml_address, d_ml->ml_size); + d_ml = d_ml->ml_next; } /* @@ -657,11 +657,11 @@ dr_del_mlist_query(struct memlist *mlist, memquery_t *mp) mp->first_nonrelocatable = (pfn_t)-1; /* XXX */ mp->last_nonrelocatable = 0; - for (ml = mlist; ml; ml = ml->next) { + for (ml = mlist; ml; ml = ml->ml_next) { memquery_t mq; rv = kphysm_del_span_query( - _b64top(ml->address), _b64top(ml->size), &mq); + _b64top(ml->ml_address), _b64top(ml->ml_size), &mq); if (rv) break; @@ -979,13 +979,13 @@ dr_post_attach_mem(dr_handle_t *hp, dr_common_unit_t **devlist, int devnum) } memlist_read_unlock(); - for (ml = mlist; ml != NULL; ml = ml->next) { + for (ml = mlist; ml != NULL; ml = ml->ml_next) { sbd_error_t *err; err = drmach_mem_add_span( mp->sbm_cm.sbdev_id, - ml->address, - ml->size); + ml->ml_address, + ml->ml_size); if (err) DRERR_SET_C(&mp->sbm_cm.sbdev_error, &err); } @@ -1072,21 +1072,21 @@ dr_add_memory_spans(dr_mem_unit_t *mp, struct memlist *ml) memlist_read_unlock(); #endif - for (; ml; ml = ml->next) { + for (; ml; ml = ml->ml_next) { pfn_t base; pgcnt_t npgs; int rv; sbd_error_t *err; - base = _b64top(ml->address); - npgs = _b64top(ml->size); + base = _b64top(ml->ml_address); + npgs = _b64top(ml->ml_size); rv = kphysm_add_memory_dynamic(base, npgs); err = drmach_mem_add_span( mp->sbm_cm.sbdev_id, - ml->address, - ml->size); + ml->ml_address, + ml->ml_size); if (err) DRERR_SET_C(&mp->sbm_cm.sbdev_error, &err); @@ -1107,10 +1107,10 @@ static int memlist_touch(struct memlist *ml, uint64_t add) { while (ml != NULL) { - if ((add == ml->address) || - (add == (ml->address + ml->size))) + if ((add == ml->ml_address) || + (add == (ml->ml_address + ml->ml_size))) return (1); - ml = ml->next; + ml = ml->ml_next; } return (0); } @@ -1138,14 +1138,14 @@ dr_process_excess_mlist(dr_mem_unit_t *s_mp, * the kernel cage glist. */ for (ml = s_mp->sbm_del_mlist; ml; - ml = ml->next) { + ml = ml->ml_next) { PR_MEM("%s: delete small<->big copy-" "rename source excess memory", f); PR_MEMLIST_DUMP(ml); err = drmach_mem_del_span( s_mp->sbm_cm.sbdev_id, - ml->address, ml->size); + ml->ml_address, ml->ml_size); if (err) DRERR_SET_C(&s_mp-> sbm_cm.sbdev_error, &err); @@ -1157,12 +1157,12 @@ dr_process_excess_mlist(dr_mem_unit_t *s_mp, f, t_mp->sbm_cm.sbdev_path); PR_MEMLIST_DUMP(t_excess_mlist); - for (ml = t_excess_mlist; ml; ml = ml->next) { + for (ml = t_excess_mlist; ml; ml = ml->ml_next) { struct memlist ml0; - ml0.address = ml->address; - ml0.size = ml->size; - ml0.next = ml0.prev = NULL; + ml0.ml_address = ml->ml_address; + ml0.ml_size = ml->ml_size; + ml0.ml_next = ml0.ml_prev = NULL; /* * If the memory object is 256 MB aligned (max page size @@ -1178,57 +1178,57 @@ dr_process_excess_mlist(dr_mem_unit_t *s_mp, * The extreme case of 8K segment will fail * kphysm_add_memory_dynamic(), e.g. */ - if ((ml->address & (MH_MPSS_ALIGNMENT - 1)) || - (ml->size & (MH_MPSS_ALIGNMENT - 1))) { + if ((ml->ml_address & (MH_MPSS_ALIGNMENT - 1)) || + (ml->ml_size & (MH_MPSS_ALIGNMENT - 1))) { memlist_read_lock(); - rv = memlist_touch(phys_install, ml0.address); + rv = memlist_touch(phys_install, ml0.ml_address); memlist_read_unlock(); if (rv) { - new_pa = roundup(ml0.address + 1, MH_MIN_ALIGNMENT); - nbytes = (new_pa - ml0.address); - if (nbytes >= ml0.size) { + new_pa = roundup(ml0.ml_address + 1, MH_MIN_ALIGNMENT); + nbytes = (new_pa - ml0.ml_address); + if (nbytes >= ml0.ml_size) { t_mp->sbm_dyn_segs = memlist_del_span(t_mp->sbm_dyn_segs, - ml0.address, ml0.size); + ml0.ml_address, ml0.ml_size); continue; } t_mp->sbm_dyn_segs = memlist_del_span(t_mp->sbm_dyn_segs, - ml0.address, nbytes); - ml0.size -= nbytes; - ml0.address = new_pa; + ml0.ml_address, nbytes); + ml0.ml_size -= nbytes; + ml0.ml_address = new_pa; } - if (ml0.size == 0) { + if (ml0.ml_size == 0) { continue; } memlist_read_lock(); - rv = memlist_touch(phys_install, ml0.address + ml0.size); + rv = memlist_touch(phys_install, ml0.ml_address + ml0.ml_size); memlist_read_unlock(); if (rv) { - new_pa = rounddown(ml0.address + ml0.size - 1, + new_pa = rounddown(ml0.ml_address + ml0.ml_size - 1, MH_MIN_ALIGNMENT); - nbytes = (ml0.address + ml0.size - new_pa); - if (nbytes >= ml0.size) { + nbytes = (ml0.ml_address + ml0.ml_size - new_pa); + if (nbytes >= ml0.ml_size) { t_mp->sbm_dyn_segs = memlist_del_span(t_mp->sbm_dyn_segs, - ml0.address, ml0.size); + ml0.ml_address, ml0.ml_size); continue; } t_mp->sbm_dyn_segs = memlist_del_span(t_mp->sbm_dyn_segs, new_pa, nbytes); - ml0.size -= nbytes; + ml0.ml_size -= nbytes; } - if (ml0.size > 0) { + if (ml0.ml_size > 0) { dr_add_memory_spans(s_mp, &ml0); } - } else if (ml0.size > 0) { + } else if (ml0.ml_size > 0) { dr_add_memory_spans(s_mp, &ml0); } } @@ -1349,9 +1349,9 @@ dr_post_detach_mem_unit(dr_mem_unit_t *s_mp) * Used to add back excess target mem. */ s_copy_mlist = memlist_dup(s_mp->sbm_mlist); - for (ml = s_mp->sbm_del_mlist; ml; ml = ml->next) { + for (ml = s_mp->sbm_del_mlist; ml; ml = ml->ml_next) { s_copy_mlist = memlist_del_span(s_copy_mlist, - ml->address, ml->size); + ml->ml_address, ml->ml_size); } PR_MEM("%s: source copy list:\n:", f); @@ -1362,9 +1362,9 @@ dr_post_detach_mem_unit(dr_mem_unit_t *s_mp) * memlists accordingly with new base * addresses. */ - for (ml = t_mp->sbm_mlist; ml; ml = ml->next) { - ml->address -= t_old_basepa; - ml->address += t_new_basepa; + for (ml = t_mp->sbm_mlist; ml; ml = ml->ml_next) { + ml->ml_address -= t_old_basepa; + ml->ml_address += t_new_basepa; } /* @@ -1377,9 +1377,9 @@ dr_post_detach_mem_unit(dr_mem_unit_t *s_mp) PR_MEM("%s: renamed target memlist and delete memlist:\n", f); PR_MEMLIST_DUMP(t_mp->sbm_mlist); - for (ml = s_mp->sbm_mlist; ml; ml = ml->next) { - ml->address -= s_old_basepa; - ml->address += s_new_basepa; + for (ml = s_mp->sbm_mlist; ml; ml = ml->ml_next) { + ml->ml_address -= s_old_basepa; + ml->ml_address += s_new_basepa; } PR_MEM("%s: renamed source memlist:\n", f); @@ -1404,10 +1404,10 @@ dr_post_detach_mem_unit(dr_mem_unit_t *s_mp) * node. */ t_excess_mlist = memlist_dup(t_mp->sbm_mlist); - for (ml = s_copy_mlist; ml; ml = ml->next) { + for (ml = s_copy_mlist; ml; ml = ml->ml_next) { t_excess_mlist = memlist_del_span(t_excess_mlist, - ml->address, ml->size); + ml->ml_address, ml->ml_size); } PR_MEM("%s: excess memlist:\n", f); PR_MEMLIST_DUMP(t_excess_mlist); @@ -1415,15 +1415,15 @@ dr_post_detach_mem_unit(dr_mem_unit_t *s_mp) /* * Update dynamically added segs */ - for (ml = s_mp->sbm_del_mlist; ml; ml = ml->next) { + for (ml = s_mp->sbm_del_mlist; ml; ml = ml->ml_next) { t_mp->sbm_dyn_segs = memlist_del_span(t_mp->sbm_dyn_segs, - ml->address, ml->size); + ml->ml_address, ml->ml_size); } - for (ml = t_excess_mlist; ml; ml = ml->next) { + for (ml = t_excess_mlist; ml; ml = ml->ml_next) { t_mp->sbm_dyn_segs = memlist_cat_span(t_mp->sbm_dyn_segs, - ml->address, ml->size); + ml->ml_address, ml->ml_size); } PR_MEM("%s: %s: updated dynamic seg list:\n", f, t_mp->sbm_cm.sbdev_path); @@ -1465,12 +1465,12 @@ dr_post_detach_mem_unit(dr_mem_unit_t *s_mp) * source board's sbm_del_mlist */ for (ml = s_mp->sbm_del_mlist; !s_excess_mem_deleted && ml; - ml = ml->next) { + ml = ml->ml_next) { PR_MEM("%s: delete source excess memory", f); PR_MEMLIST_DUMP(ml); err = drmach_mem_del_span(s_mp->sbm_cm.sbdev_id, - ml->address, ml->size); + ml->ml_address, ml->ml_size); if (err) DRERR_SET_C(&s_mp->sbm_cm.sbdev_error, &err); ASSERT(err == NULL); @@ -2094,9 +2094,9 @@ dr_reserve_mem_spans(memhandle_t *mhp, struct memlist *ml) * with kphysm_del_span. It is possible that a span may intersect * an area occupied by the cage. */ - for (mc = ml; mc != NULL; mc = mc->next) { - base = _b64top(mc->address); - npgs = _b64top(mc->size); + for (mc = ml; mc != NULL; mc = mc->ml_next) { + base = _b64top(mc->ml_address); + npgs = _b64top(mc->ml_size); err = kphysm_del_span(*mhp, base, npgs); if (err != KPHYSM_OK) { @@ -2183,9 +2183,9 @@ dr_select_mem_target(dr_handle_t *hp, /* break down s_ml if it contains dynamic segments */ b_ml = memlist_dup(s_ml); - for (ml = s_mp->sbm_dyn_segs; ml; ml = ml->next) { - b_ml = memlist_del_span(b_ml, ml->address, ml->size); - b_ml = memlist_cat_span(b_ml, ml->address, ml->size); + for (ml = s_mp->sbm_dyn_segs; ml; ml = ml->ml_next) { + b_ml = memlist_del_span(b_ml, ml->ml_address, ml->ml_size); + b_ml = memlist_cat_span(b_ml, ml->ml_address, ml->ml_size); } @@ -2363,9 +2363,9 @@ dr_select_mem_target(dr_handle_t *hp, ASSERT(d_ml != NULL); ASSERT(x_ml != NULL); - for (ml = x_ml; ml != NULL; ml = ml->next) { - d_ml = memlist_del_span(d_ml, ml->address, - ml->size); + for (ml = x_ml; ml != NULL; ml = ml->ml_next) { + d_ml = memlist_del_span(d_ml, ml->ml_address, + ml->ml_size); } PR_MEM("%s: %s: reserving src brd memlist:\n", f, @@ -2544,10 +2544,10 @@ dr_get_copy_mlist(struct memlist *s_mlist, struct memlist *t_mlist, ASSERT(t_mp->sbm_slice_size == s_mp->sbm_slice_size); s_slice_mask = s_mp->sbm_slice_size - 1; - s_slice_base = s_mlist->address & ~s_slice_mask; + s_slice_base = s_mlist->ml_address & ~s_slice_mask; t_slice_mask = t_mp->sbm_slice_size - 1; - t_slice_base = t_mlist->address & ~t_slice_mask; + t_slice_base = t_mlist->ml_address & ~t_slice_mask; t_ml = memlist_dup(t_mlist); s_del_ml = memlist_dup(s_mlist); @@ -2568,34 +2568,36 @@ dr_get_copy_mlist(struct memlist *s_mlist, struct memlist *t_mlist, * give the source delete memlist. The copy memlist is * the reciprocal of the source delete memlist. */ - for (ml = t_ml; ml != NULL; ml = ml->next) { + for (ml = t_ml; ml != NULL; ml = ml->ml_next) { /* * Normalize relative to target slice base PA * in order to preseve slice offsets. */ - ml->address -= t_slice_base; + ml->ml_address -= t_slice_base; /* * Convert to source slice PA address. */ - ml->address += s_slice_base; + ml->ml_address += s_slice_base; } - for (ml = t_ml; ml != NULL; ml = ml->next) { - s_del_ml = memlist_del_span(s_del_ml, ml->address, ml->size); + for (ml = t_ml; ml != NULL; ml = ml->ml_next) { + s_del_ml = memlist_del_span(s_del_ml, + ml->ml_address, ml->ml_size); } /* * Expand the delete mlist to fully include any dynamic segments * it intersects with. */ - for (x_ml = NULL, ml = s_del_ml; ml != NULL; ml = ml->next) { - uint64_t del_base = ml->address; - uint64_t del_end = ml->address + ml->size; + for (x_ml = NULL, ml = s_del_ml; ml != NULL; ml = ml->ml_next) { + uint64_t del_base = ml->ml_address; + uint64_t del_end = ml->ml_address + ml->ml_size; struct memlist *dyn; - for (dyn = s_mp->sbm_dyn_segs; dyn != NULL; dyn = dyn->next) { - uint64_t dyn_base = dyn->address; - uint64_t dyn_end = dyn->address + dyn->size; + for (dyn = s_mp->sbm_dyn_segs; dyn != NULL; + dyn = dyn->ml_next) { + uint64_t dyn_base = dyn->ml_address; + uint64_t dyn_end = dyn->ml_address + dyn->ml_size; if (del_base > dyn_base && del_base < dyn_end) del_base = dyn_base; @@ -2610,8 +2612,9 @@ dr_get_copy_mlist(struct memlist *s_mlist, struct memlist *t_mlist, memlist_delete(s_del_ml); s_del_ml = x_ml; - for (ml = s_del_ml; ml != NULL; ml = ml->next) { - s_copy_ml = memlist_del_span(s_copy_ml, ml->address, ml->size); + for (ml = s_del_ml; ml != NULL; ml = ml->ml_next) { + s_copy_ml = memlist_del_span(s_copy_ml, + ml->ml_address, ml->ml_size); } PR_MEM("%s: source delete mlist\n", f); @@ -2642,14 +2645,14 @@ dr_get_nonreloc_mlist(struct memlist *s_ml, dr_mem_unit_t *s_mp) PR_MEM("%s: checking for split of dyn seg list:\n", f); PR_MEMLIST_DUMP(s_mp->sbm_dyn_segs); - for (ml = s_ml; ml; ml = ml->next) { + for (ml = s_ml; ml; ml = ml->ml_next) { int rv; uint64_t nr_base, nr_end; memquery_t mq; struct memlist *dyn; rv = kphysm_del_span_query( - _b64top(ml->address), _b64top(ml->size), &mq); + _b64top(ml->ml_address), _b64top(ml->ml_size), &mq); if (rv) { memlist_delete(x_ml); return (NULL); @@ -2678,9 +2681,10 @@ dr_get_nonreloc_mlist(struct memlist *s_ml, dr_mem_unit_t *s_mp) * Expand the non-reloc span to fully include any * dynamic segments it intersects with. */ - for (dyn = s_mp->sbm_dyn_segs; dyn != NULL; dyn = dyn->next) { - uint64_t dyn_base = dyn->address; - uint64_t dyn_end = dyn->address + dyn->size; + for (dyn = s_mp->sbm_dyn_segs; dyn != NULL; + dyn = dyn->ml_next) { + uint64_t dyn_base = dyn->ml_address; + uint64_t dyn_end = dyn->ml_address + dyn->ml_size; if (nr_base > dyn_base && nr_base < dyn_end) nr_base = dyn_base; @@ -2730,11 +2734,11 @@ dr_memlist_canfit(struct memlist *s_mlist, struct memlist *t_mlist, /* * Normalize to slice relative offsets. */ - for (ml = s_ml; ml; ml = ml->next) - ml->address &= s_slice_mask; + for (ml = s_ml; ml; ml = ml->ml_next) + ml->ml_address &= s_slice_mask; - for (ml = t_ml; ml; ml = ml->next) - ml->address &= t_slice_mask; + for (ml = t_ml; ml; ml = ml->ml_next) + ml->ml_address &= t_slice_mask; canfit = memlist_canfit(s_ml, t_ml); done: @@ -2764,16 +2768,16 @@ memlist_canfit(struct memlist *s_mlist, struct memlist *t_mlist) return (0); s_ml = s_mlist; - for (t_ml = t_mlist; t_ml && s_ml; t_ml = t_ml->next) { + for (t_ml = t_mlist; t_ml && s_ml; t_ml = t_ml->ml_next) { uint64_t s_start, s_end; uint64_t t_start, t_end; - t_start = t_ml->address; - t_end = t_start + t_ml->size; + t_start = t_ml->ml_address; + t_end = t_start + t_ml->ml_size; - for (; s_ml; s_ml = s_ml->next) { - s_start = s_ml->address; - s_end = s_start + s_ml->size; + for (; s_ml; s_ml = s_ml->ml_next) { + s_start = s_ml->ml_address; + s_end = s_start + s_ml->ml_size; if ((s_start < t_start) || (s_end > t_end)) break; diff --git a/usr/src/uts/sun4u/opl/io/drmach.c b/usr/src/uts/sun4u/opl/io/drmach.c index 571068acd6..3f40c0b732 100644 --- a/usr/src/uts/sun4u/opl/io/drmach.c +++ b/usr/src/uts/sun4u/opl/io/drmach.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -428,11 +428,11 @@ drmach_setup_mc_info(dev_info_t *dip, drmach_mem_t *mp) if (ml) { uint64_t nbytes = 0; struct memlist *p; - for (p = ml; p; p = p->next) { - nbytes += p->size; + for (p = ml; p; p = p->ml_next) { + nbytes += p->ml_size; } if ((mp->nbytes = nbytes) > 0) - mp->base_pa = ml->address; + mp->base_pa = ml->ml_address; else mp->base_pa = 0; mp->memlist = ml; @@ -2476,8 +2476,8 @@ drmach_mem_status(drmachid_t id, drmach_status_t *stat) /* stop at first span that is in slice */ memlist_read_lock(); - for (ml = phys_install; ml; ml = ml->next) - if (ml->address >= pa && ml->address < pa + slice_size) + for (ml = phys_install; ml; ml = ml->ml_next) + if (ml->ml_address >= pa && ml->ml_address < pa + slice_size) break; memlist_read_unlock(); @@ -2574,11 +2574,11 @@ drmach_pt_readmem(drmachid_t id, drmach_opts_t *opts) dst_pa = va_to_pa(&dst); memlist_read_lock(); - for (ml = phys_install; ml; ml = ml->next) { + for (ml = phys_install; ml; ml = ml->ml_next) { uint64_t nbytes; - src_pa = ml->address; - nbytes = ml->size; + src_pa = ml->ml_address; + nbytes = ml->ml_size; while (nbytes != 0ull) { @@ -2969,40 +2969,41 @@ drmach_memlist_add_span(drmach_copy_rename_program_t *p, mlist = p->free_mlist; if (mlist == NULL) return (NULL); - p->free_mlist = mlist->next; - mlist->address = base; - mlist->size = len; - mlist->next = mlist->prev = NULL; + p->free_mlist = mlist->ml_next; + mlist->ml_address = base; + mlist->ml_size = len; + mlist->ml_next = mlist->ml_prev = NULL; return (mlist); } - for (tl = ml = mlist; ml; tl = ml, ml = ml->next) { - if (base < ml->address) { - if ((base + len) < ml->address) { + for (tl = ml = mlist; ml; tl = ml, ml = ml->ml_next) { + if (base < ml->ml_address) { + if ((base + len) < ml->ml_address) { nl = p->free_mlist; if (nl == NULL) return (NULL); - p->free_mlist = nl->next; - nl->address = base; - nl->size = len; - nl->next = ml; - if ((nl->prev = ml->prev) != NULL) - nl->prev->next = nl; - ml->prev = nl; + p->free_mlist = nl->ml_next; + nl->ml_address = base; + nl->ml_size = len; + nl->ml_next = ml; + if ((nl->ml_prev = ml->ml_prev) != NULL) + nl->ml_prev->ml_next = nl; + ml->ml_prev = nl; if (mlist == ml) mlist = nl; } else { - ml->size = MAX((base + len), (ml->address + - ml->size)) - base; - ml->address = base; + ml->ml_size = MAX((base + len), + (ml->ml_address + ml->ml_size)) - base; + ml->ml_address = base; } break; - } else if (base <= (ml->address + ml->size)) { - ml->size = MAX((base + len), (ml->address + ml->size)) - - MIN(ml->address, base); - ml->address = MIN(ml->address, base); + } else if (base <= (ml->ml_address + ml->ml_size)) { + ml->ml_size = + MAX((base + len), (ml->ml_address + ml->ml_size)) - + MIN(ml->ml_address, base); + ml->ml_address = MIN(ml->ml_address, base); break; } } @@ -3010,12 +3011,12 @@ drmach_memlist_add_span(drmach_copy_rename_program_t *p, nl = p->free_mlist; if (nl == NULL) return (NULL); - p->free_mlist = nl->next; - nl->address = base; - nl->size = len; - nl->next = NULL; - nl->prev = tl; - tl->next = nl; + p->free_mlist = nl->ml_next; + nl->ml_address = base; + nl->ml_size = len; + nl->ml_next = NULL; + nl->ml_prev = tl; + tl->ml_next = nl; } return (mlist); @@ -3184,13 +3185,13 @@ drmach_copy_rename_prog__relocatable(drmach_copy_rename_program_t *prog, * DO COPY. */ if (CPU_IN_SET(prog->data->cpu_copy_set, cpuid)) { - for (ml = prog->data->cpu_ml[cpuid]; ml; ml = ml->next) { + for (ml = prog->data->cpu_ml[cpuid]; ml; ml = ml->ml_next) { uint64_t s_pa, t_pa; uint64_t nbytes; - s_pa = prog->data->s_copybasepa + ml->address; - t_pa = prog->data->t_copybasepa + ml->address; - nbytes = ml->size; + s_pa = prog->data->s_copybasepa + ml->ml_address; + t_pa = prog->data->t_copybasepa + ml->ml_address; + nbytes = ml->ml_size; while (nbytes != 0ull) { /* @@ -3369,7 +3370,7 @@ drmach_setup_memlist(drmach_copy_rename_program_t *p) buf = p->memlist_buffer; while (nbytes >= sizeof (struct memlist)) { ml = (struct memlist *)buf; - ml->next = p->free_mlist; + ml->ml_next = p->free_mlist; p->free_mlist = ml; buf += s; n_elements++; @@ -3517,8 +3518,8 @@ drmach_copy_rename_init(drmachid_t t_id, drmachid_t s_id, x_ml = c_ml; mlist_size = 0; while (x_ml != NULL) { - x_ml->address -= s_copybasepa; - x_ml = x_ml->next; + x_ml->ml_address -= s_copybasepa; + x_ml = x_ml->ml_next; mlist_size++; } @@ -3754,8 +3755,8 @@ drmach_copy_rename_init(drmachid_t t_id, drmachid_t s_id, x_ml = c_ml; sz = 0; while (x_ml != NULL) { - sz += x_ml->size; - x_ml = x_ml->next; + sz += x_ml->ml_size; + x_ml = x_ml->ml_next; } copy_sz = sz/active_cpus; @@ -3770,8 +3771,8 @@ drmach_copy_rename_init(drmachid_t t_id, drmachid_t s_id, system_clock_freq; x_ml = c_ml; - c_addr = x_ml->address; - c_size = x_ml->size; + c_addr = x_ml->ml_address; + c_size = x_ml->ml_size; for (i = 0; i < NCPU; i++) { prog->stat->nbytes[i] = 0; @@ -3812,10 +3813,10 @@ drmach_copy_rename_init(drmachid_t t_id, drmachid_t s_id, goto out; } - x_ml = x_ml->next; + x_ml = x_ml->ml_next; if (x_ml != NULL) { - c_addr = x_ml->address; - c_size = x_ml->size; + c_addr = x_ml->ml_address; + c_size = x_ml->ml_size; } else { goto end; } @@ -3985,15 +3986,15 @@ drmach_swap_pa(drmach_mem_t *s_mem, drmach_mem_t *t_mem) s_mem->slice_base = t_base; s_mem->base_pa = (s_mem->base_pa - s_base) + t_base; - for (ml = s_mem->memlist; ml; ml = ml->next) { - ml->address = ml->address - s_base + t_base; + for (ml = s_mem->memlist; ml; ml = ml->ml_next) { + ml->ml_address = ml->ml_address - s_base + t_base; } t_mem->slice_base = s_base; t_mem->base_pa = (t_mem->base_pa - t_base) + s_base; - for (ml = t_mem->memlist; ml; ml = ml->next) { - ml->address = ml->address - t_base + s_base; + for (ml = t_mem->memlist; ml; ml = ml->ml_next) { + ml->ml_address = ml->ml_address - t_base + s_base; } /* diff --git a/usr/src/uts/sun4u/opl/io/mc-opl.c b/usr/src/uts/sun4u/opl/io/mc-opl.c index a6b194fc9a..e76abf21a3 100644 --- a/usr/src/uts/sun4u/opl/io/mc-opl.c +++ b/usr/src/uts/sun4u/opl/io/mc-opl.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* @@ -2442,7 +2442,7 @@ mc_memlist_delete(struct memlist *mlist) struct memlist *ml; for (ml = mlist; ml; ml = mlist) { - mlist = ml->next; + mlist = ml->ml_next; kmem_free(ml, sizeof (struct memlist)); } } @@ -2457,13 +2457,13 @@ mc_memlist_dup(struct memlist *mlist) mlp = &hl; tl = *mlp; - for (; mlist; mlist = mlist->next) { + for (; mlist; mlist = mlist->ml_next) { *mlp = kmem_alloc(sizeof (struct memlist), KM_SLEEP); - (*mlp)->address = mlist->address; - (*mlp)->size = mlist->size; - (*mlp)->prev = tl; + (*mlp)->ml_address = mlist->ml_address; + (*mlp)->ml_size = mlist->ml_size; + (*mlp)->ml_prev = tl; tl = *mlp; - mlp = &((*mlp)->next); + mlp = &((*mlp)->ml_next); } *mlp = NULL; @@ -2481,27 +2481,27 @@ mc_memlist_del_span(struct memlist *mlist, uint64_t base, uint64_t len) return (NULL); end = base + len; - if ((end <= mlist->address) || (base == end)) + if ((end <= mlist->ml_address) || (base == end)) return (mlist); for (tl = ml = mlist; ml; tl = ml, ml = nlp) { uint64_t mend; - nlp = ml->next; + nlp = ml->ml_next; - if (end <= ml->address) + if (end <= ml->ml_address) break; - mend = ml->address + ml->size; + mend = ml->ml_address + ml->ml_size; if (base < mend) { - if (base <= ml->address) { - ml->address = end; + if (base <= ml->ml_address) { + ml->ml_address = end; if (end >= mend) - ml->size = 0ull; + ml->ml_size = 0ull; else - ml->size = mend - ml->address; + ml->ml_size = mend - ml->ml_address; } else { - ml->size = base - ml->address; + ml->ml_size = base - ml->ml_address; if (end < mend) { struct memlist *nl; /* @@ -2509,26 +2509,26 @@ mc_memlist_del_span(struct memlist *mlist, uint64_t base, uint64_t len) */ nl = kmem_alloc(sizeof (struct memlist), KM_SLEEP); - nl->address = end; - nl->size = mend - nl->address; - if ((nl->next = nlp) != NULL) - nlp->prev = nl; - nl->prev = ml; - ml->next = nl; + nl->ml_address = end; + nl->ml_size = mend - nl->ml_address; + if ((nl->ml_next = nlp) != NULL) + nlp->ml_prev = nl; + nl->ml_prev = ml; + ml->ml_next = nl; nlp = nl; } } - if (ml->size == 0ull) { + if (ml->ml_size == 0ull) { if (ml == mlist) { if ((mlist = nlp) != NULL) - nlp->prev = NULL; + nlp->ml_prev = NULL; kmem_free(ml, sizeof (struct memlist)); if (mlist == NULL) break; ml = nlp; } else { - if ((tl->next = nlp) != NULL) - nlp->prev = tl; + if ((tl->ml_next = nlp) != NULL) + nlp->ml_prev = tl; kmem_free(ml, sizeof (struct memlist)); ml = tl; } diff --git a/usr/src/uts/sun4u/opl/os/opl.c b/usr/src/uts/sun4u/opl/os/opl.c index a8880ac679..26727cbd8d 100644 --- a/usr/src/uts/sun4u/opl/os/opl.c +++ b/usr/src/uts/sun4u/opl/os/opl.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -329,20 +329,20 @@ opl_memlist_per_board(struct memlist *ml) head = tail = NULL; - for (; ml; ml = ml->next) { - low = (uint64_t)ml->address; - high = low+(uint64_t)(ml->size); + for (; ml; ml = ml->ml_next) { + low = (uint64_t)ml->ml_address; + high = low+(uint64_t)(ml->ml_size); while (low < high) { boundary = roundup(low+1, ssize); boundary = MIN(high, boundary); new = kmem_zalloc(sizeof (struct memlist), KM_SLEEP); - new->address = low; - new->size = boundary - low; + new->ml_address = low; + new->ml_size = boundary - low; if (head == NULL) head = new; if (tail) { - tail->next = new; - new->prev = tail; + tail->ml_next = new; + new->ml_prev = tail; } tail = new; low = boundary; @@ -377,7 +377,7 @@ set_platform_cage_params(void) /* free the memlist */ do { - tml = ml->next; + tml = ml->ml_next; kmem_free(ml, sizeof (struct memlist)); ml = tml; } while (ml != NULL); diff --git a/usr/src/uts/sun4u/os/cpr_impl.c b/usr/src/uts/sun4u/os/cpr_impl.c index bbf1051c1d..672d761c9a 100644 --- a/usr/src/uts/sun4u/os/cpr_impl.c +++ b/usr/src/uts/sun4u/os/cpr_impl.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -1518,9 +1518,9 @@ i_cpr_find_ppages(void) */ pcnt = 0; memlist_read_lock(); - for (pmem = phys_install; pmem; pmem = pmem->next) { - npages = mmu_btop(pmem->size); - ppn = mmu_btop(pmem->address); + for (pmem = phys_install; pmem; pmem = pmem->ml_next) { + npages = mmu_btop(pmem->ml_size); + ppn = mmu_btop(pmem->ml_address); for (plast = ppn + npages; ppn < plast; ppn++) { if (page_numtopp_nolock(ppn)) continue; @@ -1574,9 +1574,9 @@ i_cpr_find_ppages(void) */ dst = pphys_list; memlist_read_lock(); - for (pmem = phys_install; pmem; pmem = pmem->next) { - npages = mmu_btop(pmem->size); - ppn = mmu_btop(pmem->address); + for (pmem = phys_install; pmem; pmem = pmem->ml_next) { + npages = mmu_btop(pmem->ml_size); + ppn = mmu_btop(pmem->ml_address); for (plast = ppn + npages; ppn < plast; ppn++) { if (cpr_isset(ppn, mapflag)) { ASSERT(dst < (pphys_list + ppage_count)); @@ -1851,7 +1851,7 @@ i_cpr_bitmap_setup(void) * phys_install ranges plus 1 for a trailing NULL struct. */ cpr_nbitmaps = 1; - for (pmem = phys_install; pmem; pmem = pmem->next) + for (pmem = phys_install; pmem; pmem = pmem->ml_next) cpr_nbitmaps++; if (cpr_nbitmaps > (CPR_MAX_BMDESC - 1)) { @@ -1869,15 +1869,15 @@ i_cpr_bitmap_setup(void) tail = dp + cpr_nbitmaps; CPR->c_bmda = dp; - for (pmem = phys_install; pmem; pmem = pmem->next) { - size = BITMAP_BYTES(pmem->size); + for (pmem = phys_install; pmem; pmem = pmem->ml_next) { + size = BITMAP_BYTES(pmem->ml_size); space = kmem_zalloc(size * 2, KM_NOSLEEP); if (space == NULL) return (ENOMEM); ASSERT(dp < tail); dp->cbd_magic = CPR_BITMAP_MAGIC; - dp->cbd_spfn = mmu_btop(pmem->address); - dp->cbd_epfn = mmu_btop(pmem->address + pmem->size) - 1; + dp->cbd_spfn = mmu_btop(pmem->ml_address); + dp->cbd_epfn = mmu_btop(pmem->ml_address + pmem->ml_size) - 1; dp->cbd_size = size; dp->cbd_reg_bitmap = (cpr_ptr)space; dp->cbd_vlt_bitmap = (cpr_ptr)((caddr_t)space + size); diff --git a/usr/src/uts/sun4u/os/mach_startup.c b/usr/src/uts/sun4u/os/mach_startup.c index 0f06f57909..3846772c8f 100644 --- a/usr/src/uts/sun4u/os/mach_startup.c +++ b/usr/src/uts/sun4u/os/mach_startup.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -525,9 +525,9 @@ ecache_flush_address(void) uint64_t ret_val; flush_size = ecache_size * 2; - for (pmem = phys_install; pmem; pmem = pmem->next) { - ret_val = P2ROUNDUP(pmem->address, ecache_size); - if (ret_val + flush_size <= pmem->address + pmem->size) + for (pmem = phys_install; pmem; pmem = pmem->ml_next) { + ret_val = P2ROUNDUP(pmem->ml_address, ecache_size); + if (ret_val + flush_size <= pmem->ml_address + pmem->ml_size) return (ret_val); } return ((uint64_t)-1); diff --git a/usr/src/uts/sun4u/os/memscrub.c b/usr/src/uts/sun4u/os/memscrub.c index 046158f359..960b987161 100644 --- a/usr/src/uts/sun4u/os/memscrub.c +++ b/usr/src/uts/sun4u/os/memscrub.c @@ -19,12 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * sun4u Memory Scrubbing * @@ -318,10 +316,10 @@ memscrub_init(void) /* * copy phys_install to memscrub_memlist */ - for (src = phys_install; src; src = src->next) { + for (src = phys_install; src; src = src->ml_next) { if (memscrub_add_span( - (pfn_t)(src->address >> PAGESHIFT), - (pgcnt_t)(src->size >> PAGESHIFT))) { + (pfn_t)(src->ml_address >> PAGESHIFT), + (pgcnt_t)(src->ml_size >> PAGESHIFT))) { memscrub_cleanup(); return (-1); } @@ -331,9 +329,9 @@ memscrub_init(void) * initialize kstats */ memscrub_ksp = kstat_create("unix", 0, "memscrub_kstat", - "misc", KSTAT_TYPE_NAMED, - sizeof (memscrub_counts) / sizeof (kstat_named_t), - KSTAT_FLAG_VIRTUAL | KSTAT_FLAG_WRITABLE); + "misc", KSTAT_TYPE_NAMED, + sizeof (memscrub_counts) / sizeof (kstat_named_t), + KSTAT_FLAG_VIRTUAL | KSTAT_FLAG_WRITABLE); if (memscrub_ksp) { memscrub_ksp->ks_data = (void *)&memscrub_counts; @@ -366,8 +364,8 @@ memscrub_cleanup(void) memscrub_uninit_mem_config(); while (memscrub_memlist) { (void) memscrub_delete_span( - (pfn_t)(memscrub_memlist->address >> PAGESHIFT), - (pgcnt_t)(memscrub_memlist->size >> PAGESHIFT)); + (pfn_t)(memscrub_memlist->ml_address >> PAGESHIFT), + (pgcnt_t)(memscrub_memlist->ml_size >> PAGESHIFT)); } if (memscrub_ksp) kstat_delete(memscrub_ksp); @@ -383,9 +381,9 @@ memscrub_printmemlist(char *title, struct memlist *listp) cmn_err(CE_CONT, "%s:\n", title); - for (list = listp; list; list = list->next) { + for (list = listp; list; list = list->ml_next) { cmn_err(CE_CONT, "addr = 0x%llx, size = 0x%llx\n", - list->address, list->size); + list->ml_address, list->ml_size); } } #endif /* MEMSCRUB_DEBUG */ @@ -478,7 +476,7 @@ memscrubber(void) goto memscrub_exit; } - address = memscrub_memlist->address; + address = memscrub_memlist->ml_address; deadline = gethrestime_sec() + memscrub_delay_start_sec; @@ -525,7 +523,7 @@ memscrubber(void) if (now >= deadline) { memscrub_counts.done_late.value.ui32++; memscrub_counts.late_sec.value.ui32 += - (now - deadline); + (now - deadline); /* * past deadline, start right away */ @@ -540,7 +538,7 @@ memscrubber(void) interval_ticks = (deadline - now) * hz; memscrub_counts.done_early.value.ui32++; memscrub_counts.early_sec.value.ui32 += - (deadline - now); + (deadline - now); deadline += memscrub_period_sec; } reached_end = 0; @@ -597,7 +595,7 @@ memscrubber(void) cmn_err(CE_NOTE, "Memory scrubber " "reading all memory per request"); - addr = memscrub_memlist->address; + addr = memscrub_memlist->ml_address; reached_end = 0; while (!reached_end) { if (disable_memscrub) @@ -672,18 +670,18 @@ memscrub_verify_span(ms_paddr_t *addrp, pgcnt_t *pagesp) * find memlist struct that contains addrp * assumes memlist is sorted by ascending address. */ - for (mlp = memscrub_memlist; mlp != NULL; mlp = mlp->next) { + for (mlp = memscrub_memlist; mlp != NULL; mlp = mlp->ml_next) { /* * if before this chunk, round up to beginning */ - if (address < mlp->address) { - address = mlp->address; + if (address < mlp->ml_address) { + address = mlp->ml_address; break; } /* * if before end of chunk, then we found it */ - if (address < (mlp->address + mlp->size)) + if (address < (mlp->ml_address + mlp->ml_size)) break; /* else go to next struct memlist */ @@ -693,13 +691,13 @@ memscrub_verify_span(ms_paddr_t *addrp, pgcnt_t *pagesp) */ if (mlp == NULL) { mlp = memscrub_memlist; - address = mlp->address; + address = mlp->ml_address; } /* * now we have legal address, and its mlp, condition bytes */ - bytes_remaining = (mlp->address + mlp->size) - address; + bytes_remaining = (mlp->ml_address + mlp->ml_size) - address; if (bytes > bytes_remaining) bytes = bytes_remaining; @@ -707,8 +705,8 @@ memscrub_verify_span(ms_paddr_t *addrp, pgcnt_t *pagesp) /* * will this span take us to end of list? */ - if ((mlp->next == NULL) && - ((mlp->address + mlp->size) == (address + bytes))) + if ((mlp->ml_next == NULL) && + ((mlp->ml_address + mlp->ml_size) == (address + bytes))) reached_end = 1; /* return values */ @@ -779,15 +777,15 @@ memscrub_add_span_gen( goto add_done; } - dst->address = address; - dst->size = bytes; + dst->ml_address = address; + dst->ml_size = bytes; /* * first insert */ if (*list == NULL) { - dst->prev = NULL; - dst->next = NULL; + dst->ml_prev = NULL; + dst->ml_next = NULL; *list = dst; goto add_done; @@ -798,8 +796,8 @@ memscrub_add_span_gen( */ for (prev = NULL, next = *list; next != NULL; - prev = next, next = next->next) { - if (address > (next->address + next->size)) + prev = next, next = next->ml_next) { + if (address > (next->ml_address + next->ml_size)) continue; /* @@ -809,11 +807,11 @@ memscrub_add_span_gen( /* * prepend to next */ - if ((address + bytes) == next->address) { + if ((address + bytes) == next->ml_address) { kmem_free(dst, sizeof (struct memlist)); - next->address = address; - next->size += bytes; + next->ml_address = address; + next->ml_size += bytes; goto add_done; } @@ -821,47 +819,49 @@ memscrub_add_span_gen( /* * append to next */ - if (address == (next->address + next->size)) { + if (address == (next->ml_address + next->ml_size)) { kmem_free(dst, sizeof (struct memlist)); - if (next->next) { + if (next->ml_next) { /* - * don't overlap with next->next + * don't overlap with next->ml_next */ - if ((address + bytes) > next->next->address) { + if ((address + bytes) > + next->ml_next->ml_address) { retval = -1; goto add_done; } /* - * concatenate next and next->next + * concatenate next and next->ml_next */ - if ((address + bytes) == next->next->address) { - struct memlist *mlp = next->next; + if ((address + bytes) == + next->ml_next->ml_address) { + struct memlist *mlp = next->ml_next; if (next == *list) - *list = next->next; + *list = next->ml_next; - mlp->address = next->address; - mlp->size += next->size; - mlp->size += bytes; + mlp->ml_address = next->ml_address; + mlp->ml_size += next->ml_size; + mlp->ml_size += bytes; - if (next->prev) - next->prev->next = mlp; - mlp->prev = next->prev; + if (next->ml_prev) + next->ml_prev->ml_next = mlp; + mlp->ml_prev = next->ml_prev; kmem_free(next, - sizeof (struct memlist)); + sizeof (struct memlist)); goto add_done; } } - next->size += bytes; + next->ml_size += bytes; goto add_done; } /* don't overlap with next */ - if ((address + bytes) > next->address) { + if ((address + bytes) > next->ml_address) { retval = -1; kmem_free(dst, sizeof (struct memlist)); goto add_done; @@ -870,13 +870,13 @@ memscrub_add_span_gen( /* * insert before next */ - dst->prev = prev; - dst->next = next; - next->prev = dst; + dst->ml_prev = prev; + dst->ml_next = next; + next->ml_prev = dst; if (prev == NULL) { *list = dst; } else { - prev->next = dst; + prev->ml_next = dst; } goto add_done; } /* end for */ @@ -884,9 +884,9 @@ memscrub_add_span_gen( /* * end of list, prev is valid and next is NULL */ - prev->next = dst; - dst->prev = prev; - dst->next = NULL; + prev->ml_next = dst; + dst->ml_prev = prev; + dst->ml_next = NULL; add_done: @@ -920,9 +920,9 @@ memscrub_delete_span(pfn_t pfn, pgcnt_t pages) /* * find struct memlist containing page */ - for (next = memscrub_memlist; next != NULL; next = next->next) { - if ((address >= next->address) && - (address < next->address + next->size)) + for (next = memscrub_memlist; next != NULL; next = next->ml_next) { + if ((address >= next->ml_address) && + (address < next->ml_address + next->ml_size)) break; } @@ -937,7 +937,7 @@ memscrub_delete_span(pfn_t pfn, pgcnt_t pages) /* * error if size goes off end of this struct memlist */ - if (address + bytes > next->address + next->size) { + if (address + bytes > next->ml_address + next->ml_size) { retval = -1; goto delete_done; } @@ -945,25 +945,25 @@ memscrub_delete_span(pfn_t pfn, pgcnt_t pages) /* * pages at beginning of struct memlist */ - if (address == next->address) { + if (address == next->ml_address) { /* * if start & size match, delete from list */ - if (bytes == next->size) { + if (bytes == next->ml_size) { if (next == memscrub_memlist) - memscrub_memlist = next->next; - if (next->prev != NULL) - next->prev->next = next->next; - if (next->next != NULL) - next->next->prev = next->prev; + memscrub_memlist = next->ml_next; + if (next->ml_prev != NULL) + next->ml_prev->ml_next = next->ml_next; + if (next->ml_next != NULL) + next->ml_next->ml_prev = next->ml_prev; kmem_free(next, sizeof (struct memlist)); } else { /* * increment start address by bytes */ - next->address += bytes; - next->size -= bytes; + next->ml_address += bytes; + next->ml_size -= bytes; } goto delete_done; } @@ -971,11 +971,11 @@ memscrub_delete_span(pfn_t pfn, pgcnt_t pages) /* * pages at end of struct memlist */ - if (address + bytes == next->address + next->size) { + if (address + bytes == next->ml_address + next->ml_size) { /* * decrement size by bytes */ - next->size -= bytes; + next->ml_size -= bytes; goto delete_done; } @@ -998,9 +998,10 @@ memscrub_delete_span(pfn_t pfn, pgcnt_t pages) * existing struct memlist gets address * and size up to pfn */ - dst->address = address + bytes; - dst->size = (next->address + next->size) - dst->address; - next->size = address - next->address; + dst->ml_address = address + bytes; + dst->ml_size = + (next->ml_address + next->ml_size) - dst->ml_address; + next->ml_size = address - next->ml_address; /* * new struct memlist gets address starting @@ -1010,12 +1011,12 @@ memscrub_delete_span(pfn_t pfn, pgcnt_t pages) /* * link in new memlist after old */ - dst->next = next->next; - dst->prev = next; + dst->ml_next = next->ml_next; + dst->ml_prev = next; - if (next->next != NULL) - next->next->prev = dst; - next->next = dst; + if (next->ml_next != NULL) + next->ml_next->ml_prev = dst; + next->ml_next = dst; } delete_done: @@ -1066,15 +1067,15 @@ memscrub_scan(uint_t blks, ms_paddr_t src) while (blks != 0) { /* Ensure the PA is properly aligned */ if (((pa & MMU_PAGEMASK4M) == pa) && - (blks >= MEMSCRUB_BPP4M)) { + (blks >= MEMSCRUB_BPP4M)) { psz = MMU_PAGESIZE4M; bpp = MEMSCRUB_BPP4M; } else if (((pa & MMU_PAGEMASK512K) == pa) && - (blks >= MEMSCRUB_BPP512K)) { + (blks >= MEMSCRUB_BPP512K)) { psz = MMU_PAGESIZE512K; bpp = MEMSCRUB_BPP512K; } else if (((pa & MMU_PAGEMASK64K) == pa) && - (blks >= MEMSCRUB_BPP64K)) { + (blks >= MEMSCRUB_BPP64K)) { psz = MMU_PAGESIZE64K; bpp = MEMSCRUB_BPP64K; } else if ((pa & MMU_PAGEMASK) == pa) { @@ -1104,7 +1105,7 @@ memscrub_scan(uint_t blks, ms_paddr_t src) pfn = mmu_btop(pa); va = (caddr_t)MEMSCRUBBASE; hat_devload(kas.a_hat, va, psz, pfn, PROT_READ, - HAT_LOAD_NOCONSIST | HAT_LOAD_LOCK); + HAT_LOAD_NOCONSIST | HAT_LOAD_LOCK); /* * Can't allow the memscrubber to migrate across CPUs as @@ -1342,15 +1343,15 @@ new_memscrub(int update_page_retire_list) list = NULL; npgs = 0; memlist_read_lock(); - for (src = phys_install; src; src = src->next) { - if (memscrub_add_span_gen((pfn_t)(src->address >> PAGESHIFT), - (pgcnt_t)(src->size >> PAGESHIFT), &list, &npgs)) { + for (src = phys_install; src; src = src->ml_next) { + if (memscrub_add_span_gen((pfn_t)(src->ml_address >> PAGESHIFT), + (pgcnt_t)(src->ml_size >> PAGESHIFT), &list, &npgs)) { memlist_read_unlock(); while (list) { struct memlist *el; el = list; - list = list->next; + list = list->ml_next; kmem_free(el, sizeof (struct memlist)); } return (-1); @@ -1372,7 +1373,7 @@ new_memscrub(int update_page_retire_list) struct memlist *el; el = old_list; - old_list = old_list->next; + old_list = old_list->ml_next; kmem_free(el, sizeof (struct memlist)); } diff --git a/usr/src/uts/sun4u/serengeti/io/sbdp_mem.c b/usr/src/uts/sun4u/serengeti/io/sbdp_mem.c index 919fe0d42f..6bc66e2e89 100644 --- a/usr/src/uts/sun4u/serengeti/io/sbdp_mem.c +++ b/usr/src/uts/sun4u/serengeti/io/sbdp_mem.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -117,9 +117,9 @@ sbdp_memlist_dump(struct memlist *mlist) if (mlist == NULL) { SBDP_DBG_MEM("memlist> EMPTY\n"); } else { - for (ml = mlist; ml; ml = ml->next) + for (ml = mlist; ml; ml = ml->ml_next) SBDP_DBG_MEM("memlist> 0x%" PRIx64", 0x%" PRIx64"\n", - ml->address, ml->size); + ml->ml_address, ml->ml_size); } } @@ -227,7 +227,7 @@ sbdp_memlist_dup(struct memlist *mlist) prev = NULL; hl = NULL; - for (; mlist; mlist = mlist->next) { + for (; mlist; mlist = mlist->ml_next) { struct memlist *mp; mp = memlist_get_one(); @@ -237,15 +237,15 @@ sbdp_memlist_dup(struct memlist *mlist) hl = NULL; break; } - mp->address = mlist->address; - mp->size = mlist->size; - mp->next = NULL; - mp->prev = prev; + mp->ml_address = mlist->ml_address; + mp->ml_size = mlist->ml_size; + mp->ml_next = NULL; + mp->ml_prev = prev; if (prev == NULL) hl = mp; else - prev->next = mp; + prev->ml_next = mp; prev = mp; } @@ -1092,13 +1092,13 @@ sbdp_copy_rename__relocatable(sbdp_cr_handle_t *hp, struct memlist *mlist, /* * DO COPY. */ - for (ml = mlist; ml; ml = ml->next) { + for (ml = mlist; ml; ml = ml->ml_next) { uint64_t s_pa, t_pa; uint64_t nbytes; - s_pa = ml->address; - t_pa = t_base + (ml->address - s_base); - nbytes = ml->size; + s_pa = ml->ml_address; + t_pa = t_base + (ml->ml_address - s_base); + nbytes = ml->ml_size; size += nbytes; while (nbytes != 0ull) { @@ -1652,8 +1652,8 @@ sbdp_get_mem_size(sbdp_handle_t *hp) mlist = sbdp_get_memlist(hp, (dev_info_t *)NULL); - for (ml = mlist; ml; ml = ml->next) - size += ml->size; + for (ml = mlist; ml; ml = ml->ml_next) + size += ml->ml_size; (void) sbdp_del_memlist(hp, mlist); @@ -2086,11 +2086,11 @@ sbdp_passthru_readmem(sbdp_handle_t *hp, void *arg) dst_pa = va_to_pa(&dst); memlist_read_lock(); - for (ml = phys_install; ml; ml = ml->next) { + for (ml = phys_install; ml; ml = ml->ml_next) { uint64_t nbytes; - src_pa = ml->address; - nbytes = ml->size; + src_pa = ml->ml_address; + nbytes = ml->ml_size; while (nbytes != 0ull) { diff --git a/usr/src/uts/sun4u/starcat/io/drmach.c b/usr/src/uts/sun4u/starcat/io/drmach.c index 002ebfcd3f..7928fbbf31 100644 --- a/usr/src/uts/sun4u/starcat/io/drmach.c +++ b/usr/src/uts/sun4u/starcat/io/drmach.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -3289,17 +3289,18 @@ drmach_copy_rename_init(drmachid_t t_id, uint64_t t_slice_offset, off_mask = DRMACH_MEM_SLICE_SIZE - 1; /* calculate source and target base pa */ - s_copybasepa = c_ml->address; - t_copybasepa = t_basepa + ((c_ml->address & off_mask) - t_slice_offset); + s_copybasepa = c_ml->ml_address; + t_copybasepa = + t_basepa + ((c_ml->ml_address & off_mask) - t_slice_offset); /* paranoia */ - ASSERT((c_ml->address & off_mask) >= t_slice_offset); + ASSERT((c_ml->ml_address & off_mask) >= t_slice_offset); /* adjust copy memlist addresses to be relative to copy base pa */ x_ml = c_ml; while (x_ml != NULL) { - x_ml->address -= s_copybasepa; - x_ml = x_ml->next; + x_ml->ml_address -= s_copybasepa; + x_ml = x_ml->ml_next; } #ifdef DEBUG @@ -3307,16 +3308,16 @@ drmach_copy_rename_init(drmachid_t t_id, uint64_t t_slice_offset, uint64_t s_basepa, s_size, t_size; x_ml = c_ml; - while (x_ml->next != NULL) - x_ml = x_ml->next; + while (x_ml->ml_next != NULL) + x_ml = x_ml->ml_next; DRMACH_PR("source copy span: base pa 0x%lx, end pa 0x%lx\n", s_copybasepa, - s_copybasepa + x_ml->address + x_ml->size); + s_copybasepa + x_ml->ml_address + x_ml->ml_size); DRMACH_PR("target copy span: base pa 0x%lx, end pa 0x%lx\n", t_copybasepa, - t_copybasepa + x_ml->address + x_ml->size); + t_copybasepa + x_ml->ml_address + x_ml->ml_size); DRMACH_PR("copy memlist (relative to copy base pa):\n"); DRMACH_MEMLIST_DUMP(c_ml); @@ -3612,13 +3613,13 @@ drmach_copy_rename(drmachid_t id) /* * DO COPY. */ - for (ml = cr->c_ml; ml; ml = ml->next) { + for (ml = cr->c_ml; ml; ml = ml->ml_next) { uint64_t s_pa, t_pa; uint64_t nbytes; - s_pa = cr->s_copybasepa + ml->address; - t_pa = cr->t_copybasepa + ml->address; - nbytes = ml->size; + s_pa = cr->s_copybasepa + ml->ml_address; + t_pa = cr->t_copybasepa + ml->ml_address; + nbytes = ml->ml_size; while (nbytes != 0ull) { /* copy 32 bytes at src_pa to dst_pa */ @@ -6785,8 +6786,8 @@ drmach_mem_status(drmachid_t id, drmach_status_t *stat) /* stop at first span that is in slice */ memlist_read_lock(); - for (ml = phys_install; ml; ml = ml->next) - if (ml->address >= pa && ml->address < pa + slice_size) + for (ml = phys_install; ml; ml = ml->ml_next) + if (ml->ml_address >= pa && ml->ml_address < pa + slice_size) break; memlist_read_unlock(); @@ -6913,11 +6914,11 @@ drmach_pt_readmem(drmachid_t id, drmach_opts_t *opts) dst_pa = va_to_pa(&dst); memlist_read_lock(); - for (ml = phys_install; ml; ml = ml->next) { + for (ml = phys_install; ml; ml = ml->ml_next) { uint64_t nbytes; - src_pa = ml->address; - nbytes = ml->size; + src_pa = ml->ml_address; + nbytes = ml->ml_size; while (nbytes != 0ull) { diff --git a/usr/src/uts/sun4u/starfire/io/drmach.c b/usr/src/uts/sun4u/starfire/io/drmach.c index 86dba92176..c7bdd5ae99 100644 --- a/usr/src/uts/sun4u/starfire/io/drmach.c +++ b/usr/src/uts/sun4u/starfire/io/drmach.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -696,8 +696,8 @@ drmach_device_new(drmach_node_t *node, if (rv) { /* every node is expected to have a name */ err = drerr_new(1, ESTF_GETPROP, - "PROM Node 0x%x: property %s", - (uint_t)node->get_dnode(node), OBP_NAME); + "PROM Node 0x%x: property %s", + (uint_t)node->get_dnode(node), OBP_NAME); return (err); } @@ -761,8 +761,8 @@ drmach_device_get_prop(drmach_device_t *dp, char *name, void *buf) rv = drmach_node_get_prop(dp->node, name, buf); if (rv) { err = drerr_new(1, ESTF_GETPROP, - "%s::%s: property %s", - dp->bp->cm.name, dp->cm.name, name); + "%s::%s: property %s", + dp->bp->cm.name, dp->cm.name, name); } return (err); @@ -777,8 +777,8 @@ drmach_device_get_proplen(drmach_device_t *dp, char *name, int *len) rv = drmach_node_get_proplen(dp->node, name, len); if (rv) { err = drerr_new(1, ESTF_GETPROPLEN, - "%s::%s: property %s", - dp->bp->cm.name, dp->cm.name, name); + "%s::%s: property %s", + dp->bp->cm.name, dp->cm.name, name); } return (err); @@ -953,12 +953,12 @@ drmach_init(void) if (drmach_array_get(drmach_boards, bnum, &id) == -1) { cmn_err(CE_WARN, "OBP node 0x%x has" - " invalid property value, %s=%d", - nodeid, OBP_BOARDNUM, bnum); + " invalid property value, %s=%d", + nodeid, OBP_BOARDNUM, bnum); /* clean up */ drmach_array_dispose( - drmach_boards, drmach_board_dispose); + drmach_boards, drmach_board_dispose); mutex_exit(&drmach_i_lock); return (-1); @@ -1208,7 +1208,7 @@ drmach_prep_rename_script(drmach_device_t *s_mem, drmach_device_t *t_mem, return (err); else if (s_masr & STARFIRE_MC_INTERLEAVE_MASK) { return (drerr_new(1, ESTF_INTERBOARD, "%s::%s", - s_mem->bp->cm.name, s_mem->cm.name)); + s_mem->bp->cm.name, s_mem->cm.name)); } /* fetch target mc asr register value */ @@ -1217,7 +1217,7 @@ drmach_prep_rename_script(drmach_device_t *s_mem, drmach_device_t *t_mem, return (err); else if (t_masr & STARFIRE_MC_INTERLEAVE_MASK) { return (drerr_new(1, ESTF_INTERBOARD, "%s::%s", - t_mem->bp->cm.name, t_mem->cm.name)); + t_mem->bp->cm.name, t_mem->cm.name)); } /* get new source base pa from target's masr */ @@ -1395,15 +1395,15 @@ drmach_prep_rename_script(drmach_device_t *s_mem, drmach_device_t *t_mem, DRMACH_PR("mc idle register address list:"); isp = (drmach_mc_idle_script_t *)buf; DRMACH_PR("source mc idle addr 0x%lx, mem id %p", - isp[0].idle_addr, (void *)isp[0].mem); + isp[0].idle_addr, (void *)isp[0].mem); DRMACH_PR("target mc idle addr 0x%lx, mem id %p", - isp[1].idle_addr, (void *)isp[1].mem); + isp[1].idle_addr, (void *)isp[1].mem); ASSERT(isp[2].idle_addr == 0); DRMACH_PR("copy-rename script:"); for (j = 0; j < m; j++) { DRMACH_PR("0x%lx = 0x%08x", - rsp[j].masr_addr, rsp[j].masr); + rsp[j].masr_addr, rsp[j].masr); } DELAY(1000000); @@ -1468,13 +1468,13 @@ drmach_copy_rename_prog__relocatable(drmach_copy_rename_program_t *prog) /* * DO COPY. */ - for (ml = prog->c_ml; ml; ml = ml->next) { + for (ml = prog->c_ml; ml; ml = ml->ml_next) { uint64_t s_pa, t_pa; uint64_t nbytes; - s_pa = prog->s_copybasepa + ml->address; - t_pa = prog->t_copybasepa + ml->address; - nbytes = ml->size; + s_pa = prog->s_copybasepa + ml->ml_address; + t_pa = prog->t_copybasepa + ml->ml_address; + nbytes = ml->ml_size; while (nbytes != 0ull) { /* @@ -1520,7 +1520,7 @@ drmach_copy_rename_prog__relocatable(drmach_copy_rename_program_t *prog) /* loop t cycles waiting for each mc to indicate it's idle */ do { v = ldphysio_il(isp->idle_addr) - & STARFIRE_MC_IDLE_MASK; + & STARFIRE_MC_IDLE_MASK; } while (v != STARFIRE_MC_IDLE_MASK && t-- > 0); @@ -1592,17 +1592,18 @@ drmach_copy_rename_init(drmachid_t t_id, uint64_t t_slice_offset, off_mask = mc_get_mem_alignment() - 1; /* calculate source and target base pa */ - s_copybasepa = c_ml->address; - t_copybasepa = t_basepa + ((c_ml->address & off_mask) - t_slice_offset); + s_copybasepa = c_ml->ml_address; + t_copybasepa = + t_basepa + ((c_ml->ml_address & off_mask) - t_slice_offset); /* paranoia */ - ASSERT((c_ml->address & off_mask) >= t_slice_offset); + ASSERT((c_ml->ml_address & off_mask) >= t_slice_offset); /* adjust copy memlist addresses to be relative to copy base pa */ x_ml = c_ml; while (x_ml != NULL) { - x_ml->address -= s_copybasepa; - x_ml = x_ml->next; + x_ml->ml_address -= s_copybasepa; + x_ml = x_ml->ml_next; } #ifdef DEBUG @@ -1610,16 +1611,16 @@ drmach_copy_rename_init(drmachid_t t_id, uint64_t t_slice_offset, uint64_t s_basepa, s_size, t_size; x_ml = c_ml; - while (x_ml->next != NULL) - x_ml = x_ml->next; + while (x_ml->ml_next != NULL) + x_ml = x_ml->ml_next; DRMACH_PR("source copy span: base pa 0x%lx, end pa 0x%lx\n", - s_copybasepa, - s_copybasepa + x_ml->address + x_ml->size); + s_copybasepa, + s_copybasepa + x_ml->ml_address + x_ml->ml_size); DRMACH_PR("target copy span: base pa 0x%lx, end pa 0x%lx\n", - t_copybasepa, - t_copybasepa + x_ml->address + x_ml->size); + t_copybasepa, + t_copybasepa + x_ml->ml_address + x_ml->ml_size); DRMACH_PR("copy memlist (relative to copy base pa):\n"); MEMLIST_DUMP(c_ml); @@ -1634,12 +1635,14 @@ drmach_copy_rename_init(drmachid_t t_id, uint64_t t_slice_offset, ASSERT(err == NULL); DRMACH_PR("current source base pa 0x%lx, size 0x%lx\n", - s_basepa, s_size); + s_basepa, s_size); DRMACH_PR("current target base pa 0x%lx, size 0x%lx\n", - t_basepa, t_size); + t_basepa, t_size); - ASSERT(s_copybasepa + x_ml->address + x_ml->size <= s_basepa + s_size); - ASSERT(t_copybasepa + x_ml->address + x_ml->size <= t_basepa + t_size); + ASSERT(s_copybasepa + x_ml->ml_address + x_ml->ml_size <= + s_basepa + s_size); + ASSERT(t_copybasepa + x_ml->ml_address + x_ml->ml_size <= + t_basepa + t_size); } #endif @@ -1667,7 +1670,7 @@ drmach_copy_rename_init(drmachid_t t_id, uint64_t t_slice_offset, * pages. */ len = (int)((ulong_t)drmach_copy_rename_end - - (ulong_t)drmach_copy_rename_prog__relocatable); + (ulong_t)drmach_copy_rename_prog__relocatable); ASSERT(wp + len < bp + PAGESIZE); bcopy((caddr_t)drmach_copy_rename_prog__relocatable, wp, len); @@ -1681,7 +1684,7 @@ drmach_copy_rename_init(drmachid_t t_id, uint64_t t_slice_offset, * Allocate temporary buffer to hold script. */ err = drmach_prep_rename_script(s_mem, t_mem, t_slice_offset, - wp, PAGESIZE - (wp - bp)); + wp, PAGESIZE - (wp - bp)); if (err) { (void) drmach_copy_rename_fini(prog); return (err); @@ -1714,7 +1717,7 @@ drmach_copy_rename_fini(drmachid_t id) if (prog->restless_mc != 0) { cmn_err(CE_WARN, "MC did not idle; OBP Node 0x%x", - (uint_t)drmach_node_get_dnode(prog->restless_mc->node)); + (uint_t)drmach_node_get_dnode(prog->restless_mc->node)); err = DRMACH_INTERNAL_ERROR(); } @@ -1797,8 +1800,8 @@ drmach_iopc_op(pda_handle_t ph, drmach_iopc_op_t op) default: cmn_err(CE_PANIC, - "drmach_iopc_op: unknown op (%d)", - (int)op); + "drmach_iopc_op: unknown op (%d)", + (int)op); /*NOTREACHED*/ } stbphysio(idle_addr, value); @@ -2077,7 +2080,7 @@ drmach_board_connect(drmachid_t id, drmach_opts_t *opts) } cmn_err(CE_CONT, "DRMACH: PROM attach %s CPU %d\n", - obj->cm.name, obj->connect_cpuid); + obj->cm.name, obj->connect_cpuid); retval = prom_tree_update(drmach_attach_board, obj); @@ -2085,7 +2088,7 @@ drmach_board_connect(drmachid_t id, drmach_opts_t *opts) err = NULL; else { cmn_err(CE_WARN, "prom error: prom_starfire_add_brd(%d) " - "returned %d", obj->connect_cpuid, retval); + "returned %d", obj->connect_cpuid, retval); err = drerr_new(1, ESTF_PROBE, obj->cm.name); } @@ -2384,11 +2387,11 @@ drmach_cpu_obp_detach(int cpuid) * helper on a prior attach. */ if (CPU_SGN_EXISTS(cpuid) && - !SGN_CPU_IS_OS(cpuid) && - !SGN_CPU_IS_OBP(cpuid)) { + !SGN_CPU_IS_OS(cpuid) && + !SGN_CPU_IS_OBP(cpuid)) { cmn_err(CE_WARN, - "unexpected signature (0x%x) for cpu %d", - get_cpu_sgn(cpuid), cpuid); + "unexpected signature (0x%x) for cpu %d", + get_cpu_sgn(cpuid), cpuid); } /* @@ -2413,7 +2416,7 @@ static int drmach_cpu_obp_is_detached(int cpuid) { if (!CPU_SGN_EXISTS(cpuid) || - (SGN_CPU_IS_OS(cpuid) && SGN_CPU_STATE_IS_DETACHED(cpuid))) + (SGN_CPU_IS_OS(cpuid) && SGN_CPU_STATE_IS_DETACHED(cpuid))) return (1); else return (0); @@ -2455,10 +2458,10 @@ drmach_cpu_start(struct cpu *cp) } DRMACH_PR("waited %d out of %d loops for cpu %d\n", - drmach_cpu_ntries - ntries, drmach_cpu_ntries, cpuid); + drmach_cpu_ntries - ntries, drmach_cpu_ntries, cpuid); xt_one(cpuid, vtag_flushpage_tl1, - (uint64_t)drmach_shutdown_va, (uint64_t)ksfmmup); + (uint64_t)drmach_shutdown_va, (uint64_t)ksfmmup); return (0); } @@ -2519,22 +2522,22 @@ drmach_cpu_stop_self(void) drmach_shutdown_asm_mbox->estack = bbsram_addr + (uint64_t)funclen; tte.tte_inthi = TTE_VALID_INT | TTE_SZ_INT(TTE8K) | - TTE_PFN_INTHI(bbsram_pfn); + TTE_PFN_INTHI(bbsram_pfn); tte.tte_intlo = TTE_PFN_INTLO(bbsram_pfn) | - TTE_HWWR_INT | TTE_PRIV_INT | TTE_LCK_INT; + TTE_HWWR_INT | TTE_PRIV_INT | TTE_LCK_INT; sfmmu_dtlb_ld_kva(drmach_shutdown_va, &tte); /* load dtlb */ sfmmu_itlb_ld_kva(drmach_shutdown_va, &tte); /* load itlb */ for (src = (uint_t *)drmach_shutdown_asm, dst = (uint_t *)bbsram_addr; - src < (uint_t *)drmach_shutdown_asm_end; src++, dst++) + src < (uint_t *)drmach_shutdown_asm_end; src++, dst++) *dst = *src; bbsram_func = (void (*)())bbsram_addr; drmach_shutdown_asm_mbox->flushaddr = ecache_flushaddr; drmach_shutdown_asm_mbox->size = (cpunodes[cpuid].ecache_size << 1); drmach_shutdown_asm_mbox->linesize = cpunodes[cpuid].ecache_linesize; - drmach_shutdown_asm_mbox->physaddr - = va_to_pa((void *)&drmach_xt_mb[cpuid]); + drmach_shutdown_asm_mbox->physaddr = + va_to_pa((void *)&drmach_xt_mb[cpuid]); /* * Signal to drmach_cpu_poweroff() is via drmach_xt_mb cleared @@ -2611,14 +2614,14 @@ drmach_cpu_juggle_bootproc(drmach_device_t *dst_cpu) if ((cp = cpu_get(cpuid)) == NULL) { err = drerr_new(1, ESTF_NODEV, "%s::%s", - dst_cpu->bp->cm.name, dst_cpu->cm.name); + dst_cpu->bp->cm.name, dst_cpu->cm.name); return (err); } if (cpuid == SIGBCPU->cpu_id) { cmn_err(CE_WARN, - "SIGBCPU(%d) same as new selection(%d)", - SIGBCPU->cpu_id, cpuid); + "SIGBCPU(%d) same as new selection(%d)", + SIGBCPU->cpu_id, cpuid); /* technically not an error, but a no-op */ return (NULL); @@ -2626,7 +2629,7 @@ drmach_cpu_juggle_bootproc(drmach_device_t *dst_cpu) } cmn_err(CE_NOTE, "?relocating SIGBCPU from %d to %d", - SIGBCPU->cpu_id, cpuid); + SIGBCPU->cpu_id, cpuid); DRMACH_PR("moving SIGBCPU to CPU %d\n", cpuid); @@ -2654,7 +2657,7 @@ drmach_cpu_juggle_bootproc(drmach_device_t *dst_cpu) return (NULL); } else { DRMACH_PR("prom error: prom_starfire_move_cpu0(%d) " - "returned %d\n", cpuid, rv); + "returned %d\n", cpuid, rv); /* * The move failed, hopefully obp_helper is still back @@ -2733,7 +2736,7 @@ drmach_cpu_disconnect(drmachid_t id) if (SIGBCPU->cpu_id == cpuid) { /* this cpu is SIGBCPU, can't disconnect */ return (drerr_new(1, ESTF_HASSIGB, "%s::%s", - cpu->bp->cm.name, cpu->cm.name)); + cpu->bp->cm.name, cpu->cm.name)); } /* @@ -2747,7 +2750,7 @@ drmach_cpu_disconnect(drmachid_t id) } if (!drmach_cpu_obp_is_detached(cpuid)) { cmn_err(CE_WARN, "failed to mark cpu %d detached in sigblock", - cpuid); + cpuid); } /* map out signature block */ @@ -2763,7 +2766,7 @@ drmach_cpu_disconnect(drmachid_t id) pc_addr = STARFIRE_BB_PC_ADDR(cpu->bp->bnum, cpu->unum, 0); DRMACH_PR("PC idle cpu %d (addr = 0x%llx, port = %d, p = %d)", - drmach_cpu_calc_id(cpu), pc_addr, cpu->unum, p); + drmach_cpu_calc_id(cpu), pc_addr, cpu->unum, p); rvalue = ldbphysio(pc_addr); rvalue |= STARFIRE_BB_PC_IDLE(p); @@ -2956,13 +2959,13 @@ drmach_mem_add_span(drmachid_t id, uint64_t basepa, uint64_t size) rv = kcage_range_add(basepfn, npages, KCAGE_DOWN); if (rv == ENOMEM) { cmn_err(CE_WARN, "%lu megabytes not available to kernel cage", - (ulong_t)(size == 0 ? 0 : size / MBYTE)); + (ulong_t)(size == 0 ? 0 : size / MBYTE)); } else if (rv != 0) { /* catch this in debug kernels */ ASSERT(0); cmn_err(CE_WARN, "unexpected kcage_range_add" - " return value %d", rv); + " return value %d", rv); } /* @@ -2994,7 +2997,7 @@ drmach_mem_del_span(drmachid_t id, uint64_t basepa, uint64_t size) return (err); else if (mcreg & STARFIRE_MC_INTERLEAVE_MASK) { return (drerr_new(1, ESTF_INTERBOARD, "%s::%s", - mem->bp->cm.name, mem->cm.name)); + mem->bp->cm.name, mem->cm.name)); } if (size > 0) { @@ -3231,7 +3234,7 @@ drmach_mem_get_memlist(drmachid_t id, struct memlist **ml) if (rv) { #ifdef DEBUG DRMACH_PR("OBP derived memlist intersects" - " with phys_install\n"); + " with phys_install\n"); memlist_dump(mlist); DRMACH_PR("phys_install memlist:\n"); @@ -3374,8 +3377,8 @@ drmach_mem_status(drmachid_t id, drmach_status_t *stat) /* stop at first span that is in slice */ memlist_read_lock(); - for (ml = phys_install; ml; ml = ml->next) - if (ml->address >= pa && ml->address < pa + slice_size) + for (ml = phys_install; ml; ml = ml->ml_next) + if (ml->ml_address >= pa && ml->ml_address < pa + slice_size) break; memlist_read_unlock(); @@ -3424,7 +3427,7 @@ drmach_board_deprobe(drmachid_t id) return (NULL); else { cmn_err(CE_WARN, "prom error: prom_starfire_rm_brd(%d) " - "returned %d", bp->bnum, retval); + "returned %d", bp->bnum, retval); return (drerr_new(1, ESTF_DEPROBE, "%s", bp->cm.name)); } } @@ -3479,8 +3482,8 @@ drmach_pt_dump_pdainfo(drmachid_t id, drmach_opts_t *opts) bdesc = (board_desc_t *)pda_get_board_info(ph, board); if (bdesc == NULL) { cmn_err(CE_CONT, - "no board descriptor found for board %d\n", - board); + "no board descriptor found for board %d\n", + board); pda_close(ph); return (DRMACH_INTERNAL_ERROR()); } @@ -3491,19 +3494,19 @@ drmach_pt_dump_pdainfo(drmachid_t id, drmach_opts_t *opts) for (i = 0; i < MAX_PROCMODS; i++) { if (BDA_NBL(bdesc->bda_proc, i) == BDAN_GOOD) cmn_err(CE_CONT, - "proc %d.%d PRESENT\n", board, i); + "proc %d.%d PRESENT\n", board, i); else cmn_err(CE_CONT, - "proc %d.%d MISSING\n", board, i); + "proc %d.%d MISSING\n", board, i); } for (i = 0; i < MAX_MGROUPS; i++) { if (BDA_NBL(bdesc->bda_mgroup, i) == BDAN_GOOD) cmn_err(CE_CONT, - "mgroup %d.%d PRESENT\n", board, i); + "mgroup %d.%d PRESENT\n", board, i); else cmn_err(CE_CONT, - "mgroup %d.%d MISSING\n", board, i); + "mgroup %d.%d MISSING\n", board, i); } /* make sure definition in platmod is in sync with pda */ @@ -3514,24 +3517,24 @@ drmach_pt_dump_pdainfo(drmachid_t id, drmach_opts_t *opts) if (BDA_NBL(bdesc->bda_ioc, i) == BDAN_GOOD) { cmn_err(CE_CONT, - "ioc %d.%d PRESENT\n", board, i); + "ioc %d.%d PRESENT\n", board, i); for (s = 0; s < MAX_SLOTS_PER_IOC; s++) { if (BDA_NBL(bdesc->bda_ios[i], s) != BDAN_GOOD) continue; cmn_err(CE_CONT, - "..scard %d.%d.%d PRESENT\n", - board, i, s); + "..scard %d.%d.%d PRESENT\n", + board, i, s); } } else { cmn_err(CE_CONT, - "ioc %d.%d MISSING\n", - board, i); + "ioc %d.%d MISSING\n", + board, i); } } cmn_err(CE_CONT, - "board %d memsize = %d pages\n", - board, pda_get_mem_size(ph, board)); + "board %d memsize = %d pages\n", + board, pda_get_mem_size(ph, board)); pda_close(ph); @@ -3550,11 +3553,11 @@ drmach_pt_readmem(drmachid_t id, drmach_opts_t *opts) dst_pa = va_to_pa(&dst); memlist_read_lock(); - for (ml = phys_install; ml; ml = ml->next) { + for (ml = phys_install; ml; ml = ml->ml_next) { uint64_t nbytes; - src_pa = ml->address; - nbytes = ml->size; + src_pa = ml->ml_address; + nbytes = ml->ml_size; while (nbytes != 0ull) { @@ -3751,7 +3754,7 @@ drmach_cpu_poweroff(struct cpu *cp) drmach_xt_mb[cpuid] = 0x80; xt_one_unchecked(cpuid, (xcfunc_t *)idle_stop_xcall, - (uint64_t)drmach_cpu_shutdown_self, NULL); + (uint64_t)drmach_cpu_shutdown_self, NULL); ntries = drmach_cpu_ntries; cnt = 0; @@ -3766,8 +3769,8 @@ drmach_cpu_poweroff(struct cpu *cp) start_cpus(); DRMACH_PR("waited %d out of %d tries for " - "drmach_cpu_shutdown_self on cpu%d", - drmach_cpu_ntries - ntries, drmach_cpu_ntries, cp->cpu_id); + "drmach_cpu_shutdown_self on cpu%d", + drmach_cpu_ntries - ntries, drmach_cpu_ntries, cp->cpu_id); drmach_cpu_obp_detach(cpuid); @@ -3815,23 +3818,23 @@ drmach_log_sysevent(int board, char *hint, int flag, int verbose) } if (verbose) DRMACH_PR("drmach_log_sysevent: %s %s, flag: %d, verbose: %d\n", - attach_pnt, hint, flag, verbose); + attach_pnt, hint, flag, verbose); if ((ev = sysevent_alloc(EC_DR, ESC_DR_AP_STATE_CHANGE, - SUNW_KERN_PUB"dr", km_flag)) == NULL) { + SUNW_KERN_PUB"dr", km_flag)) == NULL) { rv = -2; goto logexit; } evnt_val.value_type = SE_DATA_TYPE_STRING; evnt_val.value.sv_string = attach_pnt; if ((rv = sysevent_add_attr(&evnt_attr_list, DR_AP_ID, - &evnt_val, km_flag)) != 0) + &evnt_val, km_flag)) != 0) goto logexit; evnt_val.value_type = SE_DATA_TYPE_STRING; evnt_val.value.sv_string = hint; if ((rv = sysevent_add_attr(&evnt_attr_list, DR_HINT, - &evnt_val, km_flag)) != 0) { + &evnt_val, km_flag)) != 0) { sysevent_free_attr(evnt_attr_list); goto logexit; } @@ -3849,8 +3852,8 @@ logexit: sysevent_free(ev); if ((rv != 0) && verbose) cmn_err(CE_WARN, - "drmach_log_sysevent failed (rv %d) for %s %s\n", - rv, attach_pnt, hint); + "drmach_log_sysevent failed (rv %d) for %s %s\n", + rv, attach_pnt, hint); return (rv); } diff --git a/usr/src/uts/sun4v/io/dr_mem.c b/usr/src/uts/sun4v/io/dr_mem.c index a32b0af792..d7a6c65f73 100644 --- a/usr/src/uts/sun4v/io/dr_mem.c +++ b/usr/src/uts/sun4v/io/dr_mem.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -725,7 +725,7 @@ dr_mem_list_query(dr_mem_hdr_t *req, dr_mem_hdr_t **resp, int *resp_len) * Request is for domain's full view of it's memory. */ memlist_read_lock(); - for (ml = phys_install; ml; ml = ml->next) + for (ml = phys_install; ml; ml = ml->ml_next) nml++; rlen += nml * sizeof (dr_mem_query_t); @@ -744,9 +744,9 @@ dr_mem_list_query(dr_mem_hdr_t *req, dr_mem_hdr_t **resp, int *resp_len) /* get the status for each of the mblocks */ if (nml) { - for (idx = 0, ml = phys_install; ml; ml = ml->next, idx++) { - mb.addr = ml->address; - mb.size = ml->size; + for (idx = 0, ml = phys_install; ml; ml = ml->ml_next, idx++) { + mb.addr = ml->ml_address; + mb.size = ml->ml_size; dr_mem_query(&mb, &stat[idx]); } memlist_read_unlock(); @@ -1201,9 +1201,9 @@ done: /* * Add back the spans to the kcage growth list. */ - for (ml = d_ml; ml; ml = ml->next) - if (err = kcage_range_add(btop(ml->address), - btop(ml->size), KCAGE_DOWN)) + for (ml = d_ml; ml; ml = ml->ml_next) + if (err = kcage_range_add(btop(ml->ml_address), + btop(ml->ml_size), KCAGE_DOWN)) cmn_err(CE_WARN, "kcage_range_add() = %d", err); } memlist_free_list(d_ml); diff --git a/usr/src/uts/sun4v/vm/mach_kpm.c b/usr/src/uts/sun4v/vm/mach_kpm.c index de3a53f7a4..99d562ab61 100644 --- a/usr/src/uts/sun4v/vm/mach_kpm.c +++ b/usr/src/uts/sun4v/vm/mach_kpm.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -56,20 +56,20 @@ mach_kpm_init() * possible pages. */ pmem = phys_install; - start = pmem->address; - end = start + pmem->size; + start = pmem->ml_address; + end = start + pmem->ml_size; for (;;) { - if (pmem == NULL || pmem->address > end) { + if (pmem == NULL || pmem->ml_address > end) { hat_devload(kas.a_hat, kpm_vbase + start, end - start, mmu_btop(start), PROT_READ | PROT_WRITE, HAT_LOAD | HAT_LOAD_LOCK | HAT_LOAD_NOCONSIST); if (pmem == NULL) break; - start = pmem->address; + start = pmem->ml_address; } - end = pmem->address + pmem->size; - pmem = pmem->next; + end = pmem->ml_address + pmem->ml_size; + pmem = pmem->ml_next; } } |