Angel Pons | 4b42983 | 2020-04-02 23:48:50 +0200 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* This file is part of the coreboot project. */ |
Tobias Diedrich | e87c38e | 2010-11-27 09:40:16 +0000 | [diff] [blame] | 3 | |
| 4 | /* i440bx Northbridge */ |
| 5 | Device (NB) |
| 6 | { |
| 7 | Name(_ADR, 0x00000000) |
| 8 | OperationRegion(PCIC, PCI_Config, 0x00, 0x100) |
| 9 | } |
| 10 | |
| 11 | Field (NB.PCIC, AnyAcc, NoLock, Preserve) |
| 12 | { |
| 13 | Offset (0x67), // DRB7 |
| 14 | DRB7, 8, |
| 15 | } |
| 16 | |
| 17 | Method(TOM1, 0) { |
| 18 | /* Multiply by 8MB to get TOM */ |
| 19 | Return(ShiftLeft(DRB7, 23)) |
| 20 | } |
| 21 | |
| 22 | Method(_CRS, 0) { |
| 23 | Name(TMP, ResourceTemplate() { |
| 24 | WordBusNumber(ResourceProducer, MinFixed, MaxFixed, PosDecode, |
| 25 | 0x0000, // Granularity |
| 26 | 0x0000, // Range Minimum |
| 27 | 0x00FF, // Range Maximum |
| 28 | 0x0000, // Translation Offset |
| 29 | 0x0100, // Length |
| 30 | ,, |
| 31 | ) |
| 32 | IO(Decode16, 0x0CF8, 0x0CF8, 1, 8) |
| 33 | |
| 34 | WORDIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, |
| 35 | 0x0000, /* address granularity */ |
| 36 | 0x0000, /* range minimum */ |
| 37 | 0x0CF7, /* range maximum */ |
| 38 | 0x0000, /* translation */ |
| 39 | 0x0CF8 /* length */ |
| 40 | ) |
| 41 | |
| 42 | WORDIO(ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, |
| 43 | 0x0000, /* address granularity */ |
| 44 | 0x0D00, /* range minimum */ |
| 45 | 0xFFFF, /* range maximum */ |
| 46 | 0x0000, /* translation */ |
| 47 | 0xF300 /* length */ |
| 48 | ) |
| 49 | |
| 50 | /* memory space for PCI BARs below 4GB */ |
| 51 | Memory32Fixed(ReadOnly, 0x00000000, 0x00000000, MMIO) |
| 52 | }) |
| 53 | CreateDWordField(TMP, MMIO._BAS, MM1B) |
| 54 | CreateDWordField(TMP, MMIO._LEN, MM1L) |
| 55 | /* |
| 56 | * Declare memory between TOM1 and 4GB as available |
| 57 | * for PCI MMIO. |
| 58 | * |
| 59 | * Use ShiftLeft to avoid 64bit constant (for XP). |
| 60 | * This will work even if the OS does 32bit arithmetic, as |
| 61 | * 32bit (0x00000000 - TOM1) will wrap and give the same |
| 62 | * result as 64bit (0x100000000 - TOM1). |
| 63 | */ |
| 64 | Store(TOM1, MM1B) |
| 65 | ShiftLeft(0x10000000, 4, Local0) |
| 66 | Subtract(Local0, TOM1, Local0) |
| 67 | Store(Local0, MM1L) |
| 68 | |
| 69 | Return(TMP) |
| 70 | } |