void proc_ppc64_init(void) { unsigned long i; struct proc_dir_entry *ent = NULL; char buf[256]; printk("proc_ppc64: Creating /proc/ppc64/pmc\n"); /* * Create the root, system, and cpu directories as follows: * /proc/ppc64/pmc/system * /proc/ppc64/pmc/cpu0 */ spin_lock(&proc_ppc64_lock); if (proc_ppc64_root == NULL) { proc_ppc64_root = proc_mkdir("ppc64", 0); if (!proc_ppc64_root) { spin_unlock(&proc_ppc64_lock); return; } } spin_unlock(&proc_ppc64_lock); ent = create_proc_entry("naca", S_IFREG|S_IRUGO, proc_ppc64_root); if ( ent ) { ent->nlink = 1; ent->data = naca; ent->size = 4096; ent->proc_fops = &nacamap_fops; } ent = create_proc_entry("systemcfg", S_IFREG|S_IRUGO, proc_ppc64_root); if ( ent ) { ent->nlink = 1; ent->data = systemcfg; ent->size = 4096; ent->proc_fops = &nacamap_fops; } /* /proc/ppc64/paca/XX -- raw paca contents. Only readable to root */ ent = proc_mkdir("paca", proc_ppc64_root); if (ent) { for (i = 0; i < systemcfg->processorCount; i++) proc_ppc64_create_paca(i, ent); } /* Placeholder for rtas interfaces. */ if (rtas_proc_dir == NULL) { rtas_proc_dir = proc_mkdir("rtas", proc_ppc64_root); } /* Create the /proc/ppc64/pcifr for the Pci Flight Recorder. */ proc_pciFr_init(proc_ppc64_root); proc_ppc64_pmc_root = proc_mkdir("pmc", proc_ppc64_root); proc_ppc64_pmc_system_root = proc_mkdir("system", proc_ppc64_pmc_root); for (i = 0; i < systemcfg->processorCount; i++) { sprintf(buf, "cpu%ld", i); proc_ppc64_pmc_cpu_root[i] = proc_mkdir(buf, proc_ppc64_pmc_root); } /* Create directories for the software counters. */ for (i = 0; i < systemcfg->processorCount; i++) { ent = create_proc_entry("stab", S_IRUGO | S_IWUSR, proc_ppc64_pmc_cpu_root[i]); if (ent) { ent->nlink = 1; ent->data = (void *)proc_ppc64_pmc_cpu_root[i]; ent->read_proc = (void *)proc_ppc64_pmc_stab_read; ent->write_proc = (void *)proc_ppc64_pmc_stab_read; } ent = create_proc_entry("htab", S_IRUGO | S_IWUSR, proc_ppc64_pmc_cpu_root[i]); if (ent) { ent->nlink = 1; ent->data = (void *)proc_ppc64_pmc_cpu_root[i]; ent->read_proc = (void *)proc_ppc64_pmc_htab_read; ent->write_proc = (void *)proc_ppc64_pmc_htab_read; } } ent = create_proc_entry("stab", S_IRUGO | S_IWUSR, proc_ppc64_pmc_system_root); if (ent) { ent->nlink = 1; ent->data = (void *)proc_ppc64_pmc_system_root; ent->read_proc = (void *)proc_ppc64_pmc_stab_read; ent->write_proc = (void *)proc_ppc64_pmc_stab_read; } ent = create_proc_entry("htab", S_IRUGO | S_IWUSR, proc_ppc64_pmc_system_root); if (ent) { ent->nlink = 1; ent->data = (void *)proc_ppc64_pmc_system_root; ent->read_proc = (void *)proc_ppc64_pmc_htab_read; ent->write_proc = (void *)proc_ppc64_pmc_htab_read; } ent = create_proc_entry("profile", S_IWUSR | S_IRUGO, proc_ppc64_pmc_system_root); if (ent) { ent->nlink = 1; ent->proc_fops = &proc_profile_operations; /* ent->size = (1+prof_len) * sizeof(unsigned int); */ } ent = create_proc_entry("trace", S_IWUSR | S_IRUGO, proc_ppc64_pmc_system_root); if (ent) { ent->nlink = 1; ent->proc_fops = &proc_trace_operations; /* ent->size = (1+prof_len) * sizeof(unsigned int); */ } ent = create_proc_entry("timeslice", S_IWUSR | S_IRUGO, proc_ppc64_pmc_system_root); if (ent) { ent->nlink = 1; ent->proc_fops = &proc_timeslice_operations; } /* Create directories for the hardware counters. */ for (i = 0; i < systemcfg->processorCount; i++) { ent = create_proc_entry("hardware", S_IRUGO | S_IWUSR, proc_ppc64_pmc_cpu_root[i]); if (ent) { ent->nlink = 1; ent->data = (void *)proc_ppc64_pmc_cpu_root[i]; ent->read_proc = (void *)proc_ppc64_pmc_hw_read; ent->write_proc = (void *)proc_ppc64_pmc_hw_read; } } ent = create_proc_entry("hardware", S_IRUGO | S_IWUSR, proc_ppc64_pmc_system_root); if (ent) { ent->nlink = 1; ent->data = (void *)proc_ppc64_pmc_system_root; ent->read_proc = (void *)proc_ppc64_pmc_hw_read; ent->write_proc = (void *)proc_ppc64_pmc_hw_read; } }
void proc_ppc64_init(void) { unsigned long i; struct proc_dir_entry *ent = NULL; char buf[256]; printk("proc_ppc64: Creating /proc/ppc64/pmc\n"); /* * Create the root, system, and cpu directories as follows: * /proc/ppc64/pmc/system * /proc/ppc64/pmc/cpu0 */ spin_lock(&proc_ppc64_lock); proc_ppc64_root = proc_mkdir("ppc64", 0); if (!proc_ppc64_root) return; spin_unlock(&proc_ppc64_lock); /* /proc/ppc64/naca -- raw naca contents. Only readable to root */ create_proc_read_entry("naca", S_IRUSR, proc_ppc64_root, proc_ppc64_page_read, naca); /* /proc/ppc64/paca/XX -- raw paca contents. Only readable to root */ ent = proc_mkdir("paca", proc_ppc64_root); if (ent) { for (i = 0; i < naca->processorCount; i++) proc_ppc64_create_paca(i, ent); } /* Create the /proc/ppc64/pcifr for the Pci Flight Recorder. */ proc_pciFr_init(proc_ppc64_root); proc_ppc64_pmc_root = proc_mkdir("pmc", proc_ppc64_root); proc_ppc64_pmc_system_root = proc_mkdir("system", proc_ppc64_pmc_root); for (i = 0; i < naca->processorCount; i++) { sprintf(buf, "cpu%ld", i); proc_ppc64_pmc_cpu_root[i] = proc_mkdir(buf, proc_ppc64_pmc_root); } /* Create directories for the software counters. */ for (i = 0; i < naca->processorCount; i++) { ent = create_proc_entry("stab", S_IRUGO | S_IWUSR, proc_ppc64_pmc_cpu_root[i]); if (ent) { ent->nlink = 1; ent->data = (void *)proc_ppc64_pmc_cpu_root[i]; ent->read_proc = (void *)proc_ppc64_pmc_stab_read; ent->write_proc = (void *)proc_ppc64_pmc_stab_read; } ent = create_proc_entry("htab", S_IRUGO | S_IWUSR, proc_ppc64_pmc_cpu_root[i]); if (ent) { ent->nlink = 1; ent->data = (void *)proc_ppc64_pmc_cpu_root[i]; ent->read_proc = (void *)proc_ppc64_pmc_htab_read; ent->write_proc = (void *)proc_ppc64_pmc_htab_read; } } ent = create_proc_entry("stab", S_IRUGO | S_IWUSR, proc_ppc64_pmc_system_root); if (ent) { ent->nlink = 1; ent->data = (void *)proc_ppc64_pmc_system_root; ent->read_proc = (void *)proc_ppc64_pmc_stab_read; ent->write_proc = (void *)proc_ppc64_pmc_stab_read; } ent = create_proc_entry("htab", S_IRUGO | S_IWUSR, proc_ppc64_pmc_system_root); if (ent) { ent->nlink = 1; ent->data = (void *)proc_ppc64_pmc_system_root; ent->read_proc = (void *)proc_ppc64_pmc_htab_read; ent->write_proc = (void *)proc_ppc64_pmc_htab_read; } /* Create directories for the hardware counters. */ for (i = 0; i < naca->processorCount; i++) { ent = create_proc_entry("hardware", S_IRUGO | S_IWUSR, proc_ppc64_pmc_cpu_root[i]); if (ent) { ent->nlink = 1; ent->data = (void *)proc_ppc64_pmc_cpu_root[i]; ent->read_proc = (void *)proc_ppc64_pmc_hw_read; ent->write_proc = (void *)proc_ppc64_pmc_hw_read; } } ent = create_proc_entry("hardware", S_IRUGO | S_IWUSR, proc_ppc64_pmc_system_root); if (ent) { ent->nlink = 1; ent->data = (void *)proc_ppc64_pmc_system_root; ent->read_proc = (void *)proc_ppc64_pmc_hw_read; ent->write_proc = (void *)proc_ppc64_pmc_hw_read; } }