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