9front - general discussion about 9front
 help / color / mirror / Atom feed
* Fwd: [9front-commits] cinap_lenrek: hg/plan9front: ether8003: use physical addresses f...
@ 2020-04-04 17:22 cinap_lenrek
  0 siblings, 0 replies; only message in thread
From: cinap_lenrek @ 2020-04-04 17:22 UTC (permalink / raw)
  To: 9front

[-- Attachment #1: Type: text/plain, Size: 0 bytes --]



[-- Attachment #2: Type: message/rfc822, Size: 13486 bytes --]

From: The Computer <commits@code.9front.org>
To: 9front-commits@9front.org
Subject: [9front-commits] cinap_lenrek: hg/plan9front: ether8003: use physical addresses f...
Date: Sat, 04 Apr 2020 08:17:25 -0700
Message-ID: <hg.8d2cf952825d.1586013445.4892889753185008284@code.9front.org>

details:     http://code.9front.org/hg/plan9front/rev/8d2cf952825d
changeset:   7642:8d2cf952825d
user:        cinap_lenrek@felloff.net
date:        Sat Apr 04 15:47:50 2020 +0200
description: ether8003: use physical addresses for ISAConfig ether->mem

Fix the inconsistent use of ether->mem. Always use physical
addresses. Let ether8390 convert to virtual addresses using
KADDR() when we have to copy data in/out.

Subject: cinap_lenrek: hg/plan9front: ether8390: remove unused variables

details:     http://code.9front.org/hg/plan9front/rev/983cebc72fe9
changeset:   7643:983cebc72fe9
user:        cinap_lenrek@felloff.net
date:        Sat Apr 04 15:55:48 2020 +0200
description: ether8390: remove unused variables

Subject: cinap_lenrek: hg/plan9front: kernel: add portable memory map code (port/memmap.c)

details:     http://code.9front.org/hg/plan9front/rev/e4e457e1e99e
changeset:   7644:e4e457e1e99e
user:        cinap_lenrek@felloff.net
date:        Sat Apr 04 16:04:27 2020 +0200
description: kernel: add portable memory map code (port/memmap.c)

This is a generic memory map for physical addresses. Entries
can be added with memmapadd() giving a range and a type.
Ranges can be allocated and freed from the map. The code
automatically resolves overlapping ranges by type priority.

Subject: cinap_lenrek: hg/plan9front: pc, pc64: new memory map code

details:     http://code.9front.org/hg/plan9front/rev/7eba9c247d5d
changeset:   7645:7eba9c247d5d
user:        cinap_lenrek@felloff.net
date:        Sat Apr 04 16:48:37 2020 +0200
description: pc, pc64: new memory map code

This replaces the memory map code for both pc and pc64
kernels with a unified implementation using the new
portable memory map code.

The main motivation is to be robust against broken
e820 memory maps by the bios and delay the Conf.mem[]
allocation after archinit(), so mp and acpi tables
can be reserved and excluded from user memory.

There are a few changes:

new memreserve() function has been added for archinit()
to reserve bios and acpi tables.

upareserve() has been replaced by upaalloc(), which now
has an address argument.

umbrwmalloc() and umbmalloc() have been replaced by
umballoc().

both upaalloc() and umballoc() return physical addresses
or -1 on error. the physical address -1 is now used as
a sentinel value instead of 0 when dealing with physical
addresses.

archmp and archacpi now always use vmap() to access
the bios tables and reserve the ranges. more overflow
checks have been added.

ramscan() has been rewritten using vmap().

to handle the population of kernel memory, pc and pc64
now have pmap() and punmap() functions to do permanent
mappings.

Subject: cinap_lenrek: hg/plan9front: kernel: remove scheddump() comment for delay() in */fns.h

details:     http://code.9front.org/hg/plan9front/rev/beb56aca59e2
changeset:   7646:beb56aca59e2
user:        cinap_lenrek@felloff.net
date:        Sat Apr 04 16:50:37 2020 +0200
description: kernel: remove scheddump() comment for delay() in */fns.h

Subject: cinap_lenrek: hg/plan9front: mtx, ppc: use proctab() to index into process table

details:     http://code.9front.org/hg/plan9front/rev/30fe269d7971
changeset:   7647:30fe269d7971
user:        cinap_lenrek@felloff.net
date:        Sat Apr 04 16:52:08 2020 +0200
description: mtx, ppc: use proctab() to index into process table

Subject: cinap_lenrek: hg/plan9front: merge

details:     http://code.9front.org/hg/plan9front/rev/b57e5d6b3550
changeset:   7648:b57e5d6b3550
user:        cinap_lenrek@felloff.net
date:        Sat Apr 04 17:17:15 2020 +0200
description: merge


diffstat:

 sys/man/3/kbd              |    21 +-
 sys/src/9/bcm/fns.h        |     2 +-
 sys/src/9/kw/fns.h         |     2 +-
 sys/src/9/mtx/mmu.c        |     5 +-
 sys/src/9/omap/fns.h       |     2 +-
 sys/src/9/pc/archacpi.c    |    28 +-
 sys/src/9/pc/archmp.c      |    26 +-
 sys/src/9/pc/bootargs.c    |     2 +-
 sys/src/9/pc/devi82365.c   |     8 +-
 sys/src/9/pc/devkbd.c      |    34 +-
 sys/src/9/pc/devpccard.c   |    48 +-
 sys/src/9/pc/ether8003.c   |    13 +-
 sys/src/9/pc/ether8390.c   |    20 +-
 sys/src/9/pc/fns.h         |    17 +-
 sys/src/9/pc/main.c        |     3 +-
 sys/src/9/pc/mem.h         |     2 +-
 sys/src/9/pc/memory.c      |  1275 +++++++++++++------------------------------
 sys/src/9/pc/mkfile        |     1 +
 sys/src/9/pc/mmu.c         |    16 +-
 sys/src/9/pc/pci.c         |     2 +-
 sys/src/9/pc/screen.c      |    13 +-
 sys/src/9/pc64/fns.h       |    17 +-
 sys/src/9/pc64/main.c      |     3 +-
 sys/src/9/pc64/mem.h       |     2 +-
 sys/src/9/pc64/memory.c    |   802 ---------------------------
 sys/src/9/pc64/mkfile      |     1 +
 sys/src/9/pc64/mmu.c       |    35 +-
 sys/src/9/port/memmap.c    |   271 +++++++++
 sys/src/9/port/portfns.h   |     6 +
 sys/src/9/ppc/mmu.c        |    10 +-
 sys/src/9/teg2/fns.h       |     2 +-
 sys/src/cmd/upas/fs/mbox.c |     6 +-
 32 files changed, 838 insertions(+), 1857 deletions(-)

diffs (truncated from 3460 to 300 lines):

diff --git a/sys/man/3/kbd b/sys/man/3/kbd
--- a/sys/man/3/kbd
+++ b/sys/man/3/kbd
@@ -7,17 +7,15 @@ kbd \- pc keyboard driver
 
 .B /dev/scancode
 .B /dev/leds
-.B /dev/repeat
 .fi
 .SH DESCRIPTION
 .PP
 The
 .I kbd
 device serves a one-level directory containing the files
-.BR scancode ,
-.BR leds
+.BR scancode
 and
-.BR repeat .
+.BR leds .
 .PP
 Reading the
 .BR scancode
@@ -31,27 +29,14 @@ file can be only opened once by the host
 .PP
 Writing a number to the write-only 
 .BR leds
-file changes the status leds on the keyboard. The value of the
+file changes the status leds on the keyboard. the value of the
 number is the addition of 1, 2 and 4 representing activated
 Scroll, Num and Caps leds.
-.PP
-The
-.BR repeat
-file sets typematic rate and delay.  The value of the number is a
-bitmask where first 5 bits set the repeat rate (ranging from 0b00000
-for 30Hz to 0b11111 for 2Hz).  Bits 6 and 7 set the delay before the
-first repeat is activated (ranging from 0b00 for 250ms to 0b11 for
-1000ms).
 .SH EXAMPLE 
 Set the Scroll and Caps leds:
 .EX
 echo 5 >/dev/leds
 .EE
-.PP
-Enable fast repeat rate and the least delay:
-.EX
-echo 0 >/dev/repeat
-.EE
 .SH "SEE ALSO"
 .IR kbdfs (8)
 .SH SOURCE
diff --git a/sys/src/9/bcm/fns.h b/sys/src/9/bcm/fns.h
--- a/sys/src/9/bcm/fns.h
+++ b/sys/src/9/bcm/fns.h
@@ -120,7 +120,7 @@ extern int fpuemu(Ureg*);
 /*
  * Things called from port.
  */
-extern void delay(int);				/* only scheddump() */
+extern void delay(int);
 extern int islo(void);
 extern void microdelay(int);			/* only edf.c */
 extern void evenaddr(uintptr);
diff --git a/sys/src/9/kw/fns.h b/sys/src/9/kw/fns.h
--- a/sys/src/9/kw/fns.h
+++ b/sys/src/9/kw/fns.h
@@ -118,7 +118,7 @@ extern Block* uciallocb(int);
 /*
  * Things called from port.
  */
-extern void delay(int);				/* only scheddump() */
+extern void delay(int);
 extern int islo(void);
 extern void microdelay(int);			/* only edf.c */
 extern void evenaddr(uintptr);
diff --git a/sys/src/9/mtx/mmu.c b/sys/src/9/mtx/mmu.c
--- a/sys/src/9/mtx/mmu.c
+++ b/sys/src/9/mtx/mmu.c
@@ -85,10 +85,11 @@ mmusweep(void*)
 
 		sweepcolor = m->sweepcolor;
 		x = splhi();
-		p = proctab(0);
-		for(i = 0; i < conf.nproc; i++, p++)
+		for(i = 0; i < conf.nproc; i++) {
+			p = proctab(i);
 			if(PIDCOLOR(p->mmupid) == sweepcolor)
 				p->mmupid = 0;
+		}
 		splx(x);
 
 		ptab = (ulong*)m->ptabbase;
diff --git a/sys/src/9/omap/fns.h b/sys/src/9/omap/fns.h
--- a/sys/src/9/omap/fns.h
+++ b/sys/src/9/omap/fns.h
@@ -133,7 +133,7 @@ extern void ucfreeb(Block*);
 /*
  * Things called from port.
  */
-extern void delay(int);				/* only scheddump() */
+extern void delay(int);
 extern int islo(void);
 extern void microdelay(int);			/* only edf.c */
 extern void evenaddr(uintptr);
diff --git a/sys/src/9/pc/archacpi.c b/sys/src/9/pc/archacpi.c
--- a/sys/src/9/pc/archacpi.c
+++ b/sys/src/9/pc/archacpi.c
@@ -113,8 +113,9 @@ maptable(uvlong xpa)
 	int i;
 
 	pa = xpa;
-	if((uvlong)pa != xpa || pa == 0)
+	if((uvlong)pa != xpa || pa == 0 || pa+7 < pa)
 		return;
+		
 	if(ntblpa >= nelem(tblpa) || ntblmap >= nelem(tblmap))
 		return;
 
@@ -124,21 +125,18 @@ maptable(uvlong xpa)
 	}
 	tblpa[ntblpa++] = pa;
 
+	memreserve(pa, 8);
 	if((t = vmap(pa, 8)) == nil)
 		return;
 	l = get32(t->len);
-	if(l < Tblsz){
+	if(l < Tblsz
+	|| l >= 0x10000000
+	|| pa+l-1 < pa){
 		vunmap(t, 8);
 		return;
 	}
-	if(memcheck(pa, l) != l){
-		print("maptable: ignoring %.4s at [%#p-%#p); overlaps usable memory\n",
-			(char*)t->sig, pa, pa+l);
-		vunmap(t, 8);
-		return;
-	}
+	memreserve(pa, l);
 	vunmap(t, 8);
-
 	if((t = vmap(pa, l)) == nil)
 		return;
 	if(checksum(t, l)){
@@ -177,9 +175,10 @@ maptables(void)
 		return;
 	if(!checksum(rsd, 20))
 		maptable(get32(rsd->raddr));
-	if(rsd->rev >= 2)
+	if(rsd->rev >= 2){
 		if(!checksum(rsd, 36))
 			maptable(get64(rsd->xaddr));
+	}
 }
 
 static Apic*
@@ -567,8 +566,6 @@ acpiinit(void)
 	ulong lapicbase;
 	int machno, i, c;
 
-	maptables();
-
 	amlinit();
 
 	/* load DSDT */
@@ -789,14 +786,15 @@ identify(void)
 	pa = (uintptr)strtoull(cp, nil, 16);
 	if(pa <= 1)
 		rsd = rsdsearch();
-	else if(pa < MemMin)
-		rsd = KADDR(pa);
-	else
+	else {
+		memreserve(pa, sizeof(Rsd));
 		rsd = vmap(pa, sizeof(Rsd));
+	}
 	if(rsd == nil)
 		return 1;
 	if(checksum(rsd, 20) && checksum(rsd, 36))
 		return 1;
+	maptables();
 	addarchfile("acpitbls", 0444, readtbls, nil);
 	addarchfile("acpimem", 0600, readmem, writemem);
 	if(strcmp(cp, "0") == 0)
diff --git a/sys/src/9/pc/archmp.c b/sys/src/9/pc/archmp.c
--- a/sys/src/9/pc/archmp.c
+++ b/sys/src/9/pc/archmp.c
@@ -383,7 +383,7 @@ identify(void)
 {
 	char *cp;
 	_MP_ *_mp_;
-	ulong len;
+	ulong pa, len;
 
 	if((cp = getconf("*nomp")) != nil && strcmp(cp, "0") != 0)
 		return 1;
@@ -399,26 +399,28 @@ identify(void)
 		return 1;
 
 	len = PCMPsz;
-	if(_mp_->physaddr < MemMin)
-		pcmp = KADDR(_mp_->physaddr);
-	else if((pcmp = vmap(_mp_->physaddr, len)) == nil)
+	pa = _mp_->physaddr;
+	if(pa + len-1 < pa)
 		return 1;
-	if(pcmp->length < len
+
+	memreserve(pa, len);
+	if((pcmp = vmap(pa, len)) == nil)
+		return 1;
+	if(pcmp->length < PCMPsz
+	|| pa + pcmp->length-1 < pa
 	|| memcmp(pcmp, "PCMP", 4) != 0
 	|| (pcmp->version != 1 && pcmp->version != 4)){
 Bad:
-		if((uintptr)pcmp < KZERO)
-			vunmap(pcmp, len);
+		vunmap(pcmp, len);
 		pcmp = nil;
 		return 1;
 	}
 	len = pcmp->length;
-	if((uintptr)pcmp < KZERO)
-		vunmap(pcmp, PCMPsz);
-	if(_mp_->physaddr < MemMin)
-		pcmp = KADDR(_mp_->physaddr);
-	else if((pcmp = vmap(_mp_->physaddr, len)) == nil)
+	memreserve(pa, len);
+	vunmap(pcmp, PCMPsz);
+	if((pcmp = vmap(pa, len)) == nil)
 		return 1;
+
 	if(checksum(pcmp, len) != 0)
 		goto Bad;
 
diff --git a/sys/src/9/pc/bootargs.c b/sys/src/9/pc/bootargs.c
--- a/sys/src/9/pc/bootargs.c
+++ b/sys/src/9/pc/bootargs.c
@@ -24,7 +24,7 @@ multibootargs(void)
 	ulong *m, l;
 	int i, n;
 
-	if(multibootptr == 0)
+	if(multibootptr == 0 || multibootptr >= MemMin)
 		return;
 
 	multiboot = (ulong*)KADDR(multibootptr);
diff --git a/sys/src/9/pc/devi82365.c b/sys/src/9/pc/devi82365.c
--- a/sys/src/9/pc/devi82365.c
+++ b/sys/src/9/pc/devi82365.c
@@ -268,7 +268,6 @@ pcmmap(int slotno, ulong offset, int len
 		if((we & bit))
 		if(m->attr == attr)
 		if(offset >= m->ca && e <= m->cea){
-
 			m->ref++;
 			unlock(&pp->mlock);
 			return m;
@@ -285,12 +284,13 @@ pcmmap(int slotno, ulong offset, int len
 
 	/* if isa space isn't big enough, free it and get more */
 	if(m->len < len){
-		if(m->isa){
+		if(m->len){
 			umbfree(m->isa, m->len);
 			m->len = 0;
 		}
-		m->isa = PADDR(umbmalloc(0, len, Mgran));
-		if(m->isa == 0){
+		m->isa = umballoc(-1, len, Mgran);
+		if(m->isa == -1){
+			m->isa = 0;
 			print("pcmmap: out of isa space\n");
 			unlock(&pp->mlock);
 			return 0;
diff --git a/sys/src/9/pc/devkbd.c b/sys/src/9/pc/devkbd.c
--- a/sys/src/9/pc/devkbd.c
+++ b/sys/src/9/pc/devkbd.c
@@ -40,14 +40,12 @@ enum {
 	Qdir,
 	Qscancode,
 	Qleds,
-	Qrepeat,
 };
 
 static Dirtab kbdtab[] = {
 	".",		{Qdir, 0, QTDIR},	0,	0555,
 	"scancode",	{Qscancode, 0},		0,	0440,
 	"leds",		{Qleds, 0},		0,	0220,
-	"repeat",	{Qrepeat, 0},		0,	0220,
 };
 
 static Lock i8042lock;
@@ -195,28 +193,6 @@ setleds(int leds)
 	iunlock(&i8042lock);
 }
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-04-04 17:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-04 17:22 Fwd: [9front-commits] cinap_lenrek: hg/plan9front: ether8003: use physical addresses f cinap_lenrek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).