3 * smapi.c -- SMAPI interface routines
6 * Written By: Mike Sullivan IBM Corporation
8 * Copyright (C) 1999 IBM Corporation
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
21 * THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
22 * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
23 * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
24 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
25 * solely responsible for determining the appropriateness of using and
26 * distributing the Program and assumes all risks associated with its
27 * exercise of rights under this Agreement, including but not limited to
28 * the risks and costs of program errors, damage to or loss of data,
29 * programs or equipment, and unavailability or interruption of operations.
31 * DISCLAIMER OF LIABILITY
32 * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
33 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34 * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
35 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
36 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
37 * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
38 * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
40 * You should have received a copy of the GNU General Public License
41 * along with this program; if not, write to the Free Software
42 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
45 * 10/23/2000 - Alpha Release
46 * First release to the public
49 #include <linux/kernel.h>
50 #include <linux/mc146818rtc.h> /* CMOS defines */
54 static unsigned short g_usSmapiPort = 0;
57 static int smapi_request(unsigned short inBX, unsigned short inCX,
58 unsigned short inDI, unsigned short inSI,
59 unsigned short *outAX, unsigned short *outBX,
60 unsigned short *outCX, unsigned short *outDX,
61 unsigned short *outDI, unsigned short *outSI)
63 unsigned short myoutAX = 2, *pmyoutAX = &myoutAX;
64 unsigned short myoutBX = 3, *pmyoutBX = &myoutBX;
65 unsigned short myoutCX = 4, *pmyoutCX = &myoutCX;
66 unsigned short myoutDX = 5, *pmyoutDX = &myoutDX;
67 unsigned short myoutDI = 6, *pmyoutDI = &myoutDI;
68 unsigned short myoutSI = 7, *pmyoutSI = &myoutSI;
69 unsigned short usSmapiOK = -EIO, *pusSmapiOK = &usSmapiOK;
70 unsigned int inBXCX = (inBX << 16) | inCX;
71 unsigned int inDISI = (inDI << 16) | inSI;
74 PRINTK_5(TRACE_SMAPI, "inBX %x inCX %x inDI %x inSI %x\n",
75 inBX, inCX, inDI, inSI);
77 __asm__ __volatile__("movw $0x5380,%%ax\n\t"
99 "2:\n\t":"=m"(*(unsigned short *) pmyoutAX),
100 "=m"(*(unsigned short *) pmyoutBX),
101 "=m"(*(unsigned short *) pmyoutCX),
102 "=m"(*(unsigned short *) pmyoutDX),
103 "=m"(*(unsigned short *) pmyoutDI),
104 "=m"(*(unsigned short *) pmyoutSI),
105 "=m"(*(unsigned short *) pusSmapiOK)
106 :"m"(inBXCX), "m"(inDISI), "m"(g_usSmapiPort)
107 :"%eax", "%ebx", "%ecx", "%edx", "%edi",
110 PRINTK_8(TRACE_SMAPI,
111 "myoutAX %x myoutBX %x myoutCX %x myoutDX %x myoutDI %x myoutSI %x usSmapiOK %x\n",
112 myoutAX, myoutBX, myoutCX, myoutDX, myoutDI, myoutSI,
121 retval = (usSmapiOK == 1) ? 0 : -EIO;
122 PRINTK_2(TRACE_SMAPI, "smapi::smapi_request exit retval %x\n", retval);
127 int smapi_query_DSP_cfg(SMAPI_DSP_SETTINGS * pSettings)
130 unsigned short usAX, usBX, usCX, usDX, usDI, usSI;
131 unsigned short ausDspBases[] = { 0x0030, 0x4E30, 0x8E30, 0xCE30, 0x0130, 0x0350, 0x0070, 0x0DB0 };
132 unsigned short ausUartBases[] = { 0x03F8, 0x02F8, 0x03E8, 0x02E8 };
133 unsigned short numDspBases = 8;
134 unsigned short numUartBases = 4;
136 PRINTK_1(TRACE_SMAPI, "smapi::smapi_query_DSP_cfg entry\n");
138 bRC = smapi_request(0x1802, 0x0000, 0, 0,
139 &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
141 PRINTK_ERROR(KERN_ERR_MWAVE "smapi::smapi_query_DSP_cfg: Error: Could not get DSP Settings. Aborting.\n");
145 PRINTK_1(TRACE_SMAPI, "smapi::smapi_query_DSP_cfg, smapi_request OK\n");
147 pSettings->bDSPPresent = ((usBX & 0x0100) != 0);
148 pSettings->bDSPEnabled = ((usCX & 0x0001) != 0);
149 pSettings->usDspIRQ = usSI & 0x00FF;
150 pSettings->usDspDMA = (usSI & 0xFF00) >> 8;
151 if ((usDI & 0x00FF) < numDspBases) {
152 pSettings->usDspBaseIO = ausDspBases[usDI & 0x00FF];
154 pSettings->usDspBaseIO = 0;
156 PRINTK_6(TRACE_SMAPI,
157 "smapi::smapi_query_DSP_cfg get DSP Settings bDSPPresent %x bDSPEnabled %x usDspIRQ %x usDspDMA %x usDspBaseIO %x\n",
158 pSettings->bDSPPresent, pSettings->bDSPEnabled,
159 pSettings->usDspIRQ, pSettings->usDspDMA,
160 pSettings->usDspBaseIO);
162 /* check for illegal values */
163 if ( pSettings->usDspBaseIO == 0 )
164 PRINTK_ERROR(KERN_ERR_MWAVE "smapi::smapi_query_DSP_cfg: Worry: DSP base I/O address is 0\n");
165 if ( pSettings->usDspIRQ == 0 )
166 PRINTK_ERROR(KERN_ERR_MWAVE "smapi::smapi_query_DSP_cfg: Worry: DSP IRQ line is 0\n");
168 bRC = smapi_request(0x1804, 0x0000, 0, 0,
169 &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
171 PRINTK_ERROR("smapi::smapi_query_DSP_cfg: Error: Could not get DSP modem settings. Aborting.\n");
175 PRINTK_1(TRACE_SMAPI, "smapi::smapi_query_DSP_cfg, smapi_request OK\n");
177 pSettings->bModemEnabled = ((usCX & 0x0001) != 0);
178 pSettings->usUartIRQ = usSI & 0x000F;
179 if (((usSI & 0xFF00) >> 8) < numUartBases) {
180 pSettings->usUartBaseIO = ausUartBases[(usSI & 0xFF00) >> 8];
182 pSettings->usUartBaseIO = 0;
185 PRINTK_4(TRACE_SMAPI,
186 "smapi::smapi_query_DSP_cfg get DSP modem settings bModemEnabled %x usUartIRQ %x usUartBaseIO %x\n",
187 pSettings->bModemEnabled,
188 pSettings->usUartIRQ,
189 pSettings->usUartBaseIO);
191 /* check for illegal values */
192 if ( pSettings->usUartBaseIO == 0 )
193 PRINTK_ERROR(KERN_ERR_MWAVE "smapi::smapi_query_DSP_cfg: Worry: UART base I/O address is 0\n");
194 if ( pSettings->usUartIRQ == 0 )
195 PRINTK_ERROR(KERN_ERR_MWAVE "smapi::smapi_query_DSP_cfg: Worry: UART IRQ line is 0\n");
197 PRINTK_2(TRACE_SMAPI, "smapi::smapi_query_DSP_cfg exit bRC %x\n", bRC);
203 int smapi_set_DSP_cfg(void)
207 unsigned short usAX, usBX, usCX, usDX, usDI, usSI;
208 unsigned short ausDspBases[] = { 0x0030, 0x4E30, 0x8E30, 0xCE30, 0x0130, 0x0350, 0x0070, 0x0DB0 };
209 unsigned short ausUartBases[] = { 0x03F8, 0x02F8, 0x03E8, 0x02E8 };
210 unsigned short ausDspIrqs[] = { 5, 7, 10, 11, 15 };
211 unsigned short ausUartIrqs[] = { 3, 4 };
213 unsigned short numDspBases = 8;
214 unsigned short numUartBases = 4;
215 unsigned short numDspIrqs = 5;
216 unsigned short numUartIrqs = 2;
217 unsigned short dspio_index = 0, uartio_index = 0;
219 PRINTK_5(TRACE_SMAPI,
220 "smapi::smapi_set_DSP_cfg entry mwave_3780i_irq %x mwave_3780i_io %x mwave_uart_irq %x mwave_uart_io %x\n",
221 mwave_3780i_irq, mwave_3780i_io, mwave_uart_irq, mwave_uart_io);
223 if (mwave_3780i_io) {
224 for (i = 0; i < numDspBases; i++) {
225 if (mwave_3780i_io == ausDspBases[i])
228 if (i == numDspBases) {
229 PRINTK_ERROR(KERN_ERR_MWAVE "smapi::smapi_set_DSP_cfg: Error: Invalid mwave_3780i_io address %x. Aborting.\n", mwave_3780i_io);
235 if (mwave_3780i_irq) {
236 for (i = 0; i < numDspIrqs; i++) {
237 if (mwave_3780i_irq == ausDspIrqs[i])
240 if (i == numDspIrqs) {
241 PRINTK_ERROR(KERN_ERR_MWAVE "smapi::smapi_set_DSP_cfg: Error: Invalid mwave_3780i_irq %x. Aborting.\n", mwave_3780i_irq);
247 for (i = 0; i < numUartBases; i++) {
248 if (mwave_uart_io == ausUartBases[i])
251 if (i == numUartBases) {
252 PRINTK_ERROR(KERN_ERR_MWAVE "smapi::smapi_set_DSP_cfg: Error: Invalid mwave_uart_io address %x. Aborting.\n", mwave_uart_io);
259 if (mwave_uart_irq) {
260 for (i = 0; i < numUartIrqs; i++) {
261 if (mwave_uart_irq == ausUartIrqs[i])
264 if (i == numUartIrqs) {
265 PRINTK_ERROR(KERN_ERR_MWAVE "smapi::smapi_set_DSP_cfg: Error: Invalid mwave_uart_irq %x. Aborting.\n", mwave_uart_irq);
270 if (mwave_uart_irq || mwave_uart_io) {
272 /* Check serial port A */
273 bRC = smapi_request(0x1402, 0x0000, 0, 0,
274 &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
275 if (bRC) goto exit_smapi_request_error;
277 if (usBX & 0x0100) { /* serial port A is present */
278 if (usCX & 1) { /* serial port is enabled */
279 if ((usSI & 0xFF) == mwave_uart_irq) {
280 #ifndef MWAVE_FUTZ_WITH_OTHER_DEVICES
281 PRINTK_ERROR(KERN_ERR_MWAVE
282 "smapi::smapi_set_DSP_cfg: Serial port A irq %x conflicts with mwave_uart_irq %x\n", usSI & 0xFF, mwave_uart_irq);
284 PRINTK_3(TRACE_SMAPI,
285 "smapi::smapi_set_DSP_cfg: Serial port A irq %x conflicts with mwave_uart_irq %x\n", usSI & 0xFF, mwave_uart_irq);
287 #ifdef MWAVE_FUTZ_WITH_OTHER_DEVICES
288 PRINTK_1(TRACE_SMAPI,
289 "smapi::smapi_set_DSP_cfg Disabling conflicting serial port\n");
290 bRC = smapi_request(0x1403, 0x0100, 0, usSI,
291 &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
292 if (bRC) goto exit_smapi_request_error;
293 bRC = smapi_request(0x1402, 0x0000, 0, 0,
294 &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
295 if (bRC) goto exit_smapi_request_error;
300 if ((usSI >> 8) == uartio_index) {
301 #ifndef MWAVE_FUTZ_WITH_OTHER_DEVICES
302 PRINTK_ERROR(KERN_ERR_MWAVE
303 "smapi::smapi_set_DSP_cfg: Serial port A base I/O address %x conflicts with mwave uart I/O %x\n", ausUartBases[usSI >> 8], ausUartBases[uartio_index]);
305 PRINTK_3(TRACE_SMAPI,
306 "smapi::smapi_set_DSP_cfg: Serial port A base I/O address %x conflicts with mwave uart I/O %x\n", ausUartBases[usSI >> 8], ausUartBases[uartio_index]);
308 #ifdef MWAVE_FUTZ_WITH_OTHER_DEVICES
309 PRINTK_1(TRACE_SMAPI,
310 "smapi::smapi_set_DSP_cfg Disabling conflicting serial port A\n");
311 bRC = smapi_request (0x1403, 0x0100, 0, usSI,
312 &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
313 if (bRC) goto exit_smapi_request_error;
314 bRC = smapi_request (0x1402, 0x0000, 0, 0,
315 &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
316 if (bRC) goto exit_smapi_request_error;
325 /* Check serial port B */
326 bRC = smapi_request(0x1404, 0x0000, 0, 0,
327 &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
328 if (bRC) goto exit_smapi_request_error;
330 if (usBX & 0x0100) { /* serial port B is present */
331 if (usCX & 1) { /* serial port is enabled */
332 if ((usSI & 0xFF) == mwave_uart_irq) {
333 #ifndef MWAVE_FUTZ_WITH_OTHER_DEVICES
334 PRINTK_ERROR(KERN_ERR_MWAVE
335 "smapi::smapi_set_DSP_cfg: Serial port B irq %x conflicts with mwave_uart_irq %x\n", usSI & 0xFF, mwave_uart_irq);
337 PRINTK_3(TRACE_SMAPI,
338 "smapi::smapi_set_DSP_cfg: Serial port B irq %x conflicts with mwave_uart_irq %x\n", usSI & 0xFF, mwave_uart_irq);
340 #ifdef MWAVE_FUTZ_WITH_OTHER_DEVICES
341 PRINTK_1(TRACE_SMAPI,
342 "smapi::smapi_set_DSP_cfg Disabling conflicting serial port B\n");
343 bRC = smapi_request(0x1405, 0x0100, 0, usSI,
344 &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
345 if (bRC) goto exit_smapi_request_error;
346 bRC = smapi_request(0x1404, 0x0000, 0, 0,
347 &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
348 if (bRC) goto exit_smapi_request_error;
353 if ((usSI >> 8) == uartio_index) {
354 #ifndef MWAVE_FUTZ_WITH_OTHER_DEVICES
355 PRINTK_ERROR(KERN_ERR_MWAVE
356 "smapi::smapi_set_DSP_cfg: Serial port B base I/O address %x conflicts with mwave uart I/O %x\n", ausUartBases[usSI >> 8], ausUartBases[uartio_index]);
358 PRINTK_3(TRACE_SMAPI,
359 "smapi::smapi_set_DSP_cfg: Serial port B base I/O address %x conflicts with mwave uart I/O %x\n", ausUartBases[usSI >> 8], ausUartBases[uartio_index]);
361 #ifdef MWAVE_FUTZ_WITH_OTHER_DEVICES
362 PRINTK_1 (TRACE_SMAPI,
363 "smapi::smapi_set_DSP_cfg Disabling conflicting serial port B\n");
364 bRC = smapi_request (0x1405, 0x0100, 0, usSI,
365 &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
366 if (bRC) goto exit_smapi_request_error;
367 bRC = smapi_request (0x1404, 0x0000, 0, 0,
368 &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
369 if (bRC) goto exit_smapi_request_error;
379 bRC = smapi_request(0x1700, 0x0000, 0, 0,
380 &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
381 if (bRC) goto exit_smapi_request_error;
382 bRC = smapi_request(0x1704, 0x0000, 0, 0,
383 &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
384 if (bRC) goto exit_smapi_request_error;
386 if ((usCX & 0xff) != 0xff) { /* IR port not disabled */
387 if ((usCX & 0xff) == mwave_uart_irq) {
388 #ifndef MWAVE_FUTZ_WITH_OTHER_DEVICES
389 PRINTK_ERROR(KERN_ERR_MWAVE
390 "smapi::smapi_set_DSP_cfg: IR port irq %x conflicts with mwave_uart_irq %x\n", usCX & 0xff, mwave_uart_irq);
392 PRINTK_3(TRACE_SMAPI,
393 "smapi::smapi_set_DSP_cfg: IR port irq %x conflicts with mwave_uart_irq %x\n", usCX & 0xff, mwave_uart_irq);
395 #ifdef MWAVE_FUTZ_WITH_OTHER_DEVICES
396 PRINTK_1(TRACE_SMAPI,
397 "smapi::smapi_set_DSP_cfg Disabling conflicting IR port\n");
398 bRC = smapi_request(0x1701, 0x0100, 0, 0,
399 &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
400 if (bRC) goto exit_smapi_request_error;
401 bRC = smapi_request(0x1700, 0, 0, 0,
402 &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
403 if (bRC) goto exit_smapi_request_error;
404 bRC = smapi_request(0x1705, 0x01ff, 0, usSI,
405 &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
406 if (bRC) goto exit_smapi_request_error;
407 bRC = smapi_request(0x1704, 0x0000, 0, 0,
408 &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
409 if (bRC) goto exit_smapi_request_error;
414 if ((usSI & 0xff) == uartio_index) {
415 #ifndef MWAVE_FUTZ_WITH_OTHER_DEVICES
416 PRINTK_ERROR(KERN_ERR_MWAVE
417 "smapi::smapi_set_DSP_cfg: IR port base I/O address %x conflicts with mwave uart I/O %x\n", ausUartBases[usSI & 0xff], ausUartBases[uartio_index]);
419 PRINTK_3(TRACE_SMAPI,
420 "smapi::smapi_set_DSP_cfg: IR port base I/O address %x conflicts with mwave uart I/O %x\n", ausUartBases[usSI & 0xff], ausUartBases[uartio_index]);
422 #ifdef MWAVE_FUTZ_WITH_OTHER_DEVICES
423 PRINTK_1(TRACE_SMAPI,
424 "smapi::smapi_set_DSP_cfg Disabling conflicting IR port\n");
425 bRC = smapi_request(0x1701, 0x0100, 0, 0,
426 &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
427 if (bRC) goto exit_smapi_request_error;
428 bRC = smapi_request(0x1700, 0, 0, 0,
429 &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
430 if (bRC) goto exit_smapi_request_error;
431 bRC = smapi_request(0x1705, 0x01ff, 0, usSI,
432 &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
433 if (bRC) goto exit_smapi_request_error;
434 bRC = smapi_request(0x1704, 0x0000, 0, 0,
435 &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
436 if (bRC) goto exit_smapi_request_error;
445 bRC = smapi_request(0x1802, 0x0000, 0, 0,
446 &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
447 if (bRC) goto exit_smapi_request_error;
449 if (mwave_3780i_io) {
452 if (mwave_3780i_irq) {
453 usSI = (usSI & 0xff00) | mwave_3780i_irq;
456 bRC = smapi_request(0x1803, 0x0101, usDI, usSI,
457 &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
458 if (bRC) goto exit_smapi_request_error;
460 bRC = smapi_request(0x1804, 0x0000, 0, 0,
461 &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
462 if (bRC) goto exit_smapi_request_error;
465 usSI = (usSI & 0x00ff) | (uartio_index << 8);
467 if (mwave_uart_irq) {
468 usSI = (usSI & 0xff00) | mwave_uart_irq;
470 bRC = smapi_request(0x1805, 0x0101, 0, usSI,
471 &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
472 if (bRC) goto exit_smapi_request_error;
474 bRC = smapi_request(0x1802, 0x0000, 0, 0,
475 &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
476 if (bRC) goto exit_smapi_request_error;
478 bRC = smapi_request(0x1804, 0x0000, 0, 0,
479 &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
480 if (bRC) goto exit_smapi_request_error;
483 PRINTK_1(TRACE_SMAPI, "smapi::smapi_set_DSP_cfg exit\n");
487 /* Message has already been printed */
490 exit_smapi_request_error:
491 PRINTK_ERROR(KERN_ERR_MWAVE "smapi::smapi_set_DSP_cfg exit on smapi_request error bRC %x\n", bRC);
496 int smapi_set_DSP_power_state(BOOLEAN bOn)
499 unsigned short usAX, usBX, usCX, usDX, usDI, usSI;
500 unsigned short usPowerFunction;
502 PRINTK_2(TRACE_SMAPI, "smapi::smapi_set_DSP_power_state entry bOn %x\n", bOn);
504 usPowerFunction = (bOn) ? 1 : 0;
506 bRC = smapi_request(0x4901, 0x0000, 0, usPowerFunction,
507 &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
509 PRINTK_2(TRACE_SMAPI, "smapi::smapi_set_DSP_power_state exit bRC %x\n", bRC);
515 static int SmapiQuerySystemID(void)
518 unsigned short usAX = 0xffff, usBX = 0xffff, usCX = 0xffff,
519 usDX = 0xffff, usDI = 0xffff, usSI = 0xffff;
521 printk("smapi::SmapiQUerySystemID entry\n");
522 bRC = smapi_request(0x0000, 0, 0, 0,
523 &usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
526 printk("AX=%x, BX=%x, CX=%x, DX=%x, DI=%x, SI=%x\n",
527 usAX, usBX, usCX, usDX, usDI, usSI);
529 printk("smapi::SmapiQuerySystemID smapi_request error\n");
539 unsigned short usSmapiID = 0;
542 PRINTK_1(TRACE_SMAPI, "smapi::smapi_init entry\n");
544 spin_lock_irqsave(&rtc_lock, flags);
545 usSmapiID = CMOS_READ(0x7C);
546 usSmapiID |= (CMOS_READ(0x7D) << 8);
547 spin_unlock_irqrestore(&rtc_lock, flags);
548 PRINTK_2(TRACE_SMAPI, "smapi::smapi_init usSmapiID %x\n", usSmapiID);
550 if (usSmapiID == 0x5349) {
551 spin_lock_irqsave(&rtc_lock, flags);
552 g_usSmapiPort = CMOS_READ(0x7E);
553 g_usSmapiPort |= (CMOS_READ(0x7F) << 8);
554 spin_unlock_irqrestore(&rtc_lock, flags);
555 if (g_usSmapiPort == 0) {
556 PRINTK_ERROR("smapi::smapi_init, ERROR unable to read from SMAPI port\n");
558 PRINTK_2(TRACE_SMAPI,
559 "smapi::smapi_init, exit TRUE g_usSmapiPort %x\n",
562 //SmapiQuerySystemID();
565 PRINTK_ERROR("smapi::smapi_init, ERROR invalid usSmapiID\n");