Remove whitespace.
[coreboot.git] / src / mainboard / siemens / sitemp_g1p1 / dsdt.asl
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2008 Advanced Micro Devices, Inc.
5  * Copyright (C) 2010 Siemens AG, Inc.
6  * (Written by Josef Kellermann <joseph.kellermann@heitec.de> for Siemens AG, Inc.)
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; version 2 of the License.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
20  */
21
22 DefinitionBlock ("DSDT.aml", "DSDT", 2, "SIEMENS", "SITEMP ", 0x20101005)
23 {
24         /* Data to be patched by the BIOS during POST */
25         /* Memory related values */
26         Name(LOMH, 0x0) /* Start of unused memory in C0000-E0000 range */
27         Name(HPBA, 0xFED00000)  /* Base address of HPET table */
28
29         /* USB overcurrent mapping pins.   */
30         Name(UOM0, 0)
31         Name(UOM1, 2)
32         Name(UOM2, 0)
33         Name(UOM3, 7)
34         Name(UOM4, 2)
35         Name(UOM5, 2)
36         Name(UOM6, 6)
37         Name(UOM7, 2)
38         Name(UOM8, 6)
39         Name(UOM9, 6)
40
41         Name(DSEN, 1)           // Display Output Switching Enable
42         // Power notification
43
44         /* PIC IRQ mapping registers, C00h-C01h */
45         OperationRegion(PRQM, SystemIO, 0x00000C00, 0x00000002)
46                 Field(PRQM, ByteAcc, NoLock, Preserve) {
47                 PRQI, 0x00000008,
48                 PRQD, 0x00000008,  /* Offset: 1h */
49         }
50         IndexField(PRQI, PRQD, ByteAcc, NoLock, Preserve) {
51                 PINA, 0x00000008,       /* Index 0  */
52                 PINB, 0x00000008,       /* Index 1 */
53                 PINC, 0x00000008,       /* Index 2 */
54                 PIND, 0x00000008,       /* Index 3 */
55                 SINT, 0x00000008,       /*  Index 4 */
56                 Offset(0x09),
57                 PINE, 0x00000008,       /* Index 9 */
58                 PINF, 0x00000008,       /* Index A */
59                 PING, 0x00000008,       /* Index B */
60                 PINH, 0x00000008,       /* Index C */
61         }
62
63         /* PCI Error control register */
64         OperationRegion(PERC, SystemIO, 0x00000C14, 0x00000001)
65                 Field(PERC, ByteAcc, NoLock, Preserve) {
66                 SENS, 0x00000001,
67                 PENS, 0x00000001,
68                 SENE, 0x00000001,
69                 PENE, 0x00000001,
70         }
71
72         /* Client Management index/data registers */
73         OperationRegion(CMT, SystemIO, 0x00000C50, 0x00000002)
74                 Field(CMT, ByteAcc, NoLock, Preserve) {
75                 CMTI,      8,
76                 /* Client Management Data register */
77                 G64E,   1,
78                 G64O,      1,
79                 G32O,      2,
80                 ,       2,
81                 GPSL,     2,
82         }
83
84         /* GPM Port register */
85         OperationRegion(GPT, SystemIO, 0x00000C52, 0x00000001)
86                 Field(GPT, ByteAcc, NoLock, Preserve) {
87                 GPB0,1,
88                 GPB1,1,
89                 GPB2,1,
90                 GPB3,1,
91                 GPB4,1,
92                 GPB5,1,
93                 GPB6,1,
94                 GPB7,1,
95         }
96
97         /* Flash ROM program enable register */
98         OperationRegion(FRE, SystemIO, 0x00000C6F, 0x00000001)
99                 Field(FRE, ByteAcc, NoLock, Preserve) {
100                 ,     0x00000006,
101                 FLRE, 0x00000001,
102         }
103
104         /* PM2 index/data registers */
105         OperationRegion(PM2R, SystemIO, 0x00000CD0, 0x00000002)
106                 Field(PM2R, ByteAcc, NoLock, Preserve) {
107                 PM2I, 0x00000008,
108                 PM2D, 0x00000008,
109         }
110
111         /* Power Management I/O registers */
112         OperationRegion(PIOR, SystemIO, 0x00000CD6, 0x00000002)
113                 Field(PIOR, ByteAcc, NoLock, Preserve) {
114                 PIOI, 0x00000008,
115                 PIOD, 0x00000008,
116         }
117         IndexField (PIOI, PIOD, ByteAcc, NoLock, Preserve) {
118                 Offset(0x00),   /* MiscControl */
119                 , 1,
120                 T1EE, 1,
121                 T2EE, 1,
122                 Offset(0x01),   /* MiscStatus */
123                 , 1,
124                 T1E, 1,
125                 T2E, 1,
126                 Offset(0x04),   /* SmiWakeUpEventEnable3 */
127                 , 7,
128                 SSEN, 1,
129                 Offset(0x07),   /* SmiWakeUpEventStatus3 */
130                 , 7,
131                 CSSM, 1,
132                 Offset(0x10),   /* AcpiEnable */
133                 , 6,
134                 PWDE, 1,
135                 Offset(0x1C),   /* ProgramIoEnable */
136                 , 3,
137                 MKME, 1,
138                 IO3E, 1,
139                 IO2E, 1,
140                 IO1E, 1,
141                 IO0E, 1,
142                 Offset(0x1D),   /* IOMonitorStatus */
143                 , 3,
144                 MKMS, 1,
145                 IO3S, 1,
146                 IO2S, 1,
147                 IO1S, 1,
148                 IO0S,1,
149                 Offset(0x20),   /* AcpiPmEvtBlk */
150                 APEB, 16,
151                 Offset(0x36),   /* GEvtLevelConfig */
152                 , 6,
153                 ELC6, 1,
154                 ELC7, 1,
155                 Offset(0x37),   /* GPMLevelConfig0 */
156                 , 3,
157                 PLC0, 1,
158                 PLC1, 1,
159                 PLC2, 1,
160                 PLC3, 1,
161                 PLC8, 1,
162                 Offset(0x38),   /* GPMLevelConfig1 */
163                 , 1,
164                  PLC4, 1,
165                  PLC5, 1,
166                 , 1,
167                  PLC6, 1,
168                  PLC7, 1,
169                 Offset(0x3B),   /* PMEStatus1 */
170                 GP0S, 1,
171                 GM4S, 1,
172                 GM5S, 1,
173                 APS, 1,
174                 GM6S, 1,
175                 GM7S, 1,
176                 GP2S, 1,
177                 STSS, 1,
178                 Offset(0x55),   /* SoftPciRst */
179                 SPRE, 1,
180                 , 1,
181                 , 1,
182                 PNAT, 1,
183                 PWMK, 1,
184                 PWNS, 1,
185
186                 /*      Offset(0x61), */        /*  Options_1 */
187                 /*              ,7,  */
188                 /*              R617,1, */
189
190                 Offset(0x65),   /* UsbPMControl */
191                 , 4,
192                 URRE, 1,
193                 Offset(0x68),   /* MiscEnable68 */
194                 , 3,
195                 TMTE, 1,
196                 , 1,
197                 Offset(0x92),   /* GEVENTIN */
198                 , 7,
199                 E7IS, 1,
200                 Offset(0x96),   /* GPM98IN */
201                 G8IS, 1,
202                 G9IS, 1,
203                 Offset(0x9A),   /* EnhanceControl */
204                 ,7,
205                 HPDE, 1,
206                 Offset(0xA8),   /* PIO7654Enable */
207                 IO4E, 1,
208                 IO5E, 1,
209                 IO6E, 1,
210                 IO7E, 1,
211                 Offset(0xA9),   /* PIO7654Status */
212                 IO4S, 1,
213                 IO5S, 1,
214                 IO6S, 1,
215                 IO7S, 1,
216         }
217
218         /* PM1 Event Block
219         * First word is PM1_Status, Second word is PM1_Enable
220         */
221         OperationRegion(P1EB, SystemIO, APEB, 0x04)
222                 Field(P1EB, ByteAcc, NoLock, Preserve) {
223                 TMST, 1,
224                 ,    3,
225                 BMST,    1,
226                 GBST,   1,
227                 Offset(0x01),
228                 PBST, 1,
229                 , 1,
230                 RTST, 1,
231                 , 3,
232                 PWST, 1,
233                 SPWS, 1,
234                 Offset(0x02),
235                 TMEN, 1,
236                 , 4,
237                 GBEN, 1,
238                 Offset(0x03),
239                 PBEN, 1,
240                 , 1,
241                 RTEN, 1,
242                 , 3,
243                 PWDA, 1,
244         }
245
246         OperationRegion (GVAR, SystemMemory, 0xBADEAFFE, 0x100)
247         Field (GVAR, ByteAcc, NoLock, Preserve)
248         {
249                 Offset (0x00),
250                 OSYS,   16,
251                 LINX,   16,
252                 PCBA,   32,
253                 MPEN,   8
254         }
255
256         Name (IOLM,0xe0000000)
257
258 #include "acpi/platform.asl"
259
260         Scope(\_SB) {
261
262                 /* PCIe Configuration Space for 16 busses */
263                 OperationRegion(PCFG, SystemMemory, PCBA, 0x2000000) /* PCIe reserved space for 31 busses */
264                         Field(PCFG, ByteAcc, NoLock, Preserve) {
265                         Offset(0x00090024),     /* Byte offset to SATA BAR5 register 24h - Bus 0, Device 18, Function 0 */
266                         STB5, 32,
267                         Offset(0x00098042),     /* Byte offset to OHCI0 register 42h - Bus 0, Device 19, Function 0 */
268                         PT0D, 1,
269                         PT1D, 1,
270                         PT2D, 1,
271                         PT3D, 1,
272                         PT4D, 1,
273                         PT5D, 1,
274                         PT6D, 1,
275                         PT7D, 1,
276                         PT8D, 1,
277                         PT9D, 1,
278                         Offset(0x000A0004),     /* Byte offset to SMBUS register 4h - Bus 0, Device 20, Function 0 */
279                         SBIE, 1,
280                         SBME, 1,
281                         Offset(0x000A0008),     /* Byte offset to SMBUS register 8h - Bus 0, Device 20, Function 0 */
282                         SBRI, 8,
283                         Offset(0x000A0014),     /* Byte offset to SMBUS register 14h - Bus 0, Device 20, Function 0 */
284                         SBB1, 32,
285                         Offset(0x000A0078),     /* Byte offset to SMBUS register 78h - Bus 0, Device 20, Function 0 */
286                         ,14,
287                         P92E, 1,                /* Port92 decode enable */
288                 }
289
290                 OperationRegion(BAR5, SystemMemory, STB5, 0x1000)
291                         Field(BAR5, AnyAcc, NoLock, Preserve)
292                         {
293                         /* Port 0 */
294                         Offset(0x120),          /* Port 0 Task file status */
295                         P0ER, 1,
296                         , 2,
297                         P0DQ, 1,
298                         , 3,
299                         P0BY, 1,
300                         Offset(0x128),          /* Port 0 Serial ATA status */
301                         P0DD, 4,
302                         , 4,
303                         P0IS, 4,
304                         Offset(0x12C),          /* Port 0 Serial ATA control */
305                         P0DI, 4,
306                         Offset(0x130),          /* Port 0 Serial ATA error */
307                         , 16,
308                         P0PR, 1,
309
310                         /* Port 1 */
311                         offset(0x1A0),          /* Port 1 Task file status */
312                         P1ER, 1,
313                         , 2,
314                         P1DQ, 1,
315                         , 3,
316                         P1BY, 1,
317                         Offset(0x1A8),          /* Port 1 Serial ATA status */
318                         P1DD, 4,
319                         , 4,
320                         P1IS, 4,
321                         Offset(0x1AC),          /* Port 1 Serial ATA control */
322                         P1DI, 4,
323                         Offset(0x1B0),          /* Port 1 Serial ATA error */
324                         , 16,
325                         P1PR, 1,
326
327                         /* Port 2 */
328                         Offset(0x220),          /* Port 2 Task file status */
329                         P2ER, 1,
330                         , 2,
331                         P2DQ, 1,
332                         , 3,
333                         P2BY, 1,
334                         Offset(0x228),          /* Port 2 Serial ATA status */
335                         P2DD, 4,
336                         , 4,
337                         P2IS, 4,
338                         Offset(0x22C),          /* Port 2 Serial ATA control */
339                         P2DI, 4,
340                         Offset(0x230),          /* Port 2 Serial ATA error */
341                         , 16,
342                         P2PR, 1,
343
344                         /* Port 3 */
345                         Offset(0x2A0),          /* Port 3 Task file status */
346                         P3ER, 1,
347                         , 2,
348                         P3DQ, 1,
349                         , 3,
350                         P3BY, 1,
351                         Offset(0x2A8),          /* Port 3 Serial ATA status */
352                         P3DD, 4,
353                         , 4,
354                         P3IS, 4,
355                         Offset(0x2AC),          /* Port 3 Serial ATA control */
356                         P3DI, 4,
357                         Offset(0x2B0),          /* Port 3 Serial ATA error */
358                         , 16,
359                         P3PR, 1,
360                 }
361         }
362 #include "acpi/event.asl"
363 #include "acpi/routing.asl"
364 #include "acpi/usb.asl"
365
366         /* South Bridge */
367         Scope(\_SB)
368         {
369                 /* Start \_SB scope */
370
371 #include "acpi/globutil.asl"
372
373                 Device(PWRB) {  /* Start Power button device */
374                         Name(_HID, EISAID("PNP0C0C"))
375                         Name(_UID, 0xAA)
376                         Name(_PRW, Package () {3, 0x04})        /* wake from S1-S4 */
377                         Name(_STA, 0x0B) /* sata is invisible */
378                 }
379                 /*  _SB.PCI0 */
380                 /* Note: Only need HID on Primary Bus */
381                 Device(PCI0)
382                 {
383                         External (MMIO)
384                         External (TOM1)
385                         External (TOM2)
386
387                         Name(_HID, EISAID("PNP0A03"))
388                         Name(_ADR, 0x00180000)  /* Dev# = BSP Dev#, Func# = 0 */
389
390                         Method(_BBN, 0) { /* Bus number = 0 */
391                                 Return(0)
392                         }
393
394                         Method(_STA, 0) {
395                                 /* DBGO("\\_SB\\PCI0\\_STA\n") */
396                                 Return(0x0B)     /* Status is visible */
397                         }
398
399             Device (MEMR)
400             {
401                 Name (_HID, EisaId ("PNP0C02"))
402                 Name (MEM1, ResourceTemplate ()
403                 {
404                     Memory32Fixed (ReadWrite,
405                         0x00000000,         // Address Base
406                         0x00000000,         // Address Length
407                         _Y1A)
408                     Memory32Fixed (ReadWrite,
409                         0x00000000,         // Address Base
410                         0x00000000,         // Address Length
411                         _Y1B)
412                 })
413                 Method (_CRS, 0, NotSerialized)
414                 {
415                     CreateDWordField (MEM1, \_SB.PCI0.MEMR._Y1A._BAS, MB01)
416                     CreateDWordField (MEM1, \_SB.PCI0.MEMR._Y1A._LEN, ML01)
417                     CreateDWordField (MEM1, \_SB.PCI0.MEMR._Y1B._BAS, MB02)
418                     CreateDWordField (MEM1, \_SB.PCI0.MEMR._Y1B._LEN, ML02)
419                     If (PCIF)
420                     {
421                         Store (0xFEC00000, MB01)
422                         Store (0xFEE00000, MB02)
423                         Store (0x1000, ML01)
424                         Store (0x1000, ML02)
425                     }
426
427                     Return (MEM1)
428                 }
429             }
430
431                         Method(_PRT,0) {
432                                 If(PCIF){ Return(APR0) }   /* APIC mode */
433                                 Return (PR0)                  /* PIC Mode */
434                         } /* end _PRT */
435
436             OperationRegion (BAR1, PCI_Config, 0x14, 0x04)
437             Field (BAR1, ByteAcc, NoLock, Preserve)
438             {
439                 Z009,   32
440             }
441
442                         /* Describe the Northbridge devices */
443                         Device(AMRT) {
444                                 Name(_ADR, 0x00000000)
445                         } /* end AMRT */
446
447                         /* The internal GFX bridge */
448                         Device(AGPB) {
449                                 Name(_ADR, 0x00010000)
450                                 Name(_PRW, Package() {0x18, 4})
451                                 Method(_PRT,0) { Return (APR1) }
452
453                                 Device (VGA)
454                 {
455                     Name (_ADR, 0x00050000)
456                                         Method (_DOS, 1)
457                                         {
458                                                 /* Windows 2000 and Windows XP call _DOS to enable/disable
459                                                  * Display Output Switching during init and while a switch
460                                                  * is already active
461                                                 */
462                                                 Store (And(Arg0, 7), DSEN)
463                                         }
464                     Method (_STA, 0, NotSerialized)
465                     {
466                         Return (0x0F)
467                     }
468                 }
469                         }  /* end AGPB */
470
471                         /* The external GFX bridge */
472                         Device(PBR2) {
473                                 Name(_ADR, 0x00020000)
474                                 Name(_PRW, Package() {0x18, 4})
475                                 Method(_PRT,0) {
476                                         If(PCIF){ Return(APS2) }   /* APIC mode */
477                                         Return (PS2)                  /* PIC Mode */
478                                 } /* end _PRT */
479                         } /* end PBR2 */
480
481                         /* Dev3 is also an external GFX bridge */
482
483                         Device(PBR4) {
484                                 Name(_ADR, 0x00040000)
485                                 Name(_PRW, Package() {0x18, 4})
486                                 Method(_PRT,0) {
487                                         If(PCIF){ Return(APS4) }   /* APIC mode */
488                                         Return (PS4)                  /* PIC Mode */
489                                 } /* end _PRT */
490                         } /* end PBR4 */
491
492                         Device(PBR5) {
493                                 Name(_ADR, 0x00050000)
494                                 Name(_PRW, Package() {0x18, 4})
495                                 Method(_PRT,0) {
496                                         If(PCIF){ Return(APS5) }   /* APIC mode */
497                                         Return (PS5)                  /* PIC Mode */
498                                 } /* end _PRT */
499                         } /* end PBR5 */
500
501                         Device(PBR6) {
502                                 Name(_ADR, 0x00060000)
503                                 Name(_PRW, Package() {0x18, 4})
504                                 Method(_PRT,0) {
505                                         If(PCIF){ Return(APS6) }   /* APIC mode */
506                                         Return (PS6)                  /* PIC Mode */
507                                 } /* end _PRT */
508                         } /* end PBR6 */
509
510                         /* The onboard EtherNet chip */
511                         Device(PBR7) {
512                                 Name(_ADR, 0x00070000)
513                                 Name(_PRW, Package() {0x18, 4})
514                                 Method(_PRT,0) {
515                                         If(PCIF){ Return(APS7) }   /* APIC mode */
516                                         Return (PS7)               /* PIC Mode */
517                                 } /* end _PRT */
518                         } /* end PBR7 */
519
520                         /* PCI slot 1 */
521                         Device(PIBR) {
522                                 Name(_ADR, 0x00140004)
523                                 Name(_PRW, Package() {4, 5}) //  Phoenix doeas it so
524                                 Method(_PRT, 0) {
525                                         If(PCIF){ Return(AP2P) }  /* APIC Mode */
526                                         Return (PCIB)             /* PIC Mode */
527                                 }
528                         }
529
530                         /* Describe the Southbridge devices */
531                         Device(SATA) {
532                                 Name(_ADR, 0x00120000)
533 #include "acpi/sata.asl"
534                         } /* end SATA */
535
536                         Device(UOH1) {
537                                 Name(_ADR, 0x00130000)
538                                 Name(_PRW, Package() {0x0B, 3})
539                         } /* end UOH1 */
540
541                         Device(UOH2) {
542                                 Name(_ADR, 0x00130001)
543                                 Name(_PRW, Package() {0x0B, 3})
544                         } /* end UOH2 */
545
546                         Device(UOH3) {
547                                 Name(_ADR, 0x00130002)
548                                 Name(_PRW, Package() {0x0B, 3})
549                         } /* end UOH3 */
550
551                         Device(UOH4) {
552                                 Name(_ADR, 0x00130003)
553                                 Name(_PRW, Package() {0x0B, 3})
554                         } /* end UOH4 */
555
556                         Device(UOH5) {
557                                 Name(_ADR, 0x00130004)
558                                 Name(_PRW, Package() {0x0B, 3})
559                         } /* end UOH5 */
560
561                         Device(UEH1) {
562                                 Name(_ADR, 0x00130005)
563                                 Name(_PRW, Package() {0x0B, 3})
564                         } /* end UEH1 */
565
566                         Device(SBUS) {
567                                 Name(_ADR, 0x00140000)
568                         } /* end SBUS */
569
570                         /* Primary (and only) IDE channel */
571                         Device(IDEC) {
572                                 Name(_ADR, 0x00140001)
573                                 #include "acpi/ide.asl"
574                         } /* end IDEC */
575
576                         Device(AZHD) {
577                                 Name(_ADR, 0x00140002)
578                                 OperationRegion(AZPD, PCI_Config, 0x00, 0x100)
579                                         Field(AZPD, AnyAcc, NoLock, Preserve) {
580                                         offset (0x42),
581                                         NSDI, 1,
582                                         NSDO, 1,
583                                         NSEN, 1,
584                                         offset (0x44),
585                                         IPCR, 4,
586                                         offset (0x54),
587                                         PWST, 2,
588                                         , 6,
589                                         PMEB, 1,
590                                         , 6,
591                                         PMST, 1,
592                                         offset (0x62),
593                                         MMCR, 1,
594                                         offset (0x64),
595                                         MMLA, 32,
596                                         offset (0x68),
597                                         MMHA, 32,
598                                         offset (0x6C),
599                                         MMDT, 16,
600                                 }
601
602                                 Method(_INI) {
603                                         If(LEqual(LINX,1)){   /* If we are running Linux */
604                                                 Store(zero, NSEN)
605                                                 Store(one, NSDO)
606                                                 Store(one, NSDI)
607                                         }
608                                 }
609                         } /* end AZHD */
610
611                         Device(LPC0)
612                         {
613                 Name (_ADR, 0x00140003)
614                 Mutex (PSMX, 0x00)
615
616                                 /* PIC IRQ mapping registers, C00h-C01h */
617                                 OperationRegion(PRQM, SystemIO, 0x00000C00, 0x00000002)
618                                 Field(PRQM, ByteAcc, NoLock, Preserve) {
619                                         PRQI, 0x00000008,
620                                         PRQD, 0x00000008,  /* Offset: 1h */
621                                 }
622
623                                 IndexField(PRQI, PRQD, ByteAcc, NoLock, Preserve) {
624                                         PINA, 0x00000008,       /* Index 0  */
625                                         PINB, 0x00000008,       /* Index 1 */
626                                         PINC, 0x00000008,       /* Index 2 */
627                                         PIND, 0x00000008,       /* Index 3 */
628                                         SINT, 0x00000008,       /*  Index 4 */
629                                         Offset(0x09),
630                                         PINE, 0x00000008,       /* Index 9 */
631                                         PINF, 0x00000008,       /* Index A */
632                                         PING, 0x00000008,       /* Index B */
633                                         PINH, 0x00000008,       /* Index C */
634                                 }
635
636                                 Method(CIRQ, 0x00, NotSerialized)
637                                 {
638                                         Store(0, PINA)
639                                         Store(0, PINB)
640                                         Store(0, PINC)
641                                         Store(0, PIND)
642                                         Store(0, SINT)
643                                         Store(0, PINE)
644                                         Store(0, PINF)
645                                         Store(0, PING)
646                                         Store(0, PINH)
647                                 }
648
649                                 Name(IRQB, ResourceTemplate(){
650                                         IRQ(Level,ActiveLow,Shared){10,11}
651                                 })
652
653                                 Name(IRQP, ResourceTemplate(){
654                                         IRQ(Level,ActiveLow,Exclusive){3, 4, 5, 7}
655                                 })
656
657                                 Name(PITF, ResourceTemplate(){
658                                         IRQ(Level,ActiveLow,Exclusive){9}
659                                 })
660
661                                 Device(INTA) {
662                                         Name(_HID, EISAID("PNP0C0F"))
663                                         Name(_UID, 1)
664
665                                         Method(_STA, 0) {
666                                                 if (PINA) {
667                                                         Return(0x0B) /* sata is invisible */
668                                                 } else {
669                                                         Return(0x09) /* sata is disabled */
670                                                 }
671                                         } /* End Method(_SB.INTA._STA) */
672
673                                         Method(_DIS ,0) {
674                                                 Store(0, PINA)
675                                         } /* End Method(_SB.INTA._DIS) */
676
677                                         Method(_PRS ,0) {
678                                                 Return(IRQB) // Return(IRQP)
679                                         } /* Method(_SB.INTA._PRS) */
680
681                                         Method(_CRS ,0) {
682                                                 Store (IRQB, Local0) //
683                                                 CreateWordField(Local0, 0x1, IRQ0)
684                                                 ShiftLeft(1, PINA, IRQ0)
685                                                 Return(Local0)
686                                         } /* Method(_SB.INTA._CRS) */
687                                         Method(_SRS, 1) {
688                                                 CreateWordField(ARG0, 1, IRQ0)
689                                                 /* Use lowest available IRQ */
690                                                 FindSetRightBit(IRQ0, Local0)
691                                                 Decrement (Local0)
692                                                 Store(Local0, PINA)
693                                         } /* End Method(_SB.INTA._SRS) */
694                                 } /* End Device(INTA) */
695
696                                 Device(INTB) {
697                                         Name(_HID, EISAID("PNP0C0F"))
698                                         Name(_UID, 2)
699
700                                         Method(_STA, 0) {
701                                                 if (PINB) {
702                                                         Return(0x0B) /* sata is invisible */
703                                                 } else {
704                                                         Return(0x09) /* sata is disabled */
705                                                 }
706                                         } /* End Method(_SB.INTB._STA) */
707
708                                         Method(_DIS ,0) {
709                                                 Store(0, PINB)
710                                         } /* End Method(_SB.INTB._DIS) */
711
712                                         Method(_PRS ,0) {
713                                                 Return(IRQB) // Return(IRQP)
714                                         } /* Method(_SB.INTB._PRS) */
715
716                                         Method(_CRS ,0) {
717                                                 Store (IRQB, Local0) // {10,11}
718                                                 CreateWordField(Local0, 0x1, IRQ0)
719                                                 ShiftLeft(1, PINB, IRQ0)
720                                                 Return(Local0)
721                                         } /* Method(_SB.INTB._CRS) */
722
723                                         Method(_SRS, 1) {
724                                                 CreateWordField(ARG0, 1, IRQ0)
725                                                 /* Use lowest available IRQ */
726                                                 FindSetRightBit(IRQ0, Local0)
727                                                 Decrement(Local0)
728                                                 Store(Local0, PINB)
729                                         } /* End Method(_SB.INTB._SRS) */
730                                 } /* End Device(INTB)  */
731
732                                 Device(INTC) {
733                                         Name(_HID, EISAID("PNP0C0F"))
734                                         Name(_UID, 3)
735
736                                         Method(_STA, 0) {
737                                                 if (PINC) {
738                                                         Return(0x0B) /* sata is invisible */
739                                                 } else {
740                                                         Return(0x09) /* sata is disabled */
741                                                 }
742                                         } /* End Method(_SB.INTC._STA) */
743
744                                         Method(_DIS ,0) {
745                                                 Store(0, PINC)
746                                         } /* End Method(_SB.INTC._DIS) */
747
748                                         Method(_PRS ,0) {
749                                                 Return(IRQB) // Return(IRQP)
750                                         } /* Method(_SB.INTC._PRS) */
751
752                                         Method(_CRS ,0) {
753                                                 Store (IRQB, Local0) // {10,11}
754                                                 CreateWordField(Local0, 0x1, IRQ0)
755                                                 ShiftLeft(1, PINC, IRQ0)
756                                                 Return(Local0)
757                                         } /* Method(_SB.INTC._CRS) */
758
759                                         Method(_SRS, 1) {
760                                                 CreateWordField(ARG0, 1, IRQ0)
761                                                 /* Use lowest available IRQ */
762                                                 FindSetRightBit(IRQ0, Local0)
763                                                 Decrement(Local0)
764                                                 Store(Local0, PINC)
765                                         } /* End Method(_SB.INTC._SRS) */
766                                 } /* End Device(INTC)  */
767
768                                 Device(INTD) {
769                                         Name(_HID, EISAID("PNP0C0F"))
770                                         Name(_UID, 4)
771
772                                         Method(_STA, 0) {
773                                                 if (PIND) {
774                                                         Return(0x0B) /* sata is invisible */
775                                                 } else {
776                                                         Return(0x09) /* sata is disabled */
777                                                 }
778                                         } /* End Method(_SB.INTD._STA) */
779
780                                         Method(_DIS ,0) {
781                                                 Store(0, PIND)
782                                         } /* End Method(_SB.INTD._DIS) */
783
784                                         Method(_PRS ,0) {
785                                                 Return(IRQB) // Return(IRQP)
786                                         } /* Method(_SB.INTD._PRS) */
787
788                                         Method(_CRS ,0) {
789                                                 Store (IRQB, Local0) // {10,11}
790                                                 CreateWordField(Local0, 0x1, IRQ0)
791                                                 ShiftLeft(1, PIND, IRQ0)
792                                                 Return(Local0)
793                                         } /* Method(_SB.INTD._CRS) */
794
795                                         Method(_SRS, 1) {
796                                                 CreateWordField(ARG0, 1, IRQ0)
797                                                 /* Use lowest available IRQ */
798                                                 FindSetRightBit(IRQ0, Local0)
799                                                 Decrement(Local0)
800                                                 Store(Local0, PIND)
801                                         } /* End Method(_SB.INTD._SRS) */
802                                 } /* End Device(INTD)  */
803
804                                 Device(INTE) {
805                                         Name(_HID, EISAID("PNP0C0F"))
806                                         Name(_UID, 5)
807
808                                         Method(_STA, 0) {
809                                                 if (PINE) {
810                                                         Return(0x0B) /* sata is invisible */
811                                                 } else {
812                                                         Return(0x09) /* sata is disabled */
813                                                 }
814                                         } /* End Method(_SB.INTE._STA) */
815
816                                         Method(_DIS ,0) {
817                                                 Store(0, PINE)
818                                         } /* End Method(_SB.INTE._DIS) */
819
820                                         Method(_PRS ,0) {
821                                                 Return(IRQB) // Return(IRQP)
822                                         }
823
824                                         Method(_CRS ,0) {
825                                                 Store (IRQB, Local0) // {10,11}
826                                                 CreateWordField(Local0, 0x1, IRQ0)
827                                                 ShiftLeft(1, PINE, IRQ0)
828                                                 Return(Local0)
829                                         } /* Method(_SB.INTE._CRS) */
830
831                                         Method(_SRS, 1) {
832                                                 CreateWordField(ARG0, 1, IRQ0)
833                                                 /* Use lowest available IRQ */
834                                                 FindSetRightBit(IRQ0, Local0)
835                                                 Decrement(Local0)
836                                                 Store(Local0, PINE)
837                                         } /* End Method(_SB.INTE._SRS) */
838                                 } /* End Device(INTE)  */
839
840                                 Device(INTF) {
841                                         Name(_HID, EISAID("PNP0C0F"))
842                                         Name(_UID, 6)
843
844                                         Method(_STA, 0) {
845                                                 if (PINF) {
846                                                         Return(0x0B) /* sata is invisible */
847                                                 } else {
848                                                         Return(0x09) /* sata is disabled */
849                                                 }
850                                         } /* End Method(_SB.INTF._STA) */
851
852                                         Method(_DIS ,0) {
853                                                 Store(0, PINF)
854                                         } /* End Method(_SB.INTF._DIS) */
855
856                                         Method(_PRS ,0) {
857                                                 Return(IRQB) // Return(PITF)
858                                         } /* Method(_SB.INTF._PRS) */
859
860                                         Method(_CRS ,0) {
861                                                 Store (IRQB, Local0) // {10,11}
862                                                 CreateWordField(Local0, 0x1, IRQ0)
863                                                 ShiftLeft(1, PINF, IRQ0)
864                                                 Return(Local0)
865                                         } /* Method(_SB.INTF._CRS) */
866
867                                         Method(_SRS, 1) {
868                                                 CreateWordField(ARG0, 1, IRQ0)
869                                                 /* Use lowest available IRQ */
870                                                 FindSetRightBit(IRQ0, Local0)
871                                                 Decrement(Local0)
872                                                 Store(Local0, PINF)
873                                         } /*  End Method(_SB.INTF._SRS) */
874                                 } /* End Device(INTF)  */
875
876                                 Device(INTG) {
877                                         Name(_HID, EISAID("PNP0C0F"))
878                                         Name(_UID, 7)
879
880                                         Method(_STA, 0) {
881                                                 if (PING) {
882                                                         Return(0x0B) /* sata is invisible */
883                                                 } else {
884                                                         Return(0x09) /* sata is disabled */
885                                                 }
886                                         } /* End Method(_SB.INTG._STA)  */
887
888                                         Method(_DIS ,0) {
889                                                 Store(0, PING)
890                                         } /* End Method(_SB.INTG._DIS)  */
891
892                                         Method(_PRS ,0) {
893                                                 Return(IRQB) // Return(IRQP)
894                                         } /* Method(_SB.INTG._CRS)  */
895
896                                         Method(_CRS ,0) {
897                                                 Store (IRQB, Local0) // {10,11}
898                                                 CreateWordField(Local0, 0x1, IRQ0)
899                                                 ShiftLeft(1, PING, IRQ0)
900                                                 Return(Local0)
901                                         } /* Method(_SB.INTG._CRS)  */
902
903                                         Method(_SRS, 1) {
904                                                 CreateWordField(ARG0, 1, IRQ0)
905                                                 /* Use lowest available IRQ */
906                                                 FindSetRightBit(IRQ0, Local0)
907                                                 Decrement(Local0)
908                                                 Store(Local0, PING)
909                                         } /* End Method(_SB.INTG._SRS)  */
910                                 } /* End Device(INTG)  */
911
912                                 Device(INTH) {
913                                         Name(_HID, EISAID("PNP0C0F"))
914                                         Name(_UID, 8)
915
916                                         Method(_STA, 0) {
917                                                 if (PINH) {
918                                                         Return(0x0B) /* sata is invisible */
919                                                 } else {
920                                                         Return(0x09) /* sata is disabled */
921                                                 }
922                                         } /* End Method(_SB.INTH._STA)  */
923
924                                         Method(_DIS ,0) {
925                                                 Store(0, PINH)
926                                         } /* End Method(_SB.INTH._DIS)  */
927
928                                         Method(_PRS ,0) {
929                                                 Return(IRQB) // Return(IRQP)
930                                         } /* Method(_SB.INTH._CRS)  */
931
932                                         Method(_CRS ,0) {
933                                                 Store (IRQB, Local0) // {10,11}
934                                                 CreateWordField(Local0, 0x1, IRQ0)
935                                                 ShiftLeft(1, PINH, IRQ0)
936                                                 Return(Local0)
937                                         } /* Method(_SB.INTH._CRS)  */
938
939                                         Method(_SRS, 1) {
940                                                 CreateWordField(ARG0, 1, IRQ0)
941                                                 /* Use lowest available IRQ */
942                                                 FindSetRightBit(IRQ0, Local0)
943                                                 Decrement(Local0)
944                                                 Store(Local0, PINH)
945                                         } /* End Method(_SB.INTH._SRS)  */
946                                 } /* End Device(INTH)   */
947
948
949                                 /* Real Time Clock Device */
950                                 Device(RTC0) {
951                                         Name(_HID, EISAID("PNP0B00"))   /* AT Real Time Clock (not PIIX4 compatible)*/
952                                         Name(_CRS, ResourceTemplate() {
953                                                 IRQ (Edge, ActiveHigh, Exclusive, ) {8}
954                                                 IO(Decode16,0x0070, 0x0070, 1, 2)
955                                                 /* IO(Decode16,0x0070, 0x0070, 0, 4) */
956                                         })
957                                 } /* End Device(_SB.PCI0.LpcIsaBr.RTC0) */
958
959                                 Device(TMR) {   /* Timer */
960                                         Name(_HID,EISAID("PNP0100"))    /* System Timer */
961                                         Name(_CRS, ResourceTemplate() {
962                         IRQ (Edge, ActiveHigh, Exclusive, ) {0}
963                                                 IO(Decode16, 0x0040, 0x0040, 1, 4)
964                                                 /* IO(Decode16, 0x0048, 0x0048, 0, 4) */
965                                         })
966                                 } /* End Device(_SB.PCI0.LpcIsaBr.TMR) */
967
968                                 Device(SPKR) {  /* Speaker */
969                                         Name(_HID,EISAID("PNP0800"))    /* AT style speaker */
970                                         Name(_CRS, ResourceTemplate() {
971                                                 IO(Decode16, 0x0061, 0x0061, 1, 1)
972                                         })
973                                 } /* End Device(_SB.PCI0.LpcIsaBr.SPKR) */
974
975                                 Device(PIC) {
976                                         Name(_HID,EISAID("PNP0000"))    /* AT Interrupt Controller */
977                                         Name(_CRS, ResourceTemplate() {
978                                                 IRQ (Edge, ActiveHigh, Exclusive, ) {2}
979                                                 IO(Decode16,0x0020, 0x0020, 1, 2)
980                                                 IO(Decode16,0x00A0, 0x00A0, 0, 2)
981                                                 /* IO(Decode16, 0x00D0, 0x00D0, 0x10, 0x02) */
982                                                 /* IO(Decode16, 0x04D0, 0x04D0, 0x10, 0x02) */
983                                         })
984                                 } /* End Device(_SB.PCI0.LpcIsaBr.PIC) */
985
986                                 Device(MAD) { /* 8257 DMA */
987                                         Name(_HID,EISAID("PNP0200"))    /* Hardware Device ID */
988                                         Name(_CRS, ResourceTemplate() {
989                                                 DMA(Compatibility,NotBusMaster,Transfer8_16){4}
990                                                 IO(Decode16, 0x0000, 0x0000, 0x10, 0x10)
991                                                 IO(Decode16, 0x0081, 0x0081, 0x01, 0x03)
992                                                 IO(Decode16, 0x0087, 0x0087, 0x01, 0x01)
993                                                 IO(Decode16, 0x0089, 0x0089, 0x01, 0x03)
994                                                 IO(Decode16, 0x008F, 0x008F, 0x01, 0x01)
995                                                 IO(Decode16, 0x00C0, 0x00C0, 0x10, 0x20)
996                                         }) /* End Name(_SB.PCI0.LpcIsaBr.MAD._CRS) */
997                                 } /* End Device(_SB.PCI0.LpcIsaBr.MAD) */
998
999                                 Device(COPR) {
1000                                         Name(_HID,EISAID("PNP0C04"))    /* Math Coprocessor */
1001                                         Name(_CRS, ResourceTemplate() {
1002                                                 IO(Decode16, 0x00F0, 0x00F0, 1, 0x10)
1003                                                 IRQ (Edge, ActiveHigh, Exclusive, ) {13}
1004                                         })
1005                                 } /* End Device(_SB.PCI0.LpcIsaBr.COPR) */
1006
1007                                 Device(HPET) {
1008                                         Name(_HID,EISAID("PNP0103"))
1009                                         Name(CRS,ResourceTemplate()     {
1010                                                 Memory32Fixed(ReadOnly,0xFED00000, 0x00000400, HPT)     /* 1kb reserved space */
1011                                         })
1012                                         Method(_STA, 0) {
1013                                                 Return(0x0F) /* sata is visible */
1014                                         }
1015                                         Method(_CRS, 0) {
1016                                                 CreateDwordField(CRS, ^HPT._BAS, HPBA)
1017                                                 Store(HPBA, HPBA)
1018                                                 Return(CRS)
1019                                         }
1020                 }
1021
1022                 Device (KBC0)
1023                 {
1024                     Name (_HID, EisaId ("PNP0303"))
1025                     Name (_CRS, ResourceTemplate ()
1026                     {
1027                         IO (Decode16,
1028                             0x0060,             // Range Minimum
1029                             0x0060,             // Range Maximum
1030                             0x01,               // Alignment
1031                             0x01,               // Length
1032                             )
1033                         IO (Decode16,
1034                             0x0064,             // Range Minimum
1035                             0x0064,             // Range Maximum
1036                             0x01,               // Alignment
1037                             0x01,               // Length
1038                             )
1039                         IRQ (Edge, ActiveHigh, Exclusive, ) {1}
1040                     })
1041                                 }
1042
1043                 Device (MSE0)
1044                 {
1045                     Name (_HID, EisaId ("PNP0F13"))
1046                     Name (_CRS, ResourceTemplate ()
1047                     {
1048                         IRQ (Edge, ActiveHigh, Exclusive, ) {12}
1049                     })
1050                                 }
1051                         } /* end LPC0 */
1052
1053                         Device(ACAD) {
1054                                 Name(_ADR, 0x00140005)
1055                                 Name (_PRW, Package (0x02)
1056                 {
1057                     0x0C,
1058                     0x04
1059                 })
1060                         } /* end Ac97audio */
1061
1062                         Device(ACMD) {
1063                                 Name(_ADR, 0x00140006)
1064                                 Name (_PRW, Package (0x02)
1065                 {
1066                     0x0C,
1067                     0x04
1068                 })
1069                         } /* end Ac97modem */
1070
1071                         /* ITE IT8712F Support */
1072                         OperationRegion (IOID, SystemIO, 0x2E, 0x02)    /* sometimes it is 0x4E */
1073                                 Field (IOID, ByteAcc, NoLock, Preserve)
1074                                 {
1075                                         SIOI,   8,    SIOD,   8         /* 0x2E and 0x2F */
1076                                 }
1077
1078                         IndexField (SIOI, SIOD, ByteAcc, NoLock, Preserve)
1079                         {
1080                                         Offset (0x07),
1081                                 LDN,    8,      /* Logical Device Number */
1082                                         Offset (0x20),
1083                                 CID1,   8,      /* Chip ID Byte 1, 0x87 */
1084                                 CID2,   8,      /* Chip ID Byte 2, 0x12 */
1085                                         Offset (0x30),
1086                                 ACTR,   8,      /* Function activate */
1087                                         Offset (0xF0),
1088                                 APC0,   8,      /* APC/PME Event Enable Register */
1089                                 APC1,   8,      /* APC/PME Status Register */
1090                                 APC2,   8,      /* APC/PME Control Register 1 */
1091                                 APC3,   8,      /* Environment Controller Special Configuration Register */
1092                                 APC4,   8       /* APC/PME Control Register 2 */
1093                         }
1094
1095                         /* Enter the IT8712F MB PnP Mode */
1096                         Method (EPNP)
1097                         {
1098                                 Store(0x87, SIOI)
1099                                 Store(0x01, SIOI)
1100                                 Store(0x55, SIOI)
1101                                 Store(0x55, SIOI) /* IT8712F magic number */
1102                         }
1103                         /* Exit the IT8712F MB PnP Mode */
1104                         Method (XPNP)
1105                         {
1106                                 Store (0x02, SIOI)
1107                                 Store (0x02, SIOD)
1108                         }
1109
1110                         /*
1111                          * Keyboard PME is routed to SB600 Gevent3. We can wake
1112                          * up the system by pressing the key.
1113                          */
1114                 Method (SIOS, 1)
1115                         {
1116                                 /* We only enable KBD PME for S5. */
1117                                 If (LLess (Arg0, 0x05))
1118                                 {
1119                                         EPNP()
1120                                         /* DBGO("IT8712F\n") */
1121
1122                                         Store (0x4, LDN)
1123                                         Store (One, ACTR)  /* Enable EC */
1124                                         /*
1125                                         Store (0x4, LDN)
1126                                         Store (0x04, APC4)
1127                                         */  /* falling edge. which mode? Not sure. */
1128
1129                                         Store (0x4, LDN)
1130                                         Store (0x08, APC1) /* clear PME status, Use 0x18 for mouse & KBD */
1131                                         Store (0x4, LDN)
1132                                         Store (0x08, APC0) /* enable PME, Use 0x18 for mouse & KBD */
1133
1134                                         XPNP()
1135                                 }
1136                         }
1137                         Method (SIOW, 1)
1138                         {
1139                                 EPNP()
1140                                 Store (0x4, LDN)
1141                                 Store (Zero, APC0) /* disable keyboard PME */
1142                                 Store (0x4, LDN)
1143                                 Store (0xFF, APC1) /* clear keyboard PME status */
1144                                 XPNP()
1145                         }
1146
1147 /* ############################################################################################### */
1148                         Name(CRES, ResourceTemplate() {
1149                                 IO(Decode16, 0x0CF8, 0x0CF8, 1, 8)
1150
1151                                 WORDIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
1152                                         0x0000,                 /* address granularity */
1153                                         0x0000,                 /* range minimum */
1154                                         0x0CF7,                 /* range maximum */
1155                                         0x0000,                 /* translation */
1156                                         0x0CF8                  /* length */
1157                                 )
1158
1159                                 WORDIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
1160                                         0x0000,                 /* address granularity */
1161                                         0x0D00,                 /* range minimum */
1162                                         0xFFFF,                 /* range maximum */
1163                                         0x0000,                 /* translation */
1164                                         0xF300                  /* length */
1165                                 )
1166
1167                                 Memory32Fixed(READONLY, 0x000A0000, 0x00020000, VGAM)   /* VGA memory space */
1168                                 Memory32Fixed(READONLY, 0x000C0000, 0x00020000, EMM1)   /* Assume C0000-E0000 empty */
1169                                 Memory32Fixed(READONLY, 0x000E0000, 0x00020000, RDBS)   /* BIOS ROM area */
1170
1171                                 /* DRAM Memory from 1MB to TopMem */
1172                                 DWORDMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite, 0, 0, 0, 0x00, 1, ,, EMM2)
1173                                 WORDIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, 0x00, 0x0D00, 0xffff, 0x00, 0xf300)
1174                         }) /* End Name(_SB.PCI0.CRES) */
1175
1176                         Method(_CRS, 0) {
1177
1178                                 /* DBGO("\\_SB\\PCI0\\_CRS\n") */
1179
1180                                 CreateDWordField(CRES, ^EMM1._BAS, EM1B)
1181                                 CreateDWordField(CRES, ^EMM1._LEN, EM1L)
1182
1183                                 CreateDWordField(CRES, ^EMM2._MIN, EM2B)
1184                                 CreateDWordField(CRES, ^EMM2._MAX, EM2E)
1185                                 CreateDWordField(CRES, ^EMM2._LEN, EM2L)
1186
1187                                 Store(TOM1, EM2B)
1188                                 Subtract(IOLM, 1, EM2E)
1189                                 Subtract(IOLM, TOM1, EM2L)
1190
1191                                 If(LGreater(LOMH, 0xC0000)){
1192                                         Store(0xC0000, EM1B)    /* Hole above C0000 and below E0000 */
1193                                         Subtract(LOMH, 0xC0000, EM1L)   /* subtract start, assumes allocation from C0000 going up */
1194                                 }
1195
1196                                 Return(CRES) /* note to change the Name buffer */
1197                         }
1198 /* ########################################################################################## */
1199                 } /* End Device(PCI0)  */
1200         } /* End \_SB scope */
1201
1202         Scope(\_SI) {
1203                 Method(_SST, 1) {
1204                         /* DBGO("\\_SI\\_SST\n") */
1205                         /* DBGO("   New Indicator state: ") */
1206                         /* DBGO(Arg0) */
1207                         /* DBGO("\n") */
1208                 }
1209         } /* End Scope SI */
1210
1211         Mutex (SBX0, 0x00)
1212         OperationRegion (SMB0, SystemIO, 0xB00, 0x10)  // 0x0C replace by 0x10
1213                 Field (SMB0, ByteAcc, NoLock, Preserve) {
1214                         HSTS,   8, /* SMBUS status */
1215                         SSTS,   8,  /* SMBUS slave status */
1216                         HCNT,   8,  /* SMBUS control */
1217                         HCMD,   8,  /* SMBUS host cmd */
1218                         HADD,   8,  /* SMBUS address */
1219                         DAT0,   8,  /* SMBUS data0 */
1220                         DAT1,   8,  /* SMBUS data1 */
1221                         BLKD,   8,  /* SMBUS block data */
1222                         SCNT,   8,  /* SMBUS slave control */
1223                         SCMD,   8,  /* SMBUS shaow cmd */
1224                         SEVT,   8,  /* SMBUS slave event */
1225                         SDAT,   8,  /* SMBUS slave data */
1226                         SMK1,   8,
1227             SLMC,   8,
1228             RADD,   8,
1229             SADD,   8
1230         }
1231
1232         Method (WCLR, 0, NotSerialized) { /* clear SMBUS status register */
1233                 Store (0x1E, HSTS)
1234                 Store (0xFA, Local0)
1235                 While (LAnd (LNotEqual (And (HSTS, 0x1E), Zero), LGreater (Local0, Zero))) {
1236                         Stall (0x64)
1237                         Decrement (Local0)
1238                 }
1239
1240                 Return (Local0)
1241         }
1242
1243         Method (SWTC, 1, NotSerialized) {
1244                 Store (Arg0, Local0)
1245                 Store (0x07, Local2)
1246                 Store (One, Local1)
1247                 While (LEqual (Local1, One)) {
1248                         Store (And (HSTS, 0x1E), Local3)
1249                         If (LNotEqual (Local3, Zero)) { /* read sucess */
1250                                 If (LEqual (Local3, 0x02)) {
1251                                         Store (Zero, Local2)
1252                                 }
1253
1254                                 Store (Zero, Local1)
1255                         }
1256                         Else {
1257                                 If (LLess (Local0, 0x0A)) { /* read failure */
1258                                         Store (0x10, Local2)
1259                                         Store (Zero, Local1)
1260                                 }
1261                                 Else {
1262                                         Sleep (0x0A) /* 10 ms, try again */
1263                                         Subtract (Local0, 0x0A, Local0)
1264                                 }
1265                         }
1266                 }
1267
1268                 Return (Local2)
1269         }
1270
1271         Method (SMBR, 3, NotSerialized) {
1272                 Store (0x07, Local0)
1273                 If (LEqual (Acquire (SBX0, 0xFFFF), Zero)) {
1274                         Store (WCLR (), Local0) /* clear SMBUS status register before read data */
1275                         If (LEqual (Local0, Zero)) {
1276                                 Release (SBX0)
1277                                 Return (0x0)
1278                         }
1279
1280                         Store (0x1F, HSTS)
1281                         Store (Or (ShiftLeft (Arg1, One), One), HADD)
1282                         Store (Arg2, HCMD)
1283                         If (LEqual (Arg0, 0x07)) {
1284                                 Store (0x48, HCNT) /* read byte */
1285                         }
1286
1287                         Store (SWTC (0x03E8), Local1) /* 1000 ms */
1288                         If (LEqual (Local1, Zero)) {
1289                                 If (LEqual (Arg0, 0x07)) {
1290                                         Store (DAT0, Local0)
1291                                 }
1292                         }
1293                         Else {
1294                                 Store (Local1, Local0)
1295                         }
1296
1297                         Release (SBX0)
1298                 }
1299
1300                 /* DBGO("the value of SMBusData0 register ") */
1301                 /* DBGO(Arg2) */
1302                 /* DBGO(" is ") */
1303                 /* DBGO(Local0) */
1304                 /* DBGO("\n") */
1305
1306                 Return (Local0)
1307         }
1308 #include "acpi/thermal.asl"
1309 }