- x86_pkg_t *pkg;
- x86_die_t *die;
- x86_core_t *core;
- x86_lcpu_t *lcpu;
- uint32_t nDies;
- uint32_t nCores;
- uint32_t nCPUs;
-
- /*
- * XXX
- *
- * Right now this only works if the number of CPUs started is the total
- * number of CPUs. However, when specifying cpus=n the topology is only
- * partially constructed and the checks below will fail.
- *
- * We should *always* build the complete topology and only start the CPUs
- * indicated by cpus=n. Until that happens, this code will not check the
- * topology if the number of cpus defined is < that described the the
- * topology parameters.
- */
- nCPUs = topoParms.nPackages * topoParms.nLThreadsPerPackage;
- if (nCPUs > real_ncpus)
- return;
-
- pkg = x86_pkgs;
- while (pkg != NULL) {
- /*
- * Make sure that the package has the correct number of dies.
- */
- nDies = 0;
- die = pkg->dies;
- while (die != NULL) {
- if (die->package == NULL)
- panic("Die(%d)->package is NULL",
- die->pdie_num);
- if (die->package != pkg)
- panic("Die %d points to package %d, should be %d",
- die->pdie_num, die->package->lpkg_num, pkg->lpkg_num);
-
- DBG("Die(%d)->package %d\n",
- die->pdie_num, pkg->lpkg_num);
-
- /*
- * Make sure that the die has the correct number of cores.
- */
- DBG("Die(%d)->cores: ");
- nCores = 0;
- core = die->cores;
- while (core != NULL) {
- if (core->die == NULL)
- panic("Core(%d)->die is NULL",
- core->pcore_num);
- if (core->die != die)
- panic("Core %d points to die %d, should be %d",
- core->pcore_num, core->die->pdie_num, die->pdie_num);
- nCores += 1;
- DBG("%d ", core->pcore_num);
- core = core->next_in_die;
- }
- DBG("\n");
-
- if (nCores != topoParms.nLCoresPerDie)
- panic("Should have %d Cores, but only found %d for Die %d",
- topoParms.nLCoresPerDie, nCores, die->pdie_num);
-
- /*
- * Make sure that the die has the correct number of CPUs.
- */
- DBG("Die(%d)->lcpus: ", die->pdie_num);
- nCPUs = 0;
- lcpu = die->lcpus;
- while (lcpu != NULL) {
- if (lcpu->die == NULL)
- panic("CPU(%d)->die is NULL",
- lcpu->cpu_num);
- if (lcpu->die != die)
- panic("CPU %d points to die %d, should be %d",
- lcpu->cpu_num, lcpu->die->pdie_num, die->pdie_num);
- nCPUs += 1;
- DBG("%d ", lcpu->cpu_num);
- lcpu = lcpu->next_in_die;
- }
- DBG("\n");
-
- if (nCPUs != topoParms.nLThreadsPerDie)
- panic("Should have %d Threads, but only found %d for Die %d",
- topoParms.nLThreadsPerDie, nCPUs, die->pdie_num);
-
- nDies += 1;
- die = die->next_in_pkg;