summaryrefslogtreecommitdiff
path: root/sys/src/9/pc/archacpi.c
AgeCommit message (Collapse)Author
2023-05-18libaml: tow eisaid inside the environmentmia soweli
2021-09-13archacpi: leave acpi enabled with *acpi=Ori Bernstein
*acpi= was treated the same as *acpi=0, when we want it to be treated the same as *acpi=1
2021-07-15archacpi: make *acpi=1 the defaultcinap_lenrek
2021-01-17pc, pc64: add minimal HPET driver to measure LAPIC and TSC frequenciescinap_lenrek
This adds the new function pointer PCArch.clockinit(), which is a timer dependent initialization routine. It also takes over the job of guesscpuhz(). This way, the architecture ident code can switch between different timers (i8253, HPET and XEN timer).
2020-11-29pc, pc64, xen: rewrite interrupt handling codecinap_lenrek
This implements proper intrdisable() support for all interrupt controllers. For enable, (*arch->intrassign)(Vctl*) fills in the Vctl.enable and Vctl.disable pointers with the appropriate routines and returns the assigned vector number. Once the Vctl struct has been linked to its vector chain, Vctl.enable(Vctl*, shared) gets called with a flag if the vector has been already enabled (shared). This order is important here as enabling the interrupt on the controller before we have linked the chain can cause spurious interrupts, expecially on mp system where the interrupt can target a different cpu than the caller of intrenable(). The intrdisable() case is the other way around. We first disable the interrupt on the controller and after that unlink the Vctl from the chain. On a multiprocessor, the xfree() of the Vctl struct is delayed to avoid freeing it while it is still in use by another cpu. The xen port now also uses pc/irq.c which has been made generic enougth to handle xen's irq scheme. Also, archgeneric is now a separate file to avoid pulling in dependencies from the 8259 interrupt controller code.
2020-09-13kernel: massive pci code rewritecinap_lenrek
The new pci code is moved to port/pci.[hc] and shared by all ports. Each port has its own PCI controller implementation, providing the pcicfgrw*() functions for low level pci config space access. The locking for pcicfgrw*() is now done by the caller (only port/pci.c). Device drivers now need to include "../port/pci.h" in addition to "io.h". The new code now checks bridge windows and membars, while enumerating the bus, giving the pc driver a chance to re-assign them. This is needed because some UEFI implementations fail to assign the bars for some devices, so we need to do it outselfs. (See pcireservemem()). While working on this, it was discovered that the pci code assimed the smallest I/O bar size is 16 (pcibarsize()), which is wrong. I/O bars can be as small as 4 bytes. Bit 1 in an I/O bar is also reserved and should be masked off, making the port mask: port = bar & ~3;
2020-06-06archacpi: use 64-bit uvlong for physical addressescinap_lenrek
2020-04-04pc, pc64: new memory map codecinap_lenrek
This replaces the memory map code for both pc and pc64 kernels with a unified implementation using the new portable memory map code. The main motivation is to be robust against broken e820 memory maps by the bios and delay the Conf.mem[] allocation after archinit(), so mp and acpi tables can be reserved and excluded from user memory. There are a few changes: new memreserve() function has been added for archinit() to reserve bios and acpi tables. upareserve() has been replaced by upaalloc(), which now has an address argument. umbrwmalloc() and umbmalloc() have been replaced by umballoc(). both upaalloc() and umballoc() return physical addresses or -1 on error. the physical address -1 is now used as a sentinel value instead of 0 when dealing with physical addresses. archmp and archacpi now always use vmap() to access the bios tables and reserve the ranges. more overflow checks have been added. ramscan() has been rewritten using vmap(). to handle the population of kernel memory, pc and pc64 now have pmap() and punmap() functions to do permanent mappings.
2018-07-22pc, pc64: look for "RSD PTR " in ACPI reserved memory region from e820 mapcinap_lenrek
nobody passes us the "RSD PTR " address when doing multiboot/kexec on UEFI systems. so we search for it manually in the ACPI reserved area as indicated in the e820 memory map.
2017-03-25pc kernel: handle PCMP and RSD being in low (kaddr) or reserved (vmap) memorycinap_lenrek
on thinkpad x1v4, the PCMP structure resides in upper reserved memory pa=0xd7f49000 - while system memory ends at 0x0ffff000; so we have to vmap() it instead of KADDR(). the RSD structure for ACPI might reside in low memory, so we sould KADDR() in that case.
2016-11-05archacpi: fix format string warning on amd64cinap_lenrek
2016-10-23pc/archacpi: don't do acpi initialization in the kernel, provide generic ↵cinap_lenrek
acpimem routines get rid of _INI and _REG method calls, this is not full acpi environment anyway and all we really want todo at kernel boot time is figuring out the interrupt routing. aux/acpi can try to enable more stuff if it needs to later when battery status desired. dont snoop memory space regions in amlmapio(), this is just wrong as amlmapio() is *lazily* mapping regions as they are accessed, so the range table would never be really complete. instead, we provide generic access to the physical address space, excluding kernel and user memory with acpimem file.
2016-10-18archacpi: optionally export acpi memory regions; properly initialize environmentftrvxmtrx
2016-06-30acpi: _ADR and _BBN might be methods, so use amleval() to evaluate the valuecinap_lenrek
2016-06-05aml: define amlintmask and set it according to DSDT revision (64bit / 32bit)cinap_lenrek
2014-12-19pc, pc64: untangle acpireset() from mpshutdown()cinap_lenrek
mpshutdown() used to call acpireset() making it impossible to build a kernel without archacpi. now, mpshutdown() is a helper function that only shuts down the application processors that gets used from mpreset() and acpireset(). the generic machine reset code in exported by devarch's archreset() function that is called by mpreset() and from acpireset() as a fallback. so the code duplication that was in mpshutdown() is avoided.
2014-11-10pc, pc64: provide access to embedded controller with #P/ec filecinap_lenrek
2014-11-04acpi: fix pcibusno() when PCI0._ADR = 0cinap_lenrek
libaml comresses zero integer as nil, so remove the nil check. this makes interrupts work in vmware with efi.
2014-11-02pc, pc64: implement acpi reset (for efi)cinap_lenrek
x230 booted in efi only (no csp) mode hangs when traditional i8042reset() keyboard reset is tried. so we try acpireset() first which discoveres and writes the acpi reset register.
2014-10-18pc, pc64: allow passing RSDT pointer in *acpi= boot parameter, early ↵cinap_lenrek
bootscreeninit(), fix rampage() usage rampage() cannot be used after meminit(), so test for conf.mem[0].npage != 0 and use xalloc()/mallocalign() instead. this allows us to use vmap() early before mmuinit() which is needed for bootscreeninit() and acpi. to get memory for page tables, pc64 needs a lowraminit(). with EFI, the RSDT pointer is passed in *acpi= parameter from the efi loader. as the RSDT is ususally at the end of the physical address space (and not to be found in bios areas), we cannot KMAP() it so we need to vmap().
2014-04-08process acpi interrupt source override entries in a 2nd pass over the madt ↵cinap_lenrek
(APIC) table (thanks erik) according to erik, virtualbox puts the source overrides before the ioapic entries so the addirq() call fails as no ioapics have been declared yet. use a second pass over the table after we processed the apic entries.
2014-02-01pc kernel: split mpstartap() and squidboy into separate file... stuff for amd64cinap_lenrek
2013-09-08archacpi: make pcibusno() work on non pci bridges (fixes pciaddr()), ↵cinap_lenrek
distribute irqs in setuplink(), remove debug prints
2013-09-07archacpi: implement amldelay(), remove unused variable in setuplink()cinap_lenrek
2013-09-06archacpi: experimental handling of interrupt link devices, io accesscinap_lenrek
2013-07-07acpi: skip disabled LAPIC entriescinap_lenrek
disabled LAPIC entries overwrote the bootstrap processor apic causing the machine panic with: "no bootstrap processor". (problem with lenovo X230) just ignore entries that are disabled or collide with entries already found. (should not happen)
2013-06-25reintroduce *notsc= optioncinap_lenrek
the issues with the previous tsc change where not related to the tsc but where problems with timesync using an old frequency file. a patch to fix timesync was commited, so so we reintroduce the *notsc= again.
2013-06-21reverting guesscpuhz() changes, causes troublecinap_lenrek
2013-06-20disable tscticks in pc kernel (for now)cinap_lenrek
doesnt seem to be reliable. also, separate tsc frequency measurement and cpu loopconst measurement. turned out with *notsc=, the simplcycles() calls would mess up loopconst.
2013-06-19acpi: use Tblsz enum instead of sizeof(Tbl) due to alignment, enable use tsc ↵cinap_lenrek
on terminal kernel (thank erik)
2013-06-07archacpi: handle multiple SSDT tablescinap_lenrek
we cannot assume theres only one instance of an acpi table. some bios have multiple SSDT tables and we would only find the first one. now, we keep a second array to record the physical address of the table visited by maptable(). load all instances to the SSDT.
2013-01-29acpi: remove "cannot get pci bus number for ..." debug printscinap_lenrek
on almost all machines, we get tons of these prints for pci busses that are not physically there but are described in the ACPI namespace. the reason that we enumerate these is because we do not enumerate _INI and _STA methods to check if they are present. we just match the information with the PCI devices we enumerated with our generic pci code. this works fine and doesnt require aml code to poke arround in pci config space.
2012-08-24add unified sigsearch() function to look for bios data structurescinap_lenrek
replace the various functions that searched for bios data structures by a single sigsearch() one in pc/memory.c that will probe the various bios data areas. also, a new checksum() function was added that is to be used to validate the structures found.
2012-06-19acpi: work arround missing _BBN, check _HIDcinap_lenrek
2012-06-17archacpi: boot processor commentcinap_lenrek
2012-06-17fix ioapic mre off by onecinap_lenrek
2012-06-17experimental acpi support for apic irq routingcinap_lenrek