home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1999 March B / SCO_CASTOR4RRT.iso / nics / root.2 / usr / include / sys / msmnbi.h / msmnbi
Text File  |  1998-08-19  |  11KB  |  368 lines

  1. /*
  2.  * Copyright (c) 1998 The Santa Cruz Operation, Inc.. All Rights Reserved. 
  3.  *                                                                         
  4.  *        THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF THE               
  5.  *                   SANTA CRUZ OPERATION INC.                             
  6.  *                                                                         
  7.  *   The copyright notice above does not evidence any actual or intended   
  8.  *   publication of such source code.                                      
  9.  */
  10.  
  11. #ifndef _IO_MSM_MSMNBI_H   /* wrapper symbol for kernel use */
  12. #define _IO_MSM_MSMNBI_H   /* subject to change without notice */
  13.  
  14. #ident    "@(#)msmnbi.h    2.1"
  15. #ident  "$Header: $"
  16.  
  17. typedef enum _ODI_NBI_ {
  18.     ODI_NBI_SUCCESSFUL =        0x00000000,
  19.     ODI_NBI_PROTECTION_VIOLATION =  0x00000001,
  20.     ODI_NBI_HARDWARE_ERROR =    0x00000002,
  21.     ODI_NBI_MEMORY_ERROR =          0x00000003,
  22.     ODI_NBI_PARAMETER_ERROR =       0x00000004,
  23.     ODI_NBI_UNSUPPORTED_OPERATION = 0x00000005,
  24.     ODI_NBI_ITEM_NOT_PRESENT =      0x00000006,
  25.     ODI_NBI_NO_MORE_ITEMS =         0x00000007,
  26.     ODI_NBI_FAIL =              0x00000008
  27. } ODI_NBI;
  28.  
  29. struct msmbus {
  30.     struct msmbus            *next;
  31.     ULONG                busTag;
  32.     ULONG                    busType;
  33.     UINT32                  physicalMemAddrSize;
  34.     UINT32                  ioAddrSize;
  35.     char                    *busName;
  36. };
  37.  
  38. struct msmnbiinst {
  39.     struct msmnbiinst        *next;
  40.     UINT32                uniqueIdentifier;
  41.     UINT16                instanceNumber;
  42.     ULONG                busTag;
  43. };
  44.  
  45. #define ODI_BUSTYPE_ISA             0
  46. #define ODI_BUSTYPE_MCA             1
  47. #define ODI_BUSTYPE_EISA        2
  48. #define ODI_BUSTYPE_PCMCIA              3
  49. #define ODI_BUSTYPE_PCI             4
  50. #define ODI_BUSTYPE_VESA        5
  51. #define ODI_BUSTYPE_NUBUS               6
  52.  
  53. #define BUS_SIGNATURE               0xAABBCCDD
  54. #define MAX_SCAN_SEQ                8
  55.  
  56. #define ODI_ISA_MEMWIDTH        16
  57. #define ODI_ISA_IOWIDTH            16
  58. #define ODI_EISA_MEMWIDTH        32
  59. #define ODI_EISA_IOWIDTH        32
  60. #define ODI_PCI_MEMWIDTH        64
  61. #define ODI_PCI_IOWIDTH            32
  62. #define ODI_PCMCIA_MEMWIDTH        32
  63. #define ODI_PCMCIA_IOWIDTH        32
  64. #define ODI_MCA_MEMWIDTH        32
  65. #define ODI_MCA_IOWIDTH            32
  66.  
  67. #define ODI_MCA_PRODUCTIDLEN        2
  68. #define ODI_EISA_PRODUCTIDLEN        4
  69. #define ODI_PCI_PRODUCTIDLEN        4
  70.  
  71. /*
  72.  * flags for msm_read_eisa_config.
  73.  */
  74. #define MSM_EISA_SUCCESS        0x0
  75. #define MSM_EISA_INVALID_SLOT        0x80
  76. #define MSM_EISA_INVALID_FUNC        0x81
  77. #define MSM_EISA_EMPTY_SLOT        0x83
  78. #define MSM_EISA_NOMEM            0x87
  79.  
  80. #define    MSM_MATCH_SLOT            0x0
  81. #define    MSM_MATCH_UID            0x1
  82.  
  83. #define    MSM_EISA_MCA_PARAMS        0x1
  84. #define    MSM_PCI_PARAMS            0x2
  85.  
  86. #define    MSM_NEW_INUM            0x1
  87. #define    MSM_GIVEN_INUM            0x2
  88.  
  89. /*
  90.  * MSM_MAX_PARAMS should be max of above values.
  91.  */
  92. #define    MSM_MAX_PARAMS            0x2
  93.  
  94. /*
  95.  * NBI routines used by both assembly and C wrappers.
  96.  */
  97. extern UINT32    GetAlignment(UINT32 type);
  98. extern ODI_NBI    GetBusInfo(ULONG busTag, UINT32 *physicalMemAddrSize,
  99.             UINT32 *ioAddrSize);
  100. extern ODI_NBI    GetBusType(ULONG busTag, UINT32 *busType);
  101. extern ODI_NBI    GetBusName(ULONG busTag, UINT8 **busName);
  102. extern ODI_NBI    GetBusSpecificInfo(ULONG busTag, UINT32 size,
  103.             void *busSpecificInfo);
  104. extern ODI_NBI    GetBusTag(const MEON_STRING *busName, ULONG *busTag);
  105. extern ODI_NBI    GetUniqueIdentifier(ULONG busTag, UINT32 *parameters,
  106.             UINT32 parameterCount, UINT32 *uniqueIdentifier);
  107. extern ODI_NBI    GetInstanceNumber(ULONG busTag, UINT32 uniqueIdentifier,
  108.             UINT16 *instanceNumber);
  109. extern ODI_NBI    GetInstanceNumberMapping(UINT16 instanceNumber, ULONG *busTag,
  110.             UINT32 *uniqueIdentifier);
  111. extern ODI_NBI    GetCardConfigInfo(ULONG busTag, UINT32 uniqueIdentifier,
  112.             UINT32 size, UINT32 parm1, UINT32 parm2,
  113.             void *configInfo);
  114. extern ODI_NBI    GetSlot(ULONG busTag, MEON_STRING *slotName, UINT16 *slot);
  115. extern ODI_NBI    GetSlotName(ULONG busTag, UINT16 slot,
  116.             MEON_STRING **slotName);
  117. extern ODI_NBI    ScanBusInfo(UINT32 *scanSequence, ULONG *busTag,
  118.             UINT32 *busType, MEON **busName);
  119. extern ODI_NBI    SearchAdapter(UINT32 *scanSequence, UINT32 busType,
  120.             UINT32 productIDlen, const MEON *productID,
  121.             ULONG *busTag, UINT16 *slot, UINT32 *uniqueIdentifier);
  122. UINT8        RdConfigSpace8(ULONG busTag, UINT32 uniqueIdentifier,
  123.             UINT32 offset);
  124. UINT16        RdConfigSpace16(ULONG busTag, UINT32 uniqueIdentifier,
  125.             UINT32 offset);
  126. UINT32        RdConfigSpace32(ULONG busTag, UINT32 uniqueIdentifier,
  127.             UINT32 offset);
  128. void        WrtConfigSpace8(ULONG busTag, UINT32 uniqueIdentifier,
  129.             UINT32 offset, UINT8 writeVal);
  130. void        WrtConfigSpace16(ULONG busTag, UINT32 uniqueIdentifier,
  131.             UINT32 offset, UINT16 writeVal);
  132. void        WrtConfigSpace32(ULONG busTag, UINT32 uniqueIdentifier,
  133.             UINT32 offset, UINT32 writeVal);
  134. /*
  135.  * NBI routines exported directly out of the C spec (not used by assembly glu)
  136.  */
  137. void        DMACleanup(UINT32 DMAChannel);
  138. ODI_NBI        DMAStart(void *destBusTag, UINT32 destAddrType, const void
  139.             *destAddr, void *srcBusTag, UINT32 srcAddrType,
  140.             const void *srcAddr, UINT32 len, UINT32 DMAChannel,
  141.             UINT32 DMAMode1, UINT32 DMAMode2);
  142. UINT32        DMAStatus(UINT32 DMAChannel);
  143. ODI_NBI        FreeBusMemory(void *busTag1, const void *memAddrPtr,
  144.             void *busTag2, const void *mappedAddrPtr,
  145.             UINT32 len);
  146.  
  147. UINT8        In8(void *busTag, const void *IOAddrPtr);
  148. UINT16        In16(void *busTag, const void *IOAddrPtr);
  149. UINT32        In32(void *busTag, const void *IOAddrPtr);
  150. ODI_NBI        InBuff8(UINT8 *bufferPtr, void *IOBusTag,
  151.             const void *IOAddrPtr, UINT32 count);
  152. ODI_NBI        InBuff16(UINT16 *bufferPtr, void *IOBusTag,
  153.             const void *IOAddrPtr, UINT32 count);
  154. ODI_NBI        InBuff32(UINT32 *bufferPtr, void *IOBusTag,
  155.             const void *IOAddrPtr, UINT32 count);
  156. ODI_NBI        MapBusMemory(void *busTag1, const void *memAddrPtr,
  157.             void *busTag2, void *mappedAddrPtr, UINT32 len);
  158. ODI_NBI        MovFastFromBus(void *destAddrPtr, void *srcBusTag,
  159.             const void *reserved, const void *srcAddr,
  160.             UINT32 count);
  161. ODI_NBI        MovFastToBus(void *destBusTag, void *reserved, void *destAddr,
  162.             const void *srcAddrPtr, UINT32 count);
  163. ODI_NBI        MovFromBus8(void *destAddrPtr, void *srcBusTag, void
  164.             *reserved, const void *srcAddr, UINT32 count);
  165. ODI_NBI        MovFromBus16(void *destAddrPtr, void *srcBusTag,
  166.             void *reserved, const void *srcAddr, UINT32 count);
  167. ODI_NBI        MovFromBus32(void *destAddrPtr, void *srcBusTag, void
  168.             *reserved, const void *srcAddr, UINT32 count);
  169. ODI_NBI        MovToBus8(void *destBusTag, void *reserved, void *destAddr,
  170.             const void *srcAddrPtr, UINT32 count);
  171. ODI_NBI        MovToBus16(void *destBusTag, void *reserved, void *destAddr,
  172.             const void *srcAddrPtr, UINT32 count);
  173. ODI_NBI        MovToBus32(void *destBusTag, void *reserved, void *destAddr,
  174.             const void *srcAddrPtr, UINT32 count);
  175. void        Out8(void *busTag, const void *IOAddrPtr, UINT8 outputVal);
  176. void        Out16(void *busTag, const void *IOAddrPtr, UINT16 outputVal);
  177. void        Out32(void *busTag, const void *IOAddrPtr, UINT32 outputVal);
  178. ODI_NBI        OutBuff8(void *IOBusTag, void *IOAddrPtr, const void
  179.             *bufferPtr, UINT32 count);
  180. ODI_NBI        OutBuff16(void *IOBusTag, void *IOAddrPtr, const void
  181.             *bufferPtr, UINT32 count);
  182. ODI_NBI        OutBuff32(void *IOBusTag, void *IOAddrPtr, const void
  183.             *bufferPtr, UINT32 count);
  184. UINT8        Rd8(void *busTag, const void *reserved, const void *memAddr);
  185. UINT16        Rd16(void *busTag, const void *reserved, const void *memAddr);
  186. UINT32        Rd32(void *busTag, const void *reserved, const void *memAddr);
  187. ODI_NBI        Set8(void *busTag, const void *reserved, const void *memAddr,
  188.             UINT8 value, UINT32 count);
  189. ODI_NBI        Set16(void *busTag, const void *reserved, const void *memAddr,
  190.             UINT16 value, UINT32 count);
  191. ODI_NBI        Set32(void *busTag, const void *reserved, const void
  192.             *memLogicalAddr, UINT32 value, UINT32 count);
  193. void        Slow(void);
  194. void        Wrt8(void *busTag, void *reserved, void *memAddr,
  195.             UINT8 writeVal);
  196. void        Wrt16(void *busTag, void *reserved, void *memAddr,
  197.             UINT16 writeVal);
  198. void        Wrt32(void *busTag, void *reserved, void *memAddr,
  199.             UINT32 writeVal);
  200. UINT32        UnMaskBusInterrupt(void *busTag, UINT8 interrupt);
  201. UINT32        MaskBusInterrupt(void *busTag, UINT8 interrupt);
  202.  
  203.  
  204. /*
  205.  * asms needed to support NBI.
  206.  */
  207.  
  208. __asm void gen_MovFastFromBus(void *destAddr, const void *srcAddr, UINT32 count)
  209. {
  210. %mem destAddr, srcAddr, count;
  211.     pushl    %edi            / save %edi
  212.     pushl    %esi            / save %esi
  213.     movl    destAddr, %edi
  214.     movl    srcAddr, %esi
  215.     movl    count, %ecx
  216.     movl    %ecx, %eax
  217.     shrl    $0x02, %ecx
  218.     rep;    smovl
  219.     movl    %eax, %ecx
  220.     andl    $0x03, %ecx
  221.     rep;    smovb
  222.     popl    %esi            / restore %esi
  223.     popl    %edi            / restore %edi
  224. }
  225.  
  226. __asm void gen_MovFastToBus(void *destAddr, const void *srcAddr, UINT32 count)
  227. {
  228. %mem destAddr, srcAddr, count;
  229.     pushl    %edi            / save %edi
  230.     pushl    %esi            / save %esi
  231.     movl    destAddr, %edi
  232.     movl    srcAddr, %esi
  233.     movl    count, %ecx
  234.     movl    %ecx, %eax
  235.     shrl    $0x02, %ecx
  236.     rep;    smovl
  237.     movl    %eax, %ecx
  238.     andl    $0x03, %ecx
  239.     rep;    smovb
  240.     popl    %esi            / restore %esi
  241.     popl    %edi            / restore %edi
  242. }
  243.  
  244. __asm void gen_Mov8(void *destAddr, const void *srcAddr, UINT32 count)
  245. {
  246. %mem destAddr, srcAddr, count;
  247.     pushl    %edi            / save %edi
  248.     pushl    %esi            / save %esi
  249.     movl    destAddr, %edi
  250.     movl    srcAddr, %esi
  251.     movl    count, %ecx
  252.     rep;    smovb
  253.     popl    %esi            / restore %esi
  254.     popl    %edi            / restore %edi
  255. }
  256.  
  257. __asm void gen_Mov16(void *destAddr, const void *srcAddr, UINT32 count)
  258. {
  259. %mem destAddr, srcAddr, count;
  260.     pushl    %edi            / save %edi
  261.     pushl    %esi            / save %esi
  262.     movl    destAddr, %edi
  263.     movl    srcAddr, %esi
  264.     movl    count, %ecx
  265.     rep;    smovw
  266.     popl    %esi            / restore %esi
  267.     popl    %edi            / restore %edi
  268. }
  269.  
  270. __asm void gen_Mov32(void *destAddr, const void *srcAddr, UINT32 count)
  271. {
  272. %mem destAddr, srcAddr, count;
  273.     pushl    %edi            / save %edi
  274.     pushl    %esi            / save %esi
  275.     movl    destAddr, %edi
  276.     movl    srcAddr, %esi
  277.     movl    count, %ecx
  278.     rep;    smovl
  279.     popl    %esi            / restore %esi
  280.     popl    %edi            / restore %edi
  281. }
  282.  
  283. __asm UINT8 gen_Rd8(const void *memAddr)
  284. {
  285. %mem memAddr;
  286.     movl    memAddr, %eax
  287.     movb    (%eax), %al
  288. }
  289.  
  290. __asm UINT16 gen_Rd16(const void *memAddr)
  291. {
  292. %mem memAddr;
  293.     movl    memAddr, %eax
  294.     movw    (%eax), %ax
  295. }
  296.  
  297. __asm UINT32 gen_Rd32(const void *memAddr)
  298. {
  299. %mem memAddr;
  300.     movl    memAddr, %eax
  301.     movl    (%eax), %eax
  302. }
  303.  
  304. __asm void gen_Set8(const void *memAddr, UINT8 value, UINT32 count)
  305. {
  306. %mem memAddr, value, count;
  307.     pushl    %edi            / save %edi
  308.     pushl    %esi            / save %esi
  309.     movl    memAddr, %edi
  310.     movb    value, %al
  311.     movl    count, %ecx
  312.     rep;    stosb
  313.     popl    %esi            / restore %esi
  314.     popl    %edi            / restore %edi
  315. }
  316.  
  317. __asm void gen_Set16(const void *memAddr, UINT16 value, UINT32 count)
  318. {
  319. %mem memAddr, value, count;
  320.     pushl    %edi            / save %edi
  321.     pushl    %esi            / save %esi
  322.     movl    memAddr, %edi
  323.     movw    value, %ax
  324.     movl    count, %ecx
  325.     rep;    stosw
  326.     popl    %esi            / restore %esi
  327.     popl    %edi            / restore %edi
  328. }
  329.  
  330. __asm void gen_Set32(const void *memAddr, UINT32 value, UINT32 count)
  331. {
  332. %mem memAddr, value, count;
  333.     pushl    %edi            / save %edi
  334.     pushl    %esi            / save %esi
  335.     movl    memAddr, %edi
  336.     movl    value, %eax
  337.     movl    count, %ecx
  338.     rep;    stosl
  339.     popl    %esi            / restore %esi
  340.     popl    %edi            / restore %edi
  341. }
  342.  
  343. __asm void gen_Wrt8(void *memAddr, UINT8 writeVal) 
  344. {
  345. %mem memAddr, writeVal;
  346.     movl    memAddr, %ecx
  347.     movb    writeVal, %al
  348.     movb    %al, (%ecx)
  349. }
  350.  
  351. __asm void gen_Wrt16(void *memAddr, UINT16 writeVal) 
  352. {
  353. %mem memAddr, writeVal;
  354.     movl    memAddr, %ecx
  355.     movw    writeVal, %ax
  356.     movw    %ax, (%ecx)
  357. }
  358.  
  359. __asm void gen_Wrt32(void *memAddr, UINT32 writeVal) 
  360. {
  361. %mem memAddr, writeVal;
  362.     movl    memAddr, %ecx
  363.     movl    writeVal, %eax
  364.     movl    %eax, (%ecx)
  365. }
  366.  
  367. #endif    /* _IO_MSM_MSMNBI_H */
  368.