summaryrefslogtreecommitdiff
path: root/sys/src/9/bcm
AgeCommit message (Collapse)Author
2023-04-08kernel: Clear secrets on rebootcinap_lenrek
The idea is that when we reboot, we zero out memory written by processes that have the private flag set (such as factotum and keyfs), and also clear the secrmem pool, which contains TLS keys and the state of the random number generator. This is so the newly booted kernel or firmware will not find these secret keys in memory.
2023-01-03devip: actually put igmp in ip sectioncinap_lenrek
2023-01-03devip: add igmp protocol support to all kernelscinap_lenrek
2022-12-27sdmmc: new interface for SDiocinap_lenrek
We want to support the internal emmc device on the reform, which has a different initialization sequence from SDcard. The problem is, all mmc controller drivers where using the command index to derive the command properties. The command index's interpretation depends on the command set. And MMC has different commands then SD. Also, there are the APP_CMD escaped commands which drivers then tried to recover the state... All of this is total nonsense... The controller drivers should not care and the command properties should be maintained by port/sdmmc.c. So we pass the command as a struct SDiocmd, which has all the properties (command index, response type, data transfer mode... and even a string for debugging). The controller just converts this into register values and just executes the commands. Next, the controller drivers shouldnt snoop on the commands and then try to apply bus and frequency switching on their own. This is now made explicit by having SDio.bus(io, width, speed) function.
2022-12-18devgpio/bcm: (Raspberry Pi3/4, revision 2, bcm scheme) (thans Matt!)cinap_lenrek
Submitted by Matt: *Explain the problem that your change solves. Explain why your change solves the problem well.* The problem is that when using 9front on an Rpi3/Rpi4, on a revision 2 board, in bcm scheme, you cannot use GPIO5 nor GPIO6. If you look at the pinout, https://pinout.xyz/pinout/, you can see GPIO5 and GPIO6 are both GPIO pins - so, you should be able to use them. As you can see in the patch, "5" and "6" were both missing from the bcmtableR2 definition. The changes noted above fix this issue by adding GPIO5 ("5") and GPIO6 ("6") to the bcmtableR2 definition. I specifically only addressed r2 boards b/c I don't have an r1 board and don't want to make any speculations. * If applicable, explain how you tested the patch, and give us a way of reproducing the issue.* I tested this / you can reproduce this by: - Trying using GPIO5 and GPIO6 without the patch. You can do this by: bind -a '#G' /dev cd /dev/gpio echo 'scheme bcm' > ctl echo 'function out 5' > ctl echo 'function out 6' > ctl read -c 1 5 read -c 1 6 - Note that the `read` command above reads '0' from file 5 and from file 6. - Now try to change the GPIO pins from 0 (off) to 1 (on) echo '1' > 5 echo '1' > 6 read -c 1 5 read -c 1 6 - Note that the pins still read '0' - Now, apply the patch and repeat the steps above. Except, after you `echo '1' > 5` and `echo '1' > 6`, and then read files "5" and "6", you will see that the pins now read "1" as intended. Thanks, Matt
2022-12-11sdmmc: multiple controller supportcinap_lenrek
remove the global sdio struct and add a addmmcio() function for drivers to register their controllers. there is a SDio.aux pointer now where controller drivers can stash a pointer to their private data. SDio.init() also can signal that it wants to be called again for more controllers by returning > 0 (see pc/pmmc.c). this is in preparation for supporting the internal mmc device in the mnt-reform which is hooked up to usdhc1.
2025-05-14kernel: get rid of Proc.kstackglenda
The kernel stack is now above the Proc structure, so the explicit kstack pointer can be eliminated.
2022-08-129: compute available kernel pages using sizeof(Proc*)Ori Bernstein
procs come from the dynamic pools, so we don't need to remove the memory used by possible procs from the total available.
2022-08-109/port: allow kiloprocs -- allocate procs lazilyOri Bernstein
Treallocate the small data structures around procs eagerly, but use malloc to allocate the large proc data structures when we need them, which allows us to scale to many more procs. There are still many scalability bottlenecks, so we only crank up the nproc limit by a little bit this time around, and crank it up more as we optimize more.
2022-07-18kernel: consistently add devbridge and netdevmedium to kernel configscinap_lenrek
2022-02-05bcm: fix rebootcode linkagecinap_lenrek
2022-02-05devgpio: make reading ctl file return 0 bytescinap_lenrek
2022-01-16kernel: make Page.txtflush into an arraycinap_lenrek
To avoid a MAXMACH limit of 32 and make txtflush into an array for the bitmap. Provide portable macros for testing and clearing the bits: needtxtflush(), donetxtflush(). On pc/pc64, define inittxtflush()/settxtflush() as no-op macros, avoiding the storage overhead of the txtflush array alltogether.
2021-12-13devssl, cpu, import, oexportfs: deleteOri Bernstein
SSL is implemented by devssl. It's extremely obsolete by now, and is not used anywhere but cpu, import, and oexportfs. This change strips out the devssl bits, but does not (yet) remove the code from libsec.
2021-11-07bcm64: parse the emmc2bus/dma-ranges device-tree property and provide ↵cinap_lenrek
*emmc2bus kernel parameter /* * emmc2 has different DMA constraints based on SoC revisions. It was * moved into its own bus, so as for RPi4's firmware to update them. * The firmware will find whether the emmc2bus alias is defined, and if * so, it'll edit the dma-ranges property below accordingly. */ emmc2bus: emmc2bus { compatible = "simple-bus"; ranges = <0x0 0x7e000000 0x0 0xfe000000 0x01800000>; dma-ranges = <0x0 0xc0000000 0x0 0x00000000 0x40000000>; emmc2: mmc@7e340000 { compatible = "brcm,bcm2711-emmc2"; reg = <0x0 0x7e340000 0x100>; interrupts = <GIC_SPI 126 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clocks BCM2711_CLOCK_EMMC2>; status = "disabled"; }; };
2021-11-07bcm/emmc: remove unused cardr wakeup(), use MACHP(0) as tick referencecinap_lenrek
2021-10-11kernel: move waserror() macro to port/portfns.hcinap_lenrek
2021-07-25kernel: page counts a ulong, not usizecinap_lenrek
2021-04-25kernel: clean up Mach structurecinap_lenrek
Remove unused fields and factor common fields into a new PMach struct in port/portdat.h. The fields machno, splpc and proc are not moved to PMach as they are part of the known offsets from assembly (l.s).
2021-04-25bcm: try ATAGS/DTB pointer from R2 on entrycinap_lenrek
2021-02-28bcm: change color chan to RGB24 (thanks p.kosyh)cinap_lenrek
p.kosyh writes: Hello! I finally bought rpi4 4Gb specially for 9front. It seems, that default bpp of framebuffer is 16. I changed it to 24 (via cmdline.txt and config.txt) and found, that rendering is much faster! (May be due removing overheads in 16->24 conversions?) But on rpi4 r and b channels are swapped. So, i changed BGR24 to RGB24 in bcm/screen.c and now it works fine!
2021-02-06bcm64: get inbound and outbound pci window base address from device treecinap_lenrek
On the pi400, the xhci reset firmware mailbox request assumes that the pci windows match the ones specified in the device tree. The inbound window (pcidmawin) also varies now depending on the amount of memory installed. It is all pretty ridiculous, as the firmware could as well just read the pci controllers hardware register to determine the window configuration and the os could keep a nice simple 1:1 mapping (with pci dma addresses == physical addresses).
2020-12-22kernel: avoid palloc lock during mmurelease()cinap_lenrek
Previously, mmurelease() was always called with palloc spinlock held. This is unneccesary for some mmurelease() implementations as they wont release pages to the palloc pool. This change removes pagechainhead() and pagechaindone() and replaces them with just freepages() call, which aquires the palloc lock internally as needed. freepages() avoids holding the palloc lock while walking the linked list of pages, avoding some lock contention.
2020-12-21kernel: update procsave() comment, we'r not holding up->rlock anymorecinap_lenrek
2020-12-20kernel: handle tos and per process pcycle counters in port/cinap_lenrek
we might as well handle the per process cycle counter in the portable part instead of duplicating the code in every arch and have inconsistent implementations. we now have a portable kenter() and kexit() function, that is ment to be used in trap/syscall from user, which updates the counters. some kernels missed initializing Mach.cyclefreq.
2020-07-02bcm64: fix usb xhci controller on pi4 8GB variant (thanks richard miller)cinap_lenrek
On the 8GB variant of the raspberry pi 4, the eeprom chip for the xhci controller is missing and instead loaded from sdram (by the gpu firmware). for this, the gpu firmware needs to be notified of the xhci controllers pci bus address (after reset) that was assigned by our pci enumeration code.
2020-04-22bcm, bcm64: dancing to the drum of the linux clowns for device tree memory ↵cinap_lenrek
size detection (thanks kenji) looks like linux changed the device tree names for the memory node: https://github.com/raspberrypi/linux/commit/4b17654f51fd87c42cda3217b0863e6aa1df49b9#diff-ac03c9402b807c11d42edc9e8d03dfc7 this fixes the memory size detection with latest firmware on raspberry pi4-b (4GB) for kenji.
2020-04-10kernel: cleanup the software mouse cursor messcinap_lenrek
The swcursor used a 32x32 image for saving/restoring screen contents for no reason. Add a doflush argument to swcursorhide(), so that disabling software cursor with a double buffered softscreen is properly hidden. The doflush parameter should be set to 0 in all other cases as swcursordraw() will flushes both (current and previours) locations. Make sure swcursorinit() and swcursorhide() clear the visibility flag, even when gscreen is nil. Remove the cursor locking and just do everything within the drawlock. All cursor functions such as curson(), cursoff() and setcursor() will be called drawlock locked. This also means &cursor can be read. Fix devmouse cursor reads and writes. We now have the global cursor variable that is only modified under the drawlock. So copy under drawlock. Move the pc software cursor implementation into vgasoft driver, so screen.c does not need to handle it as a special case. Remove unused functions such as drawhasclients().
2020-04-04kernel: remove scheddump() comment for delay() in */fns.hcinap_lenrek
2020-02-09bcm: change ARGB32 to XRGB32 for framebuffer to avoid slow drawingRoberto E. Vargas Caballero
2020-02-02kernel: cleanup makefile for $CONF.$O targetcinap_lenrek
2020-01-26kernel: implement portable userinit() and simplify process creationcinap_lenrek
replace machine specific userinit() by a portable implemntation that uses kproc() to create the first process. the initcode text is mapped using kmap(), so there is no need for machine specific tmpmap() functions. initcode stack preparation should be done in init0() where the stack is mapped and can be accessed directly. replacing the machine specific userinit() allows some big simplifications as sysrfork() and kproc() are now the only callers of newproc() and we can avoid initializing fields that we know are being initialized by these callers. rename autogenerated init.h and reboot.h headers. the initcode[] and rebootcode[] blobs are now in *.i files and hex generation was moved to portmkfile. the machine specific mkfile only needs to specify how to build rebootcode.out and initcode.out.
2019-12-04bcm: use extended small pages so XN bit can workcinap_lenrek
the change to support no-execute bits broke the original raspberry pi1, as it uses backwards compatible page table format. to use the XN bit, subpage AP bits have to be disabled using the XP bit in CP15 Control Register c1 Bit 23.
2019-10-27bcm: fix software cursor avoidance for loadimage() case (thanks bitmapper)cinap_lenrek
2019-08-27kernel: catch execution read fault on SG_NOEXEC segmentcinap_lenrek
fault() now has an additional pc argument that is used to detect fault on a non-executable segment. that is, we check on read fault if the segment has the SG_NOEXEC attribute and the program counter is within faulting page.
2019-08-26kernel: expose no execute bit to portable mmu code as SG_NOEXEC / PTENOEXEC, ↵cinap_lenrek
add PTECACHED bits a portable SG_NOEXEC segment attribute was added to allow non-executable (physical) segments. which will set the PTENOEXEC bits for putmmu(). in the future, this can be used to make non-executable stack / bss segments. the SG_DEVICE attribute was added to distinguish between mmio regions and uncached memory. only matterns on arm64. on arm, theres the issue that PTEUNCACHED would have no bits set when using the hardware bit definitions. this is the reason bcm, kw, teg2 and omap kernels use arteficial PTE constants. on zynq, the XN bit was used as a hack to give PTEUNCACHED a non-zero value and when the bit is clear then cache attributes where added to the pte. to fix this, PTECACHED constant was added. the portable mmu code in fault.c will now explicitely set PTECACHED bits for cached memory and PTEUNCACHED for uncached memory. that way the hardware bit definitions can be used everywhere.
2019-08-25emmc: 50MHz highspeed support (from richard miller)cinap_lenrek
2019-08-23bcm64: deal with discontinuous memory regions, avoid virtual memory ↵cinap_lenrek
aliasing, implement vmap() proper on the 2GB and 4GB raspberry pi 4 variants, there are two memory regions for ram: [0x00000000..0x3e600000) [0x40000000..0xfc000000) the framebuffer is somewhere at the end of the first GB of memory. to handle these, we append the region base and limit of the second region to *maxmem= like: *maxmem=0x3e600000 0x40000000 0xfc000000 the mmu code has been changed to have non-existing ram unmapped and mmukmap() now uses small 64K pages instead of 512GB pages to avoid aliasing (framebuffer). the VIRTPCI mapping has been removed as we now have a proper vmap() implementation which assigns vritual addresses automatically.
2019-08-22bcm: invalidate cache on Fbinfo after firmware completioncinap_lenrek
2019-08-22bcm: flush out early boot messages on uart and screen initializationcinap_lenrek
make early boot messages available by writing out kmesg.buf after uart and screen initialization.
2019-08-21bcm: set XN bits for kernel device mappingscinap_lenrek
2019-08-18bcm64: add driver for emmc2 controllercinap_lenrek
2019-08-16bcm: fix typo in gpio.c on unused AFedge0 constantcinap_lenrek
2019-07-28bcm, bcm64: add vcore support for raspberry pi 3 GPIO expandercinap_lenrek
2019-07-27bcm, bcm64: add BCM2711 support for gpiopull(), fix gpiomeminit(), cleanupcinap_lenrek
according to the following linux change, BCM2711 uses a different method for changing pullup/down mode: https://github.com/raspberrypi/linux/commit/abcfd092860760087b87acbdda0963fe7906839c#diff-cf078559c38543ac72c5db99323e236d gpiomeminit() was broken, using virtual address for the gpio physseg instead of the physical one. cleanup the code, avoid repetition by declaring static u32int *regs variable. make local variable names consistent.
2019-07-25bcm, bcm64: clean dma destination buffer before issuing dma in case of non ↵cinap_lenrek
cache-line-size aligned buffer
2019-07-25bcm, bcm64: make irq.$O optional and add intrdisable(), use intrenable()cinap_lenrek
the raspberry pi 4 has a new interrupt controller and pci support, so get rid of intrenable() macro and properly make intrenable function with tbdf argument.
2019-07-25bcm, bcm64: add dmaflush() function and make virtio size and virtual address ↵cinap_lenrek
configurable in Soc.virtio and Soc.iosize
2019-07-25bcm, bcm64: add support for device tree parameter passingcinap_lenrek
the new raspberry pi 4 firmware for arm64 seems to have broken atag support. so we now parse the device tree structure to get the bootargs and memory configuration.
2019-06-20bcm, kw, omap, teg2: implement setregisters()cinap_lenrek