123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 |
- #include "all.h"
- #include "mem.h"
- #include "io.h"
- #include "ureg.h"
- #include "../pc/dosfs.h"
- /*
- * setting this to zero permits the use of discs of different sizes, but
- * can make jukeinit() quite slow while the robotics work through each disc
- * twice (once per side).
- */
- int FIXEDSIZE = 1;
- #ifndef DATE
- #define DATE 568011600L+4*3600
- #endif
- ulong mktime = DATE; /* set by mkfile */
- Startsb startsb[] =
- {
- "main", 2,
- 0
- };
- Dos dos;
- static
- struct
- {
- char *name;
- long (*read)(int, void*, long);
- vlong (*seek)(int, vlong);
- long (*write)(int, void*, long);
- int (*part)(int, char*);
- } nvrdevs[] =
- {
- { "fd", floppyread, floppyseek, floppywrite, 0, },
- { "hd", ataread, ataseek, atawrite, setatapart, },
- /*
- { "sd", scsiread, scsiseek, scsiwrite, setscsipart, },
- */
- { 0, },
- };
- void
- otherinit(void)
- {
- int dev, i, nfd, nhd, s;
- char *p, *q, buf[sizeof(nvrfile)+8];
- kbdinit();
- printcpufreq();
- etherinit();
- scsiinit();
- s = spllo();
- nhd = atainit();
- nfd = floppyinit();
- dev = 0;
- if(p = getconf("nvr")){
- strncpy(buf, p, sizeof(buf)-2);
- buf[sizeof(buf)-1] = 0;
- p = strchr(buf, '!');
- q = strrchr(buf, '!');
- if(p == 0 || q == 0 || strchr(p+1, '!') != q)
- panic("malformed nvrfile: %s\n", buf);
- *p++ = 0;
- *q++ = 0;
- dev = strtoul(p, 0, 0);
- strcpy(nvrfile, q);
- p = buf;
- } else
- if(p = getconf("bootfile")){
- strncpy(buf, p, sizeof(buf)-2);
- buf[sizeof(buf)-1] = 0;
- p = strchr(buf, '!');
- q = strrchr(buf, '!');
- if(p == 0 || q == 0 || strchr(p+1, '!') != q)
- panic("malformed bootfile: %s\n", buf);
- *p++ = 0;
- *q = 0;
- dev = strtoul(p, 0, 0);
- p = buf;
- } else
- if(nfd)
- p = "fd";
- else
- if(nhd)
- p = "hd";
- else
- p = "sd";
- for(i = 0; nvrdevs[i].name; i++){
- if(strcmp(p, nvrdevs[i].name) == 0){
- dos.dev = dev;
- if(nvrdevs[i].part && (*nvrdevs[i].part)(dos.dev, "disk") == 0)
- break;
- dos.read = nvrdevs[i].read;
- dos.seek = nvrdevs[i].seek;
- dos.write = nvrdevs[i].write;
- break;
- }
- }
- if(dos.read == 0)
- panic("no device for nvram\n");
- if(dosinit(&dos) < 0)
- panic("can't init dos dosfs on %s\n", p);
- splx(s);
- }
- void
- touser(void)
- {
- int i;
- settime(rtctime());
- boottime = time();
- print("sysinit\n");
- sysinit();
- userinit(floppyproc, 0, "floppyproc");
- /*
- * Ethernet i/o processes
- */
- etherstart();
- /*
- * read ahead processes
- */
- userinit(rahead, 0, "rah");
- /*
- * server processes
- */
- for(i=0; i<conf.nserve; i++)
- userinit(serve, 0, "srv");
- /*
- * worm "dump" copy process
- */
- userinit(wormcopy, 0, "wcp");
- /*
- * processes to read the console
- */
- consserve();
- /*
- * "sync" copy process
- * this doesn't return.
- */
- u->text = "scp";
- synccopy();
- }
- void
- localconfinit(void)
- {
- conf.nfile = 40000;
- conf.nodump = 0;
- conf.firstsb = 13219302;
- conf.recovsb = 0;
- conf.ripoff = 1;
- conf.nlgmsg = 100;
- conf.nsmmsg = 500;
- conf.minuteswest = 5*60;
- conf.dsttime = 1;
- }
- int (*fsprotocol[])(Msgbuf*) = {
- serve9p1,
- serve9p2,
- nil,
- };
|