Uwe Hermann | d436a4b | 2007-05-03 08:50:37 +0000 | [diff] [blame] | 1 | /* |
Stefan Reinauer | 7e61e45 | 2008-01-18 10:35:56 +0000 | [diff] [blame] | 2 | * This file is part of the coreboot project. |
Uwe Hermann | d436a4b | 2007-05-03 08:50:37 +0000 | [diff] [blame] | 3 | * |
| 4 | * Copyright (C) 2007 Uwe Hermann <uwe@hermann-uwe.de> |
| 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; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
Uwe Hermann | d436a4b | 2007-05-03 08:50:37 +0000 | [diff] [blame] | 15 | */ |
| 16 | |
Uwe Hermann | 9da69f8 | 2007-11-30 02:08:26 +0000 | [diff] [blame] | 17 | #ifndef SOUTHBRIDGE_INTEL_I82371EB_I82371EB_H |
| 18 | #define SOUTHBRIDGE_INTEL_I82371EB_I82371EB_H |
Uwe Hermann | d436a4b | 2007-05-03 08:50:37 +0000 | [diff] [blame] | 19 | |
Kyösti Mälkki | 12b121c | 2019-08-18 16:33:39 +0300 | [diff] [blame] | 20 | #if !defined(__ACPI__) |
Vladimir Serbinenko | 41877d8 | 2014-09-01 22:18:01 +0200 | [diff] [blame] | 21 | |
Kyösti Mälkki | 12b121c | 2019-08-18 16:33:39 +0300 | [diff] [blame] | 22 | void enable_smbus(void); |
| 23 | void enable_pm(void); |
Kyösti Mälkki | 7a95575 | 2020-01-07 12:18:24 +0200 | [diff] [blame^] | 24 | void i82371eb_early_init(void); |
Kyösti Mälkki | 12b121c | 2019-08-18 16:33:39 +0300 | [diff] [blame] | 25 | |
| 26 | #if ENV_ROMSTAGE |
| 27 | int smbus_read_byte(u8 device, u8 address); |
| 28 | #endif |
| 29 | |
Stefan Reinauer | 3f5f6d8 | 2013-05-07 20:35:29 +0200 | [diff] [blame] | 30 | #endif |
Uwe Hermann | 4028ce7 | 2010-12-07 19:16:07 +0000 | [diff] [blame] | 31 | |
Uwe Hermann | 9da69f8 | 2007-11-30 02:08:26 +0000 | [diff] [blame] | 32 | /* If 'cond' is true this macro sets the bit(s) specified by 'bits' in the |
| 33 | * 'reg' variable, otherwise it clears those bits. |
| 34 | * |
| 35 | * Examples: |
| 36 | * reg16 = ONOFF(conf->ide0_enable, reg16, (1 << 5)); |
| 37 | * reg16 = ONOFF(conf->ide0_enable, reg16, (FOO | BAR)); |
| 38 | */ |
| 39 | /* TODO: Move into some global header file? */ |
| 40 | #define ONOFF(cond,reg,bits) ((cond) ? ((reg) | (bits)) : ((reg) & ~(bits))) |
Uwe Hermann | 1410c2d | 2007-05-29 10:37:52 +0000 | [diff] [blame] | 41 | |
Uwe Hermann | 9da69f8 | 2007-11-30 02:08:26 +0000 | [diff] [blame] | 42 | #define XBCS 0x4e /* X-Bus chip select register */ |
| 43 | #define GENCFG 0xb0 /* General configuration register */ |
Uwe Hermann | 1410c2d | 2007-05-29 10:37:52 +0000 | [diff] [blame] | 44 | |
| 45 | /* IDE */ |
| 46 | #define IDETIM_PRI 0x40 /* IDE timing register, primary channel */ |
| 47 | #define IDETIM_SEC 0x42 /* IDE timing register, secondary channel */ |
Uwe Hermann | 9da69f8 | 2007-11-30 02:08:26 +0000 | [diff] [blame] | 48 | #define UDMACTL 0x48 /* Ultra DMA/33 control register */ |
| 49 | #define UDMATIM 0x4a /* Ultra DMA/33 timing register */ |
| 50 | |
| 51 | /* SMBus */ |
| 52 | #define SMBBA 0x90 /* SMBus base address */ |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 53 | #define SMBUS_IO_BASE 0x0f00 |
Uwe Hermann | 9da69f8 | 2007-11-30 02:08:26 +0000 | [diff] [blame] | 54 | #define SMBHSTCFG 0xd2 /* SMBus host configuration */ |
| 55 | |
| 56 | /* Power management (ACPI) */ |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 57 | #define PMSTS 0x00 /* Power Management Status */ |
| 58 | #define PMEN 0x02 /* Power Management Resume Enable */ |
| 59 | #define PWRBTN_EN (1<<8) |
| 60 | #define GBL_EN (1<<5) |
| 61 | #define PMCNTRL 0x04 /* Power Management Control */ |
| 62 | #define SUS_EN (1<<13) /* S0-S5 trigger */ |
| 63 | #define SUS_TYP_MSK (7<<10) |
| 64 | #define SUS_TYP_S0 (5<<10) |
| 65 | #define SUS_TYP_S1 (4<<10) |
| 66 | #define SUS_TYP_S2 (3<<10) |
| 67 | //#define SUS_TYP_S2>---(2<<10) |
| 68 | #define SUS_TYP_S3 (1<<10) |
| 69 | #define SUS_TYP_S5 (0<<10) |
| 70 | #define SCI_EN (1<<0) |
| 71 | #define PMTMR 0x08 /* Power Management Timer */ |
| 72 | #define GPSTS 0x0c /* General Purpose Status */ |
| 73 | #define GPEN 0x0e /* General Purpose Enable */ |
| 74 | #define THRM_EN (1<<0) |
| 75 | #define PCNTRL 0x10 /* Processor control */ |
| 76 | #define GLBSTS 0x18 /* Global Status */ |
| 77 | #define IRQ_RSM_STS (1<<11) |
| 78 | #define EXTSMI_STS (1<<10) |
| 79 | #define GSTBY_STS (1<<8) |
| 80 | #define GP_STS (1<<7) |
| 81 | #define BM1_STS (1<<6) |
| 82 | #define APM_STS (1<<5) |
| 83 | #define DEV_STS (1<<4) |
| 84 | #define BIOS_EN (1<<1) /* GBL_RLS write triggers SMI */ |
| 85 | #define LEGACY_USB_EN (1<<0) /* Keyboard controller access triggers SMI */ |
| 86 | #define DEVSTS 0x1c /* Device Status */ |
| 87 | #define GLBEN 0x20 /* Global Enable */ |
| 88 | #define EXTSMI_EN (1<<10) /* EXTSMI# signal triggers SMI */ |
| 89 | #define GSTBY_EN (1<<8) |
| 90 | #define BM_TRP_EN (1<<1) |
| 91 | #define BIOS_EN (1<<1) /* GBL_RLS write triggers SMI */ |
| 92 | #define LEGACY_USB_EN (1<<0) /* Keyboard controller access triggers SMI */ |
| 93 | #define GLBCTL 0x28 /* Global Control */ |
| 94 | #define EOS (1<<16) /* End of SMI */ |
| 95 | #define SMI_EN (1<<0) /* SMI enable */ |
| 96 | #define DEVCTL 0x2c /* Device Control */ |
| 97 | #define TRP_EN_DEV12 (1<<24) /* SMI on dev12 trap */ |
| 98 | #define GPO0 0x34 |
| 99 | #define GPO1 0x35 |
| 100 | #define GPO2 0x36 |
| 101 | #define GPO3 0x37 |
Uwe Hermann | 1410c2d | 2007-05-29 10:37:52 +0000 | [diff] [blame] | 102 | |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 103 | #define PMBA 0x40 /* Power management base address */ |
| 104 | #define DEFAULT_PMBASE 0xe400 |
| 105 | #define PM_IO_BASE DEFAULT_PMBASE |
| 106 | #define PMREGMISC 0x80 /* Miscellaneous power management */ |
Uwe Hermann | 115c5b9 | 2010-10-09 17:00:18 +0000 | [diff] [blame] | 107 | |
Uwe Hermann | 1410c2d | 2007-05-29 10:37:52 +0000 | [diff] [blame] | 108 | /* Bit definitions */ |
Uwe Hermann | 9da69f8 | 2007-11-30 02:08:26 +0000 | [diff] [blame] | 109 | #define EXT_BIOS_ENABLE_1MB (1 << 9) /* 1-Meg Extended BIOS Enable */ |
| 110 | #define EXT_BIOS_ENABLE (1 << 7) /* Extended BIOS Enable */ |
| 111 | #define LOWER_BIOS_ENABLE (1 << 6) /* Lower BIOS Enable */ |
| 112 | #define WRITE_PROTECT_ENABLE (1 << 2) /* Write Protect Enable */ |
Uwe Hermann | 9da69f8 | 2007-11-30 02:08:26 +0000 | [diff] [blame] | 113 | #define SMB_HST_EN (1 << 0) /* Host Interface Enable */ |
| 114 | #define IDE_DECODE_ENABLE (1 << 15) /* IDE Decode Enable */ |
| 115 | #define DTE0 (1 << 3) /* DMA Timing Enable Only, drive 0 */ |
| 116 | #define DTE1 (1 << 7) /* DMA Timing Enable Only, drive 1 */ |
| 117 | #define PSDE0 (1 << 0) /* Primary Drive 0 UDMA/33 */ |
| 118 | #define PSDE1 (1 << 1) /* Primary Drive 1 UDMA/33 */ |
| 119 | #define SSDE0 (1 << 2) /* Secondary Drive 0 UDMA/33 */ |
| 120 | #define SSDE1 (1 << 3) /* Secondary Drive 1 UDMA/33 */ |
| 121 | #define ISA (1 << 0) /* Select ISA */ |
| 122 | #define EIO (0 << 0) /* Select EIO */ |
Uwe Hermann | 0865b4d | 2010-09-19 21:12:05 +0000 | [diff] [blame] | 123 | #define PMIOSE (1 << 0) /* PM I/O Space Enable */ |
Uwe Hermann | 1410c2d | 2007-05-29 10:37:52 +0000 | [diff] [blame] | 124 | |
Uwe Hermann | 9da69f8 | 2007-11-30 02:08:26 +0000 | [diff] [blame] | 125 | #endif /* SOUTHBRIDGE_INTEL_I82371EB_I82371EB_H */ |