| plan 9 kernel history: overview | file list | diff list |
1995/0405/port/devsd.c (diff list | history)
| 1995/0404/sys/src/9/port/devsd.c:100,107 – 1995/0405/sys/src/9/port/devsd.c:100,106 (short | long | prev | next) | ||
| 1994/0913 | sdinit(void) { Disk *d; | |
| 1995/0329 |
| |
| 1995/0405 | uchar scratch[0xFF], type; | |
| 1995/0329 | int dev, i, nbytes; | |
| 1994/0913 | dev = 0; | |
| 1995/0404/sys/src/9/port/devsd.c:111,126 – 1995/0405/sys/src/9/port/devsd.c:110,120 | ||
| 1994/0913 | if(dev < 0) break; | |
| 1995/0404 |
| |
| 1994/0913 |
| |
| 1995/0405 | /* * Search for all the lun's. */ | |
| 1994/0913 | for(i = 0; i < Nlun; i++) { d->lun = i; | |
| 1995/0404 |
| |
| 1995/0329 | /* * A SCSI target does not support a lun if the | |
| 1995/0404/sys/src/9/port/devsd.c:127,154 – 1995/0405/sys/src/9/port/devsd.c:121,158 | ||
| 1995/0329 | * the peripheral device type and qualifier fields * in the response to an inquiry command are 0x7F. */ | |
| 1995/0405 | nbytes = sizeof(scratch); memset(scratch, 0, nbytes); if(scsiinquiry(d->t, d->lun, scratch, &nbytes) != STok) | |
| 1995/0329 | continue; | |
| 1995/0404 |
| |
| 1994/0913 |
| |
| 1995/0404 |
| |
| 1995/0405 | if(scratch[0] == 0x7F) | |
| 1994/0913 | continue; | |
| 1995/0405 | type = scratch[0] & 0x1F; /* * Read-capacity is mandatory for TypeDA, TypeMO and TypeCD. * It may return 'not ready' if TypeDA is not spun up, * TypeMO or TypeCD are not loaded or just plain slow getting * their act together after a reset. * If 'not ready' comes back, try starting a TypeDA and punt * the get capacity until the drive is attached. * It might be possible to be smarter here, and look at the * response from a test-unit-ready which would show if the * target was in the process of becoming ready. */ if(scsicap(d->t, d->lun, &d->size, &d->bsize) != STok) { nbytes = sizeof(scratch); memset(scratch, 0, nbytes); scsireqsense(d->t, 0, scratch, &nbytes, 1); if((scratch[2] & 0x0F) != 0x02) continue; if(type == TypeDA) scsistart(d->t, d->lun, 0); d->size = d->bsize = 0; | |
| 1994/0913 | } | |
| 1995/0404 |
| |
| 1994/0913 |
| |
| 1995/0404 |
| |
| 1995/0405 | switch(type){ | |
| 1994/0913 |
| |
| 1995/0403 |
| |
| 1994/0913 | ||
| 1995/0403 | case TypeDA: case TypeMO: sprint(d->vol, "sd%d", ndisk); | |
| 1995/0404/sys/src/9/port/devsd.c:161,167 – 1995/0405/sys/src/9/port/devsd.c:165,170 | ||
| 1995/0403 | default: continue; } | |
| 1995/0404 |
| |
| 1995/0403 | ||
| 1994/0913 | if(++ndisk >= Ndisk) break; | |
| 1995/0404/sys/src/9/port/devsd.c:281,290 – 1995/0405/sys/src/9/port/devsd.c:284,306 | ||
| 1994/0913 | char *b, *line[Npart+2], *field[3]; static char MAGIC[] = "plan9 partitions"; | |
| 1995/0405 | /* * If the drive wasn't ready when we tried to do a * read-capacity earlier (in sdinit()), try again. * It might be possible to be smarter here, and look at the * response from a test-unit-ready which would show if the * target was in the process of becoming ready. */ if(d->size == 0 || d->bsize == 0){ if(scsicap(d->t, d->lun, &d->size, &d->bsize) != STok){ d->size = d->bsize = 0; error(Eio); } } | |
| 1994/0913 | b = scsialloc(d->bsize); if(b == 0) error(Enomem); | |