Age | Commit message (Collapse) | Author |
|
Add some checks in the interrupt handler to ensure
that the slot and ring referred to by the event have
been initialized.
Also add a check in ctlrcmd() just in case we mess
up the recovery and someone issues a ctlrcmd() after
a failed xhciinit().
|
|
When a ring wraps around, we need to program a wrap around
td with the base address. To get the base, we need to call
Ctlr.dmaaddr() and we used the slot->ctlr pointer to get to
it.
But the command ring has no slot associated to it so we would
crash as soon as we tried to submit more than 256 controller
commands.
The solution is to put a ctlr pointer into the Ring structure,
which also allows us to simplify resetring() and waittd()
as they now can get the controller implicitely thru the ring
pointer.
|
|
|
|
|
|
tested with 6205
|
|
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.
|
|
|
|
Oversight, was using free() instead of freenote(),
which handles the refcounting for gorup notes.
|
|
We expose the boot partitions as separate units,
such as sdM0 is the user data partition and sdM1
is the first boot partition and sdM2 is the
second boot partition.
On access, we automatically switch the
BOOT_PARTITOIN_ACCESS bits in the EXT_CSD.
Also, the units ctl file contains "boot enabled"
or "boot disabled" if that unit is the active
or inactive boot partition.
|
|
|
|
|
|
The hub address is only usefull for the host controller
driver, while userspace really cares about the device number.
|
|
There is currently no way to get the current mouse position
and button states without blocking.
|
|
|
|
- pass the correct ocr value for SEND_OP_COND (advertise Hcs and 3.3v)
- disambiguate SEND_RELATIVE_ADDRESS/SET_RELATIVE_ADDRESS
- detect the MMC version from CSD structure
- detect the capacity according to spec for MMC
- implement SWITCH command to set highspeed frequency and bus width
- rename Ctlr to Card (thats really what we keep track of here)
|
|
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.
|
|
Make global variables static to avoid symbol clashes.
Order Link fields more compactly for 64-bit archs.
Add a common freelink() function for freeing Boards and Srvs.
Chain all Boards in a circular doubly-linked list,
so srvrename() can actually change the owners of *all*
the boards instead of just the root. We cannot use
recursion here as that could potentially blow the
kernel stack.
srvname() was also only processing the root.
Instead, we add a srvname field to Chan and set it to
the original path of the srv file that was used to post
the channel.
Call openmode() at the beginning of srvopen().
The reason is if omode has invalid bits it can error
and leave stuff in a inconsistent state.
Prevent srvwstat() to rename a file to "clone", it is
reserved.
Get rid of "lease expired" error message, just use
Eshutdown.
|
|
Mount /fd, /proc, /srv and /shr in initcode
and open /dev/cons instead of #c/cons.
This way, /boot/boot could theoretically be a rc-script
and there is less reliance on magic device characters.
|
|
Need to close the channel outside of srvlk,
otherwise risk deadlock when recursing.
|
|
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.
|
|
On error, we must free the temporary stack segment
while holding up->seglock.
|
|
|
|
|
|
For the reform kernel, we used to have a slightly modified
copy of port/usbxhci.c as the controller was implemented in
soc specific registers and requires some rocket science
initialization.
Instead, we want to have a common generic xhci driver (usbxhci)
and separate drivers that deal with the specific implementation
such as usbxhcipci and usbxhciimx.
|
|
|
|
|
|
The xhci spec says that the HCRST bit is cleared once the reset is
complete, and that no operational or runtime registers shall be
written while the bit is set.
Waiting for the reset to complete fixes initialization of some host
controllers, such as the ASMedia ASM1142, which otherwise enter an
endless init-recover loop.
Also, add a comment about the reason for the 1ms delay. This appears
to work around a system hang bug in intel chipsets through the 400
series (see errata 15 in [0]).
[0] https://cdrdv2-public.intel.com/620856/620856-009.pdf
|
|
when we have more processors than submit queues,
the submit queues are shared between some processors
and hence we have to acquire its lock.
in the case of the submit queue being full, we have
to unlock it again before retrying otherwise we have
a deadlock.
sorry :(
|
|
Some ethernet drivers like ethervt6105M maintain
a custom pool of Blocks using Block.free
callback.
To maintain that Block.list pointer is
nil when reused, we have to clear it before
returning it to the custom pool as the custom
pool code is not aware of it.
Also, poison Block.list pointer before free().
|
|
investigating
|
|
We want to provide userspace PCI config space
access on platforms that have PCI, but do not
have ISA bus.
For this, provide a stripped down version of
devpnp, wiht only the pci support that can then
be used by pi4 (bcm64) and reform (imx8) kernels.
|
|
when many processes go to sleep, our old timer would
slow to a crawl; this new implementation does not.
|
|
dmaflush() is a no-op macro on amd64, so
wrap all calls into {} braces to avoid
the compiler warning.
|
|
|
|
when forwarding packets (gating), unconditionally
check tcp-syn packets for the mss-size option and
reduce it to fit the mtu of the outgoing interface.
this is done by exporting a new tcpmssclamp() function
from ip/tcp.c that takes an ip packet and its buffer size
and the effective mtu of the interface and adjusts
the mss value of tcp syn options.
this function is now also used by devbridge, enforcing
a tcp mss below the tunnel mtu.
|
|
postnotepg()
Half NERR stack to 32.
When posing a note to a large group, avoid allocating Notes
for each individual process, but post the reference instread.
factor out process interruption into procinterrupt().
Avoid allocation of notes in alarmkproc, just posting the
same note to everyone.
|
|
|
|
to reproduce:
for(i in `{seq 10}) echo softscreen off >/dev/vgactl
|
|
de-bloat the proc structure by allocating notes
with on the heap instead of embedding them in
the proc structure.
This saves around 640 bytes per process.
|
|
Handlin notes is common for all architectures
except how the note has to be pushed on the user
stack.
This change adds a popnote() function that returns
only the note string or nil if the process should
not be notified (no notes or user notes hold off).
Popnote() also handles common errors like notify
during note handling or missing note handler and
will suicide the process in that case.
|
|
|
|
When probing a timer, we were running in our own kproc,
and not in an interrupt context, which meant that we didn't
have any access to anything worth sampling, so we didn't
give any data back.
This moves the probe to the hzclock interrupt, and returns
the pc in the probe.
|
|
The kernel stack is now above the Proc structure,
so the explicit kstack pointer can be eliminated.
|
|
procs come from the dynamic pools, so we don't need
to remove the memory used by possible procs from the
total available.
|
|
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.
|
|
We dont expose this anymore, wrapping
these would be bad. Just send more bits.
|
|
For "in" transactions, the "Total Bytes to Transfer" field in
the siTD is decremented by the controller by the actual transfer
size, so what remains in the field is the residue number of bytes.
Also, handle restart when we get a zero byte read on a isochronous
"in" endpoint in devusb itself (removing the restart code for
xhci drivers).
This fixes audio recording with a usb1.1 audio device connected
to ehci controller.
|
|
The mount ID is a sequence number in a 32 bit integer, which means that
it can't be unique. This is largely harmless, because there is no way to
use the mount id, beyond checking if it's negative.
However, there's no overflow check, so the mount ID can wrap negative,
which will break error checks on mount calls.
Because it's useless, let's just stop returning it.
|
|
Our #! line length is very short, and the naïve quoting
makes it difficult to pass more complicated arguments to
the programs being run. This is fine for simple interpreters,
but it's often useful to pass arguments to more complicated
interpreters like auth/box or awk.
This change raises the limit, but also switches to tokenizing
via tokenize(2), rather than hand rolled whitespace splitting.
The limits chosen are arbitrary, but they leave approximately
3 KiB of stack space on 386, and 13k on amd64. This is a lot
of stack used, but it should leave enough for fairly deep
devtab chan stacks.
|
|
|