Commit graph

1639 commits

Author SHA1 Message Date
cinap_lenrek a021f054b0 wifi: revert rate adoption divider, breaks arpunks wifi 2017-12-29 03:41:32 +01:00
cinap_lenrek 8040a878de devtls, devssl: avoid ~0UL comparsion (from drawterm) 2017-12-28 19:13:53 +01:00
cinap_lenrek 80185daba9 devmnt: use u32int for tagmask, simplify alloctag() 2017-12-28 18:25:15 +01:00
cinap_lenrek b9d2a9efd5 wifi: don't implicitely update lastseen timestamp on nodelookup()
in case we continue to send traffic (like ping) with the ap gone,
the sending would keep updating bss->lastseen which prevents the
timeout to happen to switch bss.
2017-12-28 04:34:03 +01:00
cinap_lenrek d13142b3da etheriwl, etherwpi: limit transmit queue buffer bloat to 48k (at 22Mbit ≅ 20ms) 2017-12-28 01:24:38 +01:00
cinap_lenrek ce9cc8a358 wifi: don't assume Wifi.rates[] is sorted, return net data rate for mbps (50% theoretical) 2017-12-28 01:19:14 +01:00
cinap_lenrek 96eb90fba1 devvga: removing #v/vgabios, use /dev/realmodemem instead 2017-12-23 04:26:50 +01:00
cinap_lenrek 50bea0348c kernel: convert textmode cga screen contents to kmesg only once
screeninit() might be called again by devvga when switching
to textmode, so only convert the text framebuffer to kmesg
the first time.
2017-12-23 03:56:12 +01:00
cinap_lenrek 02b6831fa5 kernel: remove Ipifc.mbps, unused. 2017-12-23 02:58:47 +01:00
cinap_lenrek 417bdbb869 ether8169: add Macv45 for RTL8111HN, rename Macv45 -> Macv42 (thanks qeed, sam-d) 2017-12-19 00:03:54 +01:00
cinap_lenrek c1eb4b8d68 devether: dont forward loopback packets on bridges 2017-12-18 20:47:55 +01:00
cinap_lenrek 1f80d31f41 devbridge: disable write blocking on ethernets 2017-12-18 20:44:53 +01:00
cinap_lenrek 3e48a66665 pc, pc64: add devbridge to kernel configuration 2017-12-17 20:33:39 +01:00
cinap_lenrek 520c938f0b devbridge: fix mss clamping
- use protocol constants from ip/ip.h and ip/ipv6.h
- support mss clamping for ipv6
- fix padding bug on 64 bit machines (can't use sizeof(Tcphdr))
2017-12-17 20:30:24 +01:00
cinap_lenrek 15ff38e818 wifi: use protocol constants from ip/ip.h and ip/ipv6.h for dmatproxy() 2017-12-17 17:17:26 +01:00
cinap_lenrek 070a9ef753 wifi: matt damon wifi bridging support 2017-12-16 21:43:47 +01:00
cinap_lenrek 9fd8894fec ether: allow spoofing of source mac address for bridges; used by vmx
to implement layer 2 bridges in userspace, we disable to auto filling
of the source mac address when bridge mode is enabled on the
connection.
2017-12-15 22:22:29 +01:00
cinap_lenrek 35bc3ac573 devether: remove duplicated parseether() implementation (pull from libip) 2017-12-09 22:07:32 +01:00
cinap_lenrek 65566dda8e devvga: properly handle physical screen size and panning
- remove arbitrary limits on screen size, just check with badrect()
- post resize when physgscreenr is changed (actualsize ctl command)
- preserve physgscreenr across softscreen flag toggle
- honor panning flag on resize
- fix nil dereference in panning ctl command when scr->gscreen == nil
- use clipr when drawing vga plan 9 console (vgascreenwin())
2017-12-03 18:54:25 +01:00
cinap_lenrek 4898050282 cga: capture cga console contents on boot, make sure cgapos is in range
to capture bios and bootloader messages, convert the contents
on the screen to kmesg.

on machines without legacy cga, the cga registers read out as
0xFF, resuting in out of bounds cgapos. so set cgapos to 0 in
that case.
2017-11-26 17:11:01 +01:00
cinap_lenrek af20ba6746 devvga: re-render text from kmesg after resize 2017-11-26 04:49:30 +01:00
cinap_lenrek e3736b8887 kernel: make isaconfig() consistent, not inplace tokenizing the conf string 2017-11-19 17:17:04 +01:00
cinap_lenrek 435a9a150e 9pc64: handle special case in fpurestore() for procexec()/procsetup()
when a process does an exec, it calls procsetup() which
unconditionally sets the sets the TS flag and fpstate=FPinit
and fpurestore() should not revert the fpstate.
2017-11-16 23:15:08 +01:00
cinap_lenrek 753f64a877 pc64: fix mistake fpurestore() mistake
cannot just reenable the fpu in FPactive case as we might have
been procsaved() an rescheduled on another cpu. what was i thinking...
thanks qu7uux for reproducing the problem.
2017-11-14 00:16:21 +01:00
cinap_lenrek f4880742fd igfx: allocate backing memory for framebuffer and hw cursor when not done by bios (from qu7uux)
new approach to graphics memory management:

the kernel driver never really cared about the size of stolen memory
directly. that was only to figure out the maximum allocation
to place the hardware cursor image somewhere at the end of the
allocation done by bios.

qu7uux's gm965 bios however wont steal enougth memory for his
native resolution so we have todo it manually.

the userspace igfx driver will figure out how much the bios
allocated by looking at the gtt only. then extend the memory by
creating a "fixed" physical segment.

the kernel driver allocates the memory for the cursor image
from normal kernel memory, and just maps it into the gtt at the
end of the virtual kernel framebuffer aperture.

thanks to qu7uux for the patch.
2017-11-13 00:48:46 +01:00
cinap_lenrek 4f27f6a04f pc64: allow using the FPU in syscall and pagefault handlers
The aim is to take advantage of SSE instructions such as AES-NI
in the kernel by lazily saving and restoring FPU state across
system calls and pagefaults. (everything can can do I/O)

This is accomplished by the functions fpusave() and fpurestore().

fpusave() remembers the current state and disables the FPU if it
was active by setting the TS flag. In case the FPU gets used,
the current state gets saved and a new PFPU.fpslot is allocated
by mathemu().

fpurestore() restores the previous FPU state, reenabling the FPU
if fpusave() disabled it.

In the most common case, when userspace is not using the FPU,
then fpusave()/fpurestore() just toggle the FPpush bit in
up->fpstate.

When the FPU was active, but we do not use the FPU, then nothing
needs to be saved or restored. We just switched the TS flag on
and off agaian.

Note, this is done for the amd64 kernel only.
2017-11-12 22:55:54 +01:00
cinap_lenrek 3ccd53549f pc64: set ts flag before schedinit() 2017-11-08 00:34:08 +01:00
cinap_lenrek 24057fd4f4 kernel: introduce per process FPU struct (PFPU) for more flexible machine specific fpu handling
introducing the PFPU structue which allows the machine specific
code some flexibility on how to handle the FPU process state.

for example, in the pc and pc64 kernel, the FPsave structure is
arround 512 bytes. with avx512, it could grow up to 2K. instead
of embedding that into the Proc strucutre, it is more effective
to allocate it on first use of the fpu, as most processes do not
use simd or floating point in the first place. also, the FPsave
structure has special 16 byte alignment constraint, which further
favours dynamic allocation.

this gets rid of the memmoves in pc/pc64 kernels for the aligment.

there is also devproc, which is now checking if the fpsave area
is actually valid before reading it, avoiding debuggers to see
garbage data.

the Notsave structure is gone now, as it was not used on any
machine.
2017-11-04 20:08:22 +01:00
cinap_lenrek 0e68b7551a kernel: pc/pc, fix comment line 2017-10-30 02:08:05 +01:00
cinap_lenrek 7e619e59e4 devcons: remove obsolete comment 2017-10-30 01:24:18 +01:00
cinap_lenrek 5a93b4fe2d kernel: track more header dependencies in port/portmkfile 2017-10-30 01:23:48 +01:00
cinap_lenrek b815eaca42 devswap: fix mistake 2017-10-29 23:24:42 +01:00
cinap_lenrek f3f9392517 kernel: introduce devswap #¶ to serve /dev/swap and handle swapfile encryption 2017-10-29 23:09:54 +01:00
cinap_lenrek 93117262c2 devfs: rewrite cryptio()
adjust to new aes_xts routines.

allow optional offset in the 4th argument where the encrypted
sectors start instead of hardcoding the 64K header area for
cryptsetup.

avoid allocating temporary buffer for cryptio() reads, we can
just decrypt in place there.

use sdmalloc() to allocate the temporary buffer for cryptio()
writes so that devsd wont need to allocate and copy in case
it didnt like our alignment.

do not duplicate the error reporting code, just use io()
that is what it is for.

allow 2*256 bit keys in addition to 2*128 bit keys.
2017-10-29 22:01:58 +01:00
cinap_lenrek 87274893d8 pc64: add ether82598 driver to configuration 2017-09-27 14:13:58 +02:00
cinap_lenrek d9b37eff37 ether82598: support for T540-T1, use physical addresses for isaconf port
reading mac doesnt work yet, requires ea= option in isaconf.
2017-09-27 14:13:18 +02:00
cinap_lenrek 797952d065 sdnvme: identify namespace list fails on intel ssd, just assume nsid=[1] 2017-09-27 14:02:13 +02:00
cinap_lenrek 330e7ef39b kernel: don't tokenize inplace in isaconfig() to make /dev/reboot work 2017-09-27 13:59:55 +02:00
cinap_lenrek dad00a77da kernel: get rid of 36 bit Paerange mask in mtrr (supporting machines with more than 64GB of memory) 2017-09-27 13:58:00 +02:00
cinap_lenrek 546046b46b xhci: do bounds checking in capability walking, check if controller vanished on init (thunderbolt unplug) 2017-09-22 12:55:26 +02:00
cinap_lenrek be7f3fb5e4 rename pcf kernel to pc, remove pcf, pccpuf, pccpu64 kernels, update documentation
there isnt much of a point in keep maintaining separate
kernel configurations for terminal and cpu kernels as
the role can be switched with service=cpu boot parameter.

to make stuff cosistent, we will just have one "pc" kernel
and one "pc64" kernel configuration now.
2017-09-10 22:35:23 +02:00
BurnZeZ 9af1153451 audiohda: add pci id for nvidia GM204 2017-09-10 02:27:31 +00:00
BurnZeZ 1ab2fed7a4 audiohda: add pci id for Intel 9 Series 2017-09-10 02:21:31 +00:00
cinap_lenrek e6e745e776 audiohda: add pci id for ICH10 (thanks echoline) 2017-09-10 01:37:30 +02:00
aiju bd4513fe87 devvmx: call vmxshutdown from reboot() function manually 2017-09-02 10:43:37 +00:00
cinap_lenrek e44bf536af ether82563: make the ethernet of thinkpad p50 work (thanks sam-d) 2017-08-29 19:38:29 +02:00
cinap_lenrek b41bd1b007 audiohda: Intel Sunrise Point-H support (thanks sam-d) 2017-08-29 19:37:26 +02:00
cinap_lenrek 30ea7ad58a sdnvme: pass 0 instead of 0xffffffff as NSID for identify controller and create completion/submission queue commands (thanks Ori_B)
Samsung SSD 960 EVO fails with invalid namespace error otherwise...
2017-08-29 09:52:53 +02:00
cinap_lenrek c4e51c5678 devdup: remove useless OCEXEC check, handled by namec() 2017-08-28 19:45:49 +02:00
cinap_lenrek 6fa983a5b9 merge 2017-08-28 19:42:19 +02:00
cinap_lenrek c492a8009a devsegment: handle ORCLOSE on segment directory correctly, fix wrong qid, missing COPEN flag for segmentcreate() 2017-08-28 19:40:53 +02:00
aiju e5d3aaf1aa devvmx, vmx: lilu dallas multivm 2017-08-28 17:27:41 +00:00
cinap_lenrek 543ccb37f4 sdiahci: Intel 200 Series Chipset Family PCH support (thanks aiju)
we used to tweak arround in the ICH registers for all intel controllers,
which is wrong, as the 200 series has different magic registes. see
the datasheet:

https://www.intel.com/content/www/us/en/chipsets/200-series-chipset-pch-datasheet-vol-2.html

this caused the clocks to be disabled for the 6th port causing a full
machine lockup touching the 6th port registers.

the next problem was that aiju's bios disabled the unused ports somehow
but didnt clear ther PI bits, so that they would stay in Sbist status even
after a port reset. so the port would get stuck in the Dportreset state
forever. the fix for this was to use a one second timeout for the
port reset procedure.
2017-08-27 21:20:20 +02:00
aiju 9616f61872 devvmx: more efficient data structure for memory map; simplified (more reliable) step function 2017-08-24 07:53:10 +00:00
qwx eeb8007e60 igfx: add did for x220 2017-08-20 13:52:52 +03:00
cinap_lenrek c78d4c4ce7 ether82563: add more pci ids for i210 and i354 from 9atom / openbsd 2017-08-13 15:26:24 +02:00
cinap_lenrek b3d581752b ether82563: support for i211 with iNVM. (thanks mfny and brennan for testing) 2017-08-12 23:36:24 +02:00
cinap_lenrek 6b999263ae kernel: double READSTR buffer size to 8000 bytes for devusb 2017-08-11 01:32:24 +02:00
cinap_lenrek 7dab492324 devusb: superspeed bandwidth allocation handled by controller, skip usbload() calculation
with xhci, bandwidth allocations are handled by the controller
and there are various speed settings possible that currently
not exposed in the Udev. so just keep usbload() as it is for
usb2 and keep ep->load as zero for superspeed.
2017-08-11 01:08:13 +02:00
cinap_lenrek e0474599dd usbxhci: implement recovery from host controller errors 2017-08-07 01:59:54 +02:00
cinap_lenrek bb625cebfc etheriwl: add pci id for Intel Centrino Advanced-N 6200 on x201 tablet (thanks arpunk) 2017-08-03 23:15:58 +02:00
cinap_lenrek 83b87729d9 usbxhci: handle out of memory in controller initialization 2017-08-02 21:17:50 +02:00
cinap_lenrek 1ea109345b usbxhci: abandon multiple requests per endpoint, cleanup
more conservative approach: only one transaction in flight
per endpoint (except iso). also serialize controller commands.
no driver currently uses this and i doubt it is usefull.

create constants for common TRB flags and remove bogus 1<<16
flag on TR_NORMAL.
2017-08-02 20:25:19 +02:00
cinap_lenrek 8ed13fe664 usbxhci: have to serialize and set read pointer for endpoint stop command 2017-08-02 01:45:30 +02:00
cinap_lenrek 5f23d78f06 usbohci, usbehci, usbxhci: save mmio base address in ctlr, cant PADDR() on 386... 2017-07-31 17:36:56 +02:00
cinap_lenrek 48352be825 usbxhci: provide shutdown function to halt the controller 2017-07-31 16:05:58 +02:00
cinap_lenrek 6e65596827 xhci: experimental usb3 support 2017-07-31 03:22:23 +02:00
cinap_lenrek d46099e3af usbehci: fix crash in cancelisoio() for highspeed device due to wrong pollival 2017-07-31 03:07:14 +02:00
cinap_lenrek adfb0e9371 pc, pc64: enable usbxhci in the configuration 2017-07-29 01:15:05 +02:00
cinap_lenrek cd108e2f0b usbxhci: simplify xecp() 2017-07-29 01:12:32 +02:00
cinap_lenrek c74538a67e usbxhci: implement controller handoff, ignore usb3.0 ports, honor pollival for isochronous endpoints 2017-07-29 01:02:23 +02:00
cinap_lenrek aaf6d7c558 usbxhci: basic iso write support (usb soundcard playback) 2017-07-24 23:48:50 +02:00
cinap_lenrek a397bfd48c usb: fix wrong pollival calculation in setmaxpkt() 2017-07-24 23:47:55 +02:00
cinap_lenrek 0b4ace02c4 usbxhci: handle changing maxpkt on control endpoint by reevaluating endpoint context
while endpoints != 0 are opend after the device descriptor has been
parsed and the endpoint properties like maxpkt have been set, the
control endpoint is opend with a guessed maxpkt value. once the first
8 bytes of the descriptor have been read by usbd, maxpkt gets set and
we need to reevaluate the control endpoint 0 context to update the value.
2017-07-22 19:35:32 +02:00
cinap_lenrek f72bcce2c7 usbxhci: use physical register addresses for matcing controllers and printing. simplify endpoint slot initialization. 2017-07-22 16:37:05 +02:00
cinap_lenrek f0217d2c3f usbohci, usbuhci, usbehci: use physical address of registers for matching controllers and printing 2017-07-22 16:35:13 +02:00
cinap_lenrek ffb28698bf kernel: fix bounds check in screenputc() 2017-07-20 21:03:00 +02:00
cinap_lenrek 4fd68773e2 usbxhci: implement command timeouts and aborts, serialize unstall 2017-07-20 19:57:14 +02:00
cinap_lenrek 40dc39bf7d usbxhci: better approach to unstalling endpoint and fixup td ring
instead of guessing where the controllers dequeue pointer went,
stop the endpoint and then explicitely set te dequeue pointer to
the next write td position. that way we do not need to fix the cycle
bit in the td's and dont need to rely on if the controller
advanced the dequeue pointer after a stall or not.

add ctx and slot back pointers to ring.
2017-07-17 21:10:25 +02:00
cinap_lenrek e7e18aac7f pc kernel: mkfile target usbehcipc.$O needs ../port/usb.h, add usbxhci.$O 2017-07-16 22:33:24 +02:00
cinap_lenrek 5e6f1b5769 usbxhci: commit work in progress xhci driver, no config yet 2017-07-16 22:29:29 +02:00
cinap_lenrek f58706f2cf zynq: simplify initcode stack setup (just do it in init0 when the stack is mapped) 2017-06-28 18:57:13 +02:00
cinap_lenrek befdd7d755 kernel: pass bootargs also in multiboot command line, retire the bootline mechanism to pass arguments to /boot/boot 2017-06-28 18:56:16 +02:00
cinap_lenrek 63b8965b42 devvmx: add support for SG_STICKY segments 2017-06-25 22:57:47 +02:00
cinap_lenrek aab4e32ce0 pc, pc64: support for multiboot framebuffer, common bootargs and multiboot code 2017-06-25 22:22:58 +02:00
aiju cabfa4e916 devvmx: add support for extrap command to configure halting on exceptions 2017-06-21 22:19:14 +00:00
aiju 37b9ab5a04 devvmx: error handling in clearmeminfo 2017-06-21 09:59:32 +00:00
aiju 779f6cb3b8 devvmx: remember segment names and free segments properly 2017-06-21 09:16:43 +00:00
cinap_lenrek 2723c9fc77 kernel: add support for sticky segments (cached, preallocated, never paged) 2017-06-20 21:53:45 +02:00
aiju becb89bae5 pc, pc64: adapt devvmx to work on pc64 2017-06-20 15:10:08 +00:00
aiju ed040d676a devvmx: fix CR0/CR4 readout; also don't exit on PAUSE instruction 2017-06-18 22:13:20 +00:00
aiju 2bb65c40ab devvmx: support debug registers; simplify assembly 2017-06-17 22:38:16 +00:00
aiju 74241e31aa devvmx: support pat and efer registers 2017-06-14 17:38:01 +00:00
aiju 8029c3d8c4 pc: add vmx device 2017-06-13 14:15:09 +00:00
aiju 13869bab11 pc/pc64: keep shadow copy of DR7 in Mach and use that to check whether we need to reset DR7 in procsave(); remove superfluous reset of DR7 in mmurelease() 2017-06-13 00:10:36 +00:00
aiju e8082c1d1f remove accidentally committed reference to devvmx 2017-06-12 23:03:40 +00:00
aiju dea6bc51bc pc/pc64: debugexc: ignore exception if in kernel mode and can't get hold of up->debug 2017-06-12 22:58:25 +00:00
aiju 3844090f39 pc/pc64: reset DR7 in mmurelease 2017-06-12 19:46:25 +00:00
aiju cd1f44b5c0 kernel: reset nwatchpt in pexit 2017-06-12 19:19:05 +00:00
aiju 773be02aa1 kernel: add support for hardware watchpoints 2017-06-12 19:03:07 +00:00
aiju 1cfa405d0a pc64: set error code and trap fields in Ureg* on syscalls 2017-06-12 17:09:11 +00:00
aiju 48c5da7a64 ethervirtio: report correct length; fail gracefully if we can't initialize queues 2017-06-12 11:25:12 +00:00
cinap_lenrek 94e26e7576 kernel: make statistics counters skipscheds and preempts unsigned 2017-06-03 18:59:48 +02:00
cinap_lenrek 3d1908d762 kernel: don't preempt pager during fscache reclaim
the fscache image is the main source for pages once
the page freelist got exhausted, so delay scheduling
until they release the fscache lock.
2017-06-02 17:02:43 +02:00
aiju 48fa332c61 pc: actually call netconsole() 2017-06-01 06:40:05 +00:00
aiju 7134d62ccb pc: add netconsole 2017-05-31 23:41:21 +00:00
cinap_lenrek eb6bba80ef merge 2017-05-30 16:10:23 +02:00
cinap_lenrek 1bc20697ed devsegment: return proper write count for ctl message 2017-05-30 16:08:47 +02:00
qwx 6f63752d84 igfx: add support for haswell graphics
add support for edp, dp and hdmi on haswell and haswell ult.
vga, dvi and specific configurations like ulx are unimplemented.

remaining issue: edp link training always fails (time out).
2017-05-22 18:19:24 +02:00
cinap_lenrek 760e539811 kernel: avoid panic with segio and SG_FAULT segments
the problem is that segio doesnt check segment attributes
and it can't really in case of SG_FAULT which can be
inherited from pseg and toggle at any time.

so instead of returning -1 from fault into the fault$cputype
handler which then panics when fault happend kernel mode,
we jump into segio's waserror() block just like in the
demand load i/o error case (faulterror()).
2017-05-21 16:36:11 +02:00
cinap_lenrek 7327bd43c0 kernel: fix namelenerror(), avoid memrchr() and make it static
make sure the loop terminates and doesnt get stuck at
name == aname. avoid memrchr() as it conflicts with
libc on unix (drawterm). declare namelenerror() as
static.
2017-05-07 18:13:37 +02:00
cinap_lenrek f317d233f4 devproc: can't wait for ourselfs to stop (thanks Shamar) 2017-05-06 00:49:47 +02:00
cinap_lenrek fa94532c08 vgamach64xx: remove drawdebug reference 2017-05-01 02:15:03 +02:00
cinap_lenrek 24420ab9eb kernel: fix rewinding in directories with pread() offset
reading directories with pread() offset has to work the same
way as read(), otherwise exportfs breaks rewinding in directories.
2017-04-30 01:51:07 +02:00
cinap_lenrek 3c894ece0c devdraw: ignore drawdebug command 2017-04-29 21:09:11 +02:00
cinap_lenrek 34f5a83330 pc64: state mp.h dependency for archacpi.$O 2017-04-11 02:26:39 +02:00
cinap_lenrek 00fbdd622a kernel: avoid waserror() botch in devwalk (from drawterm, thanks aiju)
calculate alloc flag before waserror(), as compilers like
gcc will not notice the value changing later because
setjump() restores the old value due to callee-saves.

change is applies here to make it easier to merge with
drawterm.

thanks to aiju for debugging this; used to cause drawterm
memory leak until compiled with gcc -O0.
2017-04-05 00:34:07 +02:00
cinap_lenrek 30c05fe3dd kernel: fix memory leak in checkpagerefs() debug function (thanks aiju) 2017-04-04 20:13:31 +02:00
cinap_lenrek 8829d51f50 devvga: remove unused copy of checkport() function 2017-04-02 20:17:44 +02:00
cinap_lenrek 8ea31ae7b2 devvga: fix mistake 2017-04-02 20:10:44 +02:00
cinap_lenrek a6d852d0a6 devvga: include hwgc in vgactl file 2017-04-02 20:08:15 +02:00
cinap_lenrek 557cbe10ad sdnvme: enable in pcf, pccpuf, pc64 kernel configuration 2017-03-30 23:37:28 +02:00
cinap_lenrek 8cacd2cc0a sdnvme: don't write completion queue doorbell register when nothing has been processed
turns out on real hardware, the front falls off if we write
the completion queue doorbell registers without consuming
an entry. so only write the register when we have processed
something.
2017-03-30 23:33:46 +02:00
cinap_lenrek 0c1110ace2 kernel: fix twakeup()/timerdel() race condition
timerdel() did not make sure that the timer function
is not active (on another cpu). just acquiering the
Timer lock in the timer function only blocks the caller
of timerdel()/timeradd() but not the other way arround
(on a multiprocessor).

this changes the timer code to track activity of
the timer function, having timerdel() wait until
the timer has finished executing.
2017-03-29 00:30:53 +02:00
cinap_lenrek bfae9e08be sdnvme: NVMe controller driver (work in progress)
basic NVMe controller driver, reads and writes work.
"namespaces" show up as logical units.
uses pin/msi interrupts (no msi-x support yet).
one submission queue per cpu, shared completion queue.
no recovery from fatal controller errors.
only tested in qemu (no hardware available).

commiting this so it can be found by someone who has
hardware.
2017-03-29 00:21:35 +02:00
cinap_lenrek f59ef5e8e7 devsd: handle case where theres no ifc->enable() function 2017-03-26 16:53:19 +02:00
cinap_lenrek 019bb580da devsd: check return value of ifc->enable(), don't leak unit name/user strings 2017-03-26 16:45:34 +02:00
cinap_lenrek 1889aa50c3 sdvirtio: return 1 for success in vioenable()/viodisable() 2017-03-26 16:43:32 +02:00
cinap_lenrek 4e8494aad7 pc kernel: handle PCMP and RSD being in low (kaddr) or reserved (vmap) memory
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.
2017-03-25 04:08:14 +01:00
cinap_lenrek 1a2aefcf11 devmouse: refactor screen blanking logic
devmouse controls the screen blanking timeout, so move the
code there avoiding cross calls between modules. the only
function that needs to be provided is blankscreen(), which
gets called with drawlock locked.

the blank timeout is set thru /dev/mousectl now, so kernels
without devvga can set it.

blanking now only happens while /dev/mouse is read. so this
avoids accidentally blanking the screen on cpu servers that
do not have a mouse to unblank it.
2017-03-18 16:58:27 +01:00
cinap_lenrek 8177d20fb2 kernel: get rid of active.Lock and active.thunderbirdsargo 2017-03-11 16:30:51 +01:00
cinap_lenrek a7f8ebca2f pc kernel: give cpu servers as many image cache strctures as processes 2017-03-11 16:28:11 +01:00
cinap_lenrek 5104934135 pc kernel: avoid AP's spinning in syncclock(), don't wait for thunderbirdsargo 2017-03-11 16:24:56 +01:00
cinap_lenrek 812383473c pc kernel: assume tsc and lapic clock rate on application processors is the same as on bootrap processor 2017-03-11 16:18:01 +01:00
cinap_lenrek 3e0e77a852 pc kernel: don't use active.thunderbirdsargo in vunmap() tlb flush code 2017-03-11 16:13:58 +01:00
cinap_lenrek cb5f6005bc teg2: fix format string warning in mmu.c 2017-03-11 16:07:48 +01:00
mischief a4895f5e44 pc64: enable cputemp driver
works on on x301 and t420.
2017-03-01 02:43:51 -08:00
mischief 319a9cc905 pc, pc64: bump Qmax in devarch
my x301 and t420 run out of archfiles with *acpi= while trying to add
hdacmd from audiohda.
2017-03-01 02:43:14 -08:00
cinap_lenrek 04171d2477 ether8169: add support for RTL8106E (thanks _potato) 2017-02-21 21:53:10 +01:00
cinap_lenrek a32d11dff3 ether82563: work arround phyprobe() failing on 82579LM without cable plugged in (thanks mischief)
on 82579LM, the phy status is inaccessible without
a cable plugged, so we wait and retry phyprobe() once
the link status changes.
2017-02-20 22:01:54 +01:00
cinap_lenrek 52570a2a2d ether82563: support for i219 (tested on t460p, thanks aiju) 2017-02-19 18:20:46 +01:00
cinap_lenrek 3ea0572f4f wifi: timestamps in debug print, flush queue on deassoc, shorter roam timeout, timeout in blocked state, fix essid seprint race
- add some milisecond timestamps to the status change debug printing
- flush the packets in the queue on deassoc to avoid processing old pae
  packets on next association.
- make roaming timeout shorter (60 -> 20 seconds)
- automatically timeout and restart wpa/pae blocked state
- fix printing race when essid gets changed underneath seprint
2017-02-16 20:08:27 +01:00
cinap_lenrek c1c644d13c etheriwl: add support for Centrino Advanced-N 6030, 6235 (thanks khm, openbsd)
from openbsd driver, it seems the Centrino Advanced-N 6030 and 6235
cards share the same device revision as the 6205 (Type6005). Also
changing the device revision field from 4 to 5 bits.
2017-02-16 20:03:41 +01:00
cinap_lenrek 45d01d9c99 wifi: handle short preamble and short time slot capabilities
- drivers enable short preamble and sort timeslot depending
  on the ap beacon capinfo field (bss->cap)
- wifi sets short preamble bit in capinfo on association request
- wifi sets short timeslot bit when ap advertized it in beacon
2017-02-13 22:26:38 +01:00
cinap_lenrek 9278b94623 pc/pc64: get rid of timerset(0) case, was used with "i8253set off" ctl 2017-01-22 21:12:38 +01:00
cinap_lenrek 885d41dd7b sgi: get rid of timerset(0) case 2017-01-22 21:08:28 +01:00
cinap_lenrek 6cb359cc00 sgi: cleanup timer code
- no need to splhi() in timerset, always called with
  interrupts off.

- make timerset always update the period (next == 0)

- remove period update in fastticks(), simplify
  delta calculation.
2017-01-22 20:39:14 +01:00
cinap_lenrek cb1555c7d7 sgi: change definition of tas() to take void* like the rest 2017-01-12 21:11:34 +01:00
cinap_lenrek 47f07b2669 kernel: make the mntcache robust against fileserver like fossil that do not change the qid.vers on wstat
introducing new ctrunc() function that invalidates any caches
for the passed in chan, invoked when handling wstat with a
specified file length or on file creation/truncation.

test program to reproduce the problem:

#include <u.h>
#include <libc.h>
#include <libsec.h>

void
main(int argc, char *argv[])
{
	int fd;
	Dir *d, nd;

	fd = create("xxx", ORDWR, 0666);
	write(fd, "1234", 4);
	d = dirstat("xxx");
	assert(d->length == 4);
	nulldir(&nd);
	nd.length = 0;
	dirwstat("xxx", &nd);
	d = dirstat("xxx");
	assert(d->length == 0);
	fd = open("xxx", OREAD);
	assert(read(fd, (void*)&d, 4) == 0);
}
2017-01-12 20:13:20 +01:00
cinap_lenrek 4aeefba681 kernel: add "close" ctl message for tcp connection to gracefully hang up a connection without a tcp reset (used by go) 2017-01-12 20:04:41 +01:00
cinap_lenrek 8547defe70 vgaigfx: enable softscreen by default
given that the igfx driver doesnt provide any acceleration functions
and drawing is usually faster with double buffering as it eleminates
reads over the pci bus, enable softscreen by default.
2016-12-29 03:46:08 +01:00
cinap_lenrek 2830cd7eb6 pc: modify cpu0 page tables in patwc() instead of current cpu ones
on 386 kernel, each processor has its own pdb where the primary
pdb for kernel mappings is on cpu0 and other cpu's lazily pull
pdb entries from cpu0 when they fault in vmapsync().

so we have to edit the table tables in the pdb of cpu0 and not
the current processor.
2016-12-17 19:47:35 +01:00
cinap_lenrek ea30cf94a5 pat write combinding support for 386 kernel, honor cpuid bits 2016-12-17 16:35:26 +01:00
cinap_lenrek d48a089486 pc64: implement simple write combining for framebuffers with the PAT
on some modern machines like the x250, the bios arranges the mtrr's
and the framebuffer membar in a way that doesnt allow us to mark
the framebuffer pages as write combining, leading to slow graphics.

since the pentium III, the processor interprets the page table bit
combinations of the WT, CD and bit7 bits as an index into the
page attribute table (PAT).

to not change the semantics of the WT and CD bits, we preserve
the bit patterns 0-3 and use the last entry 7 for write combining.
(done in mmuinit() for each core).

the new patwc() function takes virtual address range and changes
the page table marking the range as write combining. no attempt
is made on invalidating tlb's. doesnt matter in our case as the
following mtrr() call in screen.c does it for us.
2016-12-15 23:27:01 +01:00
cinap_lenrek 052abe1cc8 xen: fix build by adding missing rdrandbuf() function 2016-12-14 20:02:07 +01:00
cinap_lenrek 5d353d62fe devmouse: remove unused static map[] array 2016-12-11 16:02:30 +01:00
cinap_lenrek b3c1fa9ecf devmouse: change msec argument of *mousetrack() to ulong 2016-12-10 16:12:18 +01:00
cinap_lenrek 7a145e89b3 audioac97: support for ICH4-ICH7 based cards with memory mapped registers (thanks echoline) 2016-12-05 18:32:58 +01:00
cinap_lenrek 9a55346264 devmouse: various bugfixes, simplify
the assumption of only one producer ((abs)moustratrack()) is not true
for external mouse events from /dev/mousein, so protect the mouse state
and queue with ilock().

get rid of mousecreate(), just use devcreate().

reset cursor when all instances of /dev/mouse and /dev/cursor got closed,
instead of also considering /dev/mousectl. the reason is that kbdfs keeps
the mousectl file open. so exiting a program that has the cursor changed
will properly reset the cursor to arrow.

don't access user buffer while holding cursor spinlock! the memory access
can fault. theres also no lock needed there, we'r just copying *from* the
cursor memory.

fix use of strtol(), p will always be set, check for end of string.

keep pointer coordinates onscreen (off by one).

make lastms() function to get the last millisecond delta of last
call for resynchronization.

fix msg[3] buffer overflow in m5mouseputc().

get rid of mouseshifted logic, it is not used.
2016-11-29 21:11:48 +01:00
cinap_lenrek 3dc64de2e4 omap: cleanup mouse.c, just a dummy for mousectl() 2016-11-29 20:54:17 +01:00
cinap_lenrek 807019d6eb omap: fix format string warning %d for long 2016-11-29 20:51:08 +01:00
cinap_lenrek 93f122b94a link loopbackmedium and netdevmedium in bcm/pif, sgi/indy and zynq kernels 2016-11-19 16:45:18 +01:00
cinap_lenrek dd4de0b0fa devtls: remove unused get32() function 2016-11-17 18:14:06 +01:00
cinap_lenrek 1a782fda3e pc64: check if vmap() range fits in VMAPLEN window, remove unneeded vmapsync(), rename fault386() to faultamd64() 2016-11-17 01:28:11 +01:00
cinap_lenrek 78d2a52577 ip/tcp: never raise the mss over the link mtu < 1280 for v6
v6 mandates minimum mtu of 1280, tho someone *could* setup
an interface with a lower mtu or set it lower for testing.
2016-11-16 00:54:04 +01:00
cinap_lenrek 323d625864 ip: get rid of update_mtucache() and restrict_mtu() prototypes 2016-11-15 22:13:08 +01:00
cinap_lenrek 30c5c3404b ip/pktmedium: no mintu, no maclen... thi is ip packets 2016-11-15 22:11:47 +01:00
cinap_lenrek 3579757291 ip/pktmedium: fix wrong hsize, theres no ethernet header on packet media
packet media is just raw ip packets, so theres no link-level
header there. was probably copy-pasted from ethermedium...
2016-11-15 21:54:03 +01:00
cinap_lenrek 1f628ef132 ip/tcp: only calculae mss from interface mtu when directly reachable for v6
we currently do not implement path mtu discovery so for
destinations that are not directly reachable assume the
minimum mtu of 1280 bytes.
2016-11-15 20:28:45 +01:00
cinap_lenrek c86b5ddaa6 kernel/qio: make readblist() offset of type ulong as the rest 2016-11-12 17:41:58 +01:00
cinap_lenrek 2127b8c552 kernel/qio: get rid of unused qcopycnt debug variable 2016-11-12 16:05:00 +01:00
cinap_lenrek d2ad8df947 kernel/qio: implement concatblock() with pullupblock() 2016-11-09 19:44:38 +01:00
cinap_lenrek d97eb114d5 kernel/ip: fix typo (rfc -> ifc) 2016-11-08 22:33:48 +01:00
cinap_lenrek ba38aa8b9d gre: check nil for pullupblock() 2016-11-08 22:33:19 +01:00
cinap_lenrek 58fe71b2f5 devbridge: simplify etherwrite() as we dont deal with block lists 2016-11-08 21:06:06 +01:00
cinap_lenrek 99cc56f2e9 kernel/ip: remove nil checks for allocb() and padblock() 2016-11-08 21:05:01 +01:00
cinap_lenrek 5cbffd6e6b kernel/qio: maintain Block.next pointer in padblock() 2016-11-08 21:03:08 +01:00
cinap_lenrek b431b6c169 kernel/qio: fix comments, fix qiwrite() on close queue, remove debug setmalloctag() call in qwrite() 2016-11-08 00:38:07 +01:00
cinap_lenrek 32dfbc7c50 devcons: simplify putstrn0() 2016-11-08 00:34:59 +01:00
cinap_lenrek 48b49361d8 devbridge: various bugfixes and improvements from charles forsyth 2016-11-07 22:43:37 +01:00
cinap_lenrek a54d1cd95e kernel/qio: big cleanup of qio functions
remove bl2mem(), it is broken. a fault while copying to memory
yields a partially freed block list. it can be simply replaced
by readblist() and freeblist(), which we also use for qcopy()
now.

remove mem2bl(), and handle putting back remainer from a short
read internally (splitblock()) avoiding the releasing and re-
acquiering of the ilock.

always attempt to free blocks outside of the ilock.

have qaddlist() return the number of bytes enqueued, which
avoids walking the block list twice.
2016-11-07 22:20:10 +01:00
cinap_lenrek 23d217afb4 devloopback: simplify loopoput()
remove unneeded waserror() block, loopoput is alled from
loopbackbwrite only so we will always get called with a
*single* block, so the concatblock() is not needed.
2016-11-07 22:08:21 +01:00
cinap_lenrek 857f2528e0 ip: always pass a single block to Medium.bwrite(), avoid concatblock() calls in Dev.bwrite()
the convention for Dev.bwrite() is that it accepts a *single* block,
and not a block chain. so we never have concatblock here.

to keep stuff consistent, we also guarantee thet Medium.bwrite()
will get a *single* block passed as well, as the callers are
few in number.
2016-11-07 22:05:29 +01:00
cinap_lenrek ea993877a9 ip/nullmedium: free passed block in nullbwrite() 2016-11-07 21:40:12 +01:00
cinap_lenrek 59dd0af53a ip/tcp: remove useless nil checks for padblock() and allocb() return value 2016-11-07 21:39:28 +01:00
cinap_lenrek c1fd7c210b kernel: fix missing ; in panic() call 2016-11-05 20:08:20 +01:00
cinap_lenrek 963497f06b kernel: avoid padblock copying for devtls/devssl/esp, cleanup debugging
to avoid copying in padblock() when adding cryptographics macs to a block
in devtls/devssl/esp we reserve 16 extra bytes to the allocation.

remove qio ixsummary() function and add acid function qiostats() to
/sys/lib/acid/kernel

simplify iallocb(), remove iallocsummary() statitics.
2016-11-05 20:05:40 +01:00
cinap_lenrek 240590ab0a archacpi: fix format string warning on amd64 2016-11-05 18:31:50 +01:00
cinap_lenrek fa5bd71218 devmnt: avoid memory copies of I/O rpc buffer by using bwrite()
given that devmnt will almost always write into a pipe
or a network connection, which supports te bwrite routine,
we can avoid the memory copy that would have been done by
devbwrite(). this also means the i/o buffer for writes
will get freed sooner without having to wait for the 9p
rpc to get a response, saving memory.

theres one case where we have to keep the rpc arround and
that is when we write to a cached file, as we want to update
the cache with the data that was written, but the user buffer
cannot be trusted to stay the same during the rpc.
2016-11-05 18:26:12 +01:00
cinap_lenrek 5c1feb0ef0 libc: move calloc() into its own compilation unit
move calloc() in its own compilation unit to avoid
code duplication. also, calloc() is used rarely in
plan9 programs.
2016-11-05 18:00:10 +01:00
cinap_lenrek 234137bce3 fix bugs and cleanup cryptsetup code
devfs:

- fix memory leak in devfs leaking the aes key
- allocate aes-xts cipher state in secure memory
- actually check if the hexkey got fully parsed

cryptsetup:

- get rid of stupid "type YES" prompt
- use genrandom() to generate salts and keys
- rewrite cryptsetup to use common pbkdf2 and readcons routines
- fix alot of error handling and simplify the code
- move cryptsetup command to disk/cryptsetup
- update cryptsetup(8) manual page
2016-10-24 20:56:11 +02:00
cinap_lenrek 98dba9a4a3 pc/archacpi: don't do acpi initialization in the kernel, provide generic 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-23 04:09:27 +02:00
cinap_lenrek 055f837043 ip: simplify code as packblock() and concatblock() will never error 2016-10-23 00:31:42 +02:00
cinap_lenrek 75c6ab45e0 devip: simplify ipbwrite() by using retun value of qbwrite() 2016-10-23 00:29:41 +02:00
cinap_lenrek ef5c862ce9 ip/icmp: only reply to echo request when directed to us and source is unicast 2016-10-23 00:25:17 +02:00
ftrvxmtrx e01577f8f6 archacpi: optionally export acpi memory regions; properly initialize environment 2016-10-18 23:04:19 +02:00
cinap_lenrek 2aa727ff09 etherzynq: implement promisc mode and multicast filter support 2016-09-17 15:58:11 +02:00
cinap_lenrek c0a9c3b551 kernel: rekey chacha state on each randomread() invocation
we can encrypt the 256 bit chacha key on each invocation
making it hard to reconstruct previous outputs of the
generator given the current state (backtracking resiatance).
2016-09-11 19:07:17 +02:00
cinap_lenrek 36c9a2489d devcons: remove /dev/reboot "halt" command...
the "halt" command written to /dev/reboot just causes the
machine to crash... its also undocumented... removing it.

--
cinap
2016-09-11 14:12:39 +02:00
cinap_lenrek 95c9f5bf37 kernel: better nonce partitioning for chacha random number generator
leave the block counter to chacha_encrypt() and increment the 96 bit
iv instead.
2016-09-11 03:18:48 +02:00