| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: cpu.c,v 1.104 2021/05/05 03:54:16 thorpej Exp $ */ | | 1 | /* $NetBSD: cpu.c,v 1.105 2022/02/27 14:17:10 riastradh Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1998, 1999, 2000, 2001, 2020 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1998, 1999, 2000, 2001, 2020 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | | 8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, |
9 | * NASA Ames Research Center. | | 9 | * NASA Ames Research Center. |
10 | * | | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | | 11 | * Redistribution and use in source and binary forms, with or without |
12 | * modification, are permitted provided that the following conditions | | 12 | * modification, are permitted provided that the following conditions |
13 | * are met: | | 13 | * are met: |
14 | * 1. Redistributions of source code must retain the above copyright | | 14 | * 1. Redistributions of source code must retain the above copyright |
| @@ -49,27 +49,27 @@ | | | @@ -49,27 +49,27 @@ |
49 | * Carnegie Mellon requests users of this software to return to | | 49 | * Carnegie Mellon requests users of this software to return to |
50 | * | | 50 | * |
51 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU | | 51 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU |
52 | * School of Computer Science | | 52 | * School of Computer Science |
53 | * Carnegie Mellon University | | 53 | * Carnegie Mellon University |
54 | * Pittsburgh PA 15213-3890 | | 54 | * Pittsburgh PA 15213-3890 |
55 | * | | 55 | * |
56 | * any improvements or extensions that they make and grant Carnegie the | | 56 | * any improvements or extensions that they make and grant Carnegie the |
57 | * rights to redistribute these changes. | | 57 | * rights to redistribute these changes. |
58 | */ | | 58 | */ |
59 | | | 59 | |
60 | #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ | | 60 | #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ |
61 | | | 61 | |
62 | __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.104 2021/05/05 03:54:16 thorpej Exp $"); | | 62 | __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.105 2022/02/27 14:17:10 riastradh Exp $"); |
63 | | | 63 | |
64 | #include "opt_ddb.h" | | 64 | #include "opt_ddb.h" |
65 | #include "opt_multiprocessor.h" | | 65 | #include "opt_multiprocessor.h" |
66 | | | 66 | |
67 | #include <sys/param.h> | | 67 | #include <sys/param.h> |
68 | #include <sys/systm.h> | | 68 | #include <sys/systm.h> |
69 | #include <sys/device.h> | | 69 | #include <sys/device.h> |
70 | #include <sys/kmem.h> | | 70 | #include <sys/kmem.h> |
71 | #include <sys/proc.h> | | 71 | #include <sys/proc.h> |
72 | #include <sys/atomic.h> | | 72 | #include <sys/atomic.h> |
73 | #include <sys/cpu.h> | | 73 | #include <sys/cpu.h> |
74 | #include <sys/sysctl.h> | | 74 | #include <sys/sysctl.h> |
75 | | | 75 | |
| @@ -872,32 +872,33 @@ cpu_iccb_send(long cpu_id, const char *m | | | @@ -872,32 +872,33 @@ cpu_iccb_send(long cpu_id, const char *m |
872 | | | 872 | |
873 | /* Wait for the ICCB to become available. */ | | 873 | /* Wait for the ICCB to become available. */ |
874 | for (timeout = 10000; timeout != 0; timeout--) { | | 874 | for (timeout = 10000; timeout != 0; timeout--) { |
875 | alpha_mb(); | | 875 | alpha_mb(); |
876 | if ((hwrpb->rpb_rxrdy & cpumask) == 0) | | 876 | if ((hwrpb->rpb_rxrdy & cpumask) == 0) |
877 | break; | | 877 | break; |
878 | delay(1000); | | 878 | delay(1000); |
879 | } | | 879 | } |
880 | if (timeout == 0) | | 880 | if (timeout == 0) |
881 | return (EIO); | | 881 | return (EIO); |
882 | | | 882 | |
883 | /* | | 883 | /* |
884 | * Copy the message into the ICCB, and tell the secondary console | | 884 | * Copy the message into the ICCB, and tell the secondary console |
885 | * that it's there. | | 885 | * that it's there. Ensure the buffer is initialized before we |
| | | 886 | * set the rxrdy bits, as a store-release. |
886 | */ | | 887 | */ |
887 | strcpy(pcsp->pcs_iccb.iccb_rxbuf, msg); | | 888 | strcpy(pcsp->pcs_iccb.iccb_rxbuf, msg); |
888 | pcsp->pcs_iccb.iccb_rxlen = strlen(msg); | | 889 | pcsp->pcs_iccb.iccb_rxlen = strlen(msg); |
| | | 890 | membar_exit(); |
889 | atomic_or_ulong(&hwrpb->rpb_rxrdy, cpumask); | | 891 | atomic_or_ulong(&hwrpb->rpb_rxrdy, cpumask); |
890 | membar_sync(); | | | |
891 | | | 892 | |
892 | /* Wait for the message to be received. */ | | 893 | /* Wait for the message to be received. */ |
893 | for (timeout = 10000; timeout != 0; timeout--) { | | 894 | for (timeout = 10000; timeout != 0; timeout--) { |
894 | alpha_mb(); | | 895 | alpha_mb(); |
895 | if ((hwrpb->rpb_rxrdy & cpumask) == 0) | | 896 | if ((hwrpb->rpb_rxrdy & cpumask) == 0) |
896 | break; | | 897 | break; |
897 | delay(1000); | | 898 | delay(1000); |
898 | } | | 899 | } |
899 | if (timeout == 0) | | 900 | if (timeout == 0) |
900 | return (EIO); | | 901 | return (EIO); |
901 | | | 902 | |
902 | return (0); | | 903 | return (0); |
903 | } | | 904 | } |