acpi_quirk.c (150003) | acpi_quirk.c (167814) |
---|---|
1/*- 2 * Copyright (c) 2004 Nate Lawson (SDG) 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) 2004 Nate Lawson (SDG) 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_quirk.c 150003 2005-09-11 18:39:03Z obrien $"); | 28__FBSDID("$FreeBSD: head/sys/dev/acpica/acpi_quirk.c 167814 2007-03-22 18:16:43Z jkim $"); |
29 30#include <sys/param.h> 31#include <sys/bus.h> 32 33#include <contrib/dev/acpica/acpi.h> 34#include <dev/acpica/acpivar.h> 35 36enum ops_t { --- 5 unchanged lines hidden (view full) --- 42 43enum val_t { 44 OEM, 45 OEM_REV, 46 CREATOR, 47 CREATOR_REV, 48}; 49 | 29 30#include <sys/param.h> 31#include <sys/bus.h> 32 33#include <contrib/dev/acpica/acpi.h> 34#include <dev/acpica/acpivar.h> 35 36enum ops_t { --- 5 unchanged lines hidden (view full) --- 42 43enum val_t { 44 OEM, 45 OEM_REV, 46 CREATOR, 47 CREATOR_REV, 48}; 49 |
50#define ACPI_TABLE_END (ACPI_TABLE_MAX + 1) 51 | |
52struct acpi_q_rule { | 50struct acpi_q_rule { |
53 int sig; /* Table signature to match */ | 51 char sig[ACPI_NAME_SIZE]; /* Table signature to match */ |
54 enum val_t val; 55 union { 56 char *id; 57 enum ops_t op; 58 } x; 59 union { 60 char *tid; 61 int rev; --- 74 unchanged lines hidden (view full) --- 136 return (result); 137} 138 139int 140acpi_table_quirks(int *quirks) 141{ 142 const struct acpi_q_entry *entry; 143 const struct acpi_q_rule *match; | 52 enum val_t val; 53 union { 54 char *id; 55 enum ops_t op; 56 } x; 57 union { 58 char *tid; 59 int rev; --- 74 unchanged lines hidden (view full) --- 134 return (result); 135} 136 137int 138acpi_table_quirks(int *quirks) 139{ 140 const struct acpi_q_entry *entry; 141 const struct acpi_q_rule *match; |
144 ACPI_TABLE_HEADER *hdr; | 142 ACPI_TABLE_HEADER fadt, dsdt, xsdt, *hdr; |
145 int done; 146 147 /* First, allow the machdep system to set its idea of quirks. */ 148 KASSERT(quirks != NULL, ("acpi quirks ptr is NULL")); 149 acpi_machdep_quirks(quirks); 150 | 143 int done; 144 145 /* First, allow the machdep system to set its idea of quirks. */ 146 KASSERT(quirks != NULL, ("acpi quirks ptr is NULL")); 147 acpi_machdep_quirks(quirks); 148 |
149 if (ACPI_FAILURE(AcpiGetTableHeader(ACPI_SIG_FADT, 0, &fadt))) 150 bzero(&fadt, sizeof(fadt)); 151 if (ACPI_FAILURE(AcpiGetTableHeader(ACPI_SIG_DSDT, 0, &dsdt))) 152 bzero(&fadt, sizeof(dsdt)); 153 if (ACPI_FAILURE(AcpiGetTableHeader(ACPI_SIG_XSDT, 0, &xsdt))) 154 bzero(&fadt, sizeof(xsdt)); 155 |
|
151 /* Then, override the quirks with any matched from table signatures. */ 152 for (entry = acpi_quirks_table; entry->match; entry++) { 153 done = TRUE; | 156 /* Then, override the quirks with any matched from table signatures. */ 157 for (entry = acpi_quirks_table; entry->match; entry++) { 158 done = TRUE; |
154 for (match = entry->match; match->sig != ACPI_TABLE_END; match++) { 155 switch (match->sig) { 156 case ACPI_TABLE_FADT: 157 hdr = (ACPI_TABLE_HEADER *)AcpiGbl_FADT; 158 break; 159 case ACPI_TABLE_DSDT: 160 hdr = (ACPI_TABLE_HEADER *)AcpiGbl_DSDT; 161 break; 162 case ACPI_TABLE_XSDT: 163 hdr = (ACPI_TABLE_HEADER *)AcpiGbl_XSDT; 164 break; 165 default: | 159 for (match = entry->match; match->sig[0] != '\0'; match++) { 160 if (!strncmp(match->sig, "FADT", ACPI_NAME_SIZE)) 161 hdr = &fadt; 162 else if (!strncmp(match->sig, ACPI_SIG_DSDT, ACPI_NAME_SIZE)) 163 hdr = &dsdt; 164 else if (!strncmp(match->sig, ACPI_SIG_XSDT, ACPI_NAME_SIZE)) 165 hdr = &xsdt; 166 else |
166 panic("invalid quirk header\n"); | 167 panic("invalid quirk header\n"); |
167 } | |
168 169 /* If we don't match any, skip to the next entry. */ | 168 169 /* If we don't match any, skip to the next entry. */ |
170 if (!aq_match_header(hdr, match)) { | 170 if (aq_match_header(hdr, match) == FALSE) { |
171 done = FALSE; 172 break; 173 } 174 } 175 176 /* If all entries matched, update the quirks and return. */ 177 if (done) { 178 *quirks = entry->quirks; 179 break; 180 } 181 } 182 183 return (0); 184} | 171 done = FALSE; 172 break; 173 } 174 } 175 176 /* If all entries matched, update the quirks and return. */ 177 if (done) { 178 *quirks = entry->quirks; 179 break; 180 } 181 } 182 183 return (0); 184} |