On Zynq platforms, get the CPU count from the SCU_CONFIG register. This is necessary to boot on Xilinx' new single core chips (such as on the MiniZed). I don't have access to MiniZed yet but I have been debugging on Xilinx' port of qemu which acts like a single core Zynq so I have been using this patch for a while.
Details
Tested on Zedboard and qemu.
Diff Detail
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
I just tested this on my Cora Z7-07S board, and it looks like there's a hardware bug that prevents this patch from working.
I added a printf to dump mp_maxid and mp_ncpus, and I get 1 and 2 respectively, which per the TRM indicates that it's suppose to have 2 cpus instead of 1.
Crud. I guess the number of CPUs isn't properly represented in the SCU config register. Do you know the value of the entire register? From the u-boot prompt,
type "md 0xf8f00004 1". Another idea is to key off the device field of the SLCR's PSS_IDCODE register at 0xf8000530. Can you get that value too?
It also shows up in a sysctl under "hw.zynq.pss_idcode".
Thanks, tried to do this from FreeBSD, but couldn't figure out how to dump the entire register:
Zynq> md 0xf8f00004 1 f8f00004: 00000511 .... Zynq> md 0xf8000530 1 f8000530: 13723093 .0r.
Hmm.. that sysctl didn't work, but there was pssid:
freebsd@generic:~ % sysctl hw.zynq.pssid hw.zynq.pssid: 0x13723093: manufacturer: 0x49 device: 0x3 family: 0x1b sub-family: 0x9 rev: 0x1
I found some interesting reading on the S series Zynq chips. They just blow a fuse in the chip that disables the second core.
Fortunately, it looks like they do update the device ID in the pssid register so I have updated this diff to check that register first.
This booted on my 07S board w/o me having to set hw.ncpu in loader!
I assume you tested w/ your boards as well? Any other changes you want in?
sys/arm/xilinx/zy7_mp.c | ||
---|---|---|
2 | Probably should update copyright year. I can do this when I commit. |
sys/arm/xilinx/zy7_mp.c | ||
---|---|---|
77 | What are these magic numbers? |
Sorry, got a bit excited that things worked.
sys/arm/xilinx/zy7_mp.c | ||
---|---|---|
77 | Yes, please make these into defines. Also, very useful to include the document name/number and section/table information for various defines/magic numbers. Example is that the TRM I have (UG585, v1.12.2) doesn't have these defined in them, so if they are defined in a different doc, it'd be nice to know. Thanks. |
sys/arm/xilinx/zy7_mp.c | ||
---|---|---|
77 | I think I am going to put these defines in zy7_slcr.h and include it here. That also means doing some style and white-space clean-up to zy7_slcr.h while I'm at it. I'll put it up as soon as I've retested it. |