Martin Husemann a écrit :
On Wed, Oct 01, 2014 at 03:42:51PM +0200, BERTRAND Joël wrote:Martin Husemann a écrit :On Mon, Sep 29, 2014 at 02:19:00PM +1000, matthew green wrote:this is some what tricky. ideally, it should be derived from the cpu device, and that should find and talk to the schizo device that controls it.Since mainbus device detection is mostly hardcoded, can't we rely on all cpus to attach their autoconfig device node before any pci root hub is attached?Why not. But I don't know autoconf process enough to write it. Do you have some ideas to start ?Ok, looking at it again in more detail, I think we should do it differently. Unfortunately this looks like it would need copy&pasting to all pci root implementations (ideas to avoid that welcome). Let's for example take schizo_attach: - go up one node (OF_parent(ma->ma_node)) - basically clone the loop used to get the number of cpus from the firmware (get_ncpus) and just count, which index (from OF's point of view) each gets - within the same loop, count the PCI's, for each read the first word from the "reg" property to find out wether it is bus A or B (same condition we use in the attach code to set sp_bus_a). If bus is A, count the node Now we should get the same node index for cpu and schizo, so if the schizo node is the same node as in our attach args, we have found our cpu and can break out of the loop. Once we know the node of the CPU we are looking for, we can do a loop over all CPUs and compare it against ci->ci_node. This should work completely independent of all kernel config contents.
Hello,I'm trying to write you suggestion in schizo_attach() but it doesn't work as expected. I suppose I haven't understand what you suggested.
But I don't understand why we need to write this piece of code. If I understand, cpufreq is only registered once with only once struct cpu_info as all CPU has to share same parameters. Thus, I can take the first elements of *cpus (defined in cpu.c).
Last question : schizo_set_cpufreq() is called by xcall(). Thus, if I understand, schizo_set_cpufreq() should control cpufreq of CPU that runs this function.
In dmesg, I only obtain : ... Feb 25 22:43:14 hilbert /netbsd: register safari cpufreq driver Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 23 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 750 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 23 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 750 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 23 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 750 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 23 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 750 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 23 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 750 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 23 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 750 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 23 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 750 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 23 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 750 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 23 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 750 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 23 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 750 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 750 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 375 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 750 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 375 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 750 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 375 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 750 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 375 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 750 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 375 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 750 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 375 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 750 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 375 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 750 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 375 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 750 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 375 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 750 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 375 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 750 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 23 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 750 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 23 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 750 MHz (cpu 0) Feb 25 22:43:14 hilbert /netbsd: schizo_set_cpufreq 23 MHz (cpu 0) ...Feb 25 22:43:14 hilbert /netbsd: cd0 at scsibus0 target 6 lun 0: <TOSHIBA, DVD-ROM SD-M1401, 1009> cdrom removable Feb 25 22:43:14 hilbert /netbsd: cd0: sync (50.00ns offset 16), 8-bit (20.000MB/s) transfers Feb 25 22:43:14 hilbert /netbsd: sd0 at scsibus5 target 0 lun 0: <SEAGATE, ST3146807FC, 0006> disk fixed Feb 25 22:43:14 hilbert /netbsd: sd0: 136 GB, 49855 cyl, 8 head, 718 sec, 512 bytes/sect x 286749488 sectors Feb 25 22:43:14 hilbert /netbsd: sd1 at scsibus5 target 1 lun 0: <SEAGATE, ST3146807FC, 0006> disk fixed Feb 25 22:43:14 hilbert /netbsd: sd1: 136 GB, 49855 cyl, 8 head, 718 sec, 512 bytes/sect x 286749488 sectors
Output are written inside schizo_set_cpufreq() and cpu number is value returned by cpu_number().
I don't understand why only CPU0 frequency is controlled by cpufreq and why no cpufreq debug line is written in log or console after "cd0 at scsibus0 target 6 lun 0:".
I will send as soon as possible a patch. Regards, JKB