printk_foo -> printk(BIOS_FOO, ...)
[coreboot.git] / src / southbridge / amd / sb700 / sb700_early_setup.c
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2010 Advanced Micro Devices, Inc.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; version 2 of the License.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
18  */
19
20 #ifndef  _SB700_EARLY_SETUP_C_
21 #define  _SB700_EARLY_SETUP_C_
22
23 #include <arch/cpu.h>
24 #include "sb700.h"
25 #include "sb700_smbus.c"
26
27 #define SMBUS_IO_BASE 0x6000    /* Is it a temporary SMBus I/O base address? */
28          /*SIZE 0x40 */
29
30 static void pmio_write(u8 reg, u8 value)
31 {
32         outb(reg, PM_INDEX);
33         outb(value, PM_INDEX + 1);
34 }
35
36 static u8 pmio_read(u8 reg)
37 {
38         outb(reg, PM_INDEX);
39         return inb(PM_INDEX + 1);
40 }
41
42 /* RPR 2.28 Get SB ASIC Revision.*/
43 static u8 set_sb700_revision(void)
44 {
45         device_t dev;
46         u8 rev_id, enable_14Mhz, byte;
47         u8 rev = 0;
48
49         /* if (rev != 0) return rev; */
50
51         dev = pci_locate_device(PCI_ID(0x1002, 0x4385), 0);
52
53         if (dev == PCI_DEV_INVALID) {
54                 die("SMBUS controller not found\r\n");
55                 /* NOT REACHED */
56         }
57         rev_id =  pci_read_config8(dev, 0x08);
58
59         if (rev_id == 0x39) {
60                 enable_14Mhz = (pmio_read(0x53) >> 6) & 1;
61                 if (enable_14Mhz == 0x0)
62                         rev = 0x11;     /* A11 */
63                 else if (enable_14Mhz == 0x1) {
64                         /* This happens, if does, only once. So later if we need to get
65                          * the rivision ID, we don't have to make such a big function.
66                          * We just get reg 0x8 in smbus dev. 0x39 is A11, 0x3A is A12. */
67                         rev = 0x12;
68                         byte = pci_read_config8(dev, 0x40);
69                         byte |= 1 << 0;
70                         pci_write_config8(dev, 0x40, byte);
71
72                         pci_write_config8(dev, 0x08, 0x3A); /* Change 0x39 to 0x3A. */
73
74                         byte &= ~(1 << 0);
75                         pci_write_config8(dev, 0x40, byte);
76                 }
77         } else if (rev_id == 0x3A) { /* A12 will be 0x3A after BIOS is initialized */
78                 rev = 0x12;
79         } else if (rev_id == 0x3C) {
80                 rev = 0x14;
81         } else if (rev_id == 0x3D) {
82                 rev = 0x15;
83         } else
84                 die("It is not SB700 or SB710\r\n");
85
86         return rev;
87 }
88
89 /***************************************
90 * Legacy devices are mapped to LPC space.
91 *       Serial port 0
92 *       KBC Port
93 *       ACPI Micro-controller port
94 *       LPC ROM size
95 *       This function does not change port 0x80 decoding.
96 *       Console output through any port besides 0x3f8 is unsupported.
97 *       If you use FWH ROMs, you have to setup IDSEL.
98 ***************************************/
99 static void sb700_lpc_init(void)
100 {
101         u8 reg8;
102         u32 reg32;
103         device_t dev;
104
105         dev = pci_locate_device(PCI_ID(0x1002, 0x4385), 0);     /* SMBUS controller */
106         /* NOTE: Set BootTimerDisable, otherwise it would keep rebooting!!
107          * This bit has no meaning if debug strap is not enabled. So if the
108          * board keeps rebooting and the code fails to reach here, we could
109          * disable the debug strap first. */
110         reg32 = pci_read_config32(dev, 0x4C);
111         reg32 |= 1 << 31;
112         pci_write_config32(dev, 0x4C, reg32);
113
114         /* Enable lpc controller */
115         reg32 = pci_read_config32(dev, 0x64);
116         reg32 |= 1 << 20;
117         pci_write_config32(dev, 0x64, reg32);
118
119         dev = pci_locate_device(PCI_ID(0x1002, 0x439d), 0);     /* LPC Controller */
120         /* Decode port 0x3f8-0x3ff (Serial 0) */
121 #warning Serial port decode on LPC is hardcoded to 0x3f8
122         reg8 = pci_read_config8(dev, 0x44);
123         reg8 |= 1 << 6;
124         pci_write_config8(dev, 0x44, reg8);
125
126         /* Decode port 0x60 & 0x64 (PS/2 keyboard) and port 0x62 & 0x66 (ACPI)*/
127         reg8 = pci_read_config8(dev, 0x47);
128         reg8 |= (1 << 5) | (1 << 6);
129         pci_write_config8(dev, 0x47, reg8);
130
131         /* SuperIO, LPC ROM */
132         reg8 = pci_read_config8(dev, 0x48);
133         /* Decode ports 0x2e-0x2f, 0x4e-0x4f (SuperI/O configuration) */
134         reg8 |= (1 << 1) | (1 << 0);
135         /* Decode variable LPC ROM address ranges 1&2 (see register 0x68-0x6b, 0x6c-0x6f) */
136         reg8 |= (1 << 3) | (1 << 4);
137         /* Decode port 0x70-0x73 (RTC) */
138         reg8 |= 1 << 6;
139         pci_write_config8(dev, 0x48, reg8);
140
141         /* hardware should enable LPC ROM by pin straps */
142         /* ROM access at 0xFFF80000/0xFFF00000 - 0xFFFFFFFF */
143         /* See detail in 43366_sb700_bdg_nda_1.01.pdf page 17. */
144         /* enable LPC ROM range mirroring start 0x000e(0000) */
145         pci_write_config16(dev, 0x68, 0x000e);
146         /* enable LPC ROM range mirroring end   0x000f(ffff) */
147         pci_write_config16(dev, 0x6a, 0x000f);
148         /* enable LPC ROM range start, 0xfff8(0000): 512KB, 0xfff0(0000): 1MB */
149         pci_write_config16(dev, 0x6c, 0xfff0);
150         /* enable LPC ROM range end at 0xffff(ffff) */
151         pci_write_config16(dev, 0x6e, 0xffff);
152 }
153
154 /* what is its usage? */
155 static u32 get_sbdn(u32 bus)
156 {
157         device_t dev;
158
159         /* Find the device. */
160         dev = pci_locate_device_on_bus(PCI_ID(0x1002, 0x4385), bus);
161         return (dev >> 15) & 0x1f;
162 }
163
164 static u8 dual_core(void)
165 {
166         return (pci_read_config32(PCI_DEV(0, 0x18, 3), 0xE8) & (0x3<<12)) != 0;
167 }
168
169 /*
170  * RPR 2.4 C-state and VID/FID change for the K8 platform.
171  */
172 static void enable_fid_change_on_sb(u32 sbbusn, u32 sbdn)
173 {
174         u8 byte;
175         byte = pmio_read(0x9a);
176         byte &= ~0x34;
177         if (dual_core())
178                 byte |= 0x34;
179         else
180                 byte |= 0x04;
181         pmio_write(0x9a, byte);
182
183         byte = pmio_read(0x8f);
184         byte &= ~0x30;
185         byte |= 0x20;
186         pmio_write(0x8f, byte);
187
188         pmio_write(0x8b, 0x01); /* TODO: if the HT Link is 200 MHz, it is 0x0A. It doesnt often happen. */
189         pmio_write(0x8a, 0x90);
190
191         pmio_write(0x88, 0x10);
192
193         byte = pmio_read(0x7c);
194         byte |= 0x03;
195         pmio_write(0x7c, byte);
196
197         /*Must be 0 for K8 platform.*/
198         byte = pmio_read(0x68);
199         byte &= ~0x01;
200         pmio_write(0x68, byte);
201         /*Must be 0 for K8 platform.*/
202         byte = pmio_read(0x8d);
203         byte &= ~(1<<6);
204         pmio_write(0x8d, byte);
205
206         byte = pmio_read(0x61);
207         byte &= ~0x04;
208         pmio_write(0x61, byte);
209
210         byte = pmio_read(0x42);
211         byte &= ~0x04;
212         pmio_write(0x42, byte);
213
214         pmio_write(0x89, 0x10);
215 }
216
217 static void hard_reset(void)
218 {
219         set_bios_reset();
220
221         /* full reset */
222         outb(0x0a, 0x0cf9);
223         outb(0x0e, 0x0cf9);
224 }
225
226 static void soft_reset(void)
227 {
228         set_bios_reset();
229         /* link reset */
230         outb(0x06, 0x0cf9);
231 }
232
233 static void sb700_pci_port80(void)
234 {
235         u8 byte;
236         device_t dev;
237
238         /* P2P Bridge */
239         dev = pci_locate_device(PCI_ID(0x1002, 0x4384), 0);
240
241         /* Chip Control: Enable subtractive decoding */
242         byte = pci_read_config8(dev, 0x40);
243         byte |= 1 << 5;
244         pci_write_config8(dev, 0x40, byte);
245
246         /* Misc Control: Enable subtractive decoding if 0x40 bit 5 is set */
247         byte = pci_read_config8(dev, 0x4B);
248         byte |= 1 << 7;
249         pci_write_config8(dev, 0x4B, byte);
250
251         /* The same IO Base and IO Limit here is meaningful because we set the
252          * bridge to be subtractive. During early setup stage, we have to make
253          * sure that data can go through port 0x80.
254          */
255         /* IO Base: 0xf000 */
256         byte = pci_read_config8(dev, 0x1C);
257         byte |= 0xF << 4;
258         pci_write_config8(dev, 0x1C, byte);
259
260         /* IO Limit: 0xf000 */
261         byte = pci_read_config8(dev, 0x1D);
262         byte |= 0xF << 4;
263         pci_write_config8(dev, 0x1D, byte);
264
265         /* PCI Command: Enable IO response */
266         byte = pci_read_config8(dev, 0x04);
267         byte |= 1 << 0;
268         pci_write_config8(dev, 0x04, byte);
269
270         /* LPC controller */
271         dev = pci_locate_device(PCI_ID(0x1002, 0x439D), 0);
272
273         byte = pci_read_config8(dev, 0x4A);
274         byte &= ~(1 << 5);      /* disable lpc port 80 */
275         pci_write_config8(dev, 0x4A, byte);
276 }
277
278 static void sb700_lpc_port80(void)
279 {
280         u8 byte;
281         device_t dev;
282         u32 reg32;
283
284         /* Enable LPC controller */
285         dev = pci_locate_device(PCI_ID(0x1002, 0x4385), 0);
286         reg32 = pci_read_config32(dev, 0x64);
287         reg32 |= 0x00100000;    /* lpcEnable */
288         pci_write_config32(dev, 0x64, reg32);
289
290         /* Enable port 80 LPC decode in pci function 3 configuration space. */
291         dev = pci_locate_device(PCI_ID(0x1002, 0x439d), 0);
292         byte = pci_read_config8(dev, 0x4a);
293         byte |= 1 << 5;         /* enable port 80 */
294         pci_write_config8(dev, 0x4a, byte);
295 }
296
297 /* sbDevicesPorInitTable */
298 static void sb700_devices_por_init(void)
299 {
300         device_t dev;
301         u8 byte;
302
303         printk(BIOS_INFO, "sb700_devices_por_init()\n");
304         /* SMBus Device, BDF:0-20-0 */
305         printk(BIOS_INFO, "sb700_devices_por_init(): SMBus Device, BDF:0-20-0\n");
306         dev = pci_locate_device(PCI_ID(0x1002, 0x4385), 0);
307
308         if (dev == PCI_DEV_INVALID) {
309                 die("SMBUS controller not found\r\n");
310                 /* NOT REACHED */
311         }
312         printk(BIOS_INFO, "SMBus controller enabled, sb revision is A%x\r\n",
313                     set_sb700_revision());
314
315         /* sbPorAtStartOfTblCfg */
316         /* Set A-Link bridge access address. This address is set at device 14h, function 0, register 0xf0.
317          * This is an I/O address. The I/O address must be on 16-byte boundry.  */
318         pci_write_config32(dev, 0xf0, AB_INDX);
319
320         /* To enable AB/BIF DMA access, a specific register inside the BIF register space needs to be configured first. */
321         /* 4.3:Enables the SB700 to send transactions upstream over A-Link Express interface. */
322         axcfg_reg(0x04, 1 << 2, 1 << 2);
323         axindxc_reg(0x21, 0xff, 0);
324
325         /* 2.5:Enabling Non-Posted Memory Write for the K8 Platform */
326         axindxc_reg(0x10, 1 << 9, 1 << 9);
327         /* END of sbPorAtStartOfTblCfg */
328
329         /* sbDevicesPorInitTables */
330         /* set smbus iobase */
331         pci_write_config32(dev, 0x90, SMBUS_IO_BASE | 1);
332
333         /* enable smbus controller interface */
334         byte = pci_read_config8(dev, 0xd2);
335         byte |= (1 << 0);
336         pci_write_config8(dev, 0xd2, byte);
337
338         /* KB2RstEnable */
339         pci_write_config8(dev, 0x40, 0x44);
340
341         /* Enable ISA Address 0-960K decoding */
342         pci_write_config8(dev, 0x48, 0x0f);
343
344         /* Enable ISA  Address 0xC0000-0xDFFFF decode */
345         pci_write_config8(dev, 0x49, 0xff);
346
347         /* Enable decode cycles to IO C50, C51, C52 GPM controls. */
348         byte = pci_read_config8(dev, 0x41);
349         byte &= 0x80;
350         byte |= 0x33;
351         pci_write_config8(dev, 0x41, byte);
352
353         /* Legacy DMA Prefetch Enhancement, CIM masked it. */
354         /* pci_write_config8(dev, 0x43, 0x1); */
355
356         /* Disabling Legacy USB Fast SMI# */
357         byte = pci_read_config8(dev, 0x62);
358         byte |= 0x24;
359         pci_write_config8(dev, 0x62, byte);
360
361         /* Features Enable */
362         pci_write_config32(dev, 0x64, 0x829E79BF); /* bit10: Enables the HPET interrupt. */
363
364         /* SerialIrq Control */
365         pci_write_config8(dev, 0x69, 0x90);
366
367         /* Test Mode, PCIB_SReset_En Mask is set. */
368         pci_write_config8(dev, 0x6c, 0x20);
369
370         /* IO Address Enable, CIM set 0x78 only and masked 0x79. */
371         /*pci_write_config8(dev, 0x79, 0x4F); */
372         pci_write_config8(dev, 0x78, 0xFF);
373
374         /* Set smbus iospace enable, I don't know why write 0x04 into reg5 that is reserved */
375         pci_write_config16(dev, 0x4, 0x0407);
376
377         /* clear any lingering errors, so the transaction will run */
378         outb(inb(SMBUS_IO_BASE + SMBHSTSTAT), SMBUS_IO_BASE + SMBHSTSTAT);
379
380         /* IDE Device, BDF:0-20-1 */
381         printk(BIOS_INFO, "sb700_devices_por_init(): IDE Device, BDF:0-20-1\n");
382         dev = pci_locate_device(PCI_ID(0x1002, 0x439C), 0);
383         /* Disable prefetch */
384         byte = pci_read_config8(dev, 0x63);
385         byte |= 0x1;
386         pci_write_config8(dev, 0x63, byte);
387
388         /* LPC Device, BDF:0-20-3 */
389         printk(BIOS_INFO, "sb700_devices_por_init(): LPC Device, BDF:0-20-3\n");
390         dev = pci_locate_device(PCI_ID(0x1002, 0x439D), 0);
391         /* DMA enable */
392         pci_write_config8(dev, 0x40, 0x04);
393
394         /* IO Port Decode Enable */
395         pci_write_config8(dev, 0x44, 0xFF);
396         pci_write_config8(dev, 0x45, 0xFF);
397         pci_write_config8(dev, 0x46, 0xC3);
398         pci_write_config8(dev, 0x47, 0xFF);
399
400         /* IO/Mem Port Decode Enable, I don't know why CIM disable some ports.
401          *  Disable LPC TimeOut counter, enable SuperIO Configuration Port (2e/2f),
402          * Alternate SuperIO Configuration Port (4e/4f), Wide Generic IO Port (64/65).
403          * Enable bits for LPC ROM memory address range 1&2 for 1M ROM setting.*/
404         byte = pci_read_config8(dev, 0x48);
405         byte |= (1 << 1) | (1 << 0);    /* enable Super IO config port 2e-2h, 4e-4f */
406         byte |= (1 << 3) | (1 << 4);    /* enable for LPC ROM address range1&2, Enable 512KB rom access at 0xFFF80000 - 0xFFFFFFFF */
407         byte |= 1 << 6;         /* enable for RTC I/O range */
408         pci_write_config8(dev, 0x48, byte);
409         pci_write_config8(dev, 0x49, 0xFF);
410         /* Enable 0x480-0x4bf, 0x4700-0x470B */
411         byte = pci_read_config8(dev, 0x4A);
412         byte |= ((1 << 1) + (1 << 6));  /*0x42, save the configuraion for port 0x80. */
413         pci_write_config8(dev, 0x4A, byte);
414
415         /* Set LPC ROM size, it has been done in sb700_lpc_init().
416          * enable LPC ROM range, 0xfff8: 512KB, 0xfff0: 1MB;
417          * enable LPC ROM range, 0xfff8: 512KB, 0xfff0: 1MB
418          * pci_write_config16(dev, 0x68, 0x000e)
419          * pci_write_config16(dev, 0x6c, 0xfff0);*/
420
421         /* Enable Tpm12_en and Tpm_legacy. I don't know what is its usage and copied from CIM. */
422         pci_write_config8(dev, 0x7C, 0x05);
423
424         /* P2P Bridge, BDF:0-20-4, the configuration of the registers in this dev are copied from CIM,
425          */
426         printk(BIOS_INFO, "sb700_devices_por_init(): P2P Bridge, BDF:0-20-4\n");
427         dev = pci_locate_device(PCI_ID(0x1002, 0x4384), 0);
428
429         /* Arbiter enable. */
430         pci_write_config8(dev, 0x43, 0xff);
431
432         /* Set PCDMA request into hight priority list. */
433         /* pci_write_config8(dev, 0x49, 0x1) */ ;
434
435         pci_write_config8(dev, 0x40, 0x26);
436
437         pci_write_config8(dev, 0x0d, 0x40);
438         pci_write_config8(dev, 0x1b, 0x40);
439         /* Enable PCIB_DUAL_EN_UP will fix potential problem with PCI cards. */
440         pci_write_config8(dev, 0x50, 0x01);
441
442         /* SATA Device, BDF:0-17-0, Non-Raid-5 SATA controller */
443         printk(BIOS_INFO, "sb700_devices_por_init(): SATA Device, BDF:0-18-0\n");
444         dev = pci_locate_device(PCI_ID(0x1002, 0x4390), 0);
445
446         /*PHY Global Control*/
447         pci_write_config16(dev, 0x86, 0x2C00);
448 }
449
450 /* sbPmioPorInitTable, Pre-initializing PMIO register space
451 * The power management (PM) block is resident in the PCI/LPC/ISA bridge.
452 * The PM regs are accessed via IO mapped regs 0xcd6 and 0xcd7.
453 * The index address is first programmed into IO reg 0xcd6.
454 * Read or write values are accessed through IO reg 0xcd7.
455 */
456 static void sb700_pmio_por_init(void)
457 {
458         u8 byte;
459
460         printk(BIOS_INFO, "sb700_pmio_por_init()\n");
461         /* K8KbRstEn, KB_RST# control for K8 system. */
462         byte = pmio_read(0x66);
463         byte |= 0x20;
464         pmio_write(0x66, byte);
465
466         /* RPR2.31 PM_TURN_OFF_MSG during ASF Shutdown. */
467         if (get_sb700_revision(pci_locate_device(PCI_ID(0x1002, 0x4385), 0)) <= 0x12) {
468                 byte = pmio_read(0x65);
469                 byte &= ~(1 << 7);
470                 pmio_write(0x65, byte);
471
472                 byte = pmio_read(0x75);
473                 byte &= 0xc0;
474                 byte |= 0x05;
475                 pmio_write(0x75, byte);
476
477                 byte = pmio_read(0x52);
478                 byte &= 0xc0;
479                 byte |= 0x08;
480                 pmio_write(0x52, byte);
481         } else {
482                 byte = pmio_read(0xD7);
483                 byte |= 1 << 0;
484                 pmio_write(0xD7, byte);
485
486                 byte = pmio_read(0x65);
487                 byte |= 1 << 7;
488                 pmio_write(0x65, byte);
489
490                 byte = pmio_read(0x75);
491                 byte &= 0xc0;
492                 byte |= 0x01;
493                 pmio_write(0x75, byte);
494
495                 byte = pmio_read(0x52);
496                 byte &= 0xc0;
497                 byte |= 0x02;
498                 pmio_write(0x52, byte);
499
500         }
501
502         /* Watch Dog Timer Control
503          * Set watchdog time base to 0xfec000f0 to avoid SCSI card boot failure.
504          * But I don't find WDT is enabled in SMBUS 0x41 bit3 in CIM.
505          */
506         pmio_write(0x6c, 0xf0);
507         pmio_write(0x6d, 0x00);
508         pmio_write(0x6e, 0xc0);
509         pmio_write(0x6f, 0xfe);
510
511         /* rpr2.15: Enabling Spread Spectrum */
512         byte = pmio_read(0x42);
513         byte |= 1 << 7;
514         pmio_write(0x42, byte);
515         /* TODO: Check if it is necessary. IDE reset */
516         byte = pmio_read(0xB2);
517         byte |= 1 << 0;
518         pmio_write(0xB2, byte);
519 }
520
521 /*
522 * Add any south bridge setting.
523 */
524 static void sb700_pci_cfg(void)
525 {
526         device_t dev;
527         u8 byte;
528
529         /* SMBus Device, BDF:0-20-0 */
530         dev = pci_locate_device(PCI_ID(0x1002, 0x4385), 0);
531         /* Enable watchdog decode timer */
532         byte = pci_read_config8(dev, 0x41);
533         byte |= (1 << 3);
534         pci_write_config8(dev, 0x41, byte);
535
536         /* Set to 1 to reset USB on the software (such as IO-64 or IO-CF9 cycles)
537          * generated PCIRST#. */
538         byte = pmio_read(0x65);
539         byte |= (1 << 4);
540         pmio_write(0x65, byte);
541
542         /* IDE Device, BDF:0-20-1 */
543         dev = pci_locate_device(PCI_ID(0x1002, 0x439C), 0);
544         /* Enable IDE Explicit prefetch, 0x63[0] clear */
545         byte = pci_read_config8(dev, 0x63);
546         byte &= 0xfe;
547         pci_write_config8(dev, 0x63, byte);
548
549         /* LPC Device, BDF:0-20-3 */
550         /* The code below is ported from old chipset. It is not
551          * metioned in RPR. But I keep them. The registers and the
552          * comments are compatible. */
553         dev = pci_locate_device(PCI_ID(0x1002, 0x439D), 0);
554         /* Enabling LPC DMA function. */
555         byte = pci_read_config8(dev, 0x40);
556         byte |= (1 << 2);
557         pci_write_config8(dev, 0x40, byte);
558         /* Disabling LPC TimeOut. 0x48[7] clear. */
559         byte = pci_read_config8(dev, 0x48);
560         byte &= 0x7f;
561         pci_write_config8(dev, 0x48, byte);
562         /* Disabling LPC MSI Capability, 0x78[1] clear. */
563         byte = pci_read_config8(dev, 0x78);
564         byte &= 0xfd;
565         pci_write_config8(dev, 0x78, byte);
566
567         /* SATA Device, BDF:0-17-0, Non-Raid-5 SATA controller */
568         dev = pci_locate_device(PCI_ID(0x1002, 0x4390), 0);
569         /* rpr7.12 SATA MSI and D3 Power State Capability. */
570         byte = pci_read_config8(dev, 0x40);
571         byte |= 1 << 0;
572         pci_write_config8(dev, 0x40, byte);
573         if (get_sb700_revision(pci_locate_device(PCI_ID(0x1002, 0x4385), 0)) <= 0x12)
574                 pci_write_config8(dev, 0x34, 0x70); /* set 0x61 to 0x70 if S1 is not supported. */
575         else
576                 pci_write_config8(dev, 0x34, 0x50); /* set 0x61 to 0x50 if S1 is not supported. */
577         byte &= ~(1 << 0);
578         pci_write_config8(dev, 0x40, byte);
579 }
580
581 /*
582 */
583 static void sb700_por_init(void)
584 {
585         /* sbDevicesPorInitTable + sbK8PorInitTable */
586         sb700_devices_por_init();
587
588         /* sbPmioPorInitTable + sbK8PmioPorInitTable */
589         sb700_pmio_por_init();
590 }
591
592 /*
593 * It should be called during early POST after memory detection and BIOS shadowing but before PCI bus enumeration.
594 */
595 static void sb700_before_pci_init(void)
596 {
597         sb700_pci_cfg();
598 }
599
600 /*
601 * This function should be called after enable_sb700_smbus().
602 */
603 static void sb700_early_setup(void)
604 {
605         printk(BIOS_INFO, "sb700_early_setup()\n");
606         sb700_por_init();
607 }
608
609 static int smbus_read_byte(u32 device, u32 address)
610 {
611         return do_smbus_read_byte(SMBUS_IO_BASE, device, address);
612 }
613 #endif