1 |
For those of us who have experienced this but do not read the sparclinux |
2 |
mailing list. |
3 |
|
4 |
|
5 |
|
6 |
-------- Forwarded Message -------- |
7 |
From: David Miller <davem@×××××××××.net> |
8 |
To: sparclinux@×××××××××××.org |
9 |
Cc: bcollins@××××××.com, fabbione@××××××.com, jurij@×××××.org, |
10 |
laforge@××××××××.org |
11 |
Subject: [SILO PATCH]: Fix CDROM booting on sparc64 |
12 |
Date: Sun, 18 Jun 2006 19:07:52 -0700 (PDT) |
13 |
|
14 |
This is a fix (finally!) for the infamous CDROM boot failures a lot of |
15 |
folks reported. A good log of the situation exists in Debian bug |
16 |
#261824 |
17 |
|
18 |
It's seen mostly on SunBlade1000, V280R, and V240 systems. But other |
19 |
kinds of boxes can see it too. |
20 |
|
21 |
SILO crashes trying to open the CDROM device, it dies deep in the OBP |
22 |
code for openning the device. You can see this clearly with "ftrace" |
23 |
at the "ok" prompt which gives a forth backtrace any time an error |
24 |
occurs during OBP execution. |
25 |
|
26 |
I tinkered around a little bit and it's easy to trigger the "Fast Data |
27 |
Access MMU Miss" error by hand at the OBP prompt by simply going (this |
28 |
example is on my SB1000): |
29 |
|
30 |
ok " /pci@8,700000/scsi@6/disk@6,0:f" open-dev |
31 |
ok " /pci@8,700000/scsi@6/disk@6,0:f" open-dev |
32 |
Fast Data Access MMU Miss |
33 |
|
34 |
(that /pci@... path can be determined by asking for the cdrom device |
35 |
alias, using "devalias cdrom" or similar) |
36 |
|
37 |
Ie. try to open the cdrom device twice causes the crash. This |
38 |
actually works on most systems! And that's why the failure doesn't |
39 |
occur everywhere. |
40 |
|
41 |
But why in the world would that be happening during a CDROM boot? |
42 |
|
43 |
When OBP loads up the first stage boot block of SILO, it opens the |
44 |
CDROM, reads the boot block, and then closes the CDROM device before |
45 |
executing the bootblock. This makes sense and that's why we get to |
46 |
the first stage loader just fine and the first stage loader can open |
47 |
the CDROM. Changing the above test case shows that this is how you're |
48 |
supposed to do things: |
49 |
|
50 |
ok showstack |
51 |
ok " /pci@8,700000/scsi@6/disk@6,0:f" open-dev |
52 |
fff141014 ok fff141014 close-dev |
53 |
ok " /pci@8,700000/scsi@6/disk@6,0:f" open-dev |
54 |
fff141014 ok |
55 |
|
56 |
('showstack' prints the contents of the forth stack, this way we can |
57 |
see the file-descriptor return value from open-dev which we need to |
58 |
pass into close-dev, another way is to say '.' which prints out the |
59 |
top of stack and also pops it off, we could have also just said |
60 |
'close-dev' all by itself since the file descriptor was on the forth |
61 |
stack already) |
62 |
|
63 |
So, close it before you open it again, and everything is fine. |
64 |
|
65 |
I went and studied the first stage boot code of SILO and it looked OK. |
66 |
It's written in assembly and it closes the device node just fine. But |
67 |
then I remembered we use a different piece of code for the first stage |
68 |
boot block on CDROM devices, it's written in C, and indeed it forgets |
69 |
to close the device. So when the second stage bootloader tries to |
70 |
open the CDROM we go splat. |
71 |
|
72 |
The SILO fix is obvious, and is included below. |
73 |
|
74 |
BTW, a good source of information on all of the OBP forth mumbo-jumbo |
75 |
can be found in the OpenBoot Command Reference Manual(s): |
76 |
|
77 |
http://docs.sun.com/app/docs/doc/801-7042 |
78 |
http://docs.sun.com/app/docs/doc/805-4434 |
79 |
http://docs.sun.com/app/docs/doc/805-4436 |
80 |
http://docs.sun.com/app/docs/doc/806-1379-10 |
81 |
|
82 |
Enjoy :) |
83 |
|
84 |
--- first-isofs/isofs.c.~1~ 2006-06-18 19:05:53.000000000 -0700 |
85 |
+++ first-isofs/isofs.c 2006-06-18 19:06:08.000000000 -0700 |
86 |
@@ -101,6 +101,23 @@ |
87 |
return 0; |
88 |
} |
89 |
|
90 |
+static void cd_fini(void) |
91 |
+{ |
92 |
+ switch (prom_vers) { |
93 |
+ case PROM_V0: |
94 |
+ romvec->pv_v0devops.v0_devclose(fd); |
95 |
+ break; |
96 |
+ |
97 |
+ case PROM_V2: |
98 |
+ case PROM_V3: |
99 |
+ romvec->pv_v2devops.v2_dev_close(fd); |
100 |
+ break; |
101 |
+ |
102 |
+ case PROM_P1275: |
103 |
+ p1275_cmd("close", 1, fd); |
104 |
+ break; |
105 |
+ }; |
106 |
+} |
107 |
|
108 |
static int cd_read_block(unsigned long long offset, int size, void *data) |
109 |
{ |
110 |
@@ -445,6 +462,8 @@ |
111 |
sinfo->conf_part = 1; |
112 |
strcpy(sinfo->conf_file, silo_conf); |
113 |
|
114 |
+ cd_fini(); |
115 |
+ |
116 |
prom_putchar(sinfo->id); |
117 |
|
118 |
return dest; |
119 |
- |
120 |
To unsubscribe from this list: send the line "unsubscribe sparclinux" in |
121 |
the body of a message to majordomo@×××××××××××.org |
122 |
More majordomo info at http://vger.kernel.org/majordomo-info.html |
123 |
-- |
124 |
Ferris McCormick (P44646, MI) <fmccor@g.o> |
125 |
Developer, Gentoo Linux (Devrel, Sparc) |