9front - general discussion about 9front
 help / color / mirror / Atom feed
From: cinap_lenrek@felloff.net
To: 9front@9front.org
Subject: Re: [9front] CDROM on third drive?
Date: Sun, 4 Jan 2015 03:58:59 +0100	[thread overview]
Message-ID: <d11096430a7c7d511afea43d9c1aa9af@felloff.net> (raw)
In-Reply-To: <3e17c96c8907381879ff6e2dcb58fe68@mars.jitaku.localdomain>

found it, i made a new kernel under:

http://felloff.net/usr/cinap_lenrek/9pcfkenji2

the problem is that the ahci pci bar is probably wrong.
i added checks for this now so it shouldnt crash in this
place anymore.

if there are still issues, pass the *noahci=1 boot
parameter to the kernel in non-legacy mode. that should
at least get the kernel up and we can inspect the pci
device (using pci(1)) from netbooted plan9.

--
cinap

PS:

term% ktrace -i /tmp/9pcfkenji0 f010852c f0018c40
src(0xf010852c); // dumpstack+0x10
// data at 0xf0018c48? f016376c
src(0xf016376c); // panic+0xd2
// data at 0xf0018d70? f0108670
src(0xf0108670); // fault386+0xa3
// data at 0xf0018e20? f0107c39
src(0xf0107c39); // trap+0x15b
// data at 0xf0018ee0? f01005f0
src(0xf01005f0); // forkret
//passing interrupt frame; last pc found at sp=0xf0018ee0
// data at 0xf0018f20? f01b6736
src(0xf01b6736); // ahciidle+0x12
// data at 0xf0018f44? f01b6a25
src(0xf01b6a25); // ahciconfigdrive+0x78
// data at 0xf0018f64? f01b7424
src(0xf01b7424); // configdrive+0x2c
// data at 0xf0018f7c? f01ba366
src(0xf01ba366); // iapnp+0x337
// data at 0xf0018fc0? f01d157b
src(0xf01d157b); // sdreset+0x3d
// data at 0xf0018fd8? f0203550
src(0xf0203550); // chandevreset+0x24

acid: src(0xf01b6736); // ahciidle+0x12
/sys/src/9/pc/sdiahci.c:510
 505	ahciidle(Aport *port)
 506	{
 507		ulong *p, i, r;
 508	
 509		p = &port->cmd;
>510		if((*p & Arun) == 0)
 511			return 0;
 512		*p &= ~Ast;
 513		r = 0;
 514		for(i = 0; i < 500; i += 25){
 515			if((*p & Acr) == 0)

diff -r 1ccba5ce1e27 sys/src/9/pc/sdiahci.c
--- a/sys/src/9/pc/sdiahci.c	Sat Jan 03 18:33:35 2015 +0100
+++ b/sys/src/9/pc/sdiahci.c	Sun Jan 04 03:50:30 2015 +0100
@@ -2159,7 +2159,9 @@
 	while((p = pcimatch(p, 0, 0)) != nil){
 		if((type = didtype(p)) == -1)
 			continue;
-		if(p->mem[Abar].bar == 0)
+		if((p->mem[Abar].bar & ~0xf) == 0 || (p->mem[Abar].bar & 1) != 0)
+			continue;
+		if(p->mem[Abar].size < 0x180)
 			continue;
 		if(niactlr == NCtlr){
 			print("iapnp: %s: too many controllers\n", tname[type]);
@@ -2208,11 +2210,14 @@
 			d->ctlr = c;
 			if((c->hba->pi & 1<<i) == 0)
 				continue;
-			snprint(d->name, sizeof d->name, "iahci%d.%d", niactlr, i);
-			d->port = (Aport*)(c->mmio + 0x80*i + 0x100);
+			io = 0x100 + 0x80*i;
+			if((io + 0x80) > p->mem[Abar].size)
+				continue;
+			d->port = (Aport*)(c->mmio + io);
 			d->portc.p = d->port;
 			d->portc.m = &d->portm;
 			d->driveno = n++;
+			snprint(d->name, sizeof d->name, "iahci%d.%d", niactlr, i);
 			c->drive[d->driveno] = d;
 			iadrive[niadrive + d->driveno] = d;
 		}


  reply	other threads:[~2015-01-04  2:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-02  4:46 kokamoto
2015-01-02 10:46 ` [9front] " cinap_lenrek
2015-01-03  2:42   ` kokamoto
2015-01-03  3:16     ` cinap_lenrek
2015-01-03  6:50       ` kokamoto
2015-01-03 14:37         ` cinap_lenrek
2015-01-04  0:36           ` kokamoto
2015-01-04  0:53           ` kokamoto
2015-01-04  1:19             ` cinap_lenrek
2015-01-04  2:17               ` kokamoto
2015-01-04  2:58                 ` cinap_lenrek [this message]
2015-01-04  5:12                   ` kokamoto
2015-01-04  5:13                     ` kokamoto
2015-01-04  6:08                       ` kokamoto
2015-01-04 13:28                         ` cinap_lenrek
2015-01-07  5:39                         ` kokamoto
2015-01-07  5:54                           ` mischief
2015-01-07  8:40                             ` kokamoto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d11096430a7c7d511afea43d9c1aa9af@felloff.net \
    --to=cinap_lenrek@felloff.net \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).