diff --git a/include/fs/ubixfs/ubixfs.h b/include/fs/ubixfs/ubixfs.h index 877c9cb..cab2be5 100644 --- a/include/fs/ubixfs/ubixfs.h +++ b/include/fs/ubixfs/ubixfs.h @@ -30,10 +30,10 @@ #define _UBIXFS_UBIXFS_H #include -#include +#include #include #include -#include +#include #define UBIXFS_BLOCKSIZE_BYTES blockSize*512 #define UBIXFS_ALIGN(size) (size + ((((size) % (UBIXFS_BLOCKSIZE_BYTES)) == 0)? 0 : ((UBIXFS_BLOCKSIZE_BYTES) - ((size) % (UBIXFS_BLOCKSIZE_BYTES))))) diff --git a/include/fs/ufs/ffs.h b/include/fs/ufs/ffs.h index 77463f6..d8996f1 100644 --- a/include/fs/ufs/ffs.h +++ b/include/fs/ufs/ffs.h @@ -31,7 +31,7 @@ #define _FFS_H #include -#include +#include #include int ffs_read(fileDescriptor_t *,char *,uint32_t,long); diff --git a/include/isa/8259.h b/include/isa/8259.h new file mode 100644 index 0000000..df36487 --- /dev/null +++ b/include/isa/8259.h @@ -0,0 +1,74 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ISA_8259_H +#define _ISA_8259_H + +#include + +#define mPic 0x20 // I/O for master PIC +#define mImr 0x21 // I/O for master IMR +#define sPic 0xA0 // I/O for slave PIC +#define sImr 0xA1 // I/O for slace IMR +#define eoi 0x20 // EOI command +#define icw1 0x11 // Cascade, Edge triggered +#define icw4 0x01 // 8088 mode +#define mVec 0x68 // Vector for master +#define sVec 0x70 // Vector for slave +#define ocw3Irr 0x0A // Read IRR +#define ocw3Isr 0x0B // Read ISR + +int i8259_init(); +void irqEnable(uInt16 irqNo); +void irqDisable(uInt16 irqNo); + +#endif + +/*** + $Log: 8259.h,v $ + Revision 1.1.1.1 2006/06/01 12:46:14 reddawg + ubix2 + + Revision 1.2 2005/10/12 00:13:36 reddawg + Removed + + Revision 1.1.1.1 2005/09/26 17:23:39 reddawg + no message + + Revision 1.4 2004/07/09 13:20:08 reddawg + Oh yeah duh you can not name functions with numbers + + Revision 1.3 2004/07/09 13:14:29 reddawg + 8259: changed init8259 to 8259_init + Adjusted Startup Routines + + Revision 1.2 2004/05/21 14:57:16 reddawg + Cleaned up + + END + ***/ diff --git a/include/isa/atkbd.h b/include/isa/atkbd.h new file mode 100644 index 0000000..c1e41d9 --- /dev/null +++ b/include/isa/atkbd.h @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ISA_ATKBD_H +#define _ISA_ATKBD_H + +#define shiftKey 1 +#define controlKey 2 +#define altKey 4 +#define ledNumlock 2 +#define ledScrolllock 1 +#define ledCapslock 4 + +int atkbd_init(); +void atkbd_isr(); + +void keyboardHandler(); +void setLED(); + + +#endif /* END _ISA_ATKBD_H */ diff --git a/include/isa/fdc.h b/include/isa/fdc.h new file mode 100644 index 0000000..fcc33b8 --- /dev/null +++ b/include/isa/fdc.h @@ -0,0 +1,108 @@ +/***************************************************************************************** + Copyright (c) 2002-2004 The UbixOS Project + All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, are + permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, this list of + conditions, the following disclaimer and the list of authors. Redistributions in binary + form must reproduce the above copyright notice, this list of conditions, the following + disclaimer and the list of authors in the documentation and/or other materials provided + with the distribution. Neither the name of the UbixOS Project nor the names of its + contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT + OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + $Id: fdc.h 79 2016-01-11 16:21:27Z reddawg $ + +*****************************************************************************************/ + +#ifndef _FDC_H +#define _FDC_H + +#include + +typedef struct DrvGeom { + Int8 heads; + Int8 tracks; + Int8 spt; +} drvGeom; + + +#define fdcMsr (0x3f4) +#define fdcData (0x3f5) +#define fdcDir (0x3f7) +#define fdcCcr (0x3f7) +#define fdcDor (0x3f2) +#define fdcDrs (0x3f4) + +#define cmdWrite (0xc5) +#define cmdRead (0xe6) +#define cmdSeek (0x0f) +#define cmdSensei (0x08) +#define cmdRecal (0x07) +#define cmdSpecify (0x03) + +#define dg144Heads 2 /* heads per drive (1.44M) */ +#define dg144Tracks 80 +#define dg144Spt 18 +#define dg144Gap3rw 0x1b +#define dg168Gap3rw 0x1c + + + +int fdc_init(); +void floppyIsr(); +void floppyIsrhndlr(); +void sendByte(int Int8); +int getByte(); +bool fdcRw(int block,unsigned char *blockBuffer,bool read,unsigned long numSectors); +void block2Hts(int block,int *head,int *track,int *sector); +void motorOn(void); +void motorOff(void); +bool seek(int track); +bool waitFdc(bool sensei); +int getByte(); +void sendByte(int Int8); +void recalibrate(void); +void reset(void); +bool writeBlock(int block,Int8 *blockBuffer, unsigned long numSectors); +bool readBlock(int block,Int8 *blockBuffer, unsigned long numSectors); +void fdcWrite(void *info,void *,uInt32 startSector,uInt32 sectorCount); +void fdcRead(void *info,void *,uInt32 startSector,uInt32 sectorCount); + +#endif + +/*** + $Log: fdc.h,v $ + Revision 1.1.1.1 2006/06/01 12:46:14 reddawg + ubix2 + + Revision 1.2 2005/10/12 00:13:36 reddawg + Removed + + Revision 1.1.1.1 2005/09/26 17:23:39 reddawg + no message + + Revision 1.6 2004/07/17 02:38:31 reddawg + Fixed a few problems + + Revision 1.5 2004/07/14 12:42:46 reddawg + fdc: fdcInit to fdc_init + Changed Startup Routines + + Revision 1.4 2004/05/21 14:57:16 reddawg + Cleaned up + + END + ***/ diff --git a/include/isa/mouse.h b/include/isa/mouse.h new file mode 100644 index 0000000..240f253 --- /dev/null +++ b/include/isa/mouse.h @@ -0,0 +1,53 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ISA_MOUSE_H +#define _ISA_MOUSE_H + +int mouseInit(); +void mouseISR(); +void mouseHandler(); + +#endif + +/*** + $Log: mouse.h,v $ + Revision 1.1.1.1 2006/06/01 12:46:14 reddawg + ubix2 + + Revision 1.2 2005/10/12 00:13:36 reddawg + Removed + + Revision 1.1.1.1 2005/09/26 17:23:39 reddawg + no message + + Revision 1.1 2004/06/04 10:20:53 reddawg + mouse drive: fixed a few bugs works a bit better now + + END + ***/ diff --git a/include/isa/ne2k.h b/include/isa/ne2k.h new file mode 100644 index 0000000..e908f9c --- /dev/null +++ b/include/isa/ne2k.h @@ -0,0 +1,190 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ISA_NE2K_H +#define _ISA_NE2K_H + +#include +#include + +#define ether_addr ether_addr_t +typedef struct dp_rcvhdr +{ + uInt8 dr_status; /* Copy of rsr */ + uInt8 dr_next; /* Pointer to next packet */ + uInt8 dr_rbcl; /* Receive Byte Count Low */ + uInt8 dr_rbch; /* Receive Byte Count High */ +} dp_rcvhdr_t; + +typedef union etheraddr { + unsigned char bytes[6]; /* byteorder safe initialization */ + unsigned short shorts[3]; /* force 2-byte alignment */ +} ether_addr; + + +#define RSR_FO 0x08 +#define RSR_PRX 0x01 +#define DEF_ENABLED 0x200 + +#define OK 0 + + +#define startPage 0x4C +#define stopPage 0x80 + + +#define NE_CMD 0x00 +#define NE_PSTART 0x01 +#define NE_PSTOP 0x02 +#define NE_BNRY 0x03 +#define NE_TPSR 0x04 +#define NE_ISR 0x07 +#define NE_CURRENT 0x07 +#define NE_RBCR0 0x0A +#define NE_RBCR1 0x0B +#define NE_RCR 0x0C +#define NE_TCR 0x0D +#define NE_DCR 0x0E +#define NE_IMR 0x0F + + +#define NE_DCR_WTS 0x01 +#define NE_DCR_LS 0x08 +#define NE_DCR_AR 0x10 +#define NE_DCR_FT1 0x40 +#define NE_DCR_FT0 0x20 + + + +#define E8390_STOP 0x01 +#define E8390_NODMA 0x20 +#define E8390_PAGE0 0x00 +#define E8390_PAGE1 0x40 +#define E8390_CMD 0x00 +#define E8390_START 0x02 +#define E8390_RREAD 0x08 +#define E8390_RWRITE 0x10 +#define E8390_RXOFF 0x20 +#define E8390_TXOFF 0x00 +#define E8390_RXCONFIG 0x04 +#define E8390_TXCONFIG 0x00 + +#define EN0_COUNTER0 0x0d +#define EN0_DCFG 0x0e +#define EN0_RCNTLO 0x0a +#define EN0_RCNTHI 0x0b +#define EN0_ISR 0x07 +#define EN0_IMR 0x0f +#define EN0_RSARLO 0x08 +#define EN0_RSARHI 0x09 +#define EN0_TPSR 0x04 +#define EN0_RXCR 0x0c +#define EN0_TXCR 0x0D +#define EN0_STARTPG 0x01 +#define EN0_STOPPG 0x02 +#define EN0_BOUNDARY 0x03 + +#define EN1_PHYS 0x01 +#define EN1_CURPAG 0x07 +#define EN1_MULT 0x08 + +#define NE1SM_START_PG 0x20 +#define NE1SM_STOP_PG 0x40 +#define NESM_START_PG 0x40 +#define NESM_STOP_PG 0x80 + +#define ENISR_ALL 0x3f + +#define ENDCFG_WTS 0x01 + +#define NE_DATAPORT 0x10 + +#define TX_2X_PAGES 12 +#define TX_1X_PAGES 6 +#define TX_PAGES (dev->priv->pingPong ? TX_2X_PAGES : TX_1X_PAGES) + + +#define DP_CURR 0x7 /* Current Page Register */ +#define DP_MAR0 0x8 /* Multicast Address Register 0 */ +#define DP_MAR1 0x9 /* Multicast Address Register 1 */ +#define DP_MAR2 0xA /* Multicast Address Register 2 */ +#define DP_MAR3 0xB /* Multicast Address Register 3 */ +#define DP_MAR4 0xC /* Multicast Address Register 4 */ +#define DP_MAR5 0xD /* Multicast Address Register 5 */ +#define DP_MAR6 0xE /* Multicast Address Register 6 */ +#define DP_MAR7 0xF /* Multicast Address Register 7 */ + +#define DP_CNTR0 0xD /* Tally Counter 0 */ +#define DP_CNTR1 0xE /* Tally Counter 1 */ +#define DP_CNTR2 0xF /* Tally Counter 2 */ + + +#define DP_PAGESIZE 256 + +extern char *nicPacket; +extern uInt32 packetLength; + + +int ne2k_init(); +int ne2kProbe(int,struct device *); +int ne2kDevInit(struct device *); +void NS8390_init(struct device *dev,int startp); + +void ne2kISR(); +void ne2kHandler(); + +int NICtoPC(struct device *dev,void *packet,int length,int nic_addr); +int PCtoNIC(struct device *dev,void *packet,int length); + +struct nicBuffer *ne2kAllocBuffer(int); +struct nicBuffer *ne2kGetBuffer(); +void ne2kFreeBuffer(struct nicBuffer *); + +#endif + +/*** + $Log: ne2k.h,v $ + Revision 1.1.1.1 2006/06/01 12:46:14 reddawg + ubix2 + + Revision 1.2 2005/10/12 00:13:36 reddawg + Removed + + Revision 1.1.1.1 2005/09/26 17:23:39 reddawg + no message + + Revision 1.6 2004/07/14 12:03:49 reddawg + ne2k: ne2kInit to ne2k_init + Changed Startup Routines + + Revision 1.5 2004/05/21 14:57:16 reddawg + Cleaned up + + + END + ***/ diff --git a/include/isa/pit.h b/include/isa/pit.h new file mode 100644 index 0000000..628fd22 --- /dev/null +++ b/include/isa/pit.h @@ -0,0 +1,67 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _ISA_PIT_H +#define _ISA_PIT_H + +#define PIT_TIMER 200 + +int pit_init(); + +#endif + +/*** + $Log: pit.h,v $ + Revision 1.1.1.1 2006/06/01 12:46:14 reddawg + ubix2 + + Revision 1.2 2005/10/12 00:13:36 reddawg + Removed + + Revision 1.1.1.1 2005/09/26 17:23:40 reddawg + no message + + Revision 1.6 2004/08/14 11:23:02 reddawg + Changes + + Revision 1.5 2004/07/16 04:06:32 reddawg + Tune ups this stuff should of been taken care of months ago + + Revision 1.4 2004/07/16 01:08:58 reddawg + Whew we work once again + + Revision 1.3 2004/07/09 13:29:15 reddawg + pit: pitInit to pit_init + Adjusted initialization routines + + Revision 1.2 2004/05/21 14:57:16 reddawg + Cleaned up + + END + ***/ + diff --git a/include/mpi/mpi.h b/include/mpi/mpi.h new file mode 100644 index 0000000..0b1ce14 --- /dev/null +++ b/include/mpi/mpi.h @@ -0,0 +1,62 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _MPI_MPI_H +#define _MPI_MPI_H + +#include +#include + +#define MESSAGE_LENGTH 248 + +struct mpi_message { + char data[MESSAGE_LENGTH]; + uInt32 header; + pidType pid; + struct mpi_message *next; +}; + +struct mpi_mbox { + struct mpi_mbox *next; + struct mpi_mbox *prev; + struct mpi_message *msg; + struct mpi_message *msgLast; + char name[64]; + pidType pid; +}; + +typedef struct mpi_mbox mpi_mbox_t; +typedef struct mpi_message mpi_message_t; + +int mpi_createMbox(char *); +int mpi_destroyMbox(char *); +int mpi_postMessage(char *, uInt32, mpi_message_t *); +int mpi_fetchMessage(char *, mpi_message_t *); +int mpi_spam(uInt32, void *); + +#endif diff --git a/include/net/arch.h b/include/net/arch.h index 5cc97ae..da0a1d8 100644 --- a/include/net/arch.h +++ b/include/net/arch.h @@ -48,7 +48,7 @@ #include #include #include -#include +#include /** * @defgroup compiler_abstraction Compiler/platform abstraction diff --git a/include/net/arch/cc.h b/include/net/arch/cc.h index 2e99fc7..e910ab9 100644 --- a/include/net/arch/cc.h +++ b/include/net/arch/cc.h @@ -1,7 +1,7 @@ #ifndef __ARCH_CC_H__ #define __ARCH_CC_H__ -#include +#include #define PACK_STRUCT_FIELD(x) x __attribute__((packed)) #define PACK_STRUCT_STRUCT __attribute__((packed)) diff --git a/include/pci/hd.h b/include/pci/hd.h new file mode 100644 index 0000000..ea314f5 --- /dev/null +++ b/include/pci/hd.h @@ -0,0 +1,487 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _PCI_HD_H_ +#define _PCI_HD_H_ + +#include +#include + +#define hdData 0x0 +#define hdError 0x1 +#define hdSecCount 0x2 +#define hdSecNum 0x3 +#define hdCylLow 0x4 +#define hdCylHi 0x5 +#define hdHead 0x6 +#define hdStat 0x7 +#define hdCmd 0x7 + +/* ATA Uhm? */ +#define ATA_IDENTIFY_COMMAND_SET_SUPPORTED1_48BIT_ENABLE 0x0400 +#define ATA_IDENTIFY_SECTOR_LARGER_THEN_512_ENABLE 0x0100 + +/* ATA register defines */ +#define ATA_DATA 0 /* (RW) data */ + +#define ATA_FEATURE 1 /* (W) feature */ +#define ATA_F_DMA 0x01 /* enable DMA */ +#define ATA_F_OVL 0x02 /* enable overlap */ + +#define ATA_COUNT 2 /* (W) sector count */ + +#define ATA_SECTOR 3 /* (RW) sector # */ +#define ATA_CYL_LSB 4 /* (RW) cylinder# LSB */ +#define ATA_CYL_MSB 5 /* (RW) cylinder# MSB */ +#define ATA_DRIVE 6 /* (W) Sector/Drive/Head */ +#define ATA_D_LBA 0x40 /* use LBA addressing */ +#define ATA_D_IBM 0xa0 /* 512 byte sectors, ECC */ + +#define ATA_COMMAND 7 /* (W) command */ + +#define ATA_ERROR 8 /* (R) error */ +#define ATA_E_ILI 0x01 /* illegal length */ +#define ATA_E_NM 0x02 /* no media */ +#define ATA_E_ABORT 0x04 /* command aborted */ +#define ATA_E_MCR 0x08 /* media change request */ +#define ATA_E_IDNF 0x10 /* ID not found */ +#define ATA_E_MC 0x20 /* media changed */ +#define ATA_E_UNC 0x40 /* uncorrectable data */ +#define ATA_E_ICRC 0x80 /* UDMA crc error */ +#define ATA_E_ATAPI_SENSE_MASK 0xf0 /* ATAPI sense key mask */ + +#define ATA_IREASON 9 /* (R) interrupt reason */ +#define ATA_I_CMD 0x01 /* cmd (1) | data (0) */ +#define ATA_I_IN 0x02 /* read (1) | write (0) */ +#define ATA_I_RELEASE 0x04 /* released bus (1) */ +#define ATA_I_TAGMASK 0xf8 /* tag mask */ + +#define ATA_STATUS 10 /* (R) status */ +#define ATA_ALTSTAT 11 /* (R) alternate status */ +#define ATA_S_ERROR 0x01 /* error */ +#define ATA_S_INDEX 0x02 /* index */ +#define ATA_S_CORR 0x04 /* data corrected */ +#define ATA_S_DRQ 0x08 /* data request */ +#define ATA_S_DSC 0x10 /* drive seek completed */ +#define ATA_S_SERVICE 0x10 /* drive needs service */ +#define ATA_S_DWF 0x20 /* drive write fault */ +#define ATA_S_DMA 0x20 /* DMA ready */ +#define ATA_S_READY 0x40 /* drive ready */ +#define ATA_S_BUSY 0x80 /* busy */ + +#define ATA_CONTROL 12 /* (W) control */ + +#define ATA_CTLOFFSET 0x206 /* control register offset */ +#define ATA_PCCARD_CTLOFFSET 0x0e /* do for PCCARD devices */ +#define ATA_PC98_CTLOFFSET 0x10c /* do for PC98 devices */ +#define ATA_A_IDS 0x02 /* disable interrupts */ +#define ATA_A_RESET 0x04 /* RESET controller */ +#ifdef ATA_LEGACY_SUPPORT +#define ATA_A_4BIT 0x08 /* 4 head bits: obsolete 1996 */ +#else +#define ATA_A_4BIT 0x00 +#endif +#define ATA_A_HOB 0x80 /* High Order Byte enable */ + +/* ATA Commands */ +#define ATA_IDENTIFY 0xEC +#define ATA_CHECK_POWER_MODE 0xE5 +#define ATA_STANDBY 0xE2 +#define ATA_STANDBY_IMMED 0xE0 +#define ATA_IDLE_IMMED 0xE1 +#define ATA_IDLE 0xE3 +#define ATA_FLUSH_CACHE 0xE7 +#define ATA_FLUSH_CACHE_EXT 0xEA +#define ATA_READ_DMA_EXT 0x25 +#define ATA_READ_DMA 0xC8 +#define ATA_READ_SECTORS_EXT 0x24 +#define ATA_READ_SECTORS 0x20 +#define ATA_WRITE_DMA_EXT 0x35 +#define ATA_WRITE_DMA 0xCA +#define ATA_WRITE_SECTORS_EXT 0x34 +#define ATA_WRITE_SECTORS 0x30 +#define ATA_WRITE_UNCORRECTABLE 0x45 +#define ATA_READ_VERIFY_SECTORS 0x40 +#define ATA_READ_VERIFY_SECTORS_EXT 0x42 +#define ATA_READ_BUFFER 0xE4 +#define ATA_WRITE_BUFFER 0xE8 +#define ATA_EXECUTE_DEVICE_DIAG 0x90 +#define ATA_SET_FEATURES 0xEF +#define ATA_SMART 0xB0 +#define ATA_PACKET_IDENTIFY 0xA1 +#define ATA_PACKET 0xA0 +#define ATA_READ_FPDMA 0x60 +#define ATA_WRITE_FPDMA 0x61 +#define ATA_READ_LOG_EXT 0x2F +#define ATA_NOP 0x00 +#define ATA_DEVICE_RESET 0x08 +#define ATA_MEDIA_EJECT 0xED +#define ATA_SECURITY_UNLOCK 0xF2 +#define ATA_SECURITY_FREEZE_LOCK 0xF5 +#define ATA_DATA_SET_MANAGEMENT 0x06 +#define ATA_DOWNLOAD_MICROCODE 0x92 +#define ATA_WRITE_STREAM_DMA_EXT 0x3A +#define ATA_READ_LOG_DMA_EXT 0x47 +#define ATA_READ_STREAM_DMA_EXT 0x2A +#define ATA_WRITE_DMA_FUA 0x3D +#define ATA_WRITE_LOG_DMA_EXT 0x57 +#define ATA_READ_DMA_QUEUED 0xC7 +#define ATA_READ_DMA_QUEUED_EXT 0x26 +#define ATA_WRITE_DMA_QUEUED 0xCC +#define ATA_WRITE_DMA_QUEUED_EXT 0x36 +#define ATA_WRITE_DMA_QUEUED_FUA_EXT 0x3E +#define ATA_READ_MULTIPLE 0xC4 +#define ATA_READ_MULTIPLE_EXT 0x29 +#define ATA_WRITE_MULTIPLE 0xC5 +#define ATA_WRITE_MULTIPLE_EXT 0x39 +#define ATA_WRITE_MULTIPLE_FUA_EXT 0xCE + +struct driveInfo { + struct driveDiskLabel *diskLabel; + struct ata_identify_data *ata_identify; + uint32_t lba_high; + uint32_t lba_low; + uint32_t sector_size; + char hdEnable; + char hdDev; + char hdFlags; + char hdShift; + long hdMask; + uint32_t hdMulti; + long hdPort; + long hdSize; + long hdCalc; + long parOffset; + int part; + long lba_start; + long lba_end; +}; + +int initHardDisk(); +int hdWrite(struct driveInfo *hdd, void *, uInt32, uInt32); +int hdRead(struct driveInfo *hdd, void *, uInt32, uInt32); +int hdReset(); +int hdIoctl(); +int hdStart(); +int hdStop(); +int hdStandby(); +int hdInit(struct device_node *dev); + +struct dos_partition { + unsigned char dp_flag; /* bootstrap flags */ + unsigned char dp_shd; /* starting head */ + unsigned char dp_ssect; /* starting sector */ + unsigned char dp_scyl; /* starting cylinder */ + unsigned char dp_type; /* partition type */ + unsigned char dp_ehd; /* end head */ + unsigned char dp_esect; /* end sector */ + unsigned char dp_ecyl; /* end cylinder */ + uInt32 dp_start; /* absolute starting sector number */ + uInt32 dp_size; /* partition size in sectors */ +}; + +#define MAXPARTITIONS 8 + +struct bsd_disklabel { + uint32_t d_magic; /* the magic number */ + u_int16_t d_type; /* drive type */ + u_int16_t d_subtype; /* controller/d_type specific */ + char d_typename[16]; /* type name, e.g. "eagle" */ + + char d_packname[16]; /* pack identifier */ + + /* disk geometry: */ + uint32_t d_secsize; /* # of bytes per sector */ + uint32_t d_nsectors; /* # of data sectors per track */ + uint32_t d_ntracks; /* # of tracks per cylinder */ + uint32_t d_ncylinders; /* # of data cylinders per unit */ + uint32_t d_secpercyl; /* # of data sectors per cylinder */ + uint32_t d_secperunit; /* # of data sectors per unit */ + + /* + * Spares (bad sector replacements) below are not counted in + * d_nsectors or d_secpercyl. Spare sectors are assumed to + * be physical sectors which occupy space at the end of each + * track and/or cylinder. + */ + u_int16_t d_sparespertrack; /* # of spare sectors per track */ + u_int16_t d_sparespercyl; /* # of spare sectors per cylinder */ + /* + * Alternate cylinders include maintenance, replacement, configuration + * description areas, etc. + */ + uint32_t d_acylinders; /* # of alt. cylinders per unit */ + + /* hardware characteristics: */ + /* + * d_interleave, d_trackskew and d_cylskew describe perturbations + * in the media format used to compensate for a slow controller. + * Interleave is physical sector interleave, set up by the + * formatter or controller when formatting. When interleaving is + * in use, logically adjacent sectors are not physically + * contiguous, but instead are separated by some number of + * sectors. It is specified as the ratio of physical sectors + * traversed per logical sector. Thus an interleave of 1:1 + * implies contiguous layout, while 2:1 implies that logical + * sector 0 is separated by one sector from logical sector 1. + * d_trackskew is the offset of sector 0 on track N relative to + * sector 0 on track N-1 on the same cylinder. Finally, d_cylskew + * is the offset of sector 0 on cylinder N relative to sector 0 + * on cylinder N-1. + */ + u_int16_t d_rpm; /* rotational speed */ + u_int16_t d_interleave; /* hardware sector interleave */ + u_int16_t d_trackskew; /* sector 0 skew, per track */ + u_int16_t d_cylskew; /* sector 0 skew, per cylinder */ + uint32_t d_headswitch; /* head switch time, usec */ + uint32_t d_trkseek; /* track-to-track seek, usec */ + uint32_t d_flags; /* generic flags */ +#define NDDATA 5 + uint32_t d_drivedata[NDDATA]; /* drive-type specific information */ +#define NSPARE 5 + uint32_t d_spare[NSPARE]; /* reserved for future use */ + uint32_t d_magic2; /* the magic number (again) */ + u_int16_t d_checksum; /* xor of data incl. partitions */ + + /* filesystem and partition information: */ + u_int16_t d_npartitions; /* number of partitions in following */ + uint32_t d_bbsize; /* size of boot area at sn0, bytes */ + uint32_t d_sbsize; /* max size of fs superblock, bytes */ + struct partition { /* the partition table */ + uint32_t p_size; /* number of sectors in partition */ + uint32_t p_offset; /* starting sector */ + uint32_t p_fsize; /* filesystem basic fragment size */ + u_int8_t p_fstype; /* filesystem type, see below */ + u_int8_t p_frag; /* filesystem fragments per block */ + u_int16_t p_cpg; /* filesystem cylinders per group */ + } d_partitions[MAXPARTITIONS]; /* actually may be more */ +}; + +static const char *fstypenames[] = { "unused", "swap", "Version 6", "Version 7", "System V", "4.1BSD", "Eighth Edition", "4.2BSD", "MSDOS", "4.4LFS", "unknown", "HPFS", "ISO9660", "boot", "vinum", "raid", "?", "?", "?", "?", "jfs", NULL }; + +/** + * @name ATA_IDENTIFY_DEVICE_FIELD_LENGTHS + * + * The following constants define the number of bytes contained in various + * fields found in the IDENTIFY DEVICE data structure. + */ +#define ATA_IDENTIFY_SERIAL_NUMBER_LEN 20 +#define ATA_IDENTIFY_MODEL_NUMBER_LEN 40 +#define ATA_IDENTIFY_FW_REVISION_LEN 8 +#define ATA_IDENTIFY_48_LBA_LEN 8 +#define ATA_IDENTIFY_MEDIA_SERIAL_NUMBER_LEN 30 +#define ATA_IDENTIFY_WWN_LEN 8 + +struct ata_identify_data { + u_int16_t general_config_bits; // word 00 + u_int16_t obsolete0; // word 01 (num cylinders) + u_int16_t vendor_specific_config_bits; // word 02 + u_int16_t obsolete1; // word 03 (num heads) + u_int16_t retired1[2]; // words 04-05 + u_int16_t obsolete2; // word 06 (sectors / track) + u_int16_t reserved_for_compact_flash1[2]; // words 07-08 + u_int16_t retired0; // word 09 + u_int8_t serial_number[ATA_IDENTIFY_SERIAL_NUMBER_LEN]; // word 10-19 + u_int16_t retired2[2]; // words 20-21 + u_int16_t obsolete4; // word 22 + u_int8_t firmware_revision[ATA_IDENTIFY_FW_REVISION_LEN]; // words 23-26 + u_int8_t model_number[ATA_IDENTIFY_MODEL_NUMBER_LEN]; // words 27-46 + u_int16_t max_sectors_per_multiple; // word 47 + u_int16_t reserved0; // word 48 + u_int16_t capabilities1; // word 49 + u_int16_t capabilities2; // word 50 + u_int16_t obsolete5[2]; // words 51-52 + u_int16_t validity_bits; // word 53 + u_int16_t obsolete6[5]; // words 54-58 Used to be: + // current cylinders, + // current heads, + // current sectors/Track, + // current capacity + u_int16_t current_max_sectors_per_multiple; // word 59 + u_int8_t total_num_sectors[4]; // words 60-61 + u_int16_t obsolete7; // word 62 + u_int16_t multi_word_dma_mode; // word 63 + u_int16_t pio_modes_supported; // word 64 + u_int16_t min_multiword_dma_transfer_cycle; // word 65 + u_int16_t rec_min_multiword_dma_transfer_cycle; // word 66 + u_int16_t min_pio_transfer_no_flow_ctrl; // word 67 + u_int16_t min_pio_transfer_with_flow_ctrl; // word 68 + u_int16_t additional_supported; // word 69 + u_int16_t reserved1; // word 70 + u_int16_t reserved2[4]; // words 71-74 + u_int16_t queue_depth; // word 75 + u_int16_t serial_ata_capabilities; // word 76 + u_int16_t serial_ata_reserved; // word 77 + u_int16_t serial_ata_features_supported; // word 78 + u_int16_t serial_ata_features_enabled; // word 79 + u_int16_t major_version_number; // word 80 + u_int16_t minor_version_number; // word 81 + u_int16_t command_set_supported0; // word 82 + u_int16_t command_set_supported1; // word 83 + u_int16_t command_set_supported_extention; // word 84 + u_int16_t command_set_enabled0; // word 85 + u_int16_t command_set_enabled1; // word 86 + u_int16_t command_set_default; // word 87 + u_int16_t ultra_dma_mode; // word 88 + u_int16_t security_erase_completion_time; // word 89 + u_int16_t enhanced_security_erase_time; // word 90 + u_int16_t current_power_mgmt_value; // word 91 + u_int16_t master_password_revision; // word 92 + u_int16_t hardware_reset_result; // word 93 + u_int16_t current_acoustic_management_value; // word 94 + u_int16_t stream_min_request_size; // word 95 + u_int16_t stream_transfer_time; // word 96 + u_int16_t stream_access_latency; // word 97 + u_int16_t stream_performance_granularity[2]; // words 98-99 + u_int8_t max_48bit_lba[ATA_IDENTIFY_48_LBA_LEN]; // words 100-103 + u_int16_t streaming_transfer_time; // word 104 + u_int16_t max_lba_range_entry_blocks; // word 105 + u_int16_t physical_logical_sector_info; // word 106 + u_int16_t acoustic_test_interseek_delay; // word 107 + u_int8_t world_wide_name[ATA_IDENTIFY_WWN_LEN]; // words 108-111 + u_int8_t reserved_for_wwn_extention[ATA_IDENTIFY_WWN_LEN]; // words 112-115 + u_int16_t reserved4; // word 116 + u_int8_t words_per_logical_sector[4]; // words 117-118 + u_int16_t command_set_supported2; // word 119 + u_int16_t reserved5[7]; // words 120-126 + u_int16_t removable_media_status; // word 127 + u_int16_t security_status; // word 128 + u_int16_t vendor_specific1[31]; // words 129-159 + u_int16_t cfa_power_mode1; // word 160 + u_int16_t reserved_for_compact_flash2[7]; // words 161-167 + u_int16_t device_nominal_form_factor; // word 168 + u_int16_t data_set_management; // word 169 + u_int16_t reserved_for_compact_flash3[6]; // words 170-175 + u_int16_t current_media_serial_number[ATA_IDENTIFY_MEDIA_SERIAL_NUMBER_LEN]; //words 176-205 + u_int16_t reserved6[3]; // words 206-208 + u_int16_t logical_sector_alignment; // words 209 + u_int16_t reserved7[7]; // words 210-216 + u_int16_t nominal_media_rotation_rate; // word 217 + u_int16_t reserved8[16]; // words 218-233 + u_int16_t min_num_blocks_per_microcode; // word 234 + u_int16_t max_num_blocks_per_microcode; // word 235 + u_int16_t reserved9[19]; // words 236-254 + u_int16_t integrity_word; // word 255 +}; + +/* + * A list of partition types, probably outdated. + */ +static const char * const part_types[256] = { + [0x00] = "unused", + [0x01] = "Primary DOS with 12 bit FAT", + [0x02] = "XENIX / file system", + [0x03] = "XENIX /usr file system", + [0x04] = "Primary DOS with 16 bit FAT (< 32MB)", + [0x05] = "Extended DOS", + [0x06] = "Primary DOS, 16 bit FAT (>= 32MB)", + [0x07] = "NTFS, OS/2 HPFS, QNX-2 (16 bit) or Advanced UNIX", + [0x08] = "AIX file system or SplitDrive", + [0x09] = "AIX boot partition or Coherent", + [0x0A] = "OS/2 Boot Manager, OPUS or Coherent swap", + [0x0B] = "DOS or Windows 95 with 32 bit FAT", + [0x0C] = "DOS or Windows 95 with 32 bit FAT (LBA)", + [0x0E] = "Primary 'big' DOS (>= 32MB, LBA)", + [0x0F] = "Extended DOS (LBA)", + [0x10] = "OPUS", + [0x11] = "OS/2 BM: hidden DOS with 12-bit FAT", + [0x12] = "Compaq diagnostics", + [0x14] = "OS/2 BM: hidden DOS with 16-bit FAT (< 32MB)", + [0x16] = "OS/2 BM: hidden DOS with 16-bit FAT (>= 32MB)", + [0x17] = "OS/2 BM: hidden IFS (e.g. HPFS)", + [0x18] = "AST Windows swapfile", + [0x1b] = "ASUS Recovery partition (NTFS)", + [0x24] = "NEC DOS", + [0x3C] = "PartitionMagic recovery", + [0x39] = "plan9", + [0x40] = "VENIX 286", + [0x41] = "Linux/MINIX (sharing disk with DRDOS)", + [0x42] = "SFS or Linux swap (sharing disk with DRDOS)", + [0x43] = "Linux native (sharing disk with DRDOS)", + [0x4D] = "QNX 4.2 Primary", + [0x4E] = "QNX 4.2 Secondary", + [0x4F] = "QNX 4.2 Tertiary", + [0x50] = "DM (disk manager)", + [0x51] = "DM6 Aux1 (or Novell)", + [0x52] = "CP/M or Microport SysV/AT", + [0x53] = "DM6 Aux3", + [0x54] = "DM6", + [0x55] = "EZ-Drive (disk manager)", + [0x56] = "Golden Bow (disk manager)", + [0x5c] = "Priam Edisk (disk manager)", /* according to S. Widlake */ + [0x61] = "SpeedStor", + [0x63] = "System V/386 (such as ISC UNIX), GNU HURD or Mach", + [0x64] = "Novell Netware/286 2.xx", + [0x65] = "Novell Netware/386 3.xx", + [0x70] = "DiskSecure Multi-Boot", + [0x75] = "PCIX", + [0x77] = "QNX4.x", + [0x78] = "QNX4.x 2nd part", + [0x79] = "QNX4.x 3rd part", + [0x80] = "Minix until 1.4a", + [0x81] = "Minix since 1.4b, early Linux partition or Mitac disk manager", + [0x82] = "Linux swap or Solaris x86", + [0x83] = "Linux native", + [0x84] = "OS/2 hidden C: drive", + [0x85] = "Linux extended", + [0x86] = "NTFS volume set??", + [0x87] = "NTFS volume set??", + [0x93] = "Amoeba file system", + [0x94] = "Amoeba bad block table", + [0x9F] = "BSD/OS", + [0xA0] = "Suspend to Disk", + [0xA5] = "FreeBSD/NetBSD/386BSD", + [0xA6] = "OpenBSD", + [0xA7] = "NeXTSTEP", + [0xA9] = "NetBSD", + [0xAC] = "IBM JFS", + [0xAF] = "HFS+", + [0xB7] = "BSDI BSD/386 file system", + [0xB8] = "BSDI BSD/386 swap", + [0xBE] = "Solaris x86 boot", + [0xBF] = "Solaris x86 (new)", + [0xC1] = "DRDOS/sec with 12-bit FAT", + [0xC4] = "DRDOS/sec with 16-bit FAT (< 32MB)", + [0xC6] = "DRDOS/sec with 16-bit FAT (>= 32MB)", + [0xC7] = "Syrinx", + [0xDB] = "CP/M, Concurrent CP/M, Concurrent DOS or CTOS", + [0xDE] = "DELL Utilities - FAT filesystem", + [0xE1] = "DOS access or SpeedStor with 12-bit FAT extended partition", + [0xE3] = "DOS R/O or SpeedStor", + [0xE4] = "SpeedStor with 16-bit FAT extended partition < 1024 cyl.", + [0xEB] = "BeOS file system", + [0xEE] = "EFI GPT", + [0xEF] = "EFI System Partition", + [0xF1] = "SpeedStor", + [0xF2] = "DOS 3.3+ Secondary", + [0xF4] = "SpeedStor large partition", + [0xFB] = "VMware VMFS", + [0xFE] = "SpeedStor >1024 cyl. or LANstep", + [0xFF] = "Xenix bad blocks table", }; + +#endif diff --git a/include/pci/lnc.h b/include/pci/lnc.h new file mode 100644 index 0000000..aafd2a0 --- /dev/null +++ b/include/pci/lnc.h @@ -0,0 +1,257 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _PCI_LNC_H +#define _PCI_LNC_H + +#include + +// TEMP COMMENT FRESH +#define RDP 0x10 // Register Data Port 16Bit +#define RDP32 0x10 // Register Data Port 32Bit +#define RAP 0x12 // Register Address Port 16Bit +#define RAP32 0x14 // Register Address Port 32Bit +#define RESET 0x14 // Reset Port 16Bit +#define RESET32 0x18 // Reset Port 32Bit +#define BDP 0x16 // 16Bit +#define BDP32 0x1C // 32Bit + +// BCR18 +#define BCR18 18 +#define BCR18_DWIO 0x0080 + +// BCR20 +#define BCR20 0x0014 + +// Modes +#define MODE_16 0 +#define MODE_32 1 +#define MODE_INVALID 3 + +// CSR0 +#define CSR0 0x0000 +#define CSR0_STOP 0x0004 + +// CSR15 +#define CSR15 15 +#define CSR15_DXMTFCS 0x0008 +#define CSR15_DRTY 0x0020 +#define CSR15_PROM 0x8000 + +// CSR58 +#define CSR58 0x003A + +struct mds { + uint16_t md0; + uint16_t md1; + short md2; + uint16_t md3; +}; + +struct hostRingEntry_old { + struct mds *md; + union { + //struct mbuf *mbuf; + char *data; + } buff; +}; + +struct hostRingEntry { + uint32_t addr; + uint16_t bcnt; + uint8_t md[6]; + uint32_t reserved; +}; + +struct arpcom { + //struct ifnet ac_if; /* network-visible interface */ + uint8_t ac_enaddr[6]; /* ethernet hardware address */ + int ac_multicnt; /* length of ac_multiaddrs list */ + void *ac_netgraph; /* ng_ether(4) netgraph node info */ +}; + +struct nicInfo { + int ident; /* Type of card */ + int ic; /* Type of ic, Am7990, Am79C960 etc. */ + int memMode; + int iobase; + int mode; /* Mode setting at initialization */ +}; + +struct initBlock16 { + uint16_t mode; // Mode register + uint8_t padr[6]; // Ethernet address + uint8_t ladrf[8]; // Logical address filter (multicast) + uint16_t rdra; // Low order pointer to receive ring + uint16_t rlen; // High order pointer and no. rings + uint16_t tdra; // Low order pointer to transmit ring + uint16_t tlen; // High order pointer and no rings +}; + +struct initBlock32 { + uint16_t mode; + uint8_t rlen; + uint8_t tlen; + uint8_t padr[6]; + uint16_t res; + uint8_t ladrf[8]; + uint32_t rdra; + uint32_t tdra; +}; + +struct lncInfo { + struct arpcom arpcom; + struct nicInfo nic; + struct hostRingEntry *rxRing; + char *rxBuffer; + struct hostRingEntry *txRing; + char *txBuffer; + struct initBlock32 init; + unsigned int ioAddr; + int nrdre; + int ntdre; + int bufferSize; + int txPtr; + int rxPtr; +}; + +/* Functions */ +void lnc_writeCSR(struct lncInfo *, uint16_t, uint16_t); +void lnc_writeCSR32(struct lncInfo *, uint32_t, uint32_t); + +uint16_t lnc_readCSR(struct lncInfo *, uint16_t); +uint32_t lnc_readCSR32(struct lncInfo *, uint32_t); + +void lnc_writeBCR(struct lncInfo *, uint16_t, uint16_t); +void lnc_writeBCR32(struct lncInfo *, uint32_t, uint32_t); + +uint16_t lnc_readBCR(struct lncInfo *, uint16_t); +uint32_t lnc_readBCR32(struct lncInfo *, uint32_t); + +void lnc_reset(struct lncInfo *); +void lnc_reset32(struct lncInfo *); + +int lnc_probe(struct lncInfo *); + +int lnc_switchDWord(struct lncInfo *); + +int lnc_getMode(struct lncInfo *); + +void lnc_isr(); +int lnc_driverOwnsRX(struct lncInfo *); +int lnc_driverOwnsRX(struct lncInfo *); + +void lnc_INT(); +void lnc_rxINT(); +void lnc_txINT(); + +// OLD + +#define NDESC(len2) (1 << len2) +#define NORMAL 0 +#define MEM_SLEW 8 +#define TRANSBUFSIZE 1518 +#define RECVBUFSIZE 1518 +#define NRDRE 3 +#define NTDRE 3 +#define ETHER_ADDR_LEN 6 +#define NE2100_IOSIZE 24 + +#define PCNET_VSW 0x18 +#define NE2100 2 + +/* mem_mode values */ +#define DMA_FIXED 1 +#define DMA_MBUF 2 +#define SHMEM 4 + +/********** Chip Types **********/ +#define UNKNOWN 0 /* Unknown */ +#define LANCE 1 /* Am7990 */ +#define C_LANCE 2 /* Am79C90 */ +#define PCnet_ISA 3 /* Am79C960 */ +#define PCnet_ISAplus 4 /* Am79C961 */ +#define PCnet_ISA_II 5 /* Am79C961A */ +#define PCnet_32 6 /* Am79C965 */ +#define PCnet_PCI 7 /* Am79C970 */ +#define PCnet_PCI_II 8 /* Am79C970A */ +#define PCnet_FAST 9 /* Am79C971 */ +#define PCnet_FASTplus 10 /* Am79C972 */ +#define PCnet_Home 11 /* Am79C978 */ + +/******** AM7990 Specifics **************/ +#define CSR1 1 +#define CSR2 2 +#define CSR3 3 +#define CSR88 88 +#define CSR89 89 + +#define ERR 0x8000 +#define BABL 0x4000 +#define CERR 0x2000 +#define MISS 0x1000 +#define MERR 0x0800 +#define RINT 0x0400 +#define TINT 0x0200 +#define IDON 0x0100 +#define INTR 0x0080 +#define INEA 0x0040 +#define RXON 0x0020 +#define TXON 0x0010 +#define TDMD 0x0008 + +#define STRT 0x0002 +#define INIT 0x0001 + +/* CSR88-89: Chip ID masks */ +#define AMD_MASK 0x003 +#define PART_MASK 0xffff +#define Am79C960 0x0003 +#define Am79C961 0x2260 +#define Am79C961A 0x2261 +#define Am79C965 0x2430 +#define Am79C970 0x0242 +#define Am79C970A 0x2621 +#define Am79C971 0x2623 +#define Am79C972 0x2624 +#define Am79C973 0x2625 +#define Am79C978 0x2626 + +extern struct lncInfo *lnc; + +int initLNC(); +int probe(struct lncInfo *lnc); +int lanceProbe(struct lncInfo *lnc); +int lncAttach(struct lncInfo *lnc, int unit); + +void lncInt(); +void _lncInt(); + +int lnc_sendPacket(struct lncInfo *lnc, void *packet, size_t len, uInt8 *dest); + +#endif diff --git a/include/pci/pci.h b/include/pci/pci.h new file mode 100644 index 0000000..1c8d00d --- /dev/null +++ b/include/pci/pci.h @@ -0,0 +1,106 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _PCI_H +#define _PCI_H + +#include + +struct pciConfig { + uint16_t vendorID; + uint16_t deviceID; + + uint16_t command; + uint16_t status; + + uint8_t revisionID; + uint8_t progIf; + uint8_t subClass; + uint8_t classCode; + + uint8_t cacheLineSize; + uint8_t latencyTimer; + uint8_t headerType; + uint8_t bist; + + uint32_t bar[6]; + + uint32_t cbPointer; + + uint16_t subsysVendorID; + uint16_t subsysID; + + uint32_t epromAddr; + + uint16_t capabilites; + uint16_t res1; + + uint32_t res2; + + uint8_t intLine; + uint8_t intPin; + uint8_t minGrant; + uint8_t maxLatency; + + /* device info */ + //uint8_t bus; + //uint8_t dev; + //uint8_t func; + //uint8_t irq; + //uint8_t irqLine; + /* base registers */ + //uInt32 base[6]; + //uInt32 size[6]; + //uint16_t subsysVendor; + //uint16_t subsys; + /* Device Info */ + //Move this to anotther struct eventually + uint8_t bus; + uint8_t dev; + uint8_t func; + +}; + +struct confadd { + uint8_t reg :8; + uint8_t func :3; + uint8_t dev :5; + uint8_t bus :8; + uint8_t rsvd :7; + uint8_t enable :1; +}; + +#define countof(a) (sizeof(a) / sizeof(a[0])) + +int pci_init(); + +uint32_t pciProbe(int bus, int dev, int func); +uInt32 pciRead(int bus, int dev, int func, int reg, int bytes); +void pciWrite(int bus, int dev, int func, int reg, uInt32 v, int bytes); + +#endif diff --git a/include/sde/ogDisplay_UbixOS.h b/include/sde/ogDisplay_UbixOS.h new file mode 100644 index 0000000..8726d07 --- /dev/null +++ b/include/sde/ogDisplay_UbixOS.h @@ -0,0 +1,116 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef OGDISPLAY_UBIXOS_H +#define OGDISPLAY_UBIXOS_H + +#include +#include + +struct ogModeInfo { + uint16_t modeAttributes __attribute__((packed)); + uint8_t windowAFlags __attribute__((packed)); + uint8_t windowBFlags __attribute__((packed)); + uint16_t granularity __attribute__((packed)); + uint16_t windowSize __attribute__((packed)); + uint16_t windowASeg __attribute__((packed)); + uint16_t windowBSeg __attribute__((packed)); + void* bankSwitch __attribute__((packed)); + uint16_t bytesPerLine __attribute__((packed)); + uint16_t xRes __attribute__((packed)); + uint16_t yRes __attribute__((packed)); + uint8_t charWidth __attribute__((packed)); + uint8_t charHeight __attribute__((packed)); + uint8_t numBitPlanes __attribute__((packed)); + uint8_t bitsPerPixel __attribute__((packed)); + uint8_t numberOfBanks __attribute__((packed)); + uint8_t memoryModel __attribute__((packed)); + uint8_t bankSize __attribute__((packed)); + uint8_t numOfImagePages __attribute__((packed)); + uint8_t reserved __attribute__((packed)); + // Direct colour fields (required for Direct/6 and YUV/7 memory models + uint8_t redMaskSize __attribute__((packed)); + uint8_t redFieldPosition __attribute__((packed)); + uint8_t greenMaskSize __attribute__((packed)); + uint8_t greenFieldPosition __attribute__((packed)); + uint8_t blueMaskSize __attribute__((packed)); + uint8_t blueFieldPosition __attribute__((packed)); + uint8_t alphaMaskSize __attribute__((packed)); + uint8_t alphaFieldPosition __attribute__((packed)); + uint8_t directColourMode __attribute__((packed)); + // VESA 2.0 specific fields + uint32_t physBasePtr __attribute__((packed)); + void* offScreenMemOffset __attribute__((packed)); + uint16_t offScreenMemSize __attribute__((packed)); + uint8_t paddington[461] __attribute__((packed)); +}; + +struct ogVESAInfo { + char VBESignature[4] __attribute__((packed)); + uint8_t minVersion __attribute__((packed)); + uint8_t majVersion __attribute__((packed)); + uint32_t OEMStringPtr __attribute__((packed)); + uint32_t capabilities __attribute__((packed)); + uint32_t videoModePtr __attribute__((packed)); + uint16_t totalMemory __attribute__((packed)); + // VESA 2.0 specific fields + uint16_t OEMSoftwareRev __attribute__((packed)); + uint32_t OEMVendorNamePtr __attribute__((packed)); + uint32_t OEMProductNamePtr __attribute__((packed)); + uint32_t OEMProductRevPtr __attribute__((packed)); + uint8_t paddington[474] __attribute__((packed)); +}; + +class ogDisplay_UbixOS: public ogSurface { + protected: + void * pages[2]; + uint32_t activePage; + uint32_t visualPage; + ogVESAInfo * VESAInfo; + ogModeInfo * modeInfo; + + uint16_t FindMode(uint32_t, uint32_t, uint32_t); + void GetModeInfo(uint16_t); + void GetVESAInfo(void); + void SetMode(uint16_t); + void SetPal(void); + public: + ogDisplay_UbixOS(void); + virtual bool ogAlias(ogSurface&, uint32_t, uint32_t, uint32_t, uint32_t); + virtual bool ogClone(ogSurface&); + virtual void ogCopyPalette(ogSurface&); + virtual bool ogCreate(uint32_t, uint32_t, ogPixelFmt); + virtual bool ogLoadPalette(const char *); + virtual void ogSetPalette(const ogRGBA8[]); + virtual void ogSetPalette(uint8_t, uint8_t, uint8_t, uint8_t); + virtual void ogSetPalette(uint8_t, uint8_t, uint8_t, uint8_t, uint8_t); + virtual ~ogDisplay_UbixOS(void); +}; +// ogDisplay_UbixOS + +#endif diff --git a/include/sde/sde.h b/include/sde/sde.h new file mode 100644 index 0000000..4454434 --- /dev/null +++ b/include/sde/sde.h @@ -0,0 +1,62 @@ +/*- + * Copyright (c) 2002-2018 The UbixOS Project. + * All rights reserved. + * + * This was developed by Christopher W. Olsen for the UbixOS Project. + * + * Redistribution and use in source and binary forms, with or without modification, are permitted + * provided that the following conditions are met: + * + * 1) Redistributions of source code must retain the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors. + * 2) Redistributions in binary form must reproduce the above copyright notice, this list of + * conditions, the following disclaimer and the list of authors in the documentation and/or + * other materials provided with the distribution. + * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to + * endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _SDE_SDE_H +#define _SDE_SDE_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define registerWindow 1 +#define windowReady 2 +#define drawWindow 3 +#define killWindow 4 + +void sdeThread(); + +//void sysSDE(uint32_t cmd, void *ptr); +int sysSDE(struct thread *td, struct sys_sde_args *args); + +struct sdeWindows { + struct sdeWindows *next; + struct sdeWindows *prev; + void *buf; + pidType pid; + uint8_t status; +}; + +extern struct sdeWindows *windows; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/sys/_sigset.h b/include/sys/_sigset.h index c488c4e..eb73c5b 100644 --- a/include/sys/_sigset.h +++ b/include/sys/_sigset.h @@ -1,46 +1,59 @@ /*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. + * Copyright (c) 1982, 1986, 1989, 1991, 1993 + * The Regents of the University of California. All rights reserved. + * (c) UNIX System Laboratories, Inc. + * All or some portions of this file are derived from material licensed + * to the University of California by American Telephone and Telegraph + * Co. or Unix System Laboratories, Inc. and are reproduced herein with + * the permission of UNIX System Laboratories, Inc. * - * This was developed by Christopher W. Olsen for the UbixOS Project. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * @(#)signal.h 8.4 (Berkeley) 5/4/95 + * $FreeBSD: releng/11.2/sys/sys/_sigset.h 331722 2018-03-29 02:50:57Z eadler $ */ -#ifndef _SYS__SIGSET_H -#define _SYS__SIGSET_H +#ifndef _SYS__SIGSET_H_ +#define _SYS__SIGSET_H_ -#include - -// sigset_t macros -#define _SIG_WORDS 4 -#define _SIG_MAXSIG 128 -#define _SIG_IDX(sig) ((sig) - 1) -#define _SIG_WORD(sig) (_SIG_IDX(sig) >> 5) -#define _SIG_BIT(sig) (1 << (_SIG_IDX(sig) & 31)) -#define _SIG_VALID(sig) ((sig) <= _SIG_MAXSIG && (sig) > 0) +/* + * sigset_t macros. + */ +#define _SIG_WORDS 4 +#define _SIG_MAXSIG 128 +#define _SIG_IDX(sig) ((sig) - 1) +#define _SIG_WORD(sig) (_SIG_IDX(sig) >> 5) +#define _SIG_BIT(sig) (1 << (_SIG_IDX(sig) & 31)) +#define _SIG_VALID(sig) ((sig) <= _SIG_MAXSIG && (sig) > 0) typedef struct __sigset { - __uint32_t __bits [_SIG_WORDS]; + __uint32_t __bits[_SIG_WORDS]; } __sigset_t; -#endif /* END _SYS__SIGSET_H */ +#if defined(_KERNEL) && defined(COMPAT_43) +typedef unsigned int osigset_t; +#endif + +#endif /* !_SYS__SIGSET_H_ */ diff --git a/include/sys/buf.h b/include/sys/buf.h index b08e384..f9df8ae 100644 --- a/include/sys/buf.h +++ b/include/sys/buf.h @@ -30,7 +30,7 @@ #ifndef _BUF_H #define _BUF_H -#include +#include #include struct buf { diff --git a/include/sys/descrip.h b/include/sys/descrip.h index 9953efd..67f8e88 100644 --- a/include/sys/descrip.h +++ b/include/sys/descrip.h @@ -32,8 +32,8 @@ #include #include -#include -#include +#include +#include /* Limits */ #define MAX_FILES 256 diff --git a/include/sys/elf.h b/include/sys/elf.h index 4392989..ac3a614 100644 --- a/include/sys/elf.h +++ b/include/sys/elf.h @@ -32,7 +32,7 @@ #define __i386__ 1 #include -#include +#include #include #include diff --git a/include/sys/limits.h b/include/sys/limits.h index 34bfbd5..58ca781 100644 --- a/include/sys/limits.h +++ b/include/sys/limits.h @@ -29,7 +29,7 @@ #ifndef _SYS_LIMITS_H #define _SYS_LIMITS_H -#include +#include #define LONG_BIT __LONG_BIT diff --git a/include/sys/signal.h b/include/sys/signal.h index 0ffe9b8..33721d0 100644 --- a/include/sys/signal.h +++ b/include/sys/signal.h @@ -30,6 +30,9 @@ #define _SYS_SIGNAL_H #include +#include + +typedef __sigset_t sigset_t; #define _SIG_WORDS 4 #define _SIG_MAXSIG 128 diff --git a/include/sys/vfs/inode.h b/include/sys/vfs/inode.h index baebb1a..a7fcf32 100644 --- a/include/sys/vfs/inode.h +++ b/include/sys/vfs/inode.h @@ -30,7 +30,7 @@ #define _VFS_INODE_H #include -#include +#include #include #include diff --git a/include/sys/vfs/vfs.h b/include/sys/vfs/vfs.h index 71c966d..90c76bc 100644 --- a/include/sys/vfs/vfs.h +++ b/include/sys/vfs/vfs.h @@ -34,7 +34,7 @@ #include #include #include -#include +#include #define MAY_EXEC 1 #define MAY_WRITE 2 diff --git a/include/ubixos/init.h b/include/ubixos/init.h index e52f026..5eebbfe 100644 --- a/include/ubixos/init.h +++ b/include/ubixos/init.h @@ -39,9 +39,9 @@ #include #include #include -#include +#include #include -#include +#include #include #include #include diff --git a/include/ubixos/sched.h b/include/ubixos/sched.h index 3388bec..2cb244d 100644 --- a/include/ubixos/sched.h +++ b/include/ubixos/sched.h @@ -34,7 +34,7 @@ #endif #include -#include +#include #include #include diff --git a/include/ubixos/syscalls.h b/include/ubixos/syscalls.h index 1336ac6..426fa88 100644 --- a/include/ubixos/syscalls.h +++ b/include/ubixos/syscalls.h @@ -30,7 +30,7 @@ #define _SYSCALLS_H #include -#include +#include #include #define SYSCALLS_MAX 1024 diff --git a/include/ubixos/vitals.h b/include/ubixos/vitals.h index 8c81915..8c3ab88 100644 --- a/include/ubixos/vitals.h +++ b/include/ubixos/vitals.h @@ -31,7 +31,7 @@ #include #include -#include +#include typedef struct vitalsStruct { uint32_t sysTicks; // 0 - Do Not Change Order diff --git a/sys/fs/devfs/devfs.c b/sys/fs/devfs/devfs.c index e96ba52..4b8a33a 100644 --- a/sys/fs/devfs/devfs.c +++ b/sys/fs/devfs/devfs.c @@ -29,8 +29,8 @@ #include #include #include -#include -#include +#include +#include #include #include #include diff --git a/sys/fs/ubixfs/block.c b/sys/fs/ubixfs/block.c index 8be4d23..261cc3c 100644 --- a/sys/fs/ubixfs/block.c +++ b/sys/fs/ubixfs/block.c @@ -66,9 +66,9 @@ *****************************************************************************************/ -#include -#include -#include +#include +#include +#include void syncBat(struct vfs_mountPoint *mp) { diff --git a/sys/fs/ubixfs/dirCache.c b/sys/fs/ubixfs/dirCache.c index d4a483d..f6f7f08 100644 --- a/sys/fs/ubixfs/dirCache.c +++ b/sys/fs/ubixfs/dirCache.c @@ -28,8 +28,8 @@ *****************************************************************************************/ #include -#include -#include +#include +#include #include #include #include diff --git a/sys/fs/ubixfs/directory.c b/sys/fs/ubixfs/directory.c index 52cd70d..c47d1fb 100644 --- a/sys/fs/ubixfs/directory.c +++ b/sys/fs/ubixfs/directory.c @@ -27,9 +27,9 @@ *****************************************************************************************/ -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/sys/fs/ubixfs/thread.c b/sys/fs/ubixfs/thread.c index 69481e4..b1205a4 100644 --- a/sys/fs/ubixfs/thread.c +++ b/sys/fs/ubixfs/thread.c @@ -27,9 +27,9 @@ *****************************************************************************************/ -#include +#include #include -#include +#include #include static struct { diff --git a/sys/fs/ubixfs/ubixfs.c b/sys/fs/ubixfs/ubixfs.c index 602331c..2ea5462 100644 --- a/sys/fs/ubixfs/ubixfs.c +++ b/sys/fs/ubixfs/ubixfs.c @@ -27,9 +27,9 @@ *****************************************************************************************/ -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/sys/fs/ufs/ffs.c b/sys/fs/ufs/ffs.c index c9b8721..2a74592 100644 --- a/sys/fs/ufs/ffs.c +++ b/sys/fs/ufs/ffs.c @@ -1,6 +1,6 @@ -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/sys/fs/ufs/ufs.c b/sys/fs/ufs/ufs.c index 9ecb3ce..c3ecd6d 100644 --- a/sys/fs/ufs/ufs.c +++ b/sys/fs/ufs/ufs.c @@ -28,10 +28,10 @@ *****************************************************************************************/ #include -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include diff --git a/sys/fs/vfs/file.c b/sys/fs/vfs/file.c index 4534ab6..69e670d 100644 --- a/sys/fs/vfs/file.c +++ b/sys/fs/vfs/file.c @@ -27,7 +27,7 @@ */ #include -#include +#include #include #include #include diff --git a/sys/fs/vfs/inode.c b/sys/fs/vfs/inode.c index 30816cc..6794040 100644 --- a/sys/fs/vfs/inode.c +++ b/sys/fs/vfs/inode.c @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #include #include diff --git a/sys/fs/vfs/mount.c b/sys/fs/vfs/mount.c index 4363a75..7834732 100644 --- a/sys/fs/vfs/mount.c +++ b/sys/fs/vfs/mount.c @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #include #include #include diff --git a/sys/fs/vfs/namei.c b/sys/fs/vfs/namei.c index 139bb9c..2991df0 100644 --- a/sys/fs/vfs/namei.c +++ b/sys/fs/vfs/namei.c @@ -28,7 +28,7 @@ #include #include -#include +#include #include int follow_link(struct inode * dir, struct inode * inode, int flag, int mode, struct inode ** res_inode) { diff --git a/sys/fs/vfs/stat.c b/sys/fs/vfs/stat.c index ff102b6..5b5ea1b 100644 --- a/sys/fs/vfs/stat.c +++ b/sys/fs/vfs/stat.c @@ -28,8 +28,8 @@ #include #include -#include -#include +#include +#include #include #include diff --git a/sys/fs/vfs/vfs.c b/sys/fs/vfs/vfs.c index 63f5535..5f3914a 100644 --- a/sys/fs/vfs/vfs.c +++ b/sys/fs/vfs/vfs.c @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #include #include #include diff --git a/sys/i386/cpu.c b/sys/i386/cpu.c index ef9e0c0..ceb3db9 100644 --- a/sys/i386/cpu.c +++ b/sys/i386/cpu.c @@ -26,4 +26,4 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include diff --git a/sys/i386/i386_exec.c b/sys/i386/i386_exec.c index ae96533..ad86bab 100644 --- a/sys/i386/i386_exec.c +++ b/sys/i386/i386_exec.c @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/sys/i386/memcmp.S b/sys/i386/memcmp.S index c8e68c2..6f250dd 100644 --- a/sys/i386/memcmp.S +++ b/sys/i386/memcmp.S @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include + #include ENTRY(memcmp) pushl %edi diff --git a/sys/i386/memset.S b/sys/i386/memset.S index 03bef8d..128d1d1 100644 --- a/sys/i386/memset.S +++ b/sys/i386/memset.S @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include + #include ENTRY(memset) diff --git a/sys/i386/sched.c b/sys/i386/sched.c index 069868d..98ec14f 100644 --- a/sys/i386/sched.c +++ b/sys/i386/sched.c @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/sys/i386/strcmp.S b/sys/i386/strcmp.S index 19bb2ff..79884e2 100644 --- a/sys/i386/strcmp.S +++ b/sys/i386/strcmp.S @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include + #include ENTRY(strcmp) movl 0x04(%esp),%eax diff --git a/sys/i386/strcpy.S b/sys/i386/strcpy.S index e6f6a0c..dd55272 100644 --- a/sys/i386/strcpy.S +++ b/sys/i386/strcpy.S @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include + #include ENTRY(strcpy) movl 4(%esp),%ecx /* dst address */ diff --git a/sys/i386/strncmp.S b/sys/i386/strncmp.S index 9696281..30d5ba1 100644 --- a/sys/i386/strncmp.S +++ b/sys/i386/strncmp.S @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include + #include ENTRY(strncmp) pushl %ebx diff --git a/sys/i386/support.S b/sys/i386/support.S index 347cdf8..6b4c974 100644 --- a/sys/i386/support.S +++ b/sys/i386/support.S @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - #include + #include .text // void bzero(void *buf, u_int len) diff --git a/sys/i386/trap.c b/sys/i386/trap.c index 60f0c65..5bba1f8 100644 --- a/sys/i386/trap.c +++ b/sys/i386/trap.c @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include +#include #include #include #include diff --git a/sys/include/isa/8259.h b/sys/include/isa/8259.h deleted file mode 100644 index df36487..0000000 --- a/sys/include/isa/8259.h +++ /dev/null @@ -1,74 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _ISA_8259_H -#define _ISA_8259_H - -#include - -#define mPic 0x20 // I/O for master PIC -#define mImr 0x21 // I/O for master IMR -#define sPic 0xA0 // I/O for slave PIC -#define sImr 0xA1 // I/O for slace IMR -#define eoi 0x20 // EOI command -#define icw1 0x11 // Cascade, Edge triggered -#define icw4 0x01 // 8088 mode -#define mVec 0x68 // Vector for master -#define sVec 0x70 // Vector for slave -#define ocw3Irr 0x0A // Read IRR -#define ocw3Isr 0x0B // Read ISR - -int i8259_init(); -void irqEnable(uInt16 irqNo); -void irqDisable(uInt16 irqNo); - -#endif - -/*** - $Log: 8259.h,v $ - Revision 1.1.1.1 2006/06/01 12:46:14 reddawg - ubix2 - - Revision 1.2 2005/10/12 00:13:36 reddawg - Removed - - Revision 1.1.1.1 2005/09/26 17:23:39 reddawg - no message - - Revision 1.4 2004/07/09 13:20:08 reddawg - Oh yeah duh you can not name functions with numbers - - Revision 1.3 2004/07/09 13:14:29 reddawg - 8259: changed init8259 to 8259_init - Adjusted Startup Routines - - Revision 1.2 2004/05/21 14:57:16 reddawg - Cleaned up - - END - ***/ diff --git a/sys/include/isa/atkbd.h b/sys/include/isa/atkbd.h deleted file mode 100644 index c1e41d9..0000000 --- a/sys/include/isa/atkbd.h +++ /dev/null @@ -1,46 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _ISA_ATKBD_H -#define _ISA_ATKBD_H - -#define shiftKey 1 -#define controlKey 2 -#define altKey 4 -#define ledNumlock 2 -#define ledScrolllock 1 -#define ledCapslock 4 - -int atkbd_init(); -void atkbd_isr(); - -void keyboardHandler(); -void setLED(); - - -#endif /* END _ISA_ATKBD_H */ diff --git a/sys/include/isa/fdc.h b/sys/include/isa/fdc.h deleted file mode 100644 index fcc33b8..0000000 --- a/sys/include/isa/fdc.h +++ /dev/null @@ -1,108 +0,0 @@ -/***************************************************************************************** - Copyright (c) 2002-2004 The UbixOS Project - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, are - permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this list of - conditions, the following disclaimer and the list of authors. Redistributions in binary - form must reproduce the above copyright notice, this list of conditions, the following - disclaimer and the list of authors in the documentation and/or other materials provided - with the distribution. Neither the name of the UbixOS Project nor the names of its - contributors may be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY - EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR - TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - $Id: fdc.h 79 2016-01-11 16:21:27Z reddawg $ - -*****************************************************************************************/ - -#ifndef _FDC_H -#define _FDC_H - -#include - -typedef struct DrvGeom { - Int8 heads; - Int8 tracks; - Int8 spt; -} drvGeom; - - -#define fdcMsr (0x3f4) -#define fdcData (0x3f5) -#define fdcDir (0x3f7) -#define fdcCcr (0x3f7) -#define fdcDor (0x3f2) -#define fdcDrs (0x3f4) - -#define cmdWrite (0xc5) -#define cmdRead (0xe6) -#define cmdSeek (0x0f) -#define cmdSensei (0x08) -#define cmdRecal (0x07) -#define cmdSpecify (0x03) - -#define dg144Heads 2 /* heads per drive (1.44M) */ -#define dg144Tracks 80 -#define dg144Spt 18 -#define dg144Gap3rw 0x1b -#define dg168Gap3rw 0x1c - - - -int fdc_init(); -void floppyIsr(); -void floppyIsrhndlr(); -void sendByte(int Int8); -int getByte(); -bool fdcRw(int block,unsigned char *blockBuffer,bool read,unsigned long numSectors); -void block2Hts(int block,int *head,int *track,int *sector); -void motorOn(void); -void motorOff(void); -bool seek(int track); -bool waitFdc(bool sensei); -int getByte(); -void sendByte(int Int8); -void recalibrate(void); -void reset(void); -bool writeBlock(int block,Int8 *blockBuffer, unsigned long numSectors); -bool readBlock(int block,Int8 *blockBuffer, unsigned long numSectors); -void fdcWrite(void *info,void *,uInt32 startSector,uInt32 sectorCount); -void fdcRead(void *info,void *,uInt32 startSector,uInt32 sectorCount); - -#endif - -/*** - $Log: fdc.h,v $ - Revision 1.1.1.1 2006/06/01 12:46:14 reddawg - ubix2 - - Revision 1.2 2005/10/12 00:13:36 reddawg - Removed - - Revision 1.1.1.1 2005/09/26 17:23:39 reddawg - no message - - Revision 1.6 2004/07/17 02:38:31 reddawg - Fixed a few problems - - Revision 1.5 2004/07/14 12:42:46 reddawg - fdc: fdcInit to fdc_init - Changed Startup Routines - - Revision 1.4 2004/05/21 14:57:16 reddawg - Cleaned up - - END - ***/ diff --git a/sys/include/isa/mouse.h b/sys/include/isa/mouse.h deleted file mode 100644 index 240f253..0000000 --- a/sys/include/isa/mouse.h +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _ISA_MOUSE_H -#define _ISA_MOUSE_H - -int mouseInit(); -void mouseISR(); -void mouseHandler(); - -#endif - -/*** - $Log: mouse.h,v $ - Revision 1.1.1.1 2006/06/01 12:46:14 reddawg - ubix2 - - Revision 1.2 2005/10/12 00:13:36 reddawg - Removed - - Revision 1.1.1.1 2005/09/26 17:23:39 reddawg - no message - - Revision 1.1 2004/06/04 10:20:53 reddawg - mouse drive: fixed a few bugs works a bit better now - - END - ***/ diff --git a/sys/include/isa/ne2k.h b/sys/include/isa/ne2k.h deleted file mode 100644 index e908f9c..0000000 --- a/sys/include/isa/ne2k.h +++ /dev/null @@ -1,190 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _ISA_NE2K_H -#define _ISA_NE2K_H - -#include -#include - -#define ether_addr ether_addr_t -typedef struct dp_rcvhdr -{ - uInt8 dr_status; /* Copy of rsr */ - uInt8 dr_next; /* Pointer to next packet */ - uInt8 dr_rbcl; /* Receive Byte Count Low */ - uInt8 dr_rbch; /* Receive Byte Count High */ -} dp_rcvhdr_t; - -typedef union etheraddr { - unsigned char bytes[6]; /* byteorder safe initialization */ - unsigned short shorts[3]; /* force 2-byte alignment */ -} ether_addr; - - -#define RSR_FO 0x08 -#define RSR_PRX 0x01 -#define DEF_ENABLED 0x200 - -#define OK 0 - - -#define startPage 0x4C -#define stopPage 0x80 - - -#define NE_CMD 0x00 -#define NE_PSTART 0x01 -#define NE_PSTOP 0x02 -#define NE_BNRY 0x03 -#define NE_TPSR 0x04 -#define NE_ISR 0x07 -#define NE_CURRENT 0x07 -#define NE_RBCR0 0x0A -#define NE_RBCR1 0x0B -#define NE_RCR 0x0C -#define NE_TCR 0x0D -#define NE_DCR 0x0E -#define NE_IMR 0x0F - - -#define NE_DCR_WTS 0x01 -#define NE_DCR_LS 0x08 -#define NE_DCR_AR 0x10 -#define NE_DCR_FT1 0x40 -#define NE_DCR_FT0 0x20 - - - -#define E8390_STOP 0x01 -#define E8390_NODMA 0x20 -#define E8390_PAGE0 0x00 -#define E8390_PAGE1 0x40 -#define E8390_CMD 0x00 -#define E8390_START 0x02 -#define E8390_RREAD 0x08 -#define E8390_RWRITE 0x10 -#define E8390_RXOFF 0x20 -#define E8390_TXOFF 0x00 -#define E8390_RXCONFIG 0x04 -#define E8390_TXCONFIG 0x00 - -#define EN0_COUNTER0 0x0d -#define EN0_DCFG 0x0e -#define EN0_RCNTLO 0x0a -#define EN0_RCNTHI 0x0b -#define EN0_ISR 0x07 -#define EN0_IMR 0x0f -#define EN0_RSARLO 0x08 -#define EN0_RSARHI 0x09 -#define EN0_TPSR 0x04 -#define EN0_RXCR 0x0c -#define EN0_TXCR 0x0D -#define EN0_STARTPG 0x01 -#define EN0_STOPPG 0x02 -#define EN0_BOUNDARY 0x03 - -#define EN1_PHYS 0x01 -#define EN1_CURPAG 0x07 -#define EN1_MULT 0x08 - -#define NE1SM_START_PG 0x20 -#define NE1SM_STOP_PG 0x40 -#define NESM_START_PG 0x40 -#define NESM_STOP_PG 0x80 - -#define ENISR_ALL 0x3f - -#define ENDCFG_WTS 0x01 - -#define NE_DATAPORT 0x10 - -#define TX_2X_PAGES 12 -#define TX_1X_PAGES 6 -#define TX_PAGES (dev->priv->pingPong ? TX_2X_PAGES : TX_1X_PAGES) - - -#define DP_CURR 0x7 /* Current Page Register */ -#define DP_MAR0 0x8 /* Multicast Address Register 0 */ -#define DP_MAR1 0x9 /* Multicast Address Register 1 */ -#define DP_MAR2 0xA /* Multicast Address Register 2 */ -#define DP_MAR3 0xB /* Multicast Address Register 3 */ -#define DP_MAR4 0xC /* Multicast Address Register 4 */ -#define DP_MAR5 0xD /* Multicast Address Register 5 */ -#define DP_MAR6 0xE /* Multicast Address Register 6 */ -#define DP_MAR7 0xF /* Multicast Address Register 7 */ - -#define DP_CNTR0 0xD /* Tally Counter 0 */ -#define DP_CNTR1 0xE /* Tally Counter 1 */ -#define DP_CNTR2 0xF /* Tally Counter 2 */ - - -#define DP_PAGESIZE 256 - -extern char *nicPacket; -extern uInt32 packetLength; - - -int ne2k_init(); -int ne2kProbe(int,struct device *); -int ne2kDevInit(struct device *); -void NS8390_init(struct device *dev,int startp); - -void ne2kISR(); -void ne2kHandler(); - -int NICtoPC(struct device *dev,void *packet,int length,int nic_addr); -int PCtoNIC(struct device *dev,void *packet,int length); - -struct nicBuffer *ne2kAllocBuffer(int); -struct nicBuffer *ne2kGetBuffer(); -void ne2kFreeBuffer(struct nicBuffer *); - -#endif - -/*** - $Log: ne2k.h,v $ - Revision 1.1.1.1 2006/06/01 12:46:14 reddawg - ubix2 - - Revision 1.2 2005/10/12 00:13:36 reddawg - Removed - - Revision 1.1.1.1 2005/09/26 17:23:39 reddawg - no message - - Revision 1.6 2004/07/14 12:03:49 reddawg - ne2k: ne2kInit to ne2k_init - Changed Startup Routines - - Revision 1.5 2004/05/21 14:57:16 reddawg - Cleaned up - - - END - ***/ diff --git a/sys/include/isa/pit.h b/sys/include/isa/pit.h deleted file mode 100644 index 628fd22..0000000 --- a/sys/include/isa/pit.h +++ /dev/null @@ -1,67 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _ISA_PIT_H -#define _ISA_PIT_H - -#define PIT_TIMER 200 - -int pit_init(); - -#endif - -/*** - $Log: pit.h,v $ - Revision 1.1.1.1 2006/06/01 12:46:14 reddawg - ubix2 - - Revision 1.2 2005/10/12 00:13:36 reddawg - Removed - - Revision 1.1.1.1 2005/09/26 17:23:40 reddawg - no message - - Revision 1.6 2004/08/14 11:23:02 reddawg - Changes - - Revision 1.5 2004/07/16 04:06:32 reddawg - Tune ups this stuff should of been taken care of months ago - - Revision 1.4 2004/07/16 01:08:58 reddawg - Whew we work once again - - Revision 1.3 2004/07/09 13:29:15 reddawg - pit: pitInit to pit_init - Adjusted initialization routines - - Revision 1.2 2004/05/21 14:57:16 reddawg - Cleaned up - - END - ***/ - diff --git a/sys/include/mpi/mpi.h b/sys/include/mpi/mpi.h deleted file mode 100644 index 0b1ce14..0000000 --- a/sys/include/mpi/mpi.h +++ /dev/null @@ -1,62 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _MPI_MPI_H -#define _MPI_MPI_H - -#include -#include - -#define MESSAGE_LENGTH 248 - -struct mpi_message { - char data[MESSAGE_LENGTH]; - uInt32 header; - pidType pid; - struct mpi_message *next; -}; - -struct mpi_mbox { - struct mpi_mbox *next; - struct mpi_mbox *prev; - struct mpi_message *msg; - struct mpi_message *msgLast; - char name[64]; - pidType pid; -}; - -typedef struct mpi_mbox mpi_mbox_t; -typedef struct mpi_message mpi_message_t; - -int mpi_createMbox(char *); -int mpi_destroyMbox(char *); -int mpi_postMessage(char *, uInt32, mpi_message_t *); -int mpi_fetchMessage(char *, mpi_message_t *); -int mpi_spam(uInt32, void *); - -#endif diff --git a/sys/include/pci/hd.h b/sys/include/pci/hd.h deleted file mode 100644 index 6b0870e..0000000 --- a/sys/include/pci/hd.h +++ /dev/null @@ -1,487 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _PCI_HD_H_ -#define _PCI_HD_H_ - -#include -#include - -#define hdData 0x0 -#define hdError 0x1 -#define hdSecCount 0x2 -#define hdSecNum 0x3 -#define hdCylLow 0x4 -#define hdCylHi 0x5 -#define hdHead 0x6 -#define hdStat 0x7 -#define hdCmd 0x7 - -/* ATA Uhm? */ -#define ATA_IDENTIFY_COMMAND_SET_SUPPORTED1_48BIT_ENABLE 0x0400 -#define ATA_IDENTIFY_SECTOR_LARGER_THEN_512_ENABLE 0x0100 - -/* ATA register defines */ -#define ATA_DATA 0 /* (RW) data */ - -#define ATA_FEATURE 1 /* (W) feature */ -#define ATA_F_DMA 0x01 /* enable DMA */ -#define ATA_F_OVL 0x02 /* enable overlap */ - -#define ATA_COUNT 2 /* (W) sector count */ - -#define ATA_SECTOR 3 /* (RW) sector # */ -#define ATA_CYL_LSB 4 /* (RW) cylinder# LSB */ -#define ATA_CYL_MSB 5 /* (RW) cylinder# MSB */ -#define ATA_DRIVE 6 /* (W) Sector/Drive/Head */ -#define ATA_D_LBA 0x40 /* use LBA addressing */ -#define ATA_D_IBM 0xa0 /* 512 byte sectors, ECC */ - -#define ATA_COMMAND 7 /* (W) command */ - -#define ATA_ERROR 8 /* (R) error */ -#define ATA_E_ILI 0x01 /* illegal length */ -#define ATA_E_NM 0x02 /* no media */ -#define ATA_E_ABORT 0x04 /* command aborted */ -#define ATA_E_MCR 0x08 /* media change request */ -#define ATA_E_IDNF 0x10 /* ID not found */ -#define ATA_E_MC 0x20 /* media changed */ -#define ATA_E_UNC 0x40 /* uncorrectable data */ -#define ATA_E_ICRC 0x80 /* UDMA crc error */ -#define ATA_E_ATAPI_SENSE_MASK 0xf0 /* ATAPI sense key mask */ - -#define ATA_IREASON 9 /* (R) interrupt reason */ -#define ATA_I_CMD 0x01 /* cmd (1) | data (0) */ -#define ATA_I_IN 0x02 /* read (1) | write (0) */ -#define ATA_I_RELEASE 0x04 /* released bus (1) */ -#define ATA_I_TAGMASK 0xf8 /* tag mask */ - -#define ATA_STATUS 10 /* (R) status */ -#define ATA_ALTSTAT 11 /* (R) alternate status */ -#define ATA_S_ERROR 0x01 /* error */ -#define ATA_S_INDEX 0x02 /* index */ -#define ATA_S_CORR 0x04 /* data corrected */ -#define ATA_S_DRQ 0x08 /* data request */ -#define ATA_S_DSC 0x10 /* drive seek completed */ -#define ATA_S_SERVICE 0x10 /* drive needs service */ -#define ATA_S_DWF 0x20 /* drive write fault */ -#define ATA_S_DMA 0x20 /* DMA ready */ -#define ATA_S_READY 0x40 /* drive ready */ -#define ATA_S_BUSY 0x80 /* busy */ - -#define ATA_CONTROL 12 /* (W) control */ - -#define ATA_CTLOFFSET 0x206 /* control register offset */ -#define ATA_PCCARD_CTLOFFSET 0x0e /* do for PCCARD devices */ -#define ATA_PC98_CTLOFFSET 0x10c /* do for PC98 devices */ -#define ATA_A_IDS 0x02 /* disable interrupts */ -#define ATA_A_RESET 0x04 /* RESET controller */ -#ifdef ATA_LEGACY_SUPPORT -#define ATA_A_4BIT 0x08 /* 4 head bits: obsolete 1996 */ -#else -#define ATA_A_4BIT 0x00 -#endif -#define ATA_A_HOB 0x80 /* High Order Byte enable */ - -/* ATA Commands */ -#define ATA_IDENTIFY 0xEC -#define ATA_CHECK_POWER_MODE 0xE5 -#define ATA_STANDBY 0xE2 -#define ATA_STANDBY_IMMED 0xE0 -#define ATA_IDLE_IMMED 0xE1 -#define ATA_IDLE 0xE3 -#define ATA_FLUSH_CACHE 0xE7 -#define ATA_FLUSH_CACHE_EXT 0xEA -#define ATA_READ_DMA_EXT 0x25 -#define ATA_READ_DMA 0xC8 -#define ATA_READ_SECTORS_EXT 0x24 -#define ATA_READ_SECTORS 0x20 -#define ATA_WRITE_DMA_EXT 0x35 -#define ATA_WRITE_DMA 0xCA -#define ATA_WRITE_SECTORS_EXT 0x34 -#define ATA_WRITE_SECTORS 0x30 -#define ATA_WRITE_UNCORRECTABLE 0x45 -#define ATA_READ_VERIFY_SECTORS 0x40 -#define ATA_READ_VERIFY_SECTORS_EXT 0x42 -#define ATA_READ_BUFFER 0xE4 -#define ATA_WRITE_BUFFER 0xE8 -#define ATA_EXECUTE_DEVICE_DIAG 0x90 -#define ATA_SET_FEATURES 0xEF -#define ATA_SMART 0xB0 -#define ATA_PACKET_IDENTIFY 0xA1 -#define ATA_PACKET 0xA0 -#define ATA_READ_FPDMA 0x60 -#define ATA_WRITE_FPDMA 0x61 -#define ATA_READ_LOG_EXT 0x2F -#define ATA_NOP 0x00 -#define ATA_DEVICE_RESET 0x08 -#define ATA_MEDIA_EJECT 0xED -#define ATA_SECURITY_UNLOCK 0xF2 -#define ATA_SECURITY_FREEZE_LOCK 0xF5 -#define ATA_DATA_SET_MANAGEMENT 0x06 -#define ATA_DOWNLOAD_MICROCODE 0x92 -#define ATA_WRITE_STREAM_DMA_EXT 0x3A -#define ATA_READ_LOG_DMA_EXT 0x47 -#define ATA_READ_STREAM_DMA_EXT 0x2A -#define ATA_WRITE_DMA_FUA 0x3D -#define ATA_WRITE_LOG_DMA_EXT 0x57 -#define ATA_READ_DMA_QUEUED 0xC7 -#define ATA_READ_DMA_QUEUED_EXT 0x26 -#define ATA_WRITE_DMA_QUEUED 0xCC -#define ATA_WRITE_DMA_QUEUED_EXT 0x36 -#define ATA_WRITE_DMA_QUEUED_FUA_EXT 0x3E -#define ATA_READ_MULTIPLE 0xC4 -#define ATA_READ_MULTIPLE_EXT 0x29 -#define ATA_WRITE_MULTIPLE 0xC5 -#define ATA_WRITE_MULTIPLE_EXT 0x39 -#define ATA_WRITE_MULTIPLE_FUA_EXT 0xCE - -struct driveInfo { - struct driveDiskLabel *diskLabel; - struct ata_identify_data *ata_identify; - uint32_t lba_high; - uint32_t lba_low; - uint32_t sector_size; - char hdEnable; - char hdDev; - char hdFlags; - char hdShift; - long hdMask; - uint32_t hdMulti; - long hdPort; - long hdSize; - long hdCalc; - long parOffset; - int part; - long lba_start; - long lba_end; -}; - -int initHardDisk(); -int hdWrite(struct driveInfo *hdd, void *, uInt32, uInt32); -int hdRead(struct driveInfo *hdd, void *, uInt32, uInt32); -int hdReset(); -int hdIoctl(); -int hdStart(); -int hdStop(); -int hdStandby(); -int hdInit(struct device_node *dev); - -struct dos_partition { - unsigned char dp_flag; /* bootstrap flags */ - unsigned char dp_shd; /* starting head */ - unsigned char dp_ssect; /* starting sector */ - unsigned char dp_scyl; /* starting cylinder */ - unsigned char dp_type; /* partition type */ - unsigned char dp_ehd; /* end head */ - unsigned char dp_esect; /* end sector */ - unsigned char dp_ecyl; /* end cylinder */ - uInt32 dp_start; /* absolute starting sector number */ - uInt32 dp_size; /* partition size in sectors */ -}; - -#define MAXPARTITIONS 8 - -struct bsd_disklabel { - uint32_t d_magic; /* the magic number */ - u_int16_t d_type; /* drive type */ - u_int16_t d_subtype; /* controller/d_type specific */ - char d_typename[16]; /* type name, e.g. "eagle" */ - - char d_packname[16]; /* pack identifier */ - - /* disk geometry: */ - uint32_t d_secsize; /* # of bytes per sector */ - uint32_t d_nsectors; /* # of data sectors per track */ - uint32_t d_ntracks; /* # of tracks per cylinder */ - uint32_t d_ncylinders; /* # of data cylinders per unit */ - uint32_t d_secpercyl; /* # of data sectors per cylinder */ - uint32_t d_secperunit; /* # of data sectors per unit */ - - /* - * Spares (bad sector replacements) below are not counted in - * d_nsectors or d_secpercyl. Spare sectors are assumed to - * be physical sectors which occupy space at the end of each - * track and/or cylinder. - */ - u_int16_t d_sparespertrack; /* # of spare sectors per track */ - u_int16_t d_sparespercyl; /* # of spare sectors per cylinder */ - /* - * Alternate cylinders include maintenance, replacement, configuration - * description areas, etc. - */ - uint32_t d_acylinders; /* # of alt. cylinders per unit */ - - /* hardware characteristics: */ - /* - * d_interleave, d_trackskew and d_cylskew describe perturbations - * in the media format used to compensate for a slow controller. - * Interleave is physical sector interleave, set up by the - * formatter or controller when formatting. When interleaving is - * in use, logically adjacent sectors are not physically - * contiguous, but instead are separated by some number of - * sectors. It is specified as the ratio of physical sectors - * traversed per logical sector. Thus an interleave of 1:1 - * implies contiguous layout, while 2:1 implies that logical - * sector 0 is separated by one sector from logical sector 1. - * d_trackskew is the offset of sector 0 on track N relative to - * sector 0 on track N-1 on the same cylinder. Finally, d_cylskew - * is the offset of sector 0 on cylinder N relative to sector 0 - * on cylinder N-1. - */ - u_int16_t d_rpm; /* rotational speed */ - u_int16_t d_interleave; /* hardware sector interleave */ - u_int16_t d_trackskew; /* sector 0 skew, per track */ - u_int16_t d_cylskew; /* sector 0 skew, per cylinder */ - uint32_t d_headswitch; /* head switch time, usec */ - uint32_t d_trkseek; /* track-to-track seek, usec */ - uint32_t d_flags; /* generic flags */ -#define NDDATA 5 - uint32_t d_drivedata[NDDATA]; /* drive-type specific information */ -#define NSPARE 5 - uint32_t d_spare[NSPARE]; /* reserved for future use */ - uint32_t d_magic2; /* the magic number (again) */ - u_int16_t d_checksum; /* xor of data incl. partitions */ - - /* filesystem and partition information: */ - u_int16_t d_npartitions; /* number of partitions in following */ - uint32_t d_bbsize; /* size of boot area at sn0, bytes */ - uint32_t d_sbsize; /* max size of fs superblock, bytes */ - struct partition { /* the partition table */ - uint32_t p_size; /* number of sectors in partition */ - uint32_t p_offset; /* starting sector */ - uint32_t p_fsize; /* filesystem basic fragment size */ - u_int8_t p_fstype; /* filesystem type, see below */ - u_int8_t p_frag; /* filesystem fragments per block */ - u_int16_t p_cpg; /* filesystem cylinders per group */ - } d_partitions[MAXPARTITIONS]; /* actually may be more */ -}; - -static const char *fstypenames[] = { "unused", "swap", "Version 6", "Version 7", "System V", "4.1BSD", "Eighth Edition", "4.2BSD", "MSDOS", "4.4LFS", "unknown", "HPFS", "ISO9660", "boot", "vinum", "raid", "?", "?", "?", "?", "jfs", NULL }; - -/** - * @name ATA_IDENTIFY_DEVICE_FIELD_LENGTHS - * - * The following constants define the number of bytes contained in various - * fields found in the IDENTIFY DEVICE data structure. - */ -#define ATA_IDENTIFY_SERIAL_NUMBER_LEN 20 -#define ATA_IDENTIFY_MODEL_NUMBER_LEN 40 -#define ATA_IDENTIFY_FW_REVISION_LEN 8 -#define ATA_IDENTIFY_48_LBA_LEN 8 -#define ATA_IDENTIFY_MEDIA_SERIAL_NUMBER_LEN 30 -#define ATA_IDENTIFY_WWN_LEN 8 - -struct ata_identify_data { - u_int16_t general_config_bits; // word 00 - u_int16_t obsolete0; // word 01 (num cylinders) - u_int16_t vendor_specific_config_bits; // word 02 - u_int16_t obsolete1; // word 03 (num heads) - u_int16_t retired1[2]; // words 04-05 - u_int16_t obsolete2; // word 06 (sectors / track) - u_int16_t reserved_for_compact_flash1[2]; // words 07-08 - u_int16_t retired0; // word 09 - u_int8_t serial_number[ATA_IDENTIFY_SERIAL_NUMBER_LEN]; // word 10-19 - u_int16_t retired2[2]; // words 20-21 - u_int16_t obsolete4; // word 22 - u_int8_t firmware_revision[ATA_IDENTIFY_FW_REVISION_LEN]; // words 23-26 - u_int8_t model_number[ATA_IDENTIFY_MODEL_NUMBER_LEN]; // words 27-46 - u_int16_t max_sectors_per_multiple; // word 47 - u_int16_t reserved0; // word 48 - u_int16_t capabilities1; // word 49 - u_int16_t capabilities2; // word 50 - u_int16_t obsolete5[2]; // words 51-52 - u_int16_t validity_bits; // word 53 - u_int16_t obsolete6[5]; // words 54-58 Used to be: - // current cylinders, - // current heads, - // current sectors/Track, - // current capacity - u_int16_t current_max_sectors_per_multiple; // word 59 - u_int8_t total_num_sectors[4]; // words 60-61 - u_int16_t obsolete7; // word 62 - u_int16_t multi_word_dma_mode; // word 63 - u_int16_t pio_modes_supported; // word 64 - u_int16_t min_multiword_dma_transfer_cycle; // word 65 - u_int16_t rec_min_multiword_dma_transfer_cycle; // word 66 - u_int16_t min_pio_transfer_no_flow_ctrl; // word 67 - u_int16_t min_pio_transfer_with_flow_ctrl; // word 68 - u_int16_t additional_supported; // word 69 - u_int16_t reserved1; // word 70 - u_int16_t reserved2[4]; // words 71-74 - u_int16_t queue_depth; // word 75 - u_int16_t serial_ata_capabilities; // word 76 - u_int16_t serial_ata_reserved; // word 77 - u_int16_t serial_ata_features_supported; // word 78 - u_int16_t serial_ata_features_enabled; // word 79 - u_int16_t major_version_number; // word 80 - u_int16_t minor_version_number; // word 81 - u_int16_t command_set_supported0; // word 82 - u_int16_t command_set_supported1; // word 83 - u_int16_t command_set_supported_extention; // word 84 - u_int16_t command_set_enabled0; // word 85 - u_int16_t command_set_enabled1; // word 86 - u_int16_t command_set_default; // word 87 - u_int16_t ultra_dma_mode; // word 88 - u_int16_t security_erase_completion_time; // word 89 - u_int16_t enhanced_security_erase_time; // word 90 - u_int16_t current_power_mgmt_value; // word 91 - u_int16_t master_password_revision; // word 92 - u_int16_t hardware_reset_result; // word 93 - u_int16_t current_acoustic_management_value; // word 94 - u_int16_t stream_min_request_size; // word 95 - u_int16_t stream_transfer_time; // word 96 - u_int16_t stream_access_latency; // word 97 - u_int16_t stream_performance_granularity[2]; // words 98-99 - u_int8_t max_48bit_lba[ATA_IDENTIFY_48_LBA_LEN]; // words 100-103 - u_int16_t streaming_transfer_time; // word 104 - u_int16_t max_lba_range_entry_blocks; // word 105 - u_int16_t physical_logical_sector_info; // word 106 - u_int16_t acoustic_test_interseek_delay; // word 107 - u_int8_t world_wide_name[ATA_IDENTIFY_WWN_LEN]; // words 108-111 - u_int8_t reserved_for_wwn_extention[ATA_IDENTIFY_WWN_LEN]; // words 112-115 - u_int16_t reserved4; // word 116 - u_int8_t words_per_logical_sector[4]; // words 117-118 - u_int16_t command_set_supported2; // word 119 - u_int16_t reserved5[7]; // words 120-126 - u_int16_t removable_media_status; // word 127 - u_int16_t security_status; // word 128 - u_int16_t vendor_specific1[31]; // words 129-159 - u_int16_t cfa_power_mode1; // word 160 - u_int16_t reserved_for_compact_flash2[7]; // words 161-167 - u_int16_t device_nominal_form_factor; // word 168 - u_int16_t data_set_management; // word 169 - u_int16_t reserved_for_compact_flash3[6]; // words 170-175 - u_int16_t current_media_serial_number[ATA_IDENTIFY_MEDIA_SERIAL_NUMBER_LEN]; //words 176-205 - u_int16_t reserved6[3]; // words 206-208 - u_int16_t logical_sector_alignment; // words 209 - u_int16_t reserved7[7]; // words 210-216 - u_int16_t nominal_media_rotation_rate; // word 217 - u_int16_t reserved8[16]; // words 218-233 - u_int16_t min_num_blocks_per_microcode; // word 234 - u_int16_t max_num_blocks_per_microcode; // word 235 - u_int16_t reserved9[19]; // words 236-254 - u_int16_t integrity_word; // word 255 -}; - -/* - * A list of partition types, probably outdated. - */ -static const char * const part_types[256] = { - [0x00] = "unused", - [0x01] = "Primary DOS with 12 bit FAT", - [0x02] = "XENIX / file system", - [0x03] = "XENIX /usr file system", - [0x04] = "Primary DOS with 16 bit FAT (< 32MB)", - [0x05] = "Extended DOS", - [0x06] = "Primary DOS, 16 bit FAT (>= 32MB)", - [0x07] = "NTFS, OS/2 HPFS, QNX-2 (16 bit) or Advanced UNIX", - [0x08] = "AIX file system or SplitDrive", - [0x09] = "AIX boot partition or Coherent", - [0x0A] = "OS/2 Boot Manager, OPUS or Coherent swap", - [0x0B] = "DOS or Windows 95 with 32 bit FAT", - [0x0C] = "DOS or Windows 95 with 32 bit FAT (LBA)", - [0x0E] = "Primary 'big' DOS (>= 32MB, LBA)", - [0x0F] = "Extended DOS (LBA)", - [0x10] = "OPUS", - [0x11] = "OS/2 BM: hidden DOS with 12-bit FAT", - [0x12] = "Compaq diagnostics", - [0x14] = "OS/2 BM: hidden DOS with 16-bit FAT (< 32MB)", - [0x16] = "OS/2 BM: hidden DOS with 16-bit FAT (>= 32MB)", - [0x17] = "OS/2 BM: hidden IFS (e.g. HPFS)", - [0x18] = "AST Windows swapfile", - [0x1b] = "ASUS Recovery partition (NTFS)", - [0x24] = "NEC DOS", - [0x3C] = "PartitionMagic recovery", - [0x39] = "plan9", - [0x40] = "VENIX 286", - [0x41] = "Linux/MINIX (sharing disk with DRDOS)", - [0x42] = "SFS or Linux swap (sharing disk with DRDOS)", - [0x43] = "Linux native (sharing disk with DRDOS)", - [0x4D] = "QNX 4.2 Primary", - [0x4E] = "QNX 4.2 Secondary", - [0x4F] = "QNX 4.2 Tertiary", - [0x50] = "DM (disk manager)", - [0x51] = "DM6 Aux1 (or Novell)", - [0x52] = "CP/M or Microport SysV/AT", - [0x53] = "DM6 Aux3", - [0x54] = "DM6", - [0x55] = "EZ-Drive (disk manager)", - [0x56] = "Golden Bow (disk manager)", - [0x5c] = "Priam Edisk (disk manager)", /* according to S. Widlake */ - [0x61] = "SpeedStor", - [0x63] = "System V/386 (such as ISC UNIX), GNU HURD or Mach", - [0x64] = "Novell Netware/286 2.xx", - [0x65] = "Novell Netware/386 3.xx", - [0x70] = "DiskSecure Multi-Boot", - [0x75] = "PCIX", - [0x77] = "QNX4.x", - [0x78] = "QNX4.x 2nd part", - [0x79] = "QNX4.x 3rd part", - [0x80] = "Minix until 1.4a", - [0x81] = "Minix since 1.4b, early Linux partition or Mitac disk manager", - [0x82] = "Linux swap or Solaris x86", - [0x83] = "Linux native", - [0x84] = "OS/2 hidden C: drive", - [0x85] = "Linux extended", - [0x86] = "NTFS volume set??", - [0x87] = "NTFS volume set??", - [0x93] = "Amoeba file system", - [0x94] = "Amoeba bad block table", - [0x9F] = "BSD/OS", - [0xA0] = "Suspend to Disk", - [0xA5] = "FreeBSD/NetBSD/386BSD", - [0xA6] = "OpenBSD", - [0xA7] = "NeXTSTEP", - [0xA9] = "NetBSD", - [0xAC] = "IBM JFS", - [0xAF] = "HFS+", - [0xB7] = "BSDI BSD/386 file system", - [0xB8] = "BSDI BSD/386 swap", - [0xBE] = "Solaris x86 boot", - [0xBF] = "Solaris x86 (new)", - [0xC1] = "DRDOS/sec with 12-bit FAT", - [0xC4] = "DRDOS/sec with 16-bit FAT (< 32MB)", - [0xC6] = "DRDOS/sec with 16-bit FAT (>= 32MB)", - [0xC7] = "Syrinx", - [0xDB] = "CP/M, Concurrent CP/M, Concurrent DOS or CTOS", - [0xDE] = "DELL Utilities - FAT filesystem", - [0xE1] = "DOS access or SpeedStor with 12-bit FAT extended partition", - [0xE3] = "DOS R/O or SpeedStor", - [0xE4] = "SpeedStor with 16-bit FAT extended partition < 1024 cyl.", - [0xEB] = "BeOS file system", - [0xEE] = "EFI GPT", - [0xEF] = "EFI System Partition", - [0xF1] = "SpeedStor", - [0xF2] = "DOS 3.3+ Secondary", - [0xF4] = "SpeedStor large partition", - [0xFB] = "VMware VMFS", - [0xFE] = "SpeedStor >1024 cyl. or LANstep", - [0xFF] = "Xenix bad blocks table", }; - -#endif diff --git a/sys/include/pci/lnc.h b/sys/include/pci/lnc.h deleted file mode 100644 index aafd2a0..0000000 --- a/sys/include/pci/lnc.h +++ /dev/null @@ -1,257 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _PCI_LNC_H -#define _PCI_LNC_H - -#include - -// TEMP COMMENT FRESH -#define RDP 0x10 // Register Data Port 16Bit -#define RDP32 0x10 // Register Data Port 32Bit -#define RAP 0x12 // Register Address Port 16Bit -#define RAP32 0x14 // Register Address Port 32Bit -#define RESET 0x14 // Reset Port 16Bit -#define RESET32 0x18 // Reset Port 32Bit -#define BDP 0x16 // 16Bit -#define BDP32 0x1C // 32Bit - -// BCR18 -#define BCR18 18 -#define BCR18_DWIO 0x0080 - -// BCR20 -#define BCR20 0x0014 - -// Modes -#define MODE_16 0 -#define MODE_32 1 -#define MODE_INVALID 3 - -// CSR0 -#define CSR0 0x0000 -#define CSR0_STOP 0x0004 - -// CSR15 -#define CSR15 15 -#define CSR15_DXMTFCS 0x0008 -#define CSR15_DRTY 0x0020 -#define CSR15_PROM 0x8000 - -// CSR58 -#define CSR58 0x003A - -struct mds { - uint16_t md0; - uint16_t md1; - short md2; - uint16_t md3; -}; - -struct hostRingEntry_old { - struct mds *md; - union { - //struct mbuf *mbuf; - char *data; - } buff; -}; - -struct hostRingEntry { - uint32_t addr; - uint16_t bcnt; - uint8_t md[6]; - uint32_t reserved; -}; - -struct arpcom { - //struct ifnet ac_if; /* network-visible interface */ - uint8_t ac_enaddr[6]; /* ethernet hardware address */ - int ac_multicnt; /* length of ac_multiaddrs list */ - void *ac_netgraph; /* ng_ether(4) netgraph node info */ -}; - -struct nicInfo { - int ident; /* Type of card */ - int ic; /* Type of ic, Am7990, Am79C960 etc. */ - int memMode; - int iobase; - int mode; /* Mode setting at initialization */ -}; - -struct initBlock16 { - uint16_t mode; // Mode register - uint8_t padr[6]; // Ethernet address - uint8_t ladrf[8]; // Logical address filter (multicast) - uint16_t rdra; // Low order pointer to receive ring - uint16_t rlen; // High order pointer and no. rings - uint16_t tdra; // Low order pointer to transmit ring - uint16_t tlen; // High order pointer and no rings -}; - -struct initBlock32 { - uint16_t mode; - uint8_t rlen; - uint8_t tlen; - uint8_t padr[6]; - uint16_t res; - uint8_t ladrf[8]; - uint32_t rdra; - uint32_t tdra; -}; - -struct lncInfo { - struct arpcom arpcom; - struct nicInfo nic; - struct hostRingEntry *rxRing; - char *rxBuffer; - struct hostRingEntry *txRing; - char *txBuffer; - struct initBlock32 init; - unsigned int ioAddr; - int nrdre; - int ntdre; - int bufferSize; - int txPtr; - int rxPtr; -}; - -/* Functions */ -void lnc_writeCSR(struct lncInfo *, uint16_t, uint16_t); -void lnc_writeCSR32(struct lncInfo *, uint32_t, uint32_t); - -uint16_t lnc_readCSR(struct lncInfo *, uint16_t); -uint32_t lnc_readCSR32(struct lncInfo *, uint32_t); - -void lnc_writeBCR(struct lncInfo *, uint16_t, uint16_t); -void lnc_writeBCR32(struct lncInfo *, uint32_t, uint32_t); - -uint16_t lnc_readBCR(struct lncInfo *, uint16_t); -uint32_t lnc_readBCR32(struct lncInfo *, uint32_t); - -void lnc_reset(struct lncInfo *); -void lnc_reset32(struct lncInfo *); - -int lnc_probe(struct lncInfo *); - -int lnc_switchDWord(struct lncInfo *); - -int lnc_getMode(struct lncInfo *); - -void lnc_isr(); -int lnc_driverOwnsRX(struct lncInfo *); -int lnc_driverOwnsRX(struct lncInfo *); - -void lnc_INT(); -void lnc_rxINT(); -void lnc_txINT(); - -// OLD - -#define NDESC(len2) (1 << len2) -#define NORMAL 0 -#define MEM_SLEW 8 -#define TRANSBUFSIZE 1518 -#define RECVBUFSIZE 1518 -#define NRDRE 3 -#define NTDRE 3 -#define ETHER_ADDR_LEN 6 -#define NE2100_IOSIZE 24 - -#define PCNET_VSW 0x18 -#define NE2100 2 - -/* mem_mode values */ -#define DMA_FIXED 1 -#define DMA_MBUF 2 -#define SHMEM 4 - -/********** Chip Types **********/ -#define UNKNOWN 0 /* Unknown */ -#define LANCE 1 /* Am7990 */ -#define C_LANCE 2 /* Am79C90 */ -#define PCnet_ISA 3 /* Am79C960 */ -#define PCnet_ISAplus 4 /* Am79C961 */ -#define PCnet_ISA_II 5 /* Am79C961A */ -#define PCnet_32 6 /* Am79C965 */ -#define PCnet_PCI 7 /* Am79C970 */ -#define PCnet_PCI_II 8 /* Am79C970A */ -#define PCnet_FAST 9 /* Am79C971 */ -#define PCnet_FASTplus 10 /* Am79C972 */ -#define PCnet_Home 11 /* Am79C978 */ - -/******** AM7990 Specifics **************/ -#define CSR1 1 -#define CSR2 2 -#define CSR3 3 -#define CSR88 88 -#define CSR89 89 - -#define ERR 0x8000 -#define BABL 0x4000 -#define CERR 0x2000 -#define MISS 0x1000 -#define MERR 0x0800 -#define RINT 0x0400 -#define TINT 0x0200 -#define IDON 0x0100 -#define INTR 0x0080 -#define INEA 0x0040 -#define RXON 0x0020 -#define TXON 0x0010 -#define TDMD 0x0008 - -#define STRT 0x0002 -#define INIT 0x0001 - -/* CSR88-89: Chip ID masks */ -#define AMD_MASK 0x003 -#define PART_MASK 0xffff -#define Am79C960 0x0003 -#define Am79C961 0x2260 -#define Am79C961A 0x2261 -#define Am79C965 0x2430 -#define Am79C970 0x0242 -#define Am79C970A 0x2621 -#define Am79C971 0x2623 -#define Am79C972 0x2624 -#define Am79C973 0x2625 -#define Am79C978 0x2626 - -extern struct lncInfo *lnc; - -int initLNC(); -int probe(struct lncInfo *lnc); -int lanceProbe(struct lncInfo *lnc); -int lncAttach(struct lncInfo *lnc, int unit); - -void lncInt(); -void _lncInt(); - -int lnc_sendPacket(struct lncInfo *lnc, void *packet, size_t len, uInt8 *dest); - -#endif diff --git a/sys/include/pci/pci.h b/sys/include/pci/pci.h deleted file mode 100644 index 1c8d00d..0000000 --- a/sys/include/pci/pci.h +++ /dev/null @@ -1,106 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _PCI_H -#define _PCI_H - -#include - -struct pciConfig { - uint16_t vendorID; - uint16_t deviceID; - - uint16_t command; - uint16_t status; - - uint8_t revisionID; - uint8_t progIf; - uint8_t subClass; - uint8_t classCode; - - uint8_t cacheLineSize; - uint8_t latencyTimer; - uint8_t headerType; - uint8_t bist; - - uint32_t bar[6]; - - uint32_t cbPointer; - - uint16_t subsysVendorID; - uint16_t subsysID; - - uint32_t epromAddr; - - uint16_t capabilites; - uint16_t res1; - - uint32_t res2; - - uint8_t intLine; - uint8_t intPin; - uint8_t minGrant; - uint8_t maxLatency; - - /* device info */ - //uint8_t bus; - //uint8_t dev; - //uint8_t func; - //uint8_t irq; - //uint8_t irqLine; - /* base registers */ - //uInt32 base[6]; - //uInt32 size[6]; - //uint16_t subsysVendor; - //uint16_t subsys; - /* Device Info */ - //Move this to anotther struct eventually - uint8_t bus; - uint8_t dev; - uint8_t func; - -}; - -struct confadd { - uint8_t reg :8; - uint8_t func :3; - uint8_t dev :5; - uint8_t bus :8; - uint8_t rsvd :7; - uint8_t enable :1; -}; - -#define countof(a) (sizeof(a) / sizeof(a[0])) - -int pci_init(); - -uint32_t pciProbe(int bus, int dev, int func); -uInt32 pciRead(int bus, int dev, int func, int reg, int bytes); -void pciWrite(int bus, int dev, int func, int reg, uInt32 v, int bytes); - -#endif diff --git a/sys/include/sde/ogDisplay_UbixOS.h b/sys/include/sde/ogDisplay_UbixOS.h deleted file mode 100644 index 8726d07..0000000 --- a/sys/include/sde/ogDisplay_UbixOS.h +++ /dev/null @@ -1,116 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef OGDISPLAY_UBIXOS_H -#define OGDISPLAY_UBIXOS_H - -#include -#include - -struct ogModeInfo { - uint16_t modeAttributes __attribute__((packed)); - uint8_t windowAFlags __attribute__((packed)); - uint8_t windowBFlags __attribute__((packed)); - uint16_t granularity __attribute__((packed)); - uint16_t windowSize __attribute__((packed)); - uint16_t windowASeg __attribute__((packed)); - uint16_t windowBSeg __attribute__((packed)); - void* bankSwitch __attribute__((packed)); - uint16_t bytesPerLine __attribute__((packed)); - uint16_t xRes __attribute__((packed)); - uint16_t yRes __attribute__((packed)); - uint8_t charWidth __attribute__((packed)); - uint8_t charHeight __attribute__((packed)); - uint8_t numBitPlanes __attribute__((packed)); - uint8_t bitsPerPixel __attribute__((packed)); - uint8_t numberOfBanks __attribute__((packed)); - uint8_t memoryModel __attribute__((packed)); - uint8_t bankSize __attribute__((packed)); - uint8_t numOfImagePages __attribute__((packed)); - uint8_t reserved __attribute__((packed)); - // Direct colour fields (required for Direct/6 and YUV/7 memory models - uint8_t redMaskSize __attribute__((packed)); - uint8_t redFieldPosition __attribute__((packed)); - uint8_t greenMaskSize __attribute__((packed)); - uint8_t greenFieldPosition __attribute__((packed)); - uint8_t blueMaskSize __attribute__((packed)); - uint8_t blueFieldPosition __attribute__((packed)); - uint8_t alphaMaskSize __attribute__((packed)); - uint8_t alphaFieldPosition __attribute__((packed)); - uint8_t directColourMode __attribute__((packed)); - // VESA 2.0 specific fields - uint32_t physBasePtr __attribute__((packed)); - void* offScreenMemOffset __attribute__((packed)); - uint16_t offScreenMemSize __attribute__((packed)); - uint8_t paddington[461] __attribute__((packed)); -}; - -struct ogVESAInfo { - char VBESignature[4] __attribute__((packed)); - uint8_t minVersion __attribute__((packed)); - uint8_t majVersion __attribute__((packed)); - uint32_t OEMStringPtr __attribute__((packed)); - uint32_t capabilities __attribute__((packed)); - uint32_t videoModePtr __attribute__((packed)); - uint16_t totalMemory __attribute__((packed)); - // VESA 2.0 specific fields - uint16_t OEMSoftwareRev __attribute__((packed)); - uint32_t OEMVendorNamePtr __attribute__((packed)); - uint32_t OEMProductNamePtr __attribute__((packed)); - uint32_t OEMProductRevPtr __attribute__((packed)); - uint8_t paddington[474] __attribute__((packed)); -}; - -class ogDisplay_UbixOS: public ogSurface { - protected: - void * pages[2]; - uint32_t activePage; - uint32_t visualPage; - ogVESAInfo * VESAInfo; - ogModeInfo * modeInfo; - - uint16_t FindMode(uint32_t, uint32_t, uint32_t); - void GetModeInfo(uint16_t); - void GetVESAInfo(void); - void SetMode(uint16_t); - void SetPal(void); - public: - ogDisplay_UbixOS(void); - virtual bool ogAlias(ogSurface&, uint32_t, uint32_t, uint32_t, uint32_t); - virtual bool ogClone(ogSurface&); - virtual void ogCopyPalette(ogSurface&); - virtual bool ogCreate(uint32_t, uint32_t, ogPixelFmt); - virtual bool ogLoadPalette(const char *); - virtual void ogSetPalette(const ogRGBA8[]); - virtual void ogSetPalette(uint8_t, uint8_t, uint8_t, uint8_t); - virtual void ogSetPalette(uint8_t, uint8_t, uint8_t, uint8_t, uint8_t); - virtual ~ogDisplay_UbixOS(void); -}; -// ogDisplay_UbixOS - -#endif diff --git a/sys/include/sde/sde.h b/sys/include/sde/sde.h deleted file mode 100644 index 4454434..0000000 --- a/sys/include/sde/sde.h +++ /dev/null @@ -1,62 +0,0 @@ -/*- - * Copyright (c) 2002-2018 The UbixOS Project. - * All rights reserved. - * - * This was developed by Christopher W. Olsen for the UbixOS Project. - * - * Redistribution and use in source and binary forms, with or without modification, are permitted - * provided that the following conditions are met: - * - * 1) Redistributions of source code must retain the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors. - * 2) Redistributions in binary form must reproduce the above copyright notice, this list of - * conditions, the following disclaimer and the list of authors in the documentation and/or - * other materials provided with the distribution. - * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to - * endorse or promote products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef _SDE_SDE_H -#define _SDE_SDE_H - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define registerWindow 1 -#define windowReady 2 -#define drawWindow 3 -#define killWindow 4 - -void sdeThread(); - -//void sysSDE(uint32_t cmd, void *ptr); -int sysSDE(struct thread *td, struct sys_sde_args *args); - -struct sdeWindows { - struct sdeWindows *next; - struct sdeWindows *prev; - void *buf; - pidType pid; - uint8_t status; -}; - -extern struct sdeWindows *windows; - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/sys/isa/fdc.c b/sys/isa/fdc.c index 8e53ed1..3513d9d 100644 --- a/sys/isa/fdc.c +++ b/sys/isa/fdc.c @@ -37,7 +37,7 @@ #include #include #include -#include +#include static struct spinLock fdcSpinLock = SPIN_LOCK_INITIALIZER; diff --git a/sys/kernel/ld.c b/sys/kernel/ld.c index 725b6ad..571ef0a 100644 --- a/sys/kernel/ld.c +++ b/sys/kernel/ld.c @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/sys/kernel/vfs_calls.c b/sys/kernel/vfs_calls.c index dd465ec..c9a14d1 100644 --- a/sys/kernel/vfs_calls.c +++ b/sys/kernel/vfs_calls.c @@ -32,7 +32,7 @@ #include #include #include -#include +#include int sys_open(struct thread *td, struct sys_open_args *args) { int error = 0x0; diff --git a/sys/lib/kprintf.c b/sys/lib/kprintf.c index 66d096a..0a79d24 100644 --- a/sys/lib/kprintf.c +++ b/sys/lib/kprintf.c @@ -564,7 +564,7 @@ else if (qflag) num = va_arg(ap, u_quad_t); else if (tflag) - num = va_arg(ap, ptrdiff_t); + num = va_arg(ap, __ptrdiff_t); else if (lflag) num = va_arg(ap, u_long); else if (zflag) @@ -581,7 +581,7 @@ else if (qflag) num = va_arg(ap, quad_t); else if (tflag) - num = va_arg(ap, ptrdiff_t); + num = va_arg(ap, __ptrdiff_t); else if (lflag) num = va_arg(ap, long); else if (zflag) diff --git a/sys/lib/string.c b/sys/lib/string.c index 19fcbd1..b420de9 100644 --- a/sys/lib/string.c +++ b/sys/lib/string.c @@ -26,6 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include #include u_char const bcd2bin_data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 0, 0, 0, 0, 0, 0, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 0, 0, 0, 0, 0, 0, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 0, 0, 0, 0, 0, 0, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 0, 0, 0, 0, 0, 0, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 0, 0, 0, 0, 0, 0, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 0, 0, 0, 0, 0, 0, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 0, 0, 0, 0, 0, 0, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 0, 0, 0, 0, 0, 0, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 }; diff --git a/sys/net/core/Makefile b/sys/net/core/Makefile index 103838a..08481c0 100644 --- a/sys/net/core/Makefile +++ b/sys/net/core/Makefile @@ -12,13 +12,13 @@ # Compile Types .cc.o: - $(CXX) ${CFLAGS} -DNOBOOL -I../../include -c -o $@ $< + $(CXX) ${CFLAGS} -DNOBOOL -I../../../include -c -o $@ $< .cc.s: - $(CXX) ${CFLAGS} -DNOBOOL -I../../include -S -o $@ $< + $(CXX) ${CFLAGS} -DNOBOOL -I../../../include -S -o $@ $< .c.o: - $(CC) ${CFLAGS} -I../../include -c -o $@ $< + $(CC) ${CFLAGS} -I../../../include -c -o $@ $< .c.s: - $(CC) ${CFLAGS} -I../../include -S -o $@ $< + $(CC) ${CFLAGS} -I../../../include -S -o $@ $< .S.o: $(CC) ${CFLAGS} -c -o $@ $< diff --git a/sys/net/core/def.c b/sys/net/core/def.c index bfa98af..643b095 100644 --- a/sys/net/core/def.c +++ b/sys/net/core/def.c @@ -61,6 +61,7 @@ #include "net/opt.h" #include "net/def.h" +#include #include #if BYTE_ORDER == LITTLE_ENDIAN diff --git a/sys/pci/hd.c b/sys/pci/hd.c index be6db78..a37c2ba 100644 --- a/sys/pci/hd.c +++ b/sys/pci/hd.c @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include diff --git a/sys/vmm/vmm_memory.c b/sys/vmm/vmm_memory.c index 56e2ac8..9db6706 100644 --- a/sys/vmm/vmm_memory.c +++ b/sys/vmm/vmm_memory.c @@ -36,7 +36,7 @@ #include //MrOlsen (2016-01-11) NOTE: Need to Seperate Out CPU Specific Stuff Over Time -#include +#include static uint32_t freePages = 0; static struct spinLock vmmSpinLock = SPIN_LOCK_INITIALIZER;