| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: apic.c,v 1.4 2009/11/29 10:30:07 skrll Exp $ */ | | 1 | /* $NetBSD: apic.c,v 1.5 2009/12/03 11:54:09 skrll Exp $ */ |
2 | | | 2 | |
3 | /* $OpenBSD: apic.c,v 1.7 2007/10/06 23:50:54 krw Exp $ */ | | 3 | /* $OpenBSD: apic.c,v 1.7 2007/10/06 23:50:54 krw Exp $ */ |
4 | | | 4 | |
5 | /* | | 5 | /* |
6 | * Copyright (c) 2005 Michael Shalayeff | | 6 | * Copyright (c) 2005 Michael Shalayeff |
7 | * Copyright (c) 2007 Mark Kettenis | | 7 | * Copyright (c) 2007 Mark Kettenis |
8 | * All rights reserved. | | 8 | * All rights reserved. |
9 | * | | 9 | * |
10 | * Permission to use, copy, modify, and distribute this software for any | | 10 | * Permission to use, copy, modify, and distribute this software for any |
11 | * purpose with or without fee is hereby granted, provided that the above | | 11 | * purpose with or without fee is hereby granted, provided that the above |
12 | * copyright notice and this permission notice appear in all copies. | | 12 | * copyright notice and this permission notice appear in all copies. |
13 | * | | 13 | * |
14 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | | 14 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| @@ -248,35 +248,30 @@ apic_intr(void *v) | | | @@ -248,35 +248,30 @@ apic_intr(void *v) |
248 | } | | 248 | } |
249 | iv = iv->next; | | 249 | iv = iv->next; |
250 | } | | 250 | } |
251 | | | 251 | |
252 | return (claimed); | | 252 | return (claimed); |
253 | } | | 253 | } |
254 | | | 254 | |
255 | /* Maximum number of supported interrupt routing entries. */ | | 255 | /* Maximum number of supported interrupt routing entries. */ |
256 | #define MAX_INT_TBL_SZ 16 | | 256 | #define MAX_INT_TBL_SZ 16 |
257 | | | 257 | |
258 | void | | 258 | void |
259 | apic_get_int_tbl(struct elroy_softc *sc) | | 259 | apic_get_int_tbl(struct elroy_softc *sc) |
260 | { | | 260 | { |
261 | struct pdc_pat_io_num int_tbl_sz PDC_ALIGNMENT; | | 261 | static struct pdc_pat_io_num int_tbl_sz PDC_ALIGNMENT; |
262 | struct pdc_pat_pci_rt int_tbl[MAX_INT_TBL_SZ] PDC_ALIGNMENT; | | 262 | static struct pdc_pat_pci_rt int_tbl[MAX_INT_TBL_SZ] PDC_ALIGNMENT; |
263 | size_t size; | | 263 | size_t size; |
264 | | | 264 | |
265 | /* | | | |
266 | * XXX int_tbl should not be allocated on the stack, but we need a | | | |
267 | * 1:1 mapping, and malloc doesn't provide that. | | | |
268 | */ | | | |
269 | | | | |
270 | if (pdc_call((iodcio_t)pdc, 0, PDC_PCI_INDEX, PDC_PCI_GET_INT_TBL_SZ, | | 265 | if (pdc_call((iodcio_t)pdc, 0, PDC_PCI_INDEX, PDC_PCI_GET_INT_TBL_SZ, |
271 | &int_tbl_sz, 0, 0, 0, 0, 0)) | | 266 | &int_tbl_sz, 0, 0, 0, 0, 0)) |
272 | return; | | 267 | return; |
273 | | | 268 | |
274 | if (int_tbl_sz.num > MAX_INT_TBL_SZ) | | 269 | if (int_tbl_sz.num > MAX_INT_TBL_SZ) |
275 | panic("interrupt routing table too big (%d entries)", | | 270 | panic("interrupt routing table too big (%d entries)", |
276 | int_tbl_sz.num); | | 271 | int_tbl_sz.num); |
277 | | | 272 | |
278 | size = int_tbl_sz.num * sizeof(struct pdc_pat_pci_rt); | | 273 | size = int_tbl_sz.num * sizeof(struct pdc_pat_pci_rt); |
279 | sc->sc_int_tbl_sz = int_tbl_sz.num; | | 274 | sc->sc_int_tbl_sz = int_tbl_sz.num; |
280 | sc->sc_int_tbl = malloc(size, M_DEVBUF, M_NOWAIT); | | 275 | sc->sc_int_tbl = malloc(size, M_DEVBUF, M_NOWAIT); |
281 | if (sc->sc_int_tbl == NULL) | | 276 | if (sc->sc_int_tbl == NULL) |
282 | return; | | 277 | return; |