This source file includes following definitions.
- mp_float_t
- mp_checksum
- mp_probefloat
- smpprobe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 #include <sys/param.h>
31 #include <machine/biosvar.h>
32 #include "libsa.h"
33
34 extern int debug;
35
36 extern u_int cnvmem, extmem;
37 #define MP_FLOAT_SIG 0x5F504D5F
38 #define MP_CONF_SIG 0x504D4350
39
40 typedef struct _mp_float {
41 u_int32_t signature;
42 u_int32_t conf_addr;
43 u_int8_t length;
44 u_int8_t spec_rev;
45 u_int8_t checksum;
46 u_int8_t feature[5];
47 } mp_float_t;
48
49
50 static __inline int
51 mp_checksum(u_int8_t *ptr, int len)
52 {
53 register int i, sum = 0;
54
55 #ifdef DEBUG
56 printf("Checksum %p for %d\n", ptr, len);
57 #endif
58
59 for (i = 0; i < len; i++)
60 sum += *(ptr + i);
61
62 return (!(sum & 0xff));
63 }
64
65
66 static mp_float_t *
67 mp_probefloat(u_int8_t *ptr, int len)
68 {
69 mp_float_t *mpp = NULL;
70 int i;
71
72 #ifdef DEBUG
73 if (debug)
74 printf("Checking %p for %d\n", ptr, len);
75 #endif
76 for (i = 0; i < 1024; i++) {
77 mp_float_t *tmp = (mp_float_t*)(ptr + i);
78
79 if (tmp->signature == MP_FLOAT_SIG) {
80 printf("Found possible MP signature at: %p\n", ptr);
81
82 mpp = tmp;
83 break;
84 }
85 if ((tmp->signature == MP_FLOAT_SIG) &&
86 mp_checksum((u_int8_t *)tmp, tmp->length*16)) {
87 #ifdef DEBUG
88 if (debug)
89 printf("Found valid MP signature at: %p\n",
90 ptr);
91 #endif
92 mpp = tmp;
93 break;
94 }
95 }
96
97 return mpp;
98 }
99
100
101 void
102 smpprobe(void)
103 {
104 mp_float_t *mp = NULL;
105
106
107 if (!(mp = mp_probefloat((void *)((*((u_int32_t*)0x4e)) * 16), 1024)) &&
108
109 !(mp = mp_probefloat((void *)(0xE0000), 0x1FFFF)) &&
110
111 !(mp = mp_probefloat((void *)(cnvmem * 1024), 1024)) &&
112
113 !(mp = mp_probefloat((void *)(extmem * 1024 - 1024), 1024))) {
114
115 #if DEBUG
116 if (debug)
117 printf("No valid MP signature found.\n");
118 #endif
119 return;
120 }
121
122
123 printf(" smp");
124
125 #if DEBUG
126 if (debug)
127 printf("Floating Structure:\n"
128 "\tSignature: %x\n"
129 "\tConfig at: %x\n"
130 "\tLength: %d\n"
131 "\tRev: 1.%d\n"
132 "\tFeature: %x %x %x %x %x\n",
133 mp->signature, mp->conf_addr, mp->length, mp->spec_rev,
134 mp->feature[0], mp->feature[1], mp->feature[2],
135 mp->feature[3], mp->feature[4]);
136 #endif
137 }