]> git.lizzy.rs Git - plan9front.git/blob - sys/man/3/arch
/sys/man/*/*: fix perms (sorry)
[plan9front.git] / sys / man / 3 / arch
1 .TH ARCH 3
2 .SH NAME
3 arch \- architecture-specific information and control
4 .SH SYNOPSIS
5 .nf
6 .B bind -a #P /dev
7 .sp 0.3v
8 .B /dev/acpitbls
9 .B /dev/archctl
10 .B /dev/cputype
11 .B /dev/ec
12 .B /dev/ioalloc
13 .B /dev/iob
14 .B /dev/iol
15 .B /dev/iow
16 .B /dev/irqalloc
17 .B /dev/msr
18 .SH DESCRIPTION
19 This device presents textual information about PC hardware and allows
20 user-level control of the I/O ports on x86-class machines.
21 .PP
22 Reads from
23 .I cputype
24 recover the processor type and clock rate in MHz.
25 Reads from
26 .I archctl
27 yield at least data of this form:
28 .IP
29 .EX
30 cpu AMD64 2201 pge
31 pge on
32 coherence mfence
33 cmpswap cmpswap486
34 i8253set on
35 cache default uc
36 cache 0x0 1073741824 wb
37 cache 0x3ff00000 1048576 uc
38 .EE
39 .LP
40 Where
41 .L AMD64
42 is the processor type,
43 .L 2201
44 is the processor speed in MHz,
45 and
46 .L pge
47 is present only if the `page global extension' capability is present;
48 the next line reflects its setting.
49 .L coherence
50 is followed by one of
51 .LR mb386 ,
52 .LR mb586 ,
53 .L mfence
54 or
55 .LR nop ,
56 showing the form of memory barrier used by the kernel.
57 .L cmpswap
58 is followed by
59 .L cmpswap386
60 or
61 .LR cmpswap486 ,
62 reflecting the form of `compare and swap' used by the kernel.
63 .L i8253set
64 is a flag, indicating the need to explicitly set
65 the Intel 8253 or equivalent timer.
66 There may be lines starting with
67 .L cache
68 that reflect the state of memory caching via MTRRs
69 (memory-type region registers).
70 The second word on the line is
71 .L default
72 or a C-style number which is the base physical address of the region;
73 the third is a C-style length of the region;
74 and the fourth is one of
75 .LR uc
76 (for uncachable),
77 .LR wb
78 (write-back),
79 .LR wc
80 (write-combining),
81 .LR wp
82 (write-protected),
83 or
84 .LR wt
85 (write-through).
86 A region may be a subset of another region, and the smaller region
87 takes precedence.
88 This may be used to make I/O registers uncachable
89 in the midst of a write-combining region mostly used
90 for a video framebuffer, for example.
91 Control messages may be written to
92 .I archctl
93 and use the same syntax as the data read from
94 .IR archctl .
95 Known commands include
96 .LR cache ,
97 .LR coherence ,
98 .LR i8253set ,
99 and
100 .LR pge .
101 .
102 .PP
103 Reads from
104 .I ioalloc
105 return I/O ranges used by each device, one line
106 per range.
107 Each line contains three fields separated by white space: first address
108 in hexadecimal,
109 last address, name of device.
110 .PP
111 Reads from
112 .I irqalloc
113 return the enabled interrupts, one line per
114 interrupt.  Each line contains three fields separated by white space:
115 the trap number, the IRQ it is assigned to, and the name of
116 the device using it.
117 .PP
118 Reads and writes to
119 .IR iob ,
120 .IR iow ,
121 and
122 .IR iol
123 cause 8-bit wide, 16-bit wide, and 32-bit wide requests to
124 I/O ports.
125 The port accessed is determined by the byte offset of the
126 file descriptor.
127 .PP
128 Reads and writes to
129 .I msr
130 go to the P4/P6/Core/Core2/AMD64 MSRs.
131 .PP
132 Reads and writes to
133 .I ec
134 transfer bytes from and to the embedded controller.
135 .PP
136 Reads from
137 .I acpitbls
138 return a concatenation of system ACPI tables. Each table
139 is prefixed with a fixed size header that gives the name
140 sigature and size of the table (see section
141 .IR "5.2.6 System Description Table Header"
142 in the ACPI specification).
143 .SH EXAMPLE
144 The following code reads from an x86 byte I/O port.
145 .IP
146 .EX
147 uchar
148 inportb(unsigned port)
149 {
150     uchar data;
151
152     if(iobfd == -1)
153         iobfd = open("#P/iob", ORDWR);
154
155     seek(iobfd, port, 0);
156     if(read(iobfd, &data, sizeof(data)) != sizeof(data))
157         sysfatal("inportb(0x%4.4ux): %r", port);
158     return data;
159 }
160 .EE
161 .SH SOURCE
162 .B /sys/src/9/pc/devarch.c