]> git.lizzy.rs Git - plan9front.git/log
plan9front.git
4 years ago/sys/lib/plumb/basic: open nedmail windows with -noscroll
Alex Musolino [Mon, 21 Oct 2019 21:48:20 +0000 (08:18 +1030)]
/sys/lib/plumb/basic: open nedmail windows with -noscroll

This preserves the desired behaviour of *not* scrolling to the bottom
of plumbed messages even when rio(1) is invoked with the -s flag.

4 years agondb/dns: handle empty $DNSSERVER
cinap_lenrek [Sun, 13 Oct 2019 07:02:04 +0000 (09:02 +0200)]
ndb/dns: handle empty $DNSSERVER

when $DNSSERVER is empty, query ndb for local dns servers
instead of not using any at all.

4 years agobackup: Set execution bits in backup scripts
Roberto E. Vargas Caballero [Sun, 13 Oct 2019 08:20:10 +0000 (10:20 +0200)]
backup: Set execution bits in backup scripts

4 years agoether82563: fix multicast for i210
cinap_lenrek [Fri, 11 Oct 2019 19:38:12 +0000 (21:38 +0200)]
ether82563: fix multicast for i210

MTA has 128 entries, according to section 8.10.15 in the datasheet.
this fixes ipv6 in apu2 which has 3x i210 (8086/157b).

4 years agoFetch IMAP flags from server. This makes us sync read/answered/... flags with unix.
Ori Bernstein [Thu, 10 Oct 2019 18:52:22 +0000 (11:52 -0700)]
Fetch IMAP flags from server. This makes us sync read/answered/... flags with unix.

4 years agoawk: make empty FS unicodely-correct.
Ori Bernstein [Thu, 10 Oct 2019 00:36:02 +0000 (17:36 -0700)]
awk: make empty FS unicodely-correct.

4 years agosdiahci: force Hudson SATA Controller to AHCI mode
cinap_lenrek [Tue, 8 Oct 2019 11:53:57 +0000 (13:53 +0200)]
sdiahci: force Hudson SATA Controller to AHCI mode

4 years agosshfs: fix dir2attrib() memory leak in wstat error case (thanks BurnZeZ)
cinap_lenrek [Mon, 7 Oct 2019 10:51:21 +0000 (12:51 +0200)]
sshfs: fix dir2attrib() memory leak in wstat error case (thanks BurnZeZ)

4 years agosshfs: fix race condition between sendproc() and recvproc()
cinap_lenrek [Mon, 7 Oct 2019 09:52:14 +0000 (11:52 +0200)]
sshfs: fix race condition between sendproc() and recvproc()

there was a race between the sendproc putting the request on
the sreqrd[] id and the recvproc handling the response, and
potentially freeing the request before the sendproc() was
finished with the request (or the fid).

so we defer allocating a request id and putting it on the
sreqrd[] stage after we have completely generated the
request in vpack(). this prevents the handling of the request
before it is even sent.

this also means that the SReq should not be touched after
calling sendpkt(), submitreq(), submitsreq().

secondly, putsfid() needs to acquire the RWLock to make sure
sendproc() is finished with the request. the scenario is that
recvproc() can call respond() on the request before sendproc()
has unlocked the SFid.

4 years agocwfs: fix listen filedescriptor leaks
cinap_lenrek [Fri, 4 Oct 2019 16:54:01 +0000 (18:54 +0200)]
cwfs: fix listen filedescriptor leaks

4 years agolib9p: fix listensrv() filedescriptor leaks
cinap_lenrek [Fri, 4 Oct 2019 16:52:53 +0000 (18:52 +0200)]
lib9p: fix listensrv() filedescriptor leaks

4 years agosshfs: use threadexits() instead of exits()
cinap_lenrek [Fri, 4 Oct 2019 16:51:44 +0000 (18:51 +0200)]
sshfs: use threadexits() instead of exits()

4 years agoupas/fs: speedup mtree and henter()
cinap_lenrek [Thu, 3 Oct 2019 13:49:53 +0000 (15:49 +0200)]
upas/fs: speedup mtree and henter()

move digest pointer into Mtree structrue and embed it into Idx struct
(which is embedded in Message) to avoid one level of indirection
during mtreecmp().

get rid of mtreeisdup(). instead we have mtreeadd() return the old
message in case of a collision. this avoids double lookup.

increase the hash table size for henter() and make it a prime.

4 years agopc: move low-level allocation details out of mmu.c into memory.c rampage() function
cinap_lenrek [Tue, 1 Oct 2019 23:01:34 +0000 (01:01 +0200)]
pc: move low-level allocation details out of mmu.c into memory.c rampage() function

4 years agovgai81x: use vmap() for uncached access to cursor data instead of manipulating kernel...
cinap_lenrek [Tue, 1 Oct 2019 22:58:46 +0000 (00:58 +0200)]
vgai81x: use vmap() for uncached access to cursor data instead of manipulating kernel page table

on 386, the kernel memory region is mapped using huge 4MB pages
(when supported by the cpu). so the uncached pte manipulation
does not work to map the cursor data with uncached attribute.

instead, we allocate a memory page using newpage() and map
it globally using vmap(), which maps it uncached.

4 years agomerge
cinap_lenrek [Sun, 22 Sep 2019 18:37:33 +0000 (20:37 +0200)]
merge

4 years agoape/cc: add spim
cinap_lenrek [Sun, 22 Sep 2019 18:35:16 +0000 (20:35 +0200)]
ape/cc: add spim

4 years agomerge
cinap_lenrek [Sun, 22 Sep 2019 18:30:08 +0000 (20:30 +0200)]
merge

4 years ago2c(1): document 7c (arm64)
cinap_lenrek [Sun, 22 Sep 2019 17:09:25 +0000 (19:09 +0200)]
2c(1): document 7c (arm64)

4 years agoape/cc: Add arm64 and remove alpha
Roberto E. Vargas Caballero [Sun, 22 Sep 2019 17:07:57 +0000 (19:07 +0200)]
ape/cc: Add arm64 and remove alpha

4 years agousbxhci: fix endpoint stall recovery, handle Ep.clrhalt flag
cinap_lenrek [Sun, 22 Sep 2019 16:51:41 +0000 (18:51 +0200)]
usbxhci: fix endpoint stall recovery, handle Ep.clrhalt flag

after issuing CR_RESETEP command, we have to invalidate
the endpoints output context buffer so that the halted/error
status reflects the new state. not doing so resulted in
the halted state to be stuck and we continued issuing
endpoint reset commands when we where already recovered.

handle the devusb Ep.clrhalt flag from devusb that userspace
uses to force a endpoint reset on the next transaction.

4 years agocmd/ip/*: chown the network connection after authentication
cinap_lenrek [Sat, 21 Sep 2019 21:36:44 +0000 (23:36 +0200)]
cmd/ip/*: chown the network connection after authentication

for servers that handle incoming network connections and authentication,
change the owner of the network connection file to the authenticated user
after successfull authentication.

note that we set the permissions as well to 0660 because old devip used
to unconditionally set the bits.

4 years agodevip: fix permission checking
cinap_lenrek [Sat, 21 Sep 2019 21:28:37 +0000 (23:28 +0200)]
devip: fix permission checking

permission checking had the "other" and "owner" bits swapped plus incoming
connections where always owned by "network" instead of the owner of
the listening connection. also, ipwstat() was not effective as the uid
strings where not parsed.

this fixes the permission checks for data/ctl/err file and makes incoming
connections inherit the owner from the listening connection.

we also allow ipwstat() to change ownership to the commonuser() or anyone
if we are eve.

we might have to add additional restrictions for none at a later point...

4 years agobootrc: unmount devip *before* starting factotum
cinap_lenrek [Sat, 21 Sep 2019 16:48:14 +0000 (18:48 +0200)]
bootrc: unmount devip *before* starting factotum

we want devip to get reattached after hostowner has been written. factotum
already handles this with a private authdial() routine that mounts devip
when it is not present. so we detach devmnt before starting factotum,
and attach once factotum finishes.

4 years agobootrc: remount devip after /dev/hostowner has been written by factotum
cinap_lenrek [Sat, 21 Sep 2019 16:11:52 +0000 (18:11 +0200)]
bootrc: remount devip after /dev/hostowner has been written by factotum

devip remembers the attach uname so after we set hostowner we
remount devip so future connections have the right owner.

4 years agodevproc: fix fishy locking in proctext(), check proc validity, static functions
cinap_lenrek [Sat, 21 Sep 2019 14:36:40 +0000 (16:36 +0200)]
devproc: fix fishy locking in proctext(), check proc validity, static functions

the locking in proctext() is wrong. we have to acquire Proc.seglock
when reading segments from Proc.seg[] as segments do not
have a private freelist and can therefore be reused for other
data structures.

once we have Proc.seglock acquired, check that the process pid
is still valid so we wont accidentally read some other processes
segments. (for both proctext() and procctlmemio()). this also
should give better error message to distinguish the case when
the process did segdetach() the segment in question before we
could acquire Proc.seglock.

declare private functions as static.

4 years agodevproc: move proctab() call after Qnotepg special case in procwrite()
cinap_lenrek [Thu, 19 Sep 2019 00:24:23 +0000 (02:24 +0200)]
devproc: move proctab() call after Qnotepg special case in procwrite()

4 years agokernel: simplify pgrpnote(); moving the note string copying to procwrite()
cinap_lenrek [Thu, 19 Sep 2019 00:07:46 +0000 (02:07 +0200)]
kernel: simplify pgrpnote(); moving the note string copying to procwrite()

keeps handling of devproc's note and notepg files similar and in the
same place and reduces stack usage.

4 years agoape: don't hardcode list of ape library directories in /sys/src/ape/lib/mkfile
cinap_lenrek [Mon, 16 Sep 2019 14:21:40 +0000 (16:21 +0200)]
ape: don't hardcode list of ape library directories in /sys/src/ape/lib/mkfile

this change allows one to drop library directories (like
freetype) into /sys/src/ape/lib/ and have them built without
having to change the mkfile.

4 years agobcm64: add addarchfile() prototype to fns.h (for qeed)
cinap_lenrek [Sun, 15 Sep 2019 02:53:45 +0000 (04:53 +0200)]
bcm64: add addarchfile() prototype to fns.h (for qeed)

4 years agobcm64: enter page tables in mmutop *AFTER* switching asid in mmuswitch()
cinap_lenrek [Sat, 14 Sep 2019 12:02:34 +0000 (14:02 +0200)]
bcm64: enter page tables in mmutop *AFTER* switching asid in mmuswitch()

there was a small window between modifying mmutop and switching the
asid where the core could bring in the new entries under the old asid
into the tlb due to speculation / prefetching.

this change moves the entering of the page tables into mmutop after
setttbr() to prevent this scenario.

due to us switching to the resereved asid 0 on procsave()->putasid(),
the only asid that could have potentially been poisoned would be asid 0
which does not have any user mappings. so this did not show any noticable
effect.

4 years agoacid/kernel: for stacktraces, try to use context from error stack when process is...
cinap_lenrek [Thu, 12 Sep 2019 13:28:04 +0000 (15:28 +0200)]
acid/kernel: for stacktraces, try to use context from error stack when process is not sleeping

when a process state has not been saved (Proc.mach != nil)
then the contents of Proc.sched should be considered invalid.

to approximate a stacktrace in this case, we use the error
stack and get a stacktrace from the last waserror() call.

4 years agoip/cifsd: dont return garbage in upper 32 bit of unix extension stat fields
cinap_lenrek [Wed, 11 Sep 2019 13:41:14 +0000 (15:41 +0200)]
ip/cifsd: dont return garbage in upper 32 bit of unix extension stat fields

4 years agoip/cifsd: add basic support for UNIX extensions
cinap_lenrek [Tue, 10 Sep 2019 19:19:34 +0000 (21:19 +0200)]
ip/cifsd: add basic support for UNIX extensions

4 years agoip/cifsd: exit to close connection when we get malformed smb header (fixes linux...
cinap_lenrek [Tue, 10 Sep 2019 19:17:23 +0000 (21:17 +0200)]
ip/cifsd: exit to close connection when we get malformed smb header (fixes linux mount hang)

4 years agousbehci: silence "param declared but not used" compiler warning in itdinit()/sitdinit()
cinap_lenrek [Mon, 9 Sep 2019 14:58:45 +0000 (16:58 +0200)]
usbehci: silence "param declared but not used" compiler warning in itdinit()/sitdinit()

4 years agosdide: silence compiler warning in atadebug()
cinap_lenrek [Mon, 9 Sep 2019 14:56:01 +0000 (16:56 +0200)]
sdide: silence compiler warning in atadebug()

4 years agoape: Add mkstemp to /sys/src/ape/lib/ap/gen/mkfile
Roberto E. Vargas Caballero [Mon, 9 Sep 2019 16:27:57 +0000 (17:27 +0100)]
ape: Add mkstemp to /sys/src/ape/lib/ap/gen/mkfile

4 years agoAdd toascii() to ape
Roberto E. Vargas Caballero [Mon, 9 Sep 2019 15:00:06 +0000 (16:00 +0100)]
Add toascii() to ape

4 years agoAdd mkstemp to stdlib.h
Roberto E. Vargas Caballero [Mon, 9 Sep 2019 14:58:39 +0000 (15:58 +0100)]
Add mkstemp to stdlib.h
q

4 years agomerge
cinap_lenrek [Sun, 8 Sep 2019 17:04:55 +0000 (19:04 +0200)]
merge

4 years agokernel: clear FPillegal in pexit() and before pprint()
cinap_lenrek [Sun, 8 Sep 2019 17:02:01 +0000 (19:02 +0200)]
kernel: clear FPillegal in pexit() and before pprint()

pexit() and pprint() can get called outside of a syscall
(from procctl()) with a process that is in active note
handling and require floating point in the kernel on amd64
for aesni (devtls).

4 years agodevproc: restore psstate info string in procstopwait()
cinap_lenrek [Sun, 8 Sep 2019 16:53:12 +0000 (18:53 +0200)]
devproc: restore psstate info string in procstopwait()

4 years agoAllow address expressions in ?c after int casts.
Ori Bernstein [Sun, 8 Sep 2019 01:25:04 +0000 (18:25 -0700)]
Allow address expressions in ?c after int casts.

This fixes ocaml on non-x86 architectures, where we have code
that looks like:

#define Fl_head ((uintptr_t)(&sentinel.first_field))

Without this change, we get an error about a non-constant
initializer. This change takes the checks for pointers and
makes them apply to all expressions. It also makes the checks
stricter, preventing the following from compiling to junk:

int x;
int y = 42;
int *p = &x + y

4 years agomerge
Ori Bernstein [Sat, 7 Sep 2019 19:46:44 +0000 (12:46 -0700)]
merge

4 years agoLibflac: Tell it that we have stdint.h so it finds SIZE_MAX
Ori Bernstein [Sat, 7 Sep 2019 19:37:33 +0000 (12:37 -0700)]
Libflac: Tell it that we have stdint.h so it finds SIZE_MAX

4 years agoInclude integer limits from generic stdint.h in system-specific stdint.h
Ori Bernstein [Sat, 7 Sep 2019 01:01:52 +0000 (18:01 -0700)]
Include integer limits from generic stdint.h in system-specific stdint.h

4 years agomerge
cinap_lenrek [Sat, 7 Sep 2019 00:13:35 +0000 (02:13 +0200)]
merge

4 years agocc: fix void cast crash
cinap_lenrek [Sat, 7 Sep 2019 00:11:18 +0000 (02:11 +0200)]
cc: fix void cast crash

the following code reproduces the crash:

void
foo(void)
{
}

void
main(int argc, char **argv)
{
(void)(1 ? (void)0 : foo());
}

the problem is that side() gives a false positive on the OCOND
with later constant folding eleminating the acutal side effect
and OCAST ending up with two nested OCATS with the nested one
being zapped (type == T).

4 years agoAdd missing UINTsz_MIN defines to ape stdint.h
Ori Bernstein [Fri, 6 Sep 2019 23:33:11 +0000 (16:33 -0700)]
Add missing UINTsz_MIN defines to ape stdint.h

4 years agomerge
Ori Bernstein [Fri, 6 Sep 2019 18:57:08 +0000 (11:57 -0700)]
merge

4 years agosys/src/libventi: define VtEntryNoArchive constant
David du Colombier [Fri, 6 Sep 2019 18:55:35 +0000 (11:55 -0700)]
sys/src/libventi: define VtEntryNoArchive constant

4 years agosys/src/libventi: implement vtsha1 and vtsha1check functions
David du Colombier [Fri, 6 Sep 2019 18:55:18 +0000 (11:55 -0700)]
sys/src/libventi: implement vtsha1 and vtsha1check functions

4 years agosys/src/libventi: implement vtreconn and vtredial functions
David du Colombier [Fri, 6 Sep 2019 18:54:44 +0000 (11:54 -0700)]
sys/src/libventi: implement vtreconn and vtredial functions

4 years agoip/ipconfig: don't leave behind null address when dhcp gets interrupted
cinap_lenrek [Fri, 6 Sep 2019 16:48:35 +0000 (18:48 +0200)]
ip/ipconfig: don't leave behind null address when dhcp gets interrupted

cleanup the null address (::) when the command gets interrupted.

4 years agoAdd RFC2822 (email style) formatted dates to to date(1).
Ori Bernstein [Fri, 6 Sep 2019 15:25:21 +0000 (08:25 -0700)]
Add RFC2822 (email style) formatted dates to to date(1).

4 years agokernel: get rid of tmperrbuf and use syserrstr swapping instead in namec()
cinap_lenrek [Wed, 4 Sep 2019 00:44:39 +0000 (02:44 +0200)]
kernel: get rid of tmperrbuf and use syserrstr swapping instead in namec()

4 years agorune(2): complete source references
cinap_lenrek [Wed, 4 Sep 2019 00:41:22 +0000 (02:41 +0200)]
rune(2): complete source references

4 years agokernel: make exec clear errstr, stop side-channels and truncate on utf8 boundary
cinap_lenrek [Wed, 4 Sep 2019 00:40:41 +0000 (02:40 +0200)]
kernel: make exec clear errstr, stop side-channels and truncate on utf8 boundary

make exec() clear the per process error string
to avoid spurious errors and confusion.

the errstr() syscall used to always swap the
maximum buffer size with memmove(), which is
problematic as this gives access to the garbage
beyond the NUL byte. worse, newproc(), werrstr()
and rerrstr() only clear the first byte of the
input buffer. so random stack rubble could be
leaked across processes.

we change the errstr() syscall to not copy
beyond the NUL byte.

the manpage also documents that errstr() should
truncate on a utf8 boundary so we use utfecpy()
to ensure proper NUL termination.

4 years agobcm64: enable devgpio in kernel configuration (thanks qeed)
cinap_lenrek [Mon, 2 Sep 2019 17:38:44 +0000 (19:38 +0200)]
bcm64: enable devgpio in kernel configuration (thanks qeed)

4 years agondb/dnsquery, ndb/csquery: write ">" prompt to stderr (thanks kvik)
cinap_lenrek [Fri, 30 Aug 2019 18:17:19 +0000 (20:17 +0200)]
ndb/dnsquery, ndb/csquery: write ">" prompt to stderr (thanks kvik)

kvik writes:

dnsquery(8) prints the interactive prompt on stdout together with
query results, making scripted usage unnecessarily difficult.

A straightforward solution is prompting on stderr instead: as
practiced by rc(1), among many others -- promptly taking care of
the issue:

; echo 9front.org mx | ndb/dnsquery >[2]/dev/null

4 years agorsa(2): document asn1encodeRSApriv() and asn1encodeRSApub() functions
cinap_lenrek [Fri, 30 Aug 2019 05:35:54 +0000 (07:35 +0200)]
rsa(2): document asn1encodeRSApriv() and asn1encodeRSApub() functions

4 years agoauth/rsa2asn1: implement private key export with -a flag (thanks kvik)
cinap_lenrek [Fri, 30 Aug 2019 05:34:35 +0000 (07:34 +0200)]
auth/rsa2asn1: implement private key export with -a flag (thanks kvik)

kvik writes:

I needed to convert the RSA private key that was laying around in
secstore into a format understood by UNIX® tools like SSH.

With asn12rsa(8) we can go from the ASN.1/DER to Plan 9 format, but not
back - so I wrote the libsec function asn1encodeRSApriv(2) and used it in
rsa2asn1(8) by adding the -a flag which causes the full private key to be
encoded and output.

4 years agopc64: map kernel text readonly and everything else no-execute
cinap_lenrek [Thu, 29 Aug 2019 05:35:22 +0000 (07:35 +0200)]
pc64: map kernel text readonly and everything else no-execute

the idea is to catch bugs and make kernel exploitation
harder by mapping the kernel text section readonly
and everything else no-execute.

l.s maps the KZERO address space using 2MB pages so
to get the 4K granularity for the text section we use
the new ptesplit() function to split that mapping up.

we need to set EFER no-execute enable bit early
in apbootstrap so secondary application processors
will understand the NX bit in our shared kernel page
tables. also APBOOTSTRAP needs to be kept executable.

rebootjump() needs to mark REBOOTADDR page executable.

4 years ago8l, 6l: fix "unknown relation: TEXT" xfol() bug (thanks mischief)
cinap_lenrek [Wed, 28 Aug 2019 19:01:16 +0000 (21:01 +0200)]
8l, 6l: fix "unknown relation: TEXT" xfol() bug (thanks mischief)

mischief reports:

this assembler input assembles with 6a but makes 6l crash.

 // 6a l.s
 // 6l l.6
 // _intrr: unknown relation: TEXT in _intrr
 // 6l 511: suicide: sys: trap: fault write addr=0x18 pc=0x20789c

 TEXT noteret(SB), 1, $-4
         CLI
         JMP _intrestore // works when commented

 TEXT _intrr(SB), 1, $-4
 _intrestore:
         RET

 TEXT _main(SB), 1, $-4
         RET

4 years agokernel: prohibit changing cache attributes (SG_CACHED|SG_DEVICE) in segattach(),...
cinap_lenrek [Tue, 27 Aug 2019 04:16:20 +0000 (06:16 +0200)]
kernel: prohibit changing cache attributes (SG_CACHED|SG_DEVICE) in segattach(), set SG_RONLY in data2txt()

the user should not be able to change the cache
attributes for a segment in segattach() as this
can cause the same memory to be mapped with
conflicting attributes in the cache.

SG_TEXT should always be mapped with SG_RONLY
attribute. so fix data2txt() to follow the rules.

4 years agokernel: make user stack segment non-executable
cinap_lenrek [Tue, 27 Aug 2019 02:04:46 +0000 (04:04 +0200)]
kernel: make user stack segment non-executable

4 years agopc64: implement NX bit discovery, map kernel mappings no-execute
cinap_lenrek [Tue, 27 Aug 2019 01:55:12 +0000 (03:55 +0200)]
pc64: implement NX bit discovery, map kernel mappings no-execute

4 years agokernel: catch execution read fault on SG_NOEXEC segment (for mips)
cinap_lenrek [Tue, 27 Aug 2019 01:48:51 +0000 (03:48 +0200)]
kernel: catch execution read fault on SG_NOEXEC segment (for mips)

4 years agokernel: catch execution read fault on SG_NOEXEC segment
cinap_lenrek [Tue, 27 Aug 2019 01:47:18 +0000 (03:47 +0200)]
kernel: catch execution read fault on SG_NOEXEC segment

fault() now has an additional pc argument that is
used to detect fault on a non-executable segment.
that is, we check on read fault if the segment
has the SG_NOEXEC attribute and the program counter
is within faulting page.

4 years agokernel: expose no execute bit to portable mmu code as SG_NOEXEC / PTENOEXEC, add...
cinap_lenrek [Mon, 26 Aug 2019 20:34:38 +0000 (22:34 +0200)]
kernel: expose no execute bit to portable mmu code as SG_NOEXEC / PTENOEXEC, add PTECACHED bits

a portable SG_NOEXEC segment attribute was added to allow
non-executable (physical) segments. which will set the
PTENOEXEC bits for putmmu().

in the future, this can be used to make non-executable
stack / bss segments.

the SG_DEVICE attribute was added to distinguish between
mmio regions and uncached memory. only matterns on arm64.

on arm, theres the issue that PTEUNCACHED would have
no bits set when using the hardware bit definitions.
this is the reason bcm, kw, teg2 and omap kernels use
arteficial PTE constants. on zynq, the XN bit was used
as a hack to give PTEUNCACHED a non-zero value and when
the bit is clear then cache attributes where added to
the pte.

to fix this, PTECACHED constant was added.

the portable mmu code in fault.c will now explicitely set
PTECACHED bits for cached memory and PTEUNCACHED for
uncached memory. that way the hardware bit definitions
can be used everywhere.

4 years agovncv: fix snarf buffer realloc memory corruption
qwx [Mon, 26 Aug 2019 15:02:58 +0000 (17:02 +0200)]
vncv: fix snarf buffer realloc memory corruption

fix never updating p when snarf is reallocated,
resulting in memory corruption.

4 years agoemmc: 50MHz highspeed support (from richard miller)
cinap_lenrek [Sun, 25 Aug 2019 18:02:53 +0000 (20:02 +0200)]
emmc: 50MHz highspeed support (from richard miller)

4 years agobcm64: replace emmc2 driver with richard millers sdhc driver
cinap_lenrek [Sun, 25 Aug 2019 16:45:29 +0000 (18:45 +0200)]
bcm64: replace emmc2 driver with richard millers sdhc driver

the new driver supports 50MHz highspeed bus mode
and uses ADMA instead of SDMA.

4 years ago/sys/lib/dist/mkfile: adjust 2GB for pi3 and zynq img
cinap_lenrek [Sat, 24 Aug 2019 14:35:03 +0000 (16:35 +0200)]
/sys/lib/dist/mkfile: adjust 2GB for pi3 and zynq img

4 years ago/sys/lib/dist/mkfile: storage vendors idea of 2GB is deflating
cinap_lenrek [Sat, 24 Aug 2019 14:29:00 +0000 (16:29 +0200)]
/sys/lib/dist/mkfile: storage vendors idea of 2GB is deflating

4 years agobcm64: deal with discontinuous memory regions, avoid virtual memory aliasing, impleme...
cinap_lenrek [Fri, 23 Aug 2019 19:39:20 +0000 (21:39 +0200)]
bcm64: deal with discontinuous memory regions, avoid virtual memory aliasing, implement vmap() proper

on the 2GB and 4GB raspberry pi 4 variants, there are two
memory regions for ram:

[0x00000000..0x3e600000)
[0x40000000..0xfc000000)

the framebuffer is somewhere at the end of the first
GB of memory.

to handle these, we append the region base and limit
of the second region to *maxmem= like:

*maxmem=0x3e600000 0x40000000 0xfc000000

the mmu code has been changed to have non-existing
ram unmapped and mmukmap() now uses small 64K pages
instead of 512GB pages to avoid aliasing (framebuffer).

the VIRTPCI mapping has been removed as we now have
a proper vmap() implementation which assigns vritual
addresses automatically.

4 years agobcm: invalidate cache on Fbinfo after firmware completion
cinap_lenrek [Thu, 22 Aug 2019 00:54:06 +0000 (02:54 +0200)]
bcm: invalidate cache on Fbinfo after firmware completion

4 years agobcm: flush out early boot messages on uart and screen initialization
cinap_lenrek [Thu, 22 Aug 2019 00:52:21 +0000 (02:52 +0200)]
bcm: flush out early boot messages on uart and screen initialization

make early boot messages available by writing out
kmesg.buf after uart and screen initialization.

4 years ago/sys/lib/acid/kernel: fix procstk() for arm64, set kdir for arm/arm64 to bcm/bcm64
cinap_lenrek [Wed, 21 Aug 2019 17:34:24 +0000 (19:34 +0200)]
/sys/lib/acid/kernel: fix procstk() for arm64, set kdir for arm/arm64 to bcm/bcm64

4 years agobcm: set XN bits for kernel device mappings
cinap_lenrek [Wed, 21 Aug 2019 16:28:01 +0000 (18:28 +0200)]
bcm: set XN bits for kernel device mappings

4 years agobcm64: do not use OTP_BOOTMODE_REG to determine OSC frequency (thanks richard miller)
cinap_lenrek [Mon, 19 Aug 2019 14:42:20 +0000 (16:42 +0200)]
bcm64: do not use OTP_BOOTMODE_REG to determine OSC frequency (thanks richard miller)

the register does not seem to be accessible on the Rpi 3b.
so instead hardcode oscfreq in the Soc structure.

4 years agodisk/format: implement long name support
cinap_lenrek [Sun, 18 Aug 2019 23:09:24 +0000 (01:09 +0200)]
disk/format: implement long name support

4 years agoadd missing device tree file for raspberry pi 4
cinap_lenrek [Sun, 18 Aug 2019 20:19:29 +0000 (22:19 +0200)]
add missing device tree file for raspberry pi 4

4 years agoadd raspberry pi 4 kernel and bootloader to pi3.img target
cinap_lenrek [Sun, 18 Aug 2019 19:43:04 +0000 (21:43 +0200)]
add raspberry pi 4 kernel and bootloader to pi3.img target

4 years agobcm64: add support for more than 1GB of ram (untested)
cinap_lenrek [Sun, 18 Aug 2019 19:16:30 +0000 (21:16 +0200)]
bcm64: add support for more than 1GB of ram (untested)

this adds a 4GB KMAP window into the kernel address space
so we can access all physical ram on raspberry pi 4 for
user pages.

note that kernel memory above KZERO is still limited
to 1GB because of DMA restrictions.

4 years agobcm64: add driver for emmc2 controller
cinap_lenrek [Sun, 18 Aug 2019 16:50:24 +0000 (18:50 +0200)]
bcm64: add driver for emmc2 controller

4 years agobcm: fix typo in gpio.c on unused AFedge0 constant
cinap_lenrek [Fri, 16 Aug 2019 17:35:46 +0000 (19:35 +0200)]
bcm: fix typo in gpio.c on unused AFedge0 constant

4 years agobcm64: poll gisb arbiter for asynchronous bus errors
cinap_lenrek [Fri, 16 Aug 2019 17:24:00 +0000 (19:24 +0200)]
bcm64: poll gisb arbiter for asynchronous bus errors

4 years agoethergenet: remove debugging
cinap_lenrek [Fri, 16 Aug 2019 17:22:28 +0000 (19:22 +0200)]
ethergenet: remove debugging

the hangs where caused by missing NX bits on the mmio mappings,
so the debug code is not needed anymore.

4 years agobcm64: set XN bits for kernel device mappings
cinap_lenrek [Fri, 16 Aug 2019 17:05:04 +0000 (19:05 +0200)]
bcm64: set XN bits for kernel device mappings

4 years agocc: use 7 octal digits for 21 bit runes
cinap_lenrek [Mon, 12 Aug 2019 17:15:02 +0000 (19:15 +0200)]
cc: use 7 octal digits for 21 bit runes

4 years agolibauth: do not set errstr in auth_rpc() for ARdone result (thanks majiru)
cinap_lenrek [Fri, 2 Aug 2019 17:06:23 +0000 (19:06 +0200)]
libauth: do not set errstr in auth_rpc() for ARdone result (thanks majiru)

4 years agobcm, bcm64: add vcore support for raspberry pi 3 GPIO expander
cinap_lenrek [Sun, 28 Jul 2019 09:39:57 +0000 (11:39 +0200)]
bcm, bcm64: add vcore support for raspberry pi 3 GPIO expander

4 years agobcm, bcm64: add BCM2711 support for gpiopull(), fix gpiomeminit(), cleanup
cinap_lenrek [Sat, 27 Jul 2019 18:00:53 +0000 (20:00 +0200)]
bcm, bcm64: add BCM2711 support for gpiopull(), fix gpiomeminit(), cleanup

according to the following linux change, BCM2711 uses a different
method for changing pullup/down mode:

https://github.com/raspberrypi/linux/commit/abcfd092860760087b87acbdda0963fe7906839c#diff-cf078559c38543ac72c5db99323e236d

gpiomeminit() was broken, using virtual address for the gpio physseg
instead of the physical one.

cleanup the code, avoid repetition by declaring static u32int *regs
variable. make local variable names consistent.

4 years agobcm64: fix wrong prescaler for generic timer on rpi4
cinap_lenrek [Sat, 27 Jul 2019 15:59:25 +0000 (17:59 +0200)]
bcm64: fix wrong prescaler for generic timer on rpi4

the raspberry pi 4 uses 54 instead of 19.2 MHz crystal.
detect which frequency is used by reading OTP bootmode
register:

https://www.raspberrypi.org/documentation/hardware/raspberrypi/otpbits.md

Bit 1: sets the oscillator frequency to 19.2MHz

4 years agoethergenet: fix flow control negotiation
cinap_lenrek [Thu, 25 Jul 2019 15:44:47 +0000 (17:44 +0200)]
ethergenet: fix flow control negotiation

4 years agobcm, bcm64: clean dma destination buffer before issuing dma in case of non cache...
cinap_lenrek [Thu, 25 Jul 2019 11:55:17 +0000 (13:55 +0200)]
bcm, bcm64: clean dma destination buffer before issuing dma in case of non cache-line-size aligned buffer

4 years agobcm64: add config for raspberry pi 4
cinap_lenrek [Thu, 25 Jul 2019 07:12:40 +0000 (09:12 +0200)]
bcm64: add config for raspberry pi 4

4 years agobcm64: work in progress genet ethernet driver for raspberry pi 4
cinap_lenrek [Thu, 25 Jul 2019 07:11:53 +0000 (09:11 +0200)]
bcm64: work in progress genet ethernet driver for raspberry pi 4