Browse Source

Plan 9 from Bell Labs 2011-12-14

David du Colombier 12 years ago
parent
commit
71e0f9f2bf

+ 63 - 0
sys/include/disk.h

@@ -59,6 +59,69 @@ enum {
 	Gdisk,
 	Gguess,
 };
+enum {					/* SCSI command codes */
+	ScmdTur		= 0x00,		/* test unit ready */
+	ScmdRewind	= 0x01,		/* rezero/rewind */
+	ScmdRsense	= 0x03,		/* request sense */
+	ScmdFormat	= 0x04,		/* format unit */
+	ScmdRblimits	= 0x05,		/* read block limits */
+	ScmdRead	= 0x08,		/* read */
+	ScmdWrite	= 0x0A,		/* write */
+	ScmdSeek	= 0x0B,		/* seek */
+	ScmdFmark	= 0x10,		/* write filemarks */
+	ScmdSpace	= 0x11,		/* space forward/backward */
+	ScmdInq		= 0x12,		/* inquiry */
+	ScmdMselect6	= 0x15,		/* mode select */
+	ScmdMselect10	= 0x55,		/* mode select */
+	ScmdMsense6	= 0x1A,		/* mode sense */
+	ScmdMsense10	= 0x5A,		/* mode sense */
+	ScmdStart	= 0x1B,		/* start/stop unit */
+	ScmdRcapacity	= 0x25,		/* read capacity */
+	ScmdRcapacity16	= 0x9e,		/* long read capacity */
+	ScmdExtread	= 0x28,		/* extended read (10 bytes) */
+	ScmdRead16	= 0x88,		/* long read (16 bytes) */
+	ScmdWrite16	= 0x8A,		/* long write (16 bytes) */
+	ScmdExtwrite	= 0x2A,		/* extended write (10 bytes) */
+	ScmdExtseek	= 0x2B,		/* extended seek */
+
+	ScmdSynccache	= 0x35,		/* flush cache */
+	ScmdRTOC	= 0x43,		/* read TOC data */
+	ScmdRdiscinfo	= 0x51,		/* read disc information */
+	ScmdRtrackinfo	= 0x52,		/* read track information */
+	ScmdReserve	= 0x53,		/* reserve track */
+	ScmdBlank	= 0xA1,		/* blank *-RW media */
+
+	ScmdCDpause	= 0x4B,		/* pause/resume */
+	ScmdCDstop	= 0x4E,		/* stop play/scan */
+	ScmdCDplay	= 0xA5,		/* play audio */
+	ScmdCDload	= 0xA6,		/* load/unload */
+	ScmdCDscan	= 0xBA,		/* fast forward/reverse */
+	ScmdCDstatus	= 0xBD,		/* mechanism status */
+	Scmdgetconf	= 0x46,		/* get configuration */
+
+	ScmdEInitialise	= 0x07,		/* initialise element status */
+	ScmdMMove	= 0xA5,		/* move medium */
+	ScmdEStatus	= 0xB8,		/* read element status */
+	ScmdMExchange	= 0xA6,		/* exchange medium */
+	ScmdEposition	= 0x2B,		/* position to element */
+
+	ScmdReadDVD	= 0xAD,		/* read dvd structure */
+	ScmdReportKey	= 0xA4,		/* read dvd key */
+	ScmdSendKey	= 0xA3,		/* write dvd key */
+
+	ScmdClosetracksess= 0x5B,
+	ScmdRead12	= 0xA8,
+	ScmdSetcdspeed	= 0xBB,
+	ScmdReadcd	= 0xBE,
+
+	/* vendor-specific */
+	ScmdFwaddr	= 0xE2,		/* first writeable address */
+	ScmdTreserve	= 0xE4,		/* reserve track */
+	ScmdTinfo	= 0xE5,		/* read track info */
+	ScmdTwrite	= 0xE6,		/* write track */
+	ScmdMload	= 0xE7,		/* medium load/unload */
+	ScmdFixation	= 0xE9,		/* fixation */
+};
 
 /* proto file parsing */
 typedef void Protoenum(char *new, char *old, Dir *d, void *a);

+ 3 - 0
sys/lib/sysconfig/usb/plan9.ini

@@ -1,7 +1,10 @@
 console=0
 
+# new 9load can figure out bootfile
 bootfile=sdB0!9fat!9pccpuf.gz
 nobootprompt=local!/dev/sdXX/fossil
+
+readparts=
 nvram=/dev/sdXX/nvram
 
 debugboot=1

+ 1 - 1
sys/src/cmd/scuzz/cdaudio.c

@@ -1,7 +1,7 @@
 #include <u.h>
 #include <libc.h>
 #include <bio.h>
-
+#include <disk.h>
 #include "scsireq.h"
 
 extern Biobuf bout;

+ 1 - 1
sys/src/cmd/scuzz/cdr.c

@@ -1,6 +1,6 @@
 #include <u.h>
 #include <libc.h>
-
+#include <disk.h>
 #include "scsireq.h"
 
 long

+ 1 - 1
sys/src/cmd/scuzz/changer.c

@@ -1,6 +1,6 @@
 #include <u.h>
 #include <libc.h>
-
+#include <disk.h>
 #include "scsireq.h"
 
 long

+ 1 - 0
sys/src/cmd/scuzz/scsireq.c

@@ -5,6 +5,7 @@
  *	no luns
  *	and incomplete in many other ways
  */
+#include <disk.h>
 #include "scsireq.h"
 
 enum {

+ 0 - 61
sys/src/cmd/scuzz/scsireq.h

@@ -68,67 +68,6 @@ enum {					/* status */
 	Status_RO	= 0x85,		/* device is read-only */
 };
 
-enum {					/* SCSI command codes */
-	ScmdTur		= 0x00,		/* test unit ready */
-	ScmdRewind	= 0x01,		/* rezero/rewind */
-	ScmdRsense	= 0x03,		/* request sense */
-	ScmdFormat	= 0x04,		/* format unit */
-	ScmdRblimits	= 0x05,		/* read block limits */
-	ScmdRead	= 0x08,		/* read */
-	ScmdWrite	= 0x0A,		/* write */
-	ScmdSeek	= 0x0B,		/* seek */
-	ScmdFmark	= 0x10,		/* write filemarks */
-	ScmdSpace	= 0x11,		/* space forward/backward */
-	ScmdInq		= 0x12,		/* inquiry */
-	ScmdMselect6	= 0x15,		/* mode select */
-	ScmdMselect10	= 0x55,		/* mode select */
-	ScmdMsense6	= 0x1A,		/* mode sense */
-	ScmdMsense10	= 0x5A,		/* mode sense */
-	ScmdStart	= 0x1B,		/* start/stop unit */
-	ScmdRcapacity	= 0x25,		/* read capacity */
-	ScmdExtread	= 0x28,		/* extended read */
-	ScmdExtwrite	= 0x2A,		/* extended write */
-	ScmdExtseek	= 0x2B,		/* extended seek */
-
-	ScmdSynccache	= 0x35,		/* flush cache */
-	ScmdRTOC	= 0x43,		/* read TOC data */
-	ScmdRdiscinfo	= 0x51,		/* read disc information */
-	ScmdRtrackinfo	= 0x52,		/* read track information */
-	ScmdReserve	= 0x53,		/* reserve track */
-	ScmdBlank	= 0xA1,		/* blank *-RW media */
-
-	ScmdCDpause	= 0x4B,		/* pause/resume */
-	ScmdCDstop	= 0x4E,		/* stop play/scan */
-	ScmdCDplay	= 0xA5,		/* play audio */
-	ScmdCDload	= 0xA6,		/* load/unload */
-	ScmdCDscan	= 0xBA,		/* fast forward/reverse */
-	ScmdCDstatus	= 0xBD,		/* mechanism status */
-	Scmdgetconf	= 0x46,		/* get configuration */
-
-	ScmdEInitialise	= 0x07,		/* initialise element status */
-	ScmdMMove	= 0xA5,		/* move medium */
-	ScmdEStatus	= 0xB8,		/* read element status */
-	ScmdMExchange	= 0xA6,		/* exchange medium */
-	ScmdEposition	= 0x2B,		/* position to element */
-
-	ScmdReadDVD	= 0xAD,		/* read dvd structure */
-	ScmdReportKey	= 0xA4,		/* read dvd key */
-	ScmdSendKey	= 0xA3,		/* write dvd key */
-
-	ScmdClosetracksess= 0x5B,
-	ScmdRead12	= 0xA8,
-	ScmdSetcdspeed	= 0xBB,
-	ScmdReadcd	= 0xBE,
-
-	/* vendor-specific */
-	ScmdFwaddr	= 0xE2,		/* first writeable address */
-	ScmdTreserve	= 0xE4,		/* reserve track */
-	ScmdTinfo	= 0xE5,		/* read track info */
-	ScmdTwrite	= 0xE6,		/* write track */
-	ScmdMload	= 0xE7,		/* medium load/unload */
-	ScmdFixation	= 0xE9,		/* fixation */
-};
-
 enum {
 	/* sense data byte 0 */
 	Sd0valid	= 0x80,		/* valid sense data present */

+ 5 - 5
sys/src/cmd/scuzz/scuzz.c

@@ -1,7 +1,7 @@
 #include <u.h>
 #include <libc.h>
 #include <bio.h>
-
+#include <disk.h>
 #include "scsireq.h"
 
 enum {					/* fundamental constants/defaults */
@@ -30,7 +30,7 @@ typedef struct {
 	char *help;
 } ScsiCmd;
 
-static ScsiCmd scsicmd[];
+static ScsiCmd scsicmds[];
 
 static vlong
 vlmin(vlong a, vlong b)
@@ -1518,7 +1518,7 @@ cmdhelp(ScsiReq *rp, int argc, char *argv[])
 		p = argv[0];
 	else
 		p = 0;
-	for(cp = scsicmd; cp->name; cp++){
+	for(cp = scsicmds; cp->name; cp++){
 		if(p == 0 || strcmp(p, cp->name) == 0)
 			Bprint(&bout, "%s\n", cp->help);
 	}
@@ -1601,7 +1601,7 @@ cmdopen(ScsiReq *rp, int argc, char *argv[])
 	return status;
 }
 
-static ScsiCmd scsicmd[] = {
+static ScsiCmd scsicmds[] = {
 	{ "ready",	cmdready,	1,		/*[0x00]*/
 	  "ready",
 	},
@@ -1908,7 +1908,7 @@ main(int argc, char *argv[])
 		switch(ac = parse(ap, av, nelem(av))){
 
 		default:
-			for(cp = scsicmd; cp->name; cp++){
+			for(cp = scsicmds; cp->name; cp++){
 				if(strcmp(cp->name, av[0]) == 0)
 					break;
 			}

+ 1 - 0
sys/src/cmd/usb/disk/disk.c

@@ -9,6 +9,7 @@
 #include <ctype.h>
 #include <fcall.h>
 #include <thread.h>
+#include <disk.h>
 #include "scsireq.h"
 #include "usb.h"
 #include "usbfs.h"

+ 1 - 0
sys/src/cmd/usb/disk/main.c

@@ -5,6 +5,7 @@
 #include <libc.h>
 #include <fcall.h>
 #include <thread.h>
+#include <disk.h>
 #include "scsireq.h"
 #include "usb.h"
 #include "usbfs.h"

+ 1 - 0
sys/src/cmd/usb/disk/scsireq.c

@@ -16,6 +16,7 @@
 #include <u.h>
 #include <libc.h>
 #include <fcall.h>
+#include <disk.h>
 #include "scsireq.h"
 
 enum {

+ 0 - 62
sys/src/cmd/usb/disk/scsireq.h

@@ -77,68 +77,6 @@ enum {					/* status */
 	Status_RO	= 0x85,		/* device is read-only */
 };
 
-enum {					/* SCSI command codes */
-	ScmdTur		= 0x00,		/* test unit ready */
-	ScmdRewind	= 0x01,		/* rezero/rewind */
-	ScmdRsense	= 0x03,		/* request sense */
-	ScmdFormat	= 0x04,		/* format unit */
-	ScmdRblimits	= 0x05,		/* read block limits */
-	ScmdRead	= 0x08,		/* read */
-	ScmdWrite	= 0x0A,		/* write */
-	ScmdSeek	= 0x0B,		/* seek */
-	ScmdFmark	= 0x10,		/* write filemarks */
-	ScmdSpace	= 0x11,		/* space forward/backward */
-	ScmdInq		= 0x12,		/* inquiry */
-	ScmdMselect6	= 0x15,		/* mode select */
-	ScmdMselect10	= 0x55,		/* mode select */
-	ScmdMsense6	= 0x1A,		/* mode sense */
-	ScmdMsense10	= 0x5A,		/* mode sense */
-	ScmdStart	= 0x1B,		/* start/stop unit */
-	ScmdRcapacity	= 0x25,		/* read capacity */
-	ScmdRcapacity16	= 0x9e,		/* long read capacity */
-	ScmdExtread	= 0x28,		/* extended read */
-	ScmdExtwrite	= 0x2A,		/* extended write */
-	ScmdExtseek	= 0x2B,		/* extended seek */
-
-	ScmdSynccache	= 0x35,		/* flush cache */
-	ScmdRTOC	= 0x43,		/* read TOC data */
-	ScmdRdiscinfo	= 0x51,		/* read disc information */
-	ScmdRtrackinfo	= 0x52,		/* read track information */
-	ScmdReserve	= 0x53,		/* reserve track */
-	ScmdBlank	= 0xA1,		/* blank *-RW media */
-
-	ScmdCDpause	= 0x4B,		/* pause/resume */
-	ScmdCDstop	= 0x4E,		/* stop play/scan */
-	ScmdCDplay	= 0xA5,		/* play audio */
-	ScmdCDload	= 0xA6,		/* load/unload */
-	ScmdCDscan	= 0xBA,		/* fast forward/reverse */
-	ScmdCDstatus	= 0xBD,		/* mechanism status */
-	Scmdgetconf	= 0x46,		/* get configuration */
-
-	ScmdEInitialise	= 0x07,		/* initialise element status */
-	ScmdMMove	= 0xA5,		/* move medium */
-	ScmdEStatus	= 0xB8,		/* read element status */
-	ScmdMExchange	= 0xA6,		/* exchange medium */
-	ScmdEposition	= 0x2B,		/* position to element */
-
-	ScmdReadDVD	= 0xAD,		/* read dvd structure */
-	ScmdReportKey	= 0xA4,		/* read dvd key */
-	ScmdSendKey	= 0xA3,		/* write dvd key */
-
-	ScmdClosetracksess= 0x5B,
-	ScmdRead12	= 0xA8,
-	ScmdSetcdspeed	= 0xBB,
-	ScmdReadcd	= 0xBE,
-
-	/* vendor-specific */
-	ScmdFwaddr	= 0xE2,		/* first writeable address */
-	ScmdTreserve	= 0xE4,		/* reserve track */
-	ScmdTinfo	= 0xE5,		/* read track info */
-	ScmdTwrite	= 0xE6,		/* write track */
-	ScmdMload	= 0xE7,		/* medium load/unload */
-	ScmdFixation	= 0xE9,		/* fixation */
-};
-
 enum {
 	/* sense data byte 0 */
 	Sd0valid	= 0x80,		/* valid sense data present */