Ricardo Martins | 892d8d2 | 2012-08-06 05:40:07 +0100 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2012 Ricardo Martins <rasmartins@gmail.com> |
| 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. |
Ricardo Martins | 892d8d2 | 2012-08-06 05:40:07 +0100 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #include <arch/io.h> |
| 18 | #include <console/console.h> |
| 19 | #include <device/pci.h> |
| 20 | #include <device/device.h> |
| 21 | #include <boot/tables.h> |
| 22 | |
| 23 | /* SCH3114 runtime register (RTR) address. */ |
| 24 | #define SCH3114_RTR_ADDR (0x400) |
| 25 | /* H/W Monitoring register block index. */ |
| 26 | #define SCH3114_RTR_HWM_IDX (SCH3114_RTR_ADDR + 0x70) |
| 27 | /* H/W Monitoring register block data. */ |
| 28 | #define SCH3114_RTR_HWM_DAT (SCH3114_RTR_ADDR + 0x71) |
| 29 | /* H/W Monitoring Ready/Lock/Start register. */ |
| 30 | #define SCH3114_HWM_RLS_REG (0x40) |
| 31 | |
| 32 | static void init(struct device *dev) |
| 33 | { |
| 34 | /* SCH3114: enable hardware monitor. */ |
| 35 | printk(BIOS_INFO, "Enabling SCH3114 hardware monitor\n"); |
| 36 | outb(SCH3114_HWM_RLS_REG, SCH3114_RTR_HWM_IDX); |
| 37 | outb(inb(SCH3114_RTR_HWM_DAT) | 0x01, SCH3114_RTR_HWM_DAT); |
| 38 | } |
| 39 | |
Paul Menzel | 528640d | 2013-02-23 21:31:23 +0100 | [diff] [blame] | 40 | static void mainboard_enable(struct device *dev) |
Ricardo Martins | 892d8d2 | 2012-08-06 05:40:07 +0100 | [diff] [blame] | 41 | { |
| 42 | dev->ops->init = init; |
| 43 | } |
| 44 | |
| 45 | struct chip_operations mainboard_ops = { |
Paul Menzel | 528640d | 2013-02-23 21:31:23 +0100 | [diff] [blame] | 46 | .enable_dev = mainboard_enable, |
Ricardo Martins | 892d8d2 | 2012-08-06 05:40:07 +0100 | [diff] [blame] | 47 | }; |