Commit graph

2144 commits

Author SHA1 Message Date
Jacob Moody 28709be9a6 kernel: devwalk: correct debug print
nc is not yet tied to the device that
called us
2022-06-14 07:22:58 +00:00
Jacob Moody 96cc6335db kernel: devskel: use RWlock 2022-06-14 07:02:44 +00:00
cinap_lenrek 176206fb02 imx8/gpio: use u32int for bit mask 2022-06-13 23:26:14 +00:00
cinap_lenrek 04d1e6ffe9 imx8/gpio: allow 0 as "no-op" gpio pin
as the gpio controller number starts at 1,
we can use 0 to mean "no pin", so passing
0 to gpioout() or gpioin() pin argument
will have no effect.
2022-06-13 23:24:14 +00:00
cinap_lenrek fe033ae816 imx8: add gpio helper gpioout()/gpioin() 2022-06-13 23:00:06 +00:00
cinap_lenrek 8dd05d041e imx8: provide iomuxgpr() function to access iomuxc's gpr's 2022-06-13 19:48:01 +00:00
cinap_lenrek 5388575c14 imx8: better syntax for iomuxpad() options using ~ for negation 2022-06-13 19:18:50 +00:00
cinap_lenrek 90428d0561 imx8: add iomuxpad() helper for pad and mux control 2022-06-13 19:06:00 +00:00
cinap_lenrek d35e41424c imx8: make gpc functionality available with a powerup() function 2022-06-12 21:16:47 +00:00
cinap_lenrek 771a93f3b7 imx8/lcd: reduce flicker
increasing the pixel clock to 80% of the edid clock value
reduces flicker and also seems to not trigger the shifting
issue.
2022-06-12 16:15:55 +00:00
Ori Bernstein 306e7ca618 devsrv: revert 'add /srv/clone'
this leaks /srvs, revert until we can fix it.
2022-06-12 15:23:19 +00:00
cinap_lenrek e1a95f5630 merge 2022-06-12 14:43:50 +00:00
cinap_lenrek f1f5045b2e imx8/usbxhci: bring usb out of reset
do all the magic dwc3 specific initalization as well
as reset the hub and power on the phys.

with this, "usb start" command is not needed anymore
from u-boot.
2022-06-12 14:31:55 +00:00
Jacob Moody c3e1346bbc kernel: add /srv/clone
/srv/clone allows a namespace to get their
own private /srv session.
2022-06-12 00:44:10 +00:00
cinap_lenrek 1d81f7eacb imx8/lcd: silly work around for display instability
running at the actual pixel clock causes the screen
to shift horizontally after a while.

using 60% seems to fix it - for now.
2022-06-12 00:21:28 +00:00
cinap_lenrek 931ae0cfeb imx8: mainscreen turn on!
supports the lcd panel and adds alot of infrastructure
like for the ccm clock module and the i2c controllers.
2022-06-11 21:12:04 +00:00
cinap_lenrek 276f2039a9 devi2c: add generic i2c bus driver 2022-06-11 21:06:39 +00:00
Jacob Moody f4840cdba5 kernel: add devskel for pc and pc64 2022-06-07 05:25:44 +00:00
Jacob Moody d8d433894a kernel: cleanup unused fields from devpipe
We don't need to multiply session path by 2, the definition
for NETQID is:

Meaning we don't need to save room between session paths
for individual Qid paths. This doubles the amount of
pipe sessions we can have before a wrap.
2022-06-05 12:29:50 +00:00
Jacob Moody b75e549126 kernel: be more careful about argc for /dev/drivers writes
Not crashing on 'chdev &' is important.
2022-05-28 17:23:41 +00:00
Jacob Moody 774529e440 kernel: add /rc to devroot
This makes it much easier to run a rc
program without needing to bind in all of '#s/boot'.
2022-05-28 02:31:26 +00:00
Jacob Moody e9bb7876e1 kernel: add chdev command to devcons 2022-05-28 02:23:29 +00:00
Jacob Moody 316230f625 kernel: remove dead case from devpipe
This code is checking the return of devwalk for
a walk resulting in a clone of an open pipe file. However,
devclone ensures that the chan we are cloning is not
currently open.
2022-05-19 04:45:06 +00:00
cinap_lenrek 1da20fd5d8 imx8: add xhci driver for the soc
This is mostly a copy of port/usbxhci.c with PCIWADDR() replaced
by PADDR() and the pci specific code stripped out.

This could be refactored at a later time.

There is a gpio line for the main hub reset that needs to be
asserted and some power management functions that are currently
done by u-boot (using "usb start" command).

We will do these ourselfs once we have the infrastructure for
it in place.
2022-05-15 11:57:52 +00:00
Jacob Moody 9429dd64f7 kernel: disable wstat for devpipe 2022-05-15 05:44:59 +00:00
cinap_lenrek 6ca8e6bbaf uartimx: fix interrupts
need to turn off transmitter fifo interrupt when we run out of
data to transmit, and set rx fifo ready fifo threshold to one.
2022-05-09 17:22:00 +00:00
cinap_lenrek 7aa8c6d47e imx8: implement psci calls for system reset and multicore startup 2022-05-08 20:26:56 +00:00
cinap_lenrek fff070f2cb imx8: add work in progress i.MX8MQ kernel for the mntreform2 laptop
This is a work in progress port to the mntreform2 laptop.

Working so far:

- mmu (same as raspberry pi 3b+)
- arm generic timer
- gicv3
- uart1
- enet

With access to the uart, one can netboot this kernel in u-boot
using the following commands:

> dhcp
> bootm
2022-05-08 16:50:29 +00:00
cinap_lenrek 9126ee3eea kernel: fix noteid change race condition from devproc while forking (thanks joe7)
devproc allows changing the noteid of another process
which opens a race condition in sysrfork(), when deciding
to inherit the noteid of "up" to the child and calling
pidalloc() later to take the reference, the noteid could
have been changed and the childs noteid could have been
freed already in the process.

this bug can only happen when one writes the /proc/n/noteid
file of a another process than your own that is in the
process of forking.

the noteid changing functionality of devproc seems questinable
and seems to be only used by ape's setpgrid() implementation.
2022-05-02 19:34:00 +00:00
cinap_lenrek 8597051d64 uartpci: AMT SOL Redirection interface (x200s) 2022-04-03 04:06:27 +00:00
Sigrid Solveig Haflínudóttir 945fef7ff2 devdraw: printmesg: implement "z" fmt arg (safe since printmesg is disabled) 2022-04-02 11:12:12 +00:00
cinap_lenrek f05b8af71e devsd: cache SDunit pointer in Chan.aux, improve error handling
Avoid calling sdgetdev() for every I/O. Instead,
put the SDunit pointer for #S/sdXX/* files in Chan.aux
and keep a reference to SDev between sdopen()/sdclose().

This avoids having to do the sdindex() lookup and
qlock(),incref(),decref() on every read/write
operation. Removal of SDev's is quite rare and only
can happen with pcmcia ide controllers, and i assume
that for that we can assume thet fileservers having
been exited properly and closed their files before
we attempt to remove a device.

The rest is improving waserror() codepaths, making
sure we release the locks for any of the interface
callbacks (verify/online).

Also get rid of tas() and instead only change the
unit's rawopen flag while holding raw qlock.
2022-03-30 19:23:26 +00:00
cinap_lenrek 00542efd15 devuart: allow serial console on late detected uarts
pci uarts are detected late and usually do not contain
the console= parameter logic.

for these, we can just enable them when devuart is reset,
and replay the boot messages once enabled.

this is usefull as it allows us to use these uarts for
kernel debugging in interrupt context.
2022-03-19 15:53:40 +00:00
cinap_lenrek 02d1725d71 uartpci: add serial-over-lan uart from x230/AMT 2022-03-18 20:18:19 +00:00
cinap_lenrek 488f378470 sdide: add pci id for AMT IDE-r controller on x230 2022-03-18 19:53:11 +00:00
cinap_lenrek ca313087c1 ip(3): use flags instead of tag for 8 column route add/remove
This avoids ipconfig having to explicitely specify the tag
when we want to set route type, as the tag can be provided
implicitely thru the "tag" command.
2022-03-14 18:45:27 +00:00
cinap_lenrek 6e4a1fda8c devip: allow setting the "trans" flag on a logical interface
This makes the interface route have the "t"-flag,
which causes packets routed to the interface to get
source translated.
2022-03-13 17:16:54 +00:00
cinap_lenrek d2a7d88662 devip: implement network address translation routes
This adds a new route "t"-flag that enables network address translation,
replacing the source address (and local port) of a forwarded packet to
one of the outgoing interface.

The state for a translation is kept in a new Translation structure,
which contains two Iphash entries, so it can be inserted into the
per protocol 4-tuple hash table, requiering no extra lookups.

Translations have a low overhead (~200 bytes on amd64),
so we can have many of them. They get reused after 5 minutes
of inactivity or when the per protocol limit of 1000 entries
is reached (then the one with longest inactivity is reused).

The protocol needs to export a "forward" function that is responsible
for modifying the forwarded packet, and then handle translations in
its input function for iphash hits with Iphash.trans != 0.

This patch also fixes a few minor things found during development:

- Include the Iphash in the Conv structure, avoiding estra malloc
- Fix ttl exceeded check (ttl < 1 -> ttl <= 1)
- Router should not reply with ttl exceeded for multicast flows
- Extra checks for icmp advice to avoid protocol confusions.
2022-03-12 20:53:17 +00:00
cinap_lenrek d082a8972f ether82563: add pci id for ethernet on dell optiplex 7090 micro (thanks leimy)
0.31.6: net  02.00.00 8086/15f9 255 0:70900000 131072
         Intel Corporation
2022-02-28 13:18:13 +00:00
cinap_lenrek 5886b999d5 devbridge: fix vlan range parsing 2022-02-27 13:32:58 +00:00
cinap_lenrek 9944e16b16 devbridge: improve locking, unbind ports automatically on read error and more...
Use an RWlock so readers can work in parallel in
the common case (no cache updates).

When a reader needs to update the cache to add
a new learned source mac address, it will drop
the rlock and aquire the wlock to do the update.

When we get a read error, we now unbind the
port to avoid further packets being forwarded
to it.

This is usefull for hotplug ethernet devices
like usb ones or tunnels.

Simplify the unbind, getting rid of the refcount,
by having only the reader proc call freeport().

Avoid holding the bridge lock while opening
and closing ethernet/tunnel device files during
bind and unbind.

Dont use smalloc() (especially when holding locks).

Allocate bridges dynamically, so we do not waste
the memory when we do not need them.

Reject non-hostowner from allocating new bridges.

Use consistent naming: port -> port

Use consistent comment style: // -> /* */
2022-02-26 22:05:32 +00:00
cinap_lenrek 9cd55a085d nusb/ether: remove csp check for rndis, already done in nusbrc 2022-02-23 17:59:13 +00:00
cinap_lenrek 14bb9734a6 usbxhci: endpoint address needs to be masked with Epmax from endpoint number 2022-02-21 18:46:47 +00:00
cinap_lenrek 4b637a24f9 devbridge: implement experimental vlan support 2022-02-16 22:38:03 +00:00
cinap_lenrek 7289f371a0 devip: dont hold ifc wlock during medium bind/unbind
Wlock()'ing the ifc causes a deadlock with Medium
bind/unbind as the routine can walk /net, while
ndb/dns or ndb/cs are currently blocked enumerating
/net/ipifc/*.

The fix is to have a fake medium, called "unbound",
that is set temporarily during the call of Medium
bind and unbind.

That way, the interface rwlock can be released while
bind/unbind is in progress.

The ipifcunbind() routine will refuse to unbind a
ifc that is currently assigned to the "unbound"
medium, preventing any accidents.
2022-02-16 22:31:31 +00:00
kemal c5c79d61e6 etheriwl: fixes for 7260 ac
2021-08-14 17:50 GMT, kemal <kemalinanc8@gmail.com>:
> 1- as driver reads 8 bytes from nvm instead of 6 so fw doesn't
> spit us an ADVANCED_SYSASSERT, it was reading 2 more
> extra bytes. apparently those 2 extra bytes were put to
> the first 2 bytes of our buffer, so we got to skip that.

some more thoughts on this, i think as 0x15*2 is not multiple
of 8, fw rounds the offset to 0x14*2. i have touched to code
to read data from 0x14*2 then ignore the first 2 bytes, just
so it's not confusing. if this causes mac to be read wrong again,
report.

also, some more changes:

1. set the fwname at iwlpci, just to align the behavior with 8000+.
this is a cosmetic change.

2. i have discovered that on device boot/reset/shutdown functions,
our driver slept way much more than it should. the reason for that is,
driver used the function delay() on places where it needs to use
microdelay() instead. i have modified the code to use microdelay().
wpi likely needs similar changes too. i hope that this does not
break the code.

3. zzz a bit more on tx/rx scheduler shutdowns and niclock.

4. openbsd's iwm and linux apparently does not check if ownership
was obtained anymore in their handover functions. instead they
just loop until the hw is ready. aligned the behavior.
see linux commit: 289e5501c3141191dd830957f1d764d3dc14a54f

5. don't take antenna masks from nvm. it's apparently empty
in some cards from 7k family. we will rely on what the fw file gives
us.

6. when the calibration is completed, wakeup the proc that runs
postboot. otherwise that thing sleeps for like 2 whole seconds
even if calibration completed earlier.

i honestly don't think any of these changes will fix 7260 not
being able to get calibration results, but i don't see anything
wrong at all in postboot7000 at this point. i will just hope
these changes somehow make it get calibration results.

NOTE: latest patch on the 9front ml, posted Mon, 14 Feb 2022 15:26:55 +0300
(non functional as of yet)
2021-08-21 22:23:12 +00:00
cinap_lenrek c0f142d993 bcm: fix rebootcode linkage 2022-02-05 16:20:56 +00:00
cinap_lenrek dc72530159 devgpio: make reading ctl file return 0 bytes 2022-02-05 01:25:28 +00:00
cinap_lenrek 60adc40118 devenv: allow environment total size of up to 1MB
Sometimes, there is the one-off occation when one needs to
pass a huge list in rc...

This change makes devenv track total memory consumption
of environment groups allowing them to grow up to 1MB in
size (including overhead).

(Before, only the variable size was restricted, but
not the amount of files being created).

The maximum value size of a single environment variable
is set to half of the total size, which allows the
occational large value. (But not many of them).

Because we track all memory consuption, it is also
now possible to create around 10k small environment
variales.

A hashtable is added for name lookups and the qid.path
was changed to allow direct indexing into the entry
array without needing a scan lookup.

All smalloc() calls have been removed, exhaustion is
handled with error(Enomem) avoiding deadlock
in case we run out of kernel memory.
2022-01-23 21:33:58 +00:00
cinap_lenrek 6f9838a6a5 kernel: make Page.txtflush into an array
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.
2022-01-16 19:25:11 +00:00