|
|
1.1 root 1: /*++
2:
3: Copyright (c) 1991 Microsoft Corporation
4:
5: Module Name:
6:
7: i386\atd_plat.h
8:
9: Abstract:
10:
11: This file includes ix86 platform-dependent declarations for the AT
12: disk (aka ST506, ISA, and ix86 standard hard disk) driver for NT.
13:
14: If this driver is ported to a different platform, this file (and
15: atd_conf.h) will need to be modified extensively. The build
16: procedure should make sure that the proper version of this file is
17: available as atd_plat.h (which is included by atdisk.c) when
18: building for a specific platform.
19:
20: Author:
21:
22: Chad Schwitters (chads) 21-Feb-1991.
23:
24: Environment:
25:
26: Kernel mode only.
27:
28: Notes:
29:
30: Revision History:
31:
32: --*/
33:
34: //
35: // Macros to access the controller, which on the ix86 is in I/O space.
36: //
37:
38: #define READ_CONTROLLER( Address ) \
39: READ_PORT_UCHAR( (Address) )
40:
41: #define READ_CONTROLLER_BUFFER( Address, Value, Length ) \
42: READ_PORT_BUFFER_USHORT( \
43: ( PUSHORT )(Address), \
44: ( PUSHORT )(Value), \
45: ( ULONG )(Length) / 2 )
46:
47: #define WRITE_CONTROLLER( Address, Value ) \
48: WRITE_PORT_UCHAR( (Address), ( UCHAR )(Value) )
49:
50: #define WRITE_CONTROLLER_BUFFER( Address, Value, Length ) \
51: WRITE_PORT_BUFFER_USHORT( \
52: ( PUSHORT )(Address), \
53: ( PUSHORT )(Value), \
54: ( ULONG )(Length) / 2 )
55:
56: //
57: // ST506 register definitions, as offsets from a base (which should be
58: // passed in by configuration management).
59: //
60:
61: #define DATA_REGISTER 0
62: #define WRITE_PRECOMP_REGISTER 1
63: #define ERROR_REGISTER 1
64: #define SECTOR_COUNT_REGISTER 2
65: #define SECTOR_NUMBER_REGISTER 3
66: #define CYLINDER_LOW_REGISTER 4
67: #define CYLINDER_HIGH_REGISTER 5
68: #define DRIVE_HEAD_REGISTER 6
69: #define COMMAND_REGISTER 7
70: #define STATUS_REGISTER 7
71:
72: //
73: // In addition to I/O space access to the controller registers, ISA defines
74: // a separate "drive control" register. Here's commands to send to that
75: // register.
76: //
77:
78: #define RESET_CONTROLLER 0x04
79: #define ENABLE_INTERRUPTS 0x00
80:
81: //
82: // We know some tricks we can use on Compaq machines. Here's some
83: // things we need to identify and exploit them.
84: //
85:
86: #define PTR_TO_NAME_STRING 0xfffea
87: #define DRIVE_PARAMETER_TABLE_OFFSET 0xfe401
88: #define DRIVE_PARAMETER_TABLE_LENGTH 0x01bfe
89: #define NAME_STRING_LENGTH 6
90: #define SECOND_CONTROLLER_IRQ_PORT ( PUCHAR )0x1171
91: #define IRQ_PORT_DISABLED_MASK 0xf0
92: #define IRQ_PORT_DISABLED 0xf0
93:
94: //
95: // Configuration Memory equates. These are used to determine how many
96: // drives are attached to the system (you send a query, ie
97: // CFGMEM_HARD_DRIVES_TYPE, out the CFGMEM_QUERY_PORT, and then read the
98: // type in from CFGMEM_DATA_PORT - if the type is 0, then there is no disk
99: // attached).
100: //
101:
102: #define CFGMEM_QUERY_PORT ( PUCHAR )0x70
103: #define CFGMEM_DATA_PORT ( PUCHAR )0x71
104: #define CFGMEM_FIRST_CONTROLLER_DRIVE_TYPES ( UCHAR )0x12
105: #define CFGMEM_DRIVES_FIRST_DRIVE_MASK 0xf0
106: #define CFGMEM_DRIVES_SECOND_DRIVE_MASK 0x0f
107: #define CFGMEM_HARD_DRIVE_TYPE_ONE ( UCHAR )0x19
108: #define CFGMEM_HARD_DRIVE_TYPE_TWO ( UCHAR )0x1a
109:
110: //
111: // The following are only known to work on Compaq machines.
112: //
113:
114: #define CFGMEM_SECOND_CONTROLLER_DRIVE_TYPES ( UCHAR )0x16
115: #define CFGMEM_HARD_DRIVE_TYPE_THREE ( UCHAR )0x1b
116: #define CFGMEM_HARD_DRIVE_TYPE_FOUR ( UCHAR )0x1c
117:
118: //
119: // ISA defines the following vectors to hold pointers to fixed disk
120: // parameter tables - this allows us to determine the types of drives
121: // on the system.
122: //
123:
124: #define PTR_TO_FDPT0_ADDRESS 0x41 * sizeof (ULONG)
125: #define PTR_TO_FDPT1_ADDRESS 0x46 * sizeof (ULONG)
126:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.