FreeBSD/sys/x86/x86/mp_x86.c
/*
 * Add a cache level to the cache topology description.
 */
Add a cache level to the cache topology description.
Add a cache level to the cache topology description .
static int
add_deterministic_cache(int type, int level, int share_count)
{
	if (type == 0)
		return (0);
	if (type > 3) {
		printf("unexpected cache type %d\n", type);
		return (1);
	}
	if (type == 2) 
		return (1);
	if (level == 0 || level > MAX_CACHE_LEVELS) {
		printf("unexpected cache level %d\n", type);
		return (1);
	}
	if (caches[level - 1].present) {
		printf("WARNING: multiple entries for L%u data cache\n", level);
		printf("%u => %u\n", caches[level - 1].id_shift,
		    mask_width(share_count));
	}
	caches[level - 1].id_shift = mask_width(share_count);
	caches[level - 1].present = 1;
	if (caches[level - 1].id_shift > pkg_id_shift) {
		printf("WARNING: L%u data cache covers more "
		    "APIC IDs than a package\n", level);
		printf("%u > %u\n", caches[level - 1].id_shift, pkg_id_shift);
		caches[level - 1].id_shift = pkg_id_shift;
	}
	if (caches[level - 1].id_shift < core_id_shift) {
		printf("WARNING: L%u data cache covers less "
		    "APIC IDs than a core\n", level);
		printf("%u < %u\n", caches[level - 1].id_shift, core_id_shift);
		caches[level - 1].id_shift = core_id_shift;
	}
	return (1);
}
static int add_deterministic_cache ( int type , int level , int share_count ) { if ( type == 0 ) return ( 0 ) ; if ( type > 3 ) { printf ( " \n " , type ) ; return ( 1 ) ; } if ( type == 2 ) return ( 1 ) ; if ( level == 0 || level > MAX_CACHE_LEVELS ) { printf ( " \n " , type ) ; return ( 1 ) ; } if ( caches [ level - 1 ] . present ) { printf ( " \n " , level ) ; printf ( " \n " , caches [ level - 1 ] . id_shift , mask_width ( share_count ) ) ; } caches [ level - 1 ] . id_shift = mask_width ( share_count ) ; caches [ level - 1 ] . present = 1 ; if ( caches [ level - 1 ] . id_shift > pkg_id_shift ) { printf ( " " " \n " , level ) ; printf ( " \n " , caches [ level - 1 ] . id_shift , pkg_id_shift ) ; caches [ level - 1 ] . id_shift = pkg_id_shift ; } if ( caches [ level - 1 ] . id_shift < core_id_shift ) { printf ( " " " \n " , level ) ; printf ( " \n " , caches [ level - 1 ] . id_shift , core_id_shift ) ; caches [ level - 1 ] . id_shift = core_id_shift ; } return ( 1 ) ; }
Add a cache level to the cache topology description.
Add a cache level to the cache topology description .
/* ignore instruction cache */