summaryrefslogtreecommitdiffstats
path: root/sys/arch/loongson/dev (follow)
Commit message (Collapse)AuthorAgeFilesLines
* spellingjsg2021-03-113-6/+6
|
* Use native display resolution 1368x768 with Lynloong all-in-one computers.visa2021-01-021-3/+7
| | | | From Yifei ZHAN on tech@
* Refactor klist insertion and removalvisa2020-12-251-3/+3
| | | | | | | | | | | | Rename klist_{insert,remove}() to klist_{insert,remove}_locked(). These functions assume that the caller has locked the klist. The current state of locking remains intact because the kernel lock is still used with all klists. Add new functions klist_insert() and klist_remove() that lock the klist internally. This allows some code simplification. OK mpi@
* alpha, loongson, sh, sparc64: recompute tick, tick_nsec when hz(9) is resetcheloha2020-10-201-1/+3
| | | | | | | | | | | | | | Normally we set hz(9) at compile-time in sys/conf/param.c to the value of HZ. HZ is one of the fundamental compilation options(4). However, sometimes we need to reset hz(9) at runtime. Whenever we reset hz(9) we need to recompute tick and tick_nsec. Otherwise a variety of "time stuff" in the kernel will not work correctly. For example, most timeouts will expire "too slow" or "too fast". There are a bunch of other places we use tick and tick_nsec that will exhibit similar problems. Test-compiled by deraadt@.
* Move mfokclock(4) from loongson to sys/dev/i2c so that it be used by morepatrick2020-09-302-153/+2
| | | | | | | | | | | platforms than just loongson. Rename it to mfokrtc(4) for consistency with other RTC drivers. Make it match on st,m41t83, since that was the chip for which the driver was written for. More compatible strings can be added for each chip of the series verified to behave the same. Discussed with kettenis@ Compile tested on loongson by kn@ Tested on loongson by and ok visa@
* Remove an unused function.visa2020-07-181-12/+1
|
* kernel: use gettime(9)/getuptime(9) in lieu of time_second(9)/time_uptime(9)cheloha2020-06-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | time_second(9) and time_uptime(9) are widely used in the kernel to quickly get the system UTC or system uptime as a time_t. However, time_t is 64-bit everywhere, so it is not generally safe to use them on 32-bit platforms: you have a split-read problem if your hardware cannot perform atomic 64-bit reads. This patch replaces time_second(9) with gettime(9), a safer successor interface, throughout the kernel. Similarly, time_uptime(9) is replaced with getuptime(9). There is a performance cost on 32-bit platforms in exchange for eliminating the split-read problem: instead of two register reads you now have a lockless read loop to pull the values from the timehands. This is really not *too* bad in the grand scheme of things, but compared to what we were doing before it is several times slower. There is no performance cost on 64-bit (__LP64__) platforms. With input from visa@, dlg@, and tedu@. Several bugs squashed by visa@. ok kettenis@
* dev/rndvar.h no longer has statistical interfaces (removed during variousderaadt2020-05-291-2/+1
| | | | | | conversion steps). it only contains kernel prototypes for 4 interfaces, all of which legitimately belong in sys/systm.h, which are already included by all enqueue_randomness() users.
* Use <dev/clock_subr.h> in mcclock(4).visa2020-05-253-41/+45
| | | | | | Tested on Yeeloong. Looks good to miod@
* Use <dev/clock_subr.h> in mfokclock(4).visa2020-05-251-36/+43
| | | | Looks good to miod@
* change wsdisplay attribute type from long to uint32_tjsg2020-05-253-20/+20
| | | | | | | | miod explained it was initially a long as it was thought drivers may need to allocate storage but in practice they don't need more than 32 bits for an attribute. suggested and reviewed by miod@
* rename wsdisplay alloc_attr() to pack_attr()jsg2020-05-253-9/+9
| | | | | | | | Suggested by John Carmack. miod agrees a rename would make sense and explained it was initially thought drivers may need to allocate storage but in practice they don't need more than 32 bits for an attribute. ok mpi@
* Abstract the head of knote lists. This allows extending the lists,visa2020-04-071-3/+3
| | | | | | for example, with locking assertions. OK mpi@, anton@
* Update my email address.pirofti2020-04-061-2/+2
|
* Replace field f_isfd with field f_flags in struct filterops to allowvisa2020-02-201-2/+2
| | | | | | adding more filter properties without cluttering the struct. OK mpi@, anton@
* Send a resume event to apmd(8), like done by apm(4) and acpi(4)jca2020-02-161-1/+3
| | | | | Test & ok visa@. Sadly his Lemote doesn't come back from sleep, with or without this change.
* Use C99 designated initializers with struct filterops. In addition,visa2019-12-311-3/+7
| | | | | | make the structs const so that the data are put in .rodata. OK mpi@, deraadt@, anton@, bluhm@
* tweak ohci_checkrev so it doesnt print a leading comma and space.dlg2019-01-071-2/+2
| | | | | | | | | it assumes that it always followed an interrupt string, but we don't print that on fdt. having the bus responsible for the whitespace means the fdt glue can print a colon to separate the bus info from checkrev output, while every other glue keeps the comma. ok deraadt@
* Declare ci_ipl volatile to prevent the compiler from optimizingvisa2018-02-241-7/+1
| | | | | | | | | | | | | | | | | | or reordering accesses to the variable. Assume that the assembler preserves the correct sequence of instructions, which allows the removal of the explicit noreorder/reorder toggles from the C code. With ci_ipl being volatile, drop mips_sync() calls that follow the accesses of the variable. The sync is redundant as a compiler barrier. In addition, the MIPS64 CPU designs should not need the sync for pipeline or write buffer control. According to miod@, the use of the instruction is a carryover from code targeting early MIPS designs that lack tight integration with the cache and write buffer. Discussed with and testing help from miod@. Tested on CN5020, CN6120, CN7130, CN7360, Loongson 2F and 3A1000, R4400, R8000, R10000 and R16000.
* Make IPL_MPSAFE effective on loongson.visa2017-05-172-2/+6
| | | | Testing help from fcambus@
* Add a PCI attach hook mechanism for htb(4), similar to the onevisa2017-05-102-2/+15
| | | | | | in bonito(4). Use the hook for setting up the PIC. Discussed with miod@ long ago
* Fix range check.visa2017-05-091-2/+2
|
* Rename Debugger() into db_enter().mpi2017-04-301-2/+2
| | | | | | | Using a name with the 'db_' prefix makes it invisible from the dynamic profiler. ok deraadt@, kettenis@, visa@
* hibernate_free() should not be called from MD code, acpi_sleep_state()deraadt2017-03-271-2/+1
| | | | | unwinds that. Upon hibernate fail, this was a collection of double-frees.. ok claudio mlarkin
* Suppress messages about spurious UART interrupts on MP systems.visa2017-02-191-2/+17
| | | | | A similar workaround was added in r1.8 of cn30xxuart.c because of the same root cause.
* Nuke extraneous whitespace and tabs.fcambus2017-01-231-18/+17
|
* Extend struct platform with MP control functions, and add bootstrap codevisa2017-01-191-1/+6
| | | | | | for secondary CPUs. Discussed with miod@
* Harmonize the way frame buffer drivers display resolution and colorfcambus2017-01-152-4/+4
| | | | | | depth when attaching. OK visa@, deraadt@
* Display resolution and color depth when attaching.fcambus2017-01-101-3/+3
| | | | OK visa@, kettenis@, deraadt@
* Harmonize battery state thresholds accross platforms.fcambus2016-12-052-9/+7
| | | | | | Use the same values hardcoded in sys/dev/acpi/acpi.c where possible. OK visa@
* Add drivers for PCI host bridge and built-in UARTs on Loongson 3A,visa2016-11-178-1/+766
| | | | | | and put the pieces together by platform glue. Feedback from miod@
* Add support for lid state detection in ykbec(4).fcambus2016-11-151-4/+13
| | | | | | Tested on a Lemote Yeeloong 8101B. OK visa@, looks good to deraadt@
* Move the definition of REGVAL into a common header to make it usablevisa2016-11-051-4/+1
| | | | | | outside bonito(4). ok miod@
* Various printf claim to report the PID, so actually report that and not the TIDguenther2016-10-081-3/+4
| | | | Build testing assistance from deraadt@
* Add an initial framebuffer driver for the RS780E chipset on loongson,visa2016-10-071-0/+729
| | | | | | | ported from sparc64. For now, it works without hardware acceleration, but otherwise it is usable enough as a console and with X. Diff from Miod's hoard
* Write the system time back to the RTC every 30 minutes.naddy2016-09-031-1/+4
| | | | | | | This fixes the problem that long-running machines which were not shut down properly would reboot with a badly offset system time. hints and ok kettenis@
* Rename mips64's trap_frame into trapframe.mpi2016-03-061-7/+7
| | | | | | For coherency with other archs and in order to use it in MI code. ok visa@, tobiasu@
* Move HID support files out of dev/usb into new dev/hid directoryjcs2016-01-081-2/+2
| | | | | | | | | These files aren't USB-specific and were used by the previous Bluetooth implementation, and will be used by the upcoming HID-over-i2C implementation ok deraadt previous version ok kettenis and mpi
* In low-level suspend routines, set cold=2. In tsleep(), use this toderaadt2015-09-281-2/+2
| | | | | | | | spit out a ddb trace to console. This should allow us to find suspend or resume routines which break the rules. It depends on the console output function being non-sleeping.... but that's another codepath which should try to be safe when cold is set. ok kettenis
* trivial "if(x) free(x)" replacement by "free(x)"semarie2015-09-191-3/+2
| | | | ok miod@
* sizes for free(); ok semariederaadt2015-09-081-3/+3
|
* typomiod2015-08-151-2/+2
|
* don't check for the name in attach_args being NULL; nothing should calljasper2015-07-191-3/+2
| | | | | | their match functions with (g)aa_name not set. ok miod@
* New framework that allows hibernate to pass in entropy from it's freshderaadt2015-02-071-2/+2
| | | | | boot. ok mlarkin
* oops, forgot rndvar.hderaadt2014-12-191-1/+2
|
* use suspend_randomness() and resume_randomness()deraadt2014-12-181-1/+4
|
* #if NSWDISPLAY > 0 -> #if NWSDISPLAY > 0jsg2014-10-311-2/+2
| | | | now wsdisplay_suspend() will run on suspend
* Use correct format specifiers in various loongson machine dependent code.jsing2014-09-261-3/+3
| | | | | | Makes a loongson kernel buildable without -Wno-format. ok miod@ jsg@
* Use config_suspend_all(9).kettenis2014-09-201-7/+6
| | | | ok mpi@, uebayasi@, dlg@
* Bring back pci_dopm, but disable it before powerdown.pirofti2014-07-191-1/+6
| | | | | | | | | This fixes both the Lemote reboot issue and the USB issue on the Gdium's that miod@ spotted. Suggested by kettenis@, thanks! Okay miod@