From 76b14f19d7aff6b2b711462fbdd62e4d89a8f06a Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Tue, 19 Jan 1999 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1999-01-19 --- carrera/kbd.c | 1 + carrera/screen.c | 1 + carrera/screen.h | 1 + pc/devvga.c | 1 + pc/mouse.c | 1 + pc/screen.c | 1 + pc/screen.h | 1 + pc/scsi.c | 38 ++++++++++++++++++++++---------------- pc/vga.c | 1 + pc/vgaark2000pv.c | 1 + pc/vgabt485.c | 1 + pc/vgaclgd542x.c | 1 + pc/vgact65545.c | 1 + pc/vgacyber938x.c | 1 + pc/vgamach64xx.c | 1 + pc/vgamga2164w.c | 1 + pc/vgargb524.c | 1 + pc/vgas3.c | 1 + pc/vgatvp3020.c | 1 + pc/vgatvp3026.c | 1 + pc/vgax.c | 1 + port/devmouse.c | 6 +++--- 22 files changed, 45 insertions(+), 19 deletions(-) diff --git a/carrera/kbd.c b/carrera/kbd.c index d02d2d66004fc6bb3a8898cf05b0d8ba4982cc6a..5b6de0037b324c750649de15812e5204f559cad4 100644 --- a/carrera/kbd.c +++ b/carrera/kbd.c @@ -8,6 +8,7 @@ #define Image IMAGE #include +#include #include "screen.h" enum diff --git a/carrera/screen.c b/carrera/screen.c index 94501f1df107b803bcd272355632862893e2842f..58f8f5292604125fa5531ba90f5635de2f62297b 100644 --- a/carrera/screen.c +++ b/carrera/screen.c @@ -10,6 +10,7 @@ #define Image IMAGE #include #include +#include #include "screen.h" #define MINX 8 diff --git a/carrera/screen.h b/carrera/screen.h index 427db66f23a4f6ada93e497f45143a0a265ae6c4..e2263272d22f9cf237baffcc2d4a71e35a9c5700 100644 --- a/carrera/screen.h +++ b/carrera/screen.h @@ -1,3 +1,4 @@ +typedef struct Cursor Cursor; typedef struct Cursorinfo Cursorinfo; struct Cursorinfo diff --git a/pc/devvga.c b/pc/devvga.c index 79e02172812e03652fec91cbce9bccb9cd75a8c8..44648b4ccae21bad9e3dd4b014939b939209d3d7 100644 --- a/pc/devvga.c +++ b/pc/devvga.c @@ -10,6 +10,7 @@ #define Image IMAGE #include #include +#include #include "screen.h" enum { diff --git a/pc/mouse.c b/pc/mouse.c index 6cc0a1278fb0c11758f41ef4f9707d94946155b8..e2807f99892b22ba7521effe8e58b4fa2c6259a9 100644 --- a/pc/mouse.c +++ b/pc/mouse.c @@ -9,6 +9,7 @@ #define Image IMAGE #include #include +#include #include "screen.h" /* diff --git a/pc/screen.c b/pc/screen.c index 70a4b7a5e54e549eb54d7542d9d9e3a43ac4284c..d8da276b246cbb07740e09d49679e8c38f9c2f9f 100644 --- a/pc/screen.c +++ b/pc/screen.c @@ -10,6 +10,7 @@ #define Image IMAGE #include #include +#include #include "screen.h" static ulong onesbits = ~0; diff --git a/pc/screen.h b/pc/screen.h index 6edbc082264e1d4b65363a4218ae42e8ba39b9e5..4252b2b8266b34d40b906b648ce58a6f104c9de6 100644 --- a/pc/screen.h +++ b/pc/screen.h @@ -1,3 +1,4 @@ +typedef struct Cursor Cursor; typedef struct Cursorinfo Cursorinfo; struct Cursorinfo { Cursor; diff --git a/pc/scsi.c b/pc/scsi.c index 7aa866d39c2c528320be78c2e262df0b89ff0e35..8d564663b79451c0dfac4217e551f21239e16d87 100644 --- a/pc/scsi.c +++ b/pc/scsi.c @@ -17,6 +17,7 @@ enum { CMDwrite6 = 0x0A, CMDinquire = 0x12, CMDstart = 0x1B, + CMDcapacity = 0x25, CMDread10 = 0x28, CMDwrite10 = 0x2A, }; @@ -97,11 +98,12 @@ scsiexec(Target *t, int rw, uchar *cmd, int cbytes, void *data, int *dbytes) default: /* - * It's more complicated than this. There are conditions which - * are 'ok' but for which the returned status code is not 'STok'. - * Also, not all conditions require a reqsense, there may be a - * need to do a reqsense here when necessary and making it - * available to the caller somehow. + * It's more complicated than this. There are conditions + * which are 'ok' but for which the returned status code + * is not 'STok'. + * Also, not all conditions require a reqsense, might + * need to do a reqsense here and make it available to the + * caller somehow. * * Later. */ @@ -145,7 +147,8 @@ scsiprobe(Ctlr *ctlr) nbytes = Nscratch; s = scsireqsense(t, 0, t->scratch, &nbytes, 0); if(s != STok){ - print("scsi#%d: unit %d unavailable, status %d\n", t->ctlrno, i, s); + print("scsi#%d: unit %d unavailable, status %d\n", + t->ctlrno, i, s); continue; } @@ -157,10 +160,12 @@ scsiprobe(Ctlr *ctlr) nbytes = Ninq; s = scsiinquiry(t, 0, t->inq, &nbytes); if(s != STok) { - print("scsi#%d: unit %d inquire failed, status %d\n", t->ctlrno, i, s); + print("scsi#%d: unit %d inquire failed, status %d\n", + t->ctlrno, i, s); continue; } - print("scsi#%d: unit %d: %s\n", t->ctlrno, i, (char*)(t->inq+8)); + print("scsi#%d: unit %d: %s\n", + t->ctlrno, i, (char*)(t->inq+8)); t->ok = 1; } } @@ -209,7 +214,8 @@ scsiinv(int devno, int *type, Target **rt, uchar **inq, char *id) *rt = t; *inq = t->inq; if(id) - sprint(id, "scsi%d: unit %d", ctlr, unit); + sprint(id, "scsi%d: unit %d", + ctlr, unit); return devno; } } @@ -259,7 +265,7 @@ scsicap(Target *t, char lun, ulong *size, ulong *bsize) uchar cmd[10], *d; memset(cmd, 0, sizeof(cmd)); - cmd[0] = 0x25; + cmd[0] = CMDcapacity; cmd[1] = lun<<5; nbytes = 8; @@ -354,17 +360,17 @@ scsireqsense(Target *t, char lun, void *data, int *nbytes, int quiet) switch(sense[2] & 0x0F){ - case 6: /* unit attention */ - if(sense[12] != 0x29) /* power on, reset */ + case 6: /* unit attention */ + if(sense[12] != 0x29) /* power on, reset */ goto buggery; /*FALLTHROUGH*/ - case 0: /* no sense */ - case 1: /* recovered error */ + case 0: /* no sense */ + case 1: /* recovered error */ free(sense); return STok; - case 2: /* not ready */ - if(sense[12] == 0x3A) /* medium not present */ + case 2: /* not ready */ + if(sense[12] == 0x3A) /* medium not present */ goto buggery; /*FALLTHROUGH*/ diff --git a/pc/vga.c b/pc/vga.c index fa101c78ddccd95ae8d24e9926092d98a00ff2f4..7ca41d658d1d7f0020fe4a16a9837216f4a5e342 100644 --- a/pc/vga.c +++ b/pc/vga.c @@ -8,6 +8,7 @@ #define Image IMAGE #include #include +#include #include "screen.h" static ulong backbits = (Backgnd<<24)|(Backgnd<<16)|(Backgnd<<8)|Backgnd; diff --git a/pc/vgaark2000pv.c b/pc/vgaark2000pv.c index fdf370ae9caad26f60f4d85d93a4927e5f29f7a6..3dfb96e18cf3d0760144de200d348a01f7657bad 100644 --- a/pc/vgaark2000pv.c +++ b/pc/vgaark2000pv.c @@ -8,6 +8,7 @@ #define Image IMAGE #include #include +#include #include "screen.h" static int diff --git a/pc/vgabt485.c b/pc/vgabt485.c index 72c28674219be5e175c31cebef20f12a115e2dee..1c155e6de6067e7a3c842a8fd4d59ff5d313f91b 100644 --- a/pc/vgabt485.c +++ b/pc/vgabt485.c @@ -8,6 +8,7 @@ #define Image IMAGE #include #include +#include #include "screen.h" /* diff --git a/pc/vgaclgd542x.c b/pc/vgaclgd542x.c index 7b9143c196006fe19f1f403b18d3c30095794ec4..951a142c15b1f526c717e207bb4440a82e16ceca 100644 --- a/pc/vgaclgd542x.c +++ b/pc/vgaclgd542x.c @@ -9,6 +9,7 @@ #define Image IMAGE #include #include +#include #include "screen.h" static int diff --git a/pc/vgact65545.c b/pc/vgact65545.c index 5be49fe0bf6ea3a605b060fd73fc46859914e14a..1f8f92b9bf311e8f3a31fdf7afe8febfbc93f011 100644 --- a/pc/vgact65545.c +++ b/pc/vgact65545.c @@ -8,6 +8,7 @@ #define Image IMAGE #include #include +#include #include "screen.h" static void diff --git a/pc/vgacyber938x.c b/pc/vgacyber938x.c index 96b6ddffc9204e97d27692595b504e76a940c116..5794394ca4ed3911232442d9c3aff5df9207bca2 100644 --- a/pc/vgacyber938x.c +++ b/pc/vgacyber938x.c @@ -9,6 +9,7 @@ #define Image IMAGE #include #include +#include #include "screen.h" enum { diff --git a/pc/vgamach64xx.c b/pc/vgamach64xx.c index e9e6b6dabad1fc3d0e0c3dfca5e6215da9a2c231..30fc6a633c1a7d8255fd43df4e9a92d6198975eb 100644 --- a/pc/vgamach64xx.c +++ b/pc/vgamach64xx.c @@ -9,6 +9,7 @@ #define Image IMAGE #include #include +#include #include "screen.h" /* diff --git a/pc/vgamga2164w.c b/pc/vgamga2164w.c index 0239dde7b764ccb1f45cb7d520bf7d553346a668..b9ebe0353ba3bf4754e2b9b2cafd29be8057896d 100644 --- a/pc/vgamga2164w.c +++ b/pc/vgamga2164w.c @@ -9,6 +9,7 @@ #define Image IMAGE #include #include +#include #include "screen.h" /* diff --git a/pc/vgargb524.c b/pc/vgargb524.c index 44eb7df4d9221a1d845375b5b57f1792bc73de8e..89c2129d3c99598903eeb9bca78c17da61b152ea 100644 --- a/pc/vgargb524.c +++ b/pc/vgargb524.c @@ -8,6 +8,7 @@ #define Image IMAGE #include #include +#include #include "screen.h" /* diff --git a/pc/vgas3.c b/pc/vgas3.c index 8e98ff75a75ad137df0893c65ac89fc74800ad58..a9d3bb164e64f6ee6b6e3407e5f683f78dc181aa 100644 --- a/pc/vgas3.c +++ b/pc/vgas3.c @@ -9,6 +9,7 @@ #define Image IMAGE #include #include +#include #include "screen.h" static int diff --git a/pc/vgatvp3020.c b/pc/vgatvp3020.c index 1ca7348a96d54c09f99294200fb5a43b28cabee6..08871d4ad1eb1701d58fb8ceb0491499045a8bdc 100644 --- a/pc/vgatvp3020.c +++ b/pc/vgatvp3020.c @@ -8,6 +8,7 @@ #define Image IMAGE #include #include +#include #include "screen.h" /* diff --git a/pc/vgatvp3026.c b/pc/vgatvp3026.c index 7080fe06e903747315779da4576c478e1e8313db..1b97d1bf7a830af4cea6670618f8aff2b5dfe4ed 100644 --- a/pc/vgatvp3026.c +++ b/pc/vgatvp3026.c @@ -8,6 +8,7 @@ #define Image IMAGE #include #include +#include #include "screen.h" /* diff --git a/pc/vgax.c b/pc/vgax.c index 9ca7720a6ff322a2187ed71df3c229f303f0d8c2..c765508e745b5708d088306e430065462fc1a83c 100644 --- a/pc/vgax.c +++ b/pc/vgax.c @@ -8,6 +8,7 @@ #define Image IMAGE #include #include +#include #include "screen.h" static Lock vgaxlock; /* access to index registers */ diff --git a/port/devmouse.c b/port/devmouse.c index a8cfcec39d9851564b08cc9dd6fdfdf6c5ddb1c4..0ad6fa164cc3ba578b04a25574bd6b39116789f3 100644 --- a/port/devmouse.c +++ b/port/devmouse.c @@ -6,10 +6,9 @@ #include "../port/error.h" #define Image IMAGE -#define mouse moose #include -#undef mouse #include +#include #include "screen.h" typedef struct Mouseinfo Mouseinfo; @@ -19,7 +18,8 @@ struct Mouseinfo int dx; int dy; int track; /* dx & dy updated */ - Mouse; + Point xy; /* mouse.xy */ + int buttons; /* mouse.buttons */ int redraw; /* update cursor on screen */ ulong counter; /* increments every update */ ulong lastcounter; /* value when /dev/mouse read */