/* * hubspc_init * Registration of the hubspc devices with the hub manager */ void hubspc_init(void) { /* * Register with the hub manager */ /* The reference counters */ hubdev_register(mem_refcnt_attach); /* Prom space */ hubdev_register(cpuprom_attach); #if defined(CONFIG_SERIAL_SGI_L1_PROTOCOL) /* L1 system controller link */ if ( !IS_RUNNING_ON_SIMULATOR() ) { /* initialize the L1 link */ void l1_cons_init( l1sc_t *sc ); elsc_t *get_elsc(void); l1_cons_init((l1sc_t *)get_elsc()); } #endif #ifdef HUBSPC_DEBUG printf("hubspc_init: Completed\n"); #endif /* HUBSPC_DEBUG */ /* Initialize spinlocks */ mutex_spinlock_init(&cpuprom_spinlock); }
/* * Allocate the map needed to allocate the ATE entries. */ struct map * atemapalloc(ulong_t mapsiz) { struct map *mp; ulong_t size; struct a { spinlock_t lock; sv_t sema; } *sync; if (mapsiz == 0) return(NULL); size = sizeof(struct map) * (mapsiz + 2); if ((mp = (struct map *) kmalloc(size, GFP_KERNEL)) == NULL) return(NULL); memset(mp, 0x0, size); sync = kmalloc(sizeof(struct a), GFP_KERNEL); if (sync == NULL) { kfree(mp); return(NULL); } memset(sync, 0x0, sizeof(struct a)); mutex_spinlock_init(&sync->lock); sv_init( &(sync->sema), &(sync->lock), SV_MON_SPIN | SV_ORDER_FIFO /*| SV_INTS*/); mp[1].m_size = (unsigned long) &sync->lock; mp[1].m_addr = (unsigned long) &sync->sema; mapsize(mp) = mapsiz - 1; return(mp); }