Lines Matching refs:ge
156 #define PGE_ID(ge) (fls(MAX(1, (ge)->v1.Notify.PollInterval)) - 1) argument
386 apei_ge_handler(struct apei_ge *ge, bool copy) in apei_ge_handler() argument
388 uint8_t *buf = copy ? ge->copybuf : ge->buf; in apei_ge_handler()
402 len = MIN(ge->v1.ErrorBlockLength - sizeof(*ges), ges->DataLength); in apei_ge_handler()
413 if (!copy && ge->v1.Header.Type == ACPI_HEST_TYPE_GENERIC_ERROR_V2 && in apei_ge_handler()
414 ge->res2) { in apei_ge_handler()
415 uint64_t val = READ8(ge->res2, 0); in apei_ge_handler()
416 val &= ge->v2.ReadAckPreserve; in apei_ge_handler()
417 val |= ge->v2.ReadAckWrite; in apei_ge_handler()
418 WRITE8(ge->res2, 0, val); in apei_ge_handler()
432 struct apei_ge *ge; in apei_nmi_swi() local
434 TAILQ_FOREACH(ge, &nges->ges, nlink) in apei_nmi_swi()
435 apei_ge_handler(ge, true); in apei_nmi_swi()
442 struct apei_ge *ge; in apei_nmi_handler() local
449 TAILQ_FOREACH(ge, &nges->ges, nlink) { in apei_nmi_handler()
450 ges = (ACPI_HEST_GENERIC_STATUS *)ge->buf; in apei_nmi_handler()
459 gesc = (ACPI_HEST_GENERIC_STATUS *)ge->copybuf; in apei_nmi_handler()
461 memcpy(ge->copybuf, ge->buf, ge->v1.ErrorBlockLength); in apei_nmi_handler()
465 if (ge->v1.Header.Type == ACPI_HEST_TYPE_GENERIC_ERROR_V2 && in apei_nmi_handler()
466 ge->res2) { in apei_nmi_handler()
467 uint64_t val = READ8(ge->res2, 0); in apei_nmi_handler()
468 val &= ge->v2.ReadAckPreserve; in apei_nmi_handler()
469 val |= ge->v2.ReadAckWrite; in apei_nmi_handler()
470 WRITE8(ge->res2, 0, val); in apei_nmi_handler()
486 struct apei_ge *ge; in apei_callout_handler() local
488 TAILQ_FOREACH(ge, &pges->ges, nlink) in apei_callout_handler()
489 apei_ge_handler(ge, false); in apei_callout_handler()
498 struct apei_ge *ge; in apei_notify_handler() local
500 TAILQ_FOREACH(ge, &sc->iges.ges, nlink) in apei_notify_handler()
501 apei_ge_handler(ge, false); in apei_notify_handler()
508 struct apei_ge *ge; in hest_parse_structure() local
542 ge = malloc(sizeof(*ge), M_DEVBUF, M_WAITOK | M_ZERO); in hest_parse_structure()
543 ge->v1 = *s; in hest_parse_structure()
544 TAILQ_INSERT_TAIL(&sc->ges, ge, link); in hest_parse_structure()
549 ge = malloc(sizeof(*ge), M_DEVBUF, M_WAITOK | M_ZERO); in hest_parse_structure()
550 ge->v2 = *s; in hest_parse_structure()
551 TAILQ_INSERT_TAIL(&sc->ges, ge, link); in hest_parse_structure()
667 struct apei_ge *ge; in apei_attach() local
701 TAILQ_FOREACH(ge, &sc->ges, link) { in apei_attach()
702 ge->res_rid = rid++; in apei_attach()
703 acpi_bus_alloc_gas(dev, &ge->res_type, &ge->res_rid, in apei_attach()
704 &ge->v1.ErrorStatusAddress, &ge->res, 0); in apei_attach()
705 if (ge->res) { in apei_attach()
706 ge->buf = pmap_mapdev_attr(READ8(ge->res, 0), in apei_attach()
707 ge->v1.ErrorBlockLength, VM_MEMATTR_WRITE_COMBINING); in apei_attach()
711 if (ge->v1.Header.Type == ACPI_HEST_TYPE_GENERIC_ERROR_V2) { in apei_attach()
712 ge->res2_rid = rid++; in apei_attach()
713 acpi_bus_alloc_gas(dev, &ge->res2_type, &ge->res2_rid, in apei_attach()
714 &ge->v2.ReadAckRegister, &ge->res2, RF_SHAREABLE); in apei_attach()
715 if (ge->res2 == NULL) in apei_attach()
718 if (ge->v1.Notify.Type == ACPI_HEST_NOTIFY_POLLED) { in apei_attach()
719 pges = &sc->pges[PGE_ID(ge)]; in apei_attach()
720 TAILQ_INSERT_TAIL(&sc->pges[PGE_ID(ge)].ges, ge, nlink); in apei_attach()
723 } else if (ge->v1.Notify.Type == ACPI_HEST_NOTIFY_SCI || in apei_attach()
724 ge->v1.Notify.Type == ACPI_HEST_NOTIFY_GPIO || in apei_attach()
725 ge->v1.Notify.Type == ACPI_HEST_NOTIFY_GSIV) { in apei_attach()
726 TAILQ_INSERT_TAIL(&sc->iges.ges, ge, nlink); in apei_attach()
727 } else if (ge->v1.Notify.Type == ACPI_HEST_NOTIFY_NMI) { in apei_attach()
728 ge->copybuf = malloc(ge->v1.ErrorBlockLength, in apei_attach()
730 TAILQ_INSERT_TAIL(&sc->nges.ges, ge, nlink); in apei_attach()
752 struct apei_ge *ge; in apei_detach() local
767 while ((ge = TAILQ_FIRST(&sc->ges)) != NULL) { in apei_detach()
768 TAILQ_REMOVE(&sc->ges, ge, link); in apei_detach()
769 if (ge->res) { in apei_detach()
770 bus_release_resource(dev, ge->res_type, in apei_detach()
771 ge->res_rid, ge->res); in apei_detach()
773 if (ge->res2) { in apei_detach()
774 bus_release_resource(dev, ge->res2_type, in apei_detach()
775 ge->res2_rid, ge->res2); in apei_detach()
777 if (ge->v1.Notify.Type == ACPI_HEST_NOTIFY_POLLED) { in apei_detach()
778 TAILQ_REMOVE(&sc->pges[PGE_ID(ge)].ges, ge, nlink); in apei_detach()
779 } else if (ge->v1.Notify.Type == ACPI_HEST_NOTIFY_SCI || in apei_detach()
780 ge->v1.Notify.Type == ACPI_HEST_NOTIFY_GPIO || in apei_detach()
781 ge->v1.Notify.Type == ACPI_HEST_NOTIFY_GSIV) { in apei_detach()
782 TAILQ_REMOVE(&sc->iges.ges, ge, nlink); in apei_detach()
783 } else if (ge->v1.Notify.Type == ACPI_HEST_NOTIFY_NMI) { in apei_detach()
784 TAILQ_REMOVE(&sc->nges.ges, ge, nlink); in apei_detach()
785 free(ge->copybuf, M_DEVBUF); in apei_detach()
787 if (ge->buf) { in apei_detach()
788 pmap_unmapdev(ge->buf, ge->v1.ErrorBlockLength); in apei_detach()
790 free(ge, M_DEVBUF); in apei_detach()