acpi_hpet.c (168010) | acpi_hpet.c (169574) |
---|---|
1/*- 2 * Copyright (c) 2005 Poul-Henning Kamp 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2005 Poul-Henning Kamp 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/dev/acpica/acpi_hpet.c 168010 2007-03-28 22:28:48Z njl $"); | 28__FBSDID("$FreeBSD: head/sys/dev/acpica/acpi_hpet.c 169574 2007-05-15 08:41:05Z takawata $"); |
29 30#include "opt_acpi.h" 31#include <sys/param.h> 32#include <sys/bus.h> 33#include <sys/kernel.h> 34#include <sys/module.h> 35#include <sys/rman.h> 36#include <sys/time.h> 37#include <sys/timetc.h> 38 39#include <contrib/dev/acpica/acpi.h> 40#include <dev/acpica/acpivar.h> 41 42ACPI_SERIAL_DECL(hpet, "ACPI HPET support"); 43 | 29 30#include "opt_acpi.h" 31#include <sys/param.h> 32#include <sys/bus.h> 33#include <sys/kernel.h> 34#include <sys/module.h> 35#include <sys/rman.h> 36#include <sys/time.h> 37#include <sys/timetc.h> 38 39#include <contrib/dev/acpica/acpi.h> 40#include <dev/acpica/acpivar.h> 41 42ACPI_SERIAL_DECL(hpet, "ACPI HPET support"); 43 |
44static devclass_t acpi_hpet_devclass; 45 |
|
44/* ACPI CA debugging */ 45#define _COMPONENT ACPI_TIMER 46ACPI_MODULE_NAME("HPET") 47 48struct acpi_hpet_softc { 49 device_t dev; 50 struct resource *mem_res; 51 ACPI_HANDLE handle; --- 21 unchanged lines hidden (view full) --- 73hpet_get_timecount(struct timecounter *tc) 74{ 75 struct acpi_hpet_softc *sc; 76 77 sc = tc->tc_priv; 78 return (bus_read_4(sc->mem_res, HPET_OFFSET_VALUE)); 79} 80 | 46/* ACPI CA debugging */ 47#define _COMPONENT ACPI_TIMER 48ACPI_MODULE_NAME("HPET") 49 50struct acpi_hpet_softc { 51 device_t dev; 52 struct resource *mem_res; 53 ACPI_HANDLE handle; --- 21 unchanged lines hidden (view full) --- 75hpet_get_timecount(struct timecounter *tc) 76{ 77 struct acpi_hpet_softc *sc; 78 79 sc = tc->tc_priv; 80 return (bus_read_4(sc->mem_res, HPET_OFFSET_VALUE)); 81} 82 |
83#define DEV_HPET(x) (acpi_get_magic(x) == (int)&acpi_hpet_devclass) 84 85void 86acpi_hpet_table_probe(device_t parent) 87{ 88 ACPI_TABLE_HPET *hpet; 89 ACPI_TABLE_HEADER *hdr; 90 ACPI_STATUS status; 91 device_t child; 92 93 /*Currently, id and minimam clock tick info. is discarded.*/ 94 95 status = AcpiGetTable(ACPI_SIG_HPET, 1, (ACPI_TABLE_HEADER **)&hdr); 96 if (ACPI_FAILURE(status)) 97 return; 98 99 hpet = (ACPI_TABLE_HPET *) hdr; 100 101 /*unit No.hdr->Sequence*/ 102 if(hpet->Sequence) 103 printf("HPET TABLE:Sequense is non zero %d\n", hpet->Sequence); 104 105 child = BUS_ADD_CHILD(parent, 0, "acpi_hpet", 0); 106 107 if (child == NULL) { 108 printf("%s: can't add child\n", __func__); 109 return; 110 } 111 112 acpi_set_magic(child, (int)&acpi_hpet_devclass); 113 bus_set_resource(child, SYS_RES_MEMORY, 0, hpet->Address.Address, HPET_MEM_WIDTH); 114 if(device_probe_and_attach(child) != 0) 115 device_delete_child(parent, child); 116} 117 |
|
81static int 82acpi_hpet_probe(device_t dev) 83{ 84 ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__); 85 | 118static int 119acpi_hpet_probe(device_t dev) 120{ 121 ACPI_FUNCTION_TRACE((char *)(uintptr_t) __func__); 122 |
86 if (acpi_disabled("hpet") || | 123 if (acpi_disabled("hpet")|| 124 !DEV_HPET(dev) || |
87 ACPI_ID_PROBE(device_get_parent(dev), dev, hpet_ids) == NULL || 88 device_get_unit(dev) != 0) 89 return (ENXIO); 90 91 device_set_desc(dev, "High Precision Event Timer"); 92 return (0); 93} 94 --- 111 unchanged lines hidden (view full) --- 206}; 207 208static driver_t acpi_hpet_driver = { 209 "acpi_hpet", 210 acpi_hpet_methods, 211 sizeof(struct acpi_hpet_softc), 212}; 213 | 125 ACPI_ID_PROBE(device_get_parent(dev), dev, hpet_ids) == NULL || 126 device_get_unit(dev) != 0) 127 return (ENXIO); 128 129 device_set_desc(dev, "High Precision Event Timer"); 130 return (0); 131} 132 --- 111 unchanged lines hidden (view full) --- 244}; 245 246static driver_t acpi_hpet_driver = { 247 "acpi_hpet", 248 acpi_hpet_methods, 249 sizeof(struct acpi_hpet_softc), 250}; 251 |
214static devclass_t acpi_hpet_devclass; | |
215 216DRIVER_MODULE(acpi_hpet, acpi, acpi_hpet_driver, acpi_hpet_devclass, 0, 0); 217MODULE_DEPEND(acpi_hpet, acpi, 1, 1, 1); | 252 253DRIVER_MODULE(acpi_hpet, acpi, acpi_hpet_driver, acpi_hpet_devclass, 0, 0); 254MODULE_DEPEND(acpi_hpet, acpi, 1, 1, 1); |