Wed May 4 07:48:35 2022 UTC ()
fix various typos in comments and log messages.


(andvar)
diff -r1.119 -r1.120 src/sys/arch/sun3/sun3x/pmap.c
diff -r1.56 -r1.57 src/sys/arch/x68k/dev/mha.c
diff -r1.40 -r1.41 src/sys/dev/i2o/iopsp.c
diff -r1.71 -r1.72 src/sys/dev/sbus/stp4020.c
diff -r1.69 -r1.70 src/sys/net/ppp_tty.c

cvs diff -r1.119 -r1.120 src/sys/arch/sun3/sun3x/pmap.c (expand / switch to unified diff)

--- src/sys/arch/sun3/sun3x/pmap.c 2022/05/03 20:52:31 1.119
+++ src/sys/arch/sun3/sun3x/pmap.c 2022/05/04 07:48:34 1.120
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: pmap.c,v 1.119 2022/05/03 20:52:31 andvar Exp $ */ 1/* $NetBSD: pmap.c,v 1.120 2022/05/04 07:48:34 andvar Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. 4 * Copyright (c) 1996, 1997 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 Jeremy Cooper. 8 * by Jeremy Cooper.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -95,27 +95,27 @@ @@ -95,27 +95,27 @@
95 * affected by the change. These instances are documented in the code at 95 * affected by the change. These instances are documented in the code at
96 * various points. 96 * various points.
97 */ 97 */
98/*** A Note About the Note About the 68851 Address Translation Cache 98/*** A Note About the Note About the 68851 Address Translation Cache
99 * 4 months into this code I discovered that the sun3x does not have 99 * 4 months into this code I discovered that the sun3x does not have
100 * a MC68851 chip. Instead, it has a version of this MMU that is part of the 100 * a MC68851 chip. Instead, it has a version of this MMU that is part of the
101 * the 68030 CPU. 101 * the 68030 CPU.
102 * All though it behaves very similarly to the 68851, it only has 1 task 102 * All though it behaves very similarly to the 68851, it only has 1 task
103 * alias and a 22 entry cache. So sadly (or happily), the first paragraph 103 * alias and a 22 entry cache. So sadly (or happily), the first paragraph
104 * of the previous note does not apply to the sun3x pmap. 104 * of the previous note does not apply to the sun3x pmap.
105 */ 105 */
106 106
107#include <sys/cdefs.h> 107#include <sys/cdefs.h>
108__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.119 2022/05/03 20:52:31 andvar Exp $"); 108__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.120 2022/05/04 07:48:34 andvar Exp $");
109 109
110#include "opt_ddb.h" 110#include "opt_ddb.h"
111#include "opt_pmap_debug.h" 111#include "opt_pmap_debug.h"
112 112
113#include <sys/param.h> 113#include <sys/param.h>
114#include <sys/systm.h> 114#include <sys/systm.h>
115#include <sys/proc.h> 115#include <sys/proc.h>
116#include <sys/malloc.h> 116#include <sys/malloc.h>
117#include <sys/pool.h> 117#include <sys/pool.h>
118#include <sys/queue.h> 118#include <sys/queue.h>
119#include <sys/kcore.h> 119#include <sys/kcore.h>
120#include <sys/atomic.h> 120#include <sys/atomic.h>
121 121
@@ -212,27 +212,27 @@ int pmap_debug = 0; @@ -212,27 +212,27 @@ int pmap_debug = 0;
212 * tmgrCbase -> +-------------------------------------------------------+ 212 * tmgrCbase -> +-------------------------------------------------------+
213 * | TMGR C level table structures | 213 * | TMGR C level table structures |
214 * pvbase -> +-------------------------------------------------------+ 214 * pvbase -> +-------------------------------------------------------+
215 * | Physical to Virtual mapping table (list heads) | 215 * | Physical to Virtual mapping table (list heads) |
216 * pvebase -> +-------------------------------------------------------+ 216 * pvebase -> +-------------------------------------------------------+
217 * | Physical to Virtual mapping table (list elements) | 217 * | Physical to Virtual mapping table (list elements) |
218 * | | 218 * | |
219 * +-------------------------------------------------------+ 219 * +-------------------------------------------------------+
220 * towards higher memory 220 * towards higher memory
221 * 221 *
222 * For every A table in the MMU A area, there will be a corresponding 222 * For every A table in the MMU A area, there will be a corresponding
223 * a_tmgr structure in the TMGR A area. The same will be true for 223 * a_tmgr structure in the TMGR A area. The same will be true for
224 * the B and C tables. This arrangement will make it easy to find the 224 * the B and C tables. This arrangement will make it easy to find the
225 * controling tmgr structure for any table in the system by use of 225 * controlling tmgr structure for any table in the system by use of
226 * (relatively) simple macros. 226 * (relatively) simple macros.
227 */ 227 */
228 228
229/* 229/*
230 * Global variables for storing the base addresses for the areas 230 * Global variables for storing the base addresses for the areas
231 * labeled above. 231 * labeled above.
232 */ 232 */
233static vaddr_t kernAphys; 233static vaddr_t kernAphys;
234static mmu_long_dte_t *kernAbase; 234static mmu_long_dte_t *kernAbase;
235static mmu_short_dte_t *kernBbase; 235static mmu_short_dte_t *kernBbase;
236static mmu_short_pte_t *kernCbase; 236static mmu_short_pte_t *kernCbase;
237static mmu_short_pte_t *mmuCbase; 237static mmu_short_pte_t *mmuCbase;
238static mmu_short_dte_t *mmuBbase; 238static mmu_short_dte_t *mmuBbase;
@@ -283,27 +283,27 @@ vaddr_t virtual_contig_end; @@ -283,27 +283,27 @@ vaddr_t virtual_contig_end;
283paddr_t avail_next; 283paddr_t avail_next;
284 284
285/* These are used by pmap_copy_page(), etc. */ 285/* These are used by pmap_copy_page(), etc. */
286vaddr_t tmp_vpages[2]; 286vaddr_t tmp_vpages[2];
287 287
288/* memory pool for pmap structures */ 288/* memory pool for pmap structures */
289struct pool pmap_pmap_pool; 289struct pool pmap_pmap_pool;
290 290
291/* 291/*
292 * The 3/80 is the only member of the sun3x family that has non-contiguous 292 * The 3/80 is the only member of the sun3x family that has non-contiguous
293 * physical memory. Memory is divided into 4 banks which are physically 293 * physical memory. Memory is divided into 4 banks which are physically
294 * locatable on the system board. Although the size of these banks varies 294 * locatable on the system board. Although the size of these banks varies
295 * with the size of memory they contain, their base addresses are 295 * with the size of memory they contain, their base addresses are
296 * permenently fixed. The following structure, which describes these 296 * permanently fixed. The following structure, which describes these
297 * banks, is initialized by pmap_bootstrap() after it reads from a similar 297 * banks, is initialized by pmap_bootstrap() after it reads from a similar
298 * structure provided by the ROM Monitor. 298 * structure provided by the ROM Monitor.
299 * 299 *
300 * For the other machines in the sun3x architecture which do have contiguous 300 * For the other machines in the sun3x architecture which do have contiguous
301 * RAM, this list will have only one entry, which will describe the entire 301 * RAM, this list will have only one entry, which will describe the entire
302 * range of available memory. 302 * range of available memory.
303 */ 303 */
304struct pmap_physmem_struct avail_mem[SUN3X_NPHYS_RAM_SEGS]; 304struct pmap_physmem_struct avail_mem[SUN3X_NPHYS_RAM_SEGS];
305u_int total_phys_mem; 305u_int total_phys_mem;
306 306
307/*************************************************************************/ 307/*************************************************************************/
308 308
309/* 309/*
@@ -1208,27 +1208,27 @@ pmap_init_pv(void) @@ -1208,27 +1208,27 @@ pmap_init_pv(void)
1208 pvbase[i].pv_flags = 0; /* Zero out page flags */ 1208 pvbase[i].pv_flags = 0; /* Zero out page flags */
1209 } 1209 }
1210} 1210}
1211 1211
1212/* is_managed INTERNAL 1212/* is_managed INTERNAL
1213 ** 1213 **
1214 * Determine if the given physical address is managed by the PV system. 1214 * Determine if the given physical address is managed by the PV system.
1215 * Note that this logic assumes that no one will ask for the status of 1215 * Note that this logic assumes that no one will ask for the status of
1216 * addresses which lie in-between the memory banks on the 3/80. If they 1216 * addresses which lie in-between the memory banks on the 3/80. If they
1217 * do so, it will falsely report that it is managed. 1217 * do so, it will falsely report that it is managed.
1218 * 1218 *
1219 * Note: A "managed" address is one that was reported to the VM system as 1219 * Note: A "managed" address is one that was reported to the VM system as
1220 * a "usable page" during system startup. As such, the VM system expects the 1220 * a "usable page" during system startup. As such, the VM system expects the
1221 * pmap module to keep an accurate track of the useage of those pages. 1221 * pmap module to keep an accurate track of the usage of those pages.
1222 * Any page not given to the VM system at startup does not exist (as far as 1222 * Any page not given to the VM system at startup does not exist (as far as
1223 * the VM system is concerned) and is therefore "unmanaged." Examples are 1223 * the VM system is concerned) and is therefore "unmanaged." Examples are
1224 * those pages which belong to the ROM monitor and the memory allocated before 1224 * those pages which belong to the ROM monitor and the memory allocated before
1225 * the VM system was started. 1225 * the VM system was started.
1226 */ 1226 */
1227static INLINE bool 1227static INLINE bool
1228is_managed(paddr_t pa) 1228is_managed(paddr_t pa)
1229{ 1229{
1230 if (pa >= avail_start && pa < avail_end) 1230 if (pa >= avail_start && pa < avail_end)
1231 return true; 1231 return true;
1232 else 1232 else
1233 return false; 1233 return false;
1234} 1234}
@@ -1694,27 +1694,27 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd @@ -1694,27 +1694,27 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd
1694 * system, parts of the architecture-dependent section of the sun3x 1694 * system, parts of the architecture-dependent section of the sun3x
1695 * kernel pass their own flags in the lower, unused bits of the 1695 * kernel pass their own flags in the lower, unused bits of the
1696 * physical address supplied to this function. These flags are 1696 * physical address supplied to this function. These flags are
1697 * extracted and stored in the temporary variable 'mapflags'. 1697 * extracted and stored in the temporary variable 'mapflags'.
1698 * 1698 *
1699 * Extract sun3x specific flags from the physical address. 1699 * Extract sun3x specific flags from the physical address.
1700 */ 1700 */
1701 mapflags = (pa & ~MMU_PAGE_MASK); 1701 mapflags = (pa & ~MMU_PAGE_MASK);
1702 pa &= MMU_PAGE_MASK; 1702 pa &= MMU_PAGE_MASK;
1703 1703
1704 /* 1704 /*
1705 * Determine if the physical address being mapped is on-board RAM. 1705 * Determine if the physical address being mapped is on-board RAM.
1706 * Any other area of the address space is likely to belong to a 1706 * Any other area of the address space is likely to belong to a
1707 * device and hence it would be disasterous to cache its contents. 1707 * device and hence it would be disastrous to cache its contents.
1708 */ 1708 */
1709 if ((managed = is_managed(pa)) == false) 1709 if ((managed = is_managed(pa)) == false)
1710 mapflags |= PMAP_NC; 1710 mapflags |= PMAP_NC;
1711 1711
1712 /* 1712 /*
1713 * For user mappings we walk along the MMU tables of the given 1713 * For user mappings we walk along the MMU tables of the given
1714 * pmap, reaching a PTE which describes the virtual page being 1714 * pmap, reaching a PTE which describes the virtual page being
1715 * mapped or changed. If any level of the walk ends in an invalid 1715 * mapped or changed. If any level of the walk ends in an invalid
1716 * entry, a table must be allocated and the entry must be updated 1716 * entry, a table must be allocated and the entry must be updated
1717 * to point to it. 1717 * to point to it.
1718 * There is a bit of confusion as to whether this code must be 1718 * There is a bit of confusion as to whether this code must be
1719 * re-entrant. For now we will assume it is. To support 1719 * re-entrant. For now we will assume it is. To support
1720 * re-entrancy we must unlink tables from the table pool before 1720 * re-entrancy we must unlink tables from the table pool before
@@ -2054,27 +2054,27 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd @@ -2054,27 +2054,27 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd
2054} 2054}
2055 2055
2056/* pmap_enter_kernel INTERNAL 2056/* pmap_enter_kernel INTERNAL
2057 ** 2057 **
2058 * Map the given virtual address to the given physical address within the 2058 * Map the given virtual address to the given physical address within the
2059 * kernel address space. This function exists because the kernel map does 2059 * kernel address space. This function exists because the kernel map does
2060 * not do dynamic table allocation. It consists of a contiguous array of ptes 2060 * not do dynamic table allocation. It consists of a contiguous array of ptes
2061 * and can be edited directly without the need to walk through any tables. 2061 * and can be edited directly without the need to walk through any tables.
2062 * 2062 *
2063 * XXX: "Danger, Will Robinson!" 2063 * XXX: "Danger, Will Robinson!"
2064 * Note that the kernel should never take a fault on any page 2064 * Note that the kernel should never take a fault on any page
2065 * between [ KERNBASE .. virtual_avail ] and this is checked in 2065 * between [ KERNBASE .. virtual_avail ] and this is checked in
2066 * trap.c for kernel-mode MMU faults. This means that mappings 2066 * trap.c for kernel-mode MMU faults. This means that mappings
2067 * created in that range must be implicily wired. -gwr 2067 * created in that range must be implicitly wired. -gwr
2068 */ 2068 */
2069void 2069void
2070pmap_enter_kernel(vaddr_t va, paddr_t pa, vm_prot_t prot) 2070pmap_enter_kernel(vaddr_t va, paddr_t pa, vm_prot_t prot)
2071{ 2071{
2072 bool was_valid, insert; 2072 bool was_valid, insert;
2073 u_short pte_idx; 2073 u_short pte_idx;
2074 int flags; 2074 int flags;
2075 mmu_short_pte_t *pte; 2075 mmu_short_pte_t *pte;
2076 pv_t *pv; 2076 pv_t *pv;
2077 paddr_t old_pa; 2077 paddr_t old_pa;
2078 2078
2079 flags = (pa & ~MMU_PAGE_MASK); 2079 flags = (pa & ~MMU_PAGE_MASK);
2080 pa &= MMU_PAGE_MASK; 2080 pa &= MMU_PAGE_MASK;
@@ -3016,27 +3016,27 @@ pmap_remove(pmap_t pmap, vaddr_t sva, va @@ -3016,27 +3016,27 @@ pmap_remove(pmap_t pmap, vaddr_t sva, va
3016 if (kernel_crp.rp_addr == pmap->pm_a_phys) { 3016 if (kernel_crp.rp_addr == pmap->pm_a_phys) {
3017 kernel_crp.rp_addr = kernAphys; 3017 kernel_crp.rp_addr = kernAphys;
3018 loadcrp(&kernel_crp); 3018 loadcrp(&kernel_crp);
3019 /* will do TLB flush below */ 3019 /* will do TLB flush below */
3020 } 3020 }
3021 pmap->pm_a_tmgr = NULL; 3021 pmap->pm_a_tmgr = NULL;
3022 pmap->pm_a_phys = kernAphys; 3022 pmap->pm_a_phys = kernAphys;
3023 } 3023 }
3024 3024
3025 /* 3025 /*
3026 * If we just modified the current address space, 3026 * If we just modified the current address space,
3027 * make sure to flush the MMU cache. 3027 * make sure to flush the MMU cache.
3028 * 3028 *
3029 * XXX - this could be an unecessarily large flush. 3029 * XXX - this could be an unnecessarily large flush.
3030 * XXX - Could decide, based on the size of the VA range 3030 * XXX - Could decide, based on the size of the VA range
3031 * to be removed, whether to flush "by pages" or "all". 3031 * to be removed, whether to flush "by pages" or "all".
3032 */ 3032 */
3033 if (pmap == current_pmap()) 3033 if (pmap == current_pmap())
3034 TBIAU(); 3034 TBIAU();
3035} 3035}
3036 3036
3037/* pmap_remove_a INTERNAL 3037/* pmap_remove_a INTERNAL
3038 ** 3038 **
3039 * This is function number one in a set of three that removes a range 3039 * This is function number one in a set of three that removes a range
3040 * of memory in the most efficient manner by removing the highest possible 3040 * of memory in the most efficient manner by removing the highest possible
3041 * tables from the memory space. This particular function attempts to remove 3041 * tables from the memory space. This particular function attempts to remove
3042 * as many B tables as it can, delegating the remaining fragmented ranges to 3042 * as many B tables as it can, delegating the remaining fragmented ranges to
@@ -3050,44 +3050,44 @@ pmap_remove(pmap_t pmap, vaddr_t sva, va @@ -3050,44 +3050,44 @@ pmap_remove(pmap_t pmap, vaddr_t sva, va
3050bool 3050bool
3051pmap_remove_a(a_tmgr_t *a_tbl, vaddr_t sva, vaddr_t eva) 3051pmap_remove_a(a_tmgr_t *a_tbl, vaddr_t sva, vaddr_t eva)
3052{ 3052{
3053 bool empty; 3053 bool empty;
3054 int idx; 3054 int idx;
3055 vaddr_t nstart, nend; 3055 vaddr_t nstart, nend;
3056 b_tmgr_t *b_tbl; 3056 b_tmgr_t *b_tbl;
3057 mmu_long_dte_t *a_dte; 3057 mmu_long_dte_t *a_dte;
3058 mmu_short_dte_t *b_dte; 3058 mmu_short_dte_t *b_dte;
3059 uint8_t at_wired, bt_wired; 3059 uint8_t at_wired, bt_wired;
3060 3060
3061 /* 3061 /*
3062 * The following code works with what I call a 'granularity 3062 * The following code works with what I call a 'granularity
3063 * reduction algorithim'. A range of addresses will always have 3063 * reduction algorithm'. A range of addresses will always have
3064 * the following properties, which are classified according to 3064 * the following properties, which are classified according to
3065 * how the range relates to the size of the current granularity 3065 * how the range relates to the size of the current granularity
3066 * - an A table entry: 3066 * - an A table entry:
3067 * 3067 *
3068 * 1 2 3 4 3068 * 1 2 3 4
3069 * -+---+---+---+---+---+---+---+- 3069 * -+---+---+---+---+---+---+---+-
3070 * -+---+---+---+---+---+---+---+- 3070 * -+---+---+---+---+---+---+---+-
3071 * 3071 *
3072 * A range will always start on a granularity boundary, illustrated 3072 * A range will always start on a granularity boundary, illustrated
3073 * by '+' signs in the table above, or it will start at some point 3073 * by '+' signs in the table above, or it will start at some point
3074 * inbetween a granularity boundary, as illustrated by point 1. 3074 * in-between a granularity boundary, as illustrated by point 1.
3075 * The first step in removing a range of addresses is to remove the 3075 * The first step in removing a range of addresses is to remove the
3076 * range between 1 and 2, the nearest granularity boundary. This 3076 * range between 1 and 2, the nearest granularity boundary. This
3077 * job is handled by the section of code governed by the 3077 * job is handled by the section of code governed by the
3078 * 'if (start < nstart)' statement. 3078 * 'if (start < nstart)' statement.
3079 * 3079 *
3080 * A range will always encompass zero or more intergral granules, 3080 * A range will always encompass zero or more integral granules,
3081 * illustrated by points 2 and 3. Integral granules are easy to 3081 * illustrated by points 2 and 3. Integral granules are easy to
3082 * remove. The removal of these granules is the second step, and 3082 * remove. The removal of these granules is the second step, and
3083 * is handled by the code block 'if (nstart < nend)'. 3083 * is handled by the code block 'if (nstart < nend)'.
3084 * 3084 *
3085 * Lastly, a range will always end on a granularity boundary, 3085 * Lastly, a range will always end on a granularity boundary,
3086 * ill. by point 3, or it will fall just beyond one, ill. by point 3086 * ill. by point 3, or it will fall just beyond one, ill. by point
3087 * 4. The last step involves removing this range and is handled by 3087 * 4. The last step involves removing this range and is handled by
3088 * the code block 'if (nend < end)'. 3088 * the code block 'if (nend < end)'.
3089 */ 3089 */
3090 nstart = MMU_ROUND_UP_A(sva); 3090 nstart = MMU_ROUND_UP_A(sva);
3091 nend = MMU_ROUND_A(eva); 3091 nend = MMU_ROUND_A(eva);
3092 3092
3093 at_wired = a_tbl->at_wcnt; 3093 at_wired = a_tbl->at_wcnt;
@@ -3582,27 +3582,27 @@ pmap_kcore_hdr(struct sun3x_kcore_hdr *s @@ -3582,27 +3582,27 @@ pmap_kcore_hdr(struct sun3x_kcore_hdr *s
3582 spa = avail_mem[i].pmem_start; 3582 spa = avail_mem[i].pmem_start;
3583 spa = m68k_trunc_page(spa); 3583 spa = m68k_trunc_page(spa);
3584 len = avail_mem[i].pmem_end - spa; 3584 len = avail_mem[i].pmem_end - spa;
3585 len = m68k_round_page(len); 3585 len = m68k_round_page(len);
3586 sh->ram_segs[i].start = spa; 3586 sh->ram_segs[i].start = spa;
3587 sh->ram_segs[i].size = len; 3587 sh->ram_segs[i].size = len;
3588 } 3588 }
3589} 3589}
3590 3590
3591 3591
3592/* pmap_virtual_space INTERFACE 3592/* pmap_virtual_space INTERFACE
3593 ** 3593 **
3594 * Return the current available range of virtual addresses in the 3594 * Return the current available range of virtual addresses in the
3595 * arguuments provided. Only really called once. 3595 * arguments provided. Only really called once.
3596 */ 3596 */
3597void 3597void
3598pmap_virtual_space(vaddr_t *vstart, vaddr_t *vend) 3598pmap_virtual_space(vaddr_t *vstart, vaddr_t *vend)
3599{ 3599{
3600 3600
3601 *vstart = virtual_avail; 3601 *vstart = virtual_avail;
3602 *vend = virtual_end; 3602 *vend = virtual_end;
3603} 3603}
3604 3604
3605/* 3605/*
3606 * Provide memory to the VM system. 3606 * Provide memory to the VM system.
3607 * 3607 *
3608 * Assume avail_start is always in the 3608 * Assume avail_start is always in the
@@ -3639,27 +3639,27 @@ pmap_page_upload(void) @@ -3639,27 +3639,27 @@ pmap_page_upload(void)
3639 * map statistics. 3639 * map statistics.
3640 */ 3640 */
3641segsz_t 3641segsz_t
3642pmap_count(pmap_t pmap, int type) 3642pmap_count(pmap_t pmap, int type)
3643{ 3643{
3644 u_int count; 3644 u_int count;
3645 int a_idx, b_idx; 3645 int a_idx, b_idx;
3646 a_tmgr_t *a_tbl; 3646 a_tmgr_t *a_tbl;
3647 b_tmgr_t *b_tbl; 3647 b_tmgr_t *b_tbl;
3648 c_tmgr_t *c_tbl; 3648 c_tmgr_t *c_tbl;
3649 3649
3650 /* 3650 /*
3651 * If the pmap does not have its own A table manager, it has no 3651 * If the pmap does not have its own A table manager, it has no
3652 * valid entires. 3652 * valid entries.
3653 */ 3653 */
3654 if (pmap->pm_a_tmgr == NULL) 3654 if (pmap->pm_a_tmgr == NULL)
3655 return 0; 3655 return 0;
3656 3656
3657 a_tbl = pmap->pm_a_tmgr; 3657 a_tbl = pmap->pm_a_tmgr;
3658 3658
3659 count = 0; 3659 count = 0;
3660 for (a_idx = 0; a_idx < MMU_TIA(KERNBASE3X); a_idx++) { 3660 for (a_idx = 0; a_idx < MMU_TIA(KERNBASE3X); a_idx++) {
3661 if (MMU_VALID_DT(a_tbl->at_dtbl[a_idx])) { 3661 if (MMU_VALID_DT(a_tbl->at_dtbl[a_idx])) {
3662 b_tbl = mmuB2tmgr(mmu_ptov(a_tbl->at_dtbl[a_idx].addr.raw)); 3662 b_tbl = mmuB2tmgr(mmu_ptov(a_tbl->at_dtbl[a_idx].addr.raw));
3663 for (b_idx = 0; b_idx < MMU_B_TBL_SIZE; b_idx++) { 3663 for (b_idx = 0; b_idx < MMU_B_TBL_SIZE; b_idx++) {
3664 if (MMU_VALID_DT(b_tbl->bt_dtbl[b_idx])) { 3664 if (MMU_VALID_DT(b_tbl->bt_dtbl[b_idx])) {
3665 c_tbl = mmuC2tmgr( 3665 c_tbl = mmuC2tmgr(

cvs diff -r1.56 -r1.57 src/sys/arch/x68k/dev/mha.c (expand / switch to unified diff)

--- src/sys/arch/x68k/dev/mha.c 2021/08/07 16:19:07 1.56
+++ src/sys/arch/x68k/dev/mha.c 2022/05/04 07:48:34 1.57
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: mha.c,v 1.56 2021/08/07 16:19:07 thorpej Exp $ */ 1/* $NetBSD: mha.c,v 1.57 2022/05/04 07:48:34 andvar Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1996-1999 The NetBSD Foundation, Inc. 4 * Copyright (c) 1996-1999 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 Charles M. Hannum, Masaru Oki, Takumi Nakamura, Masanobu Saitoh and 8 * by Charles M. Hannum, Masaru Oki, Takumi Nakamura, Masanobu Saitoh and
9 * Minoura Makoto. 9 * Minoura Makoto.
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 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 49 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
50 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 50 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
51 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 51 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
52 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 52 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
53 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 53 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
54 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 54 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 55 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
56 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 56 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
57 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 57 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
58 * POSSIBILITY OF SUCH DAMAGE. 58 * POSSIBILITY OF SUCH DAMAGE.
59 */ 59 */
60 60
61#include <sys/cdefs.h> 61#include <sys/cdefs.h>
62__KERNEL_RCSID(0, "$NetBSD: mha.c,v 1.56 2021/08/07 16:19:07 thorpej Exp $"); 62__KERNEL_RCSID(0, "$NetBSD: mha.c,v 1.57 2022/05/04 07:48:34 andvar Exp $");
63 63
64#include "opt_ddb.h" 64#include "opt_ddb.h"
65 65
66/* Synchronous data transfers? */ 66/* Synchronous data transfers? */
67#define SPC_USE_SYNCHRONOUS 0 67#define SPC_USE_SYNCHRONOUS 0
68#define SPC_SYNC_REQ_ACK_OFS 8 68#define SPC_SYNC_REQ_ACK_OFS 8
69 69
70/* Default DMA mode? */ 70/* Default DMA mode? */
71#define MHA_DMA_LIMIT_XFER 1 71#define MHA_DMA_LIMIT_XFER 1
72#define MHA_DMA_BURST_XFER 1 72#define MHA_DMA_BURST_XFER 1
73#define MHA_DMA_SHORT_BUS_CYCLE 1 73#define MHA_DMA_SHORT_BUS_CYCLE 1
74 74
75#define MHA_DMA_DATAIN (0 | (MHA_DMA_LIMIT_XFER << 1) \ 75#define MHA_DMA_DATAIN (0 | (MHA_DMA_LIMIT_XFER << 1) \
@@ -802,27 +802,27 @@ mha_poll(struct mha_softc *sc, struct ac @@ -802,27 +802,27 @@ mha_poll(struct mha_softc *sc, struct ac
802 */ 802 */
803 803
804/* 804/*
805 * Set synchronous transfer offset and period. 805 * Set synchronous transfer offset and period.
806 */ 806 */
807inline void 807inline void
808mha_setsync(struct mha_softc *sc, struct spc_tinfo *ti) 808mha_setsync(struct mha_softc *sc, struct spc_tinfo *ti)
809{ 809{
810} 810}
811 811
812/* 812/*
813 * Schedule a SCSI operation. This has now been pulled out of the interrupt 813 * Schedule a SCSI operation. This has now been pulled out of the interrupt
814 * handler so that we may call it from mha_scsi_cmd and mha_done. This may 814 * handler so that we may call it from mha_scsi_cmd and mha_done. This may
815 * save us an unecessary interrupt just to get things going. Should only be 815 * save us an unnecessary interrupt just to get things going. Should only be
816 * called when state == SPC_IDLE and at bio pl. 816 * called when state == SPC_IDLE and at bio pl.
817 */ 817 */
818void 818void
819mha_sched(struct mha_softc *sc) 819mha_sched(struct mha_softc *sc)
820{ 820{
821 struct scsipi_periph *periph; 821 struct scsipi_periph *periph;
822 struct acb *acb; 822 struct acb *acb;
823 int t; 823 int t;
824 824
825 SPC_TRACE(("[mha_sched] ")); 825 SPC_TRACE(("[mha_sched] "));
826 if (sc->sc_state != SPC_IDLE) 826 if (sc->sc_state != SPC_IDLE)
827 panic("mha_sched: not IDLE (state=%d)", sc->sc_state); 827 panic("mha_sched: not IDLE (state=%d)", sc->sc_state);
828 828

cvs diff -r1.40 -r1.41 src/sys/dev/i2o/iopsp.c (expand / switch to unified diff)

--- src/sys/dev/i2o/iopsp.c 2021/08/07 16:19:11 1.40
+++ src/sys/dev/i2o/iopsp.c 2022/05/04 07:48:34 1.41
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: iopsp.c,v 1.40 2021/08/07 16:19:11 thorpej Exp $ */ 1/* $NetBSD: iopsp.c,v 1.41 2022/05/04 07:48:34 andvar Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2000, 2001, 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2000, 2001, 2007 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 Andrew Doran. 8 * by Andrew Doran.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -25,27 +25,27 @@ @@ -25,27 +25,27 @@
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32/* 32/*
33 * Raw SCSI device support for I2O. IOPs present SCSI devices individually; 33 * Raw SCSI device support for I2O. IOPs present SCSI devices individually;
34 * we group them by controlling port. 34 * we group them by controlling port.
35 */ 35 */
36 36
37#include <sys/cdefs.h> 37#include <sys/cdefs.h>
38__KERNEL_RCSID(0, "$NetBSD: iopsp.c,v 1.40 2021/08/07 16:19:11 thorpej Exp $"); 38__KERNEL_RCSID(0, "$NetBSD: iopsp.c,v 1.41 2022/05/04 07:48:34 andvar Exp $");
39 39
40#include <sys/param.h> 40#include <sys/param.h>
41#include <sys/systm.h> 41#include <sys/systm.h>
42#include <sys/kernel.h> 42#include <sys/kernel.h>
43#include <sys/device.h> 43#include <sys/device.h>
44#include <sys/queue.h> 44#include <sys/queue.h>
45#include <sys/proc.h> 45#include <sys/proc.h>
46#include <sys/buf.h> 46#include <sys/buf.h>
47#include <sys/endian.h> 47#include <sys/endian.h>
48#include <sys/malloc.h> 48#include <sys/malloc.h>
49#include <sys/scsiio.h> 49#include <sys/scsiio.h>
50 50
51#include <sys/bswap.h> 51#include <sys/bswap.h>
@@ -136,27 +136,27 @@ iopsp_attach(device_t parent, device_t s @@ -136,27 +136,27 @@ iopsp_attach(device_t parent, device_t s
136 sc->sc_ii.ii_tid = ia->ia_tid; 136 sc->sc_ii.ii_tid = ia->ia_tid;
137 sc->sc_ii.ii_reconfig = iopsp_reconfig; 137 sc->sc_ii.ii_reconfig = iopsp_reconfig;
138 sc->sc_ii.ii_adjqparam = iopsp_adjqparam; 138 sc->sc_ii.ii_adjqparam = iopsp_adjqparam;
139 iop_initiator_register(iop, &sc->sc_ii); 139 iop_initiator_register(iop, &sc->sc_ii);
140 140
141 rv = iop_field_get_all(iop, ia->ia_tid, I2O_PARAM_HBA_CTLR_INFO, 141 rv = iop_field_get_all(iop, ia->ia_tid, I2O_PARAM_HBA_CTLR_INFO,
142 &param, sizeof(param), NULL); 142 &param, sizeof(param), NULL);
143 if (rv != 0) 143 if (rv != 0)
144 goto bad; 144 goto bad;
145 145
146 fc = (param.p.ci.bustype == I2O_HBA_BUS_FCA); 146 fc = (param.p.ci.bustype == I2O_HBA_BUS_FCA);
147 147
148 /* 148 /*
149 * Say what the device is. If we can find out what the controling 149 * Say what the device is. If we can find out what the controlling
150 * device is, say what that is too. 150 * device is, say what that is too.
151 */ 151 */
152 aprint_normal(": SCSI port"); 152 aprint_normal(": SCSI port");
153 iop_print_ident(iop, ia->ia_tid); 153 iop_print_ident(iop, ia->ia_tid);
154 aprint_normal("\n"); 154 aprint_normal("\n");
155 155
156 rv = iop_field_get_all(iop, ia->ia_tid, I2O_PARAM_HBA_SCSI_CTLR_INFO, 156 rv = iop_field_get_all(iop, ia->ia_tid, I2O_PARAM_HBA_SCSI_CTLR_INFO,
157 &param, sizeof(param), NULL); 157 &param, sizeof(param), NULL);
158 if (rv != 0) 158 if (rv != 0)
159 goto bad; 159 goto bad;
160 160
161 aprint_normal_dev(sc->sc_dev, ""); 161 aprint_normal_dev(sc->sc_dev, "");
162 if (fc) 162 if (fc)

cvs diff -r1.71 -r1.72 src/sys/dev/sbus/stp4020.c (expand / switch to unified diff)

--- src/sys/dev/sbus/stp4020.c 2021/08/07 16:19:15 1.71
+++ src/sys/dev/sbus/stp4020.c 2022/05/04 07:48:35 1.72
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: stp4020.c,v 1.71 2021/08/07 16:19:15 thorpej Exp $ */ 1/* $NetBSD: stp4020.c,v 1.72 2022/05/04 07:48:35 andvar Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1998 The NetBSD Foundation, Inc. 4 * Copyright (c) 1998 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 Paul Kranenburg. 8 * by Paul Kranenburg.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -24,27 +24,27 @@ @@ -24,27 +24,27 @@
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32/* 32/*
33 * STP4020: SBus/PCMCIA bridge supporting two Type-3 PCMCIA cards. 33 * STP4020: SBus/PCMCIA bridge supporting two Type-3 PCMCIA cards.
34 */ 34 */
35 35
36#include <sys/cdefs.h> 36#include <sys/cdefs.h>
37__KERNEL_RCSID(0, "$NetBSD: stp4020.c,v 1.71 2021/08/07 16:19:15 thorpej Exp $"); 37__KERNEL_RCSID(0, "$NetBSD: stp4020.c,v 1.72 2022/05/04 07:48:35 andvar Exp $");
38 38
39#include <sys/param.h> 39#include <sys/param.h>
40#include <sys/systm.h> 40#include <sys/systm.h>
41#include <sys/errno.h> 41#include <sys/errno.h>
42#include <sys/malloc.h> 42#include <sys/malloc.h>
43#include <sys/extent.h> 43#include <sys/extent.h>
44#include <sys/proc.h> 44#include <sys/proc.h>
45#include <sys/kernel.h> 45#include <sys/kernel.h>
46#include <sys/kthread.h> 46#include <sys/kthread.h>
47#include <sys/device.h> 47#include <sys/device.h>
48#include <sys/intr.h> 48#include <sys/intr.h>
49 49
50#include <dev/pcmcia/pcmciareg.h> 50#include <dev/pcmcia/pcmciareg.h>
@@ -972,34 +972,34 @@ stp4020_chip_socket_settype(pcmcia_chips @@ -972,34 +972,34 @@ stp4020_chip_socket_settype(pcmcia_chips
972 */ 972 */
973 v = stp4020_rd_sockctl(h, STP4020_ICR0_IDX); 973 v = stp4020_rd_sockctl(h, STP4020_ICR0_IDX);
974 v &= ~(STP4020_ICR0_IOIE | STP4020_ICR0_IOILVL | STP4020_ICR0_IFTYPE | 974 v &= ~(STP4020_ICR0_IOIE | STP4020_ICR0_IOILVL | STP4020_ICR0_IFTYPE |
975 STP4020_ICR0_SPKREN); 975 STP4020_ICR0_SPKREN);
976 if (type == PCMCIA_IFTYPE_IO) { 976 if (type == PCMCIA_IFTYPE_IO) {
977 v |= STP4020_ICR0_IFTYPE_IO|STP4020_ICR0_IOIE 977 v |= STP4020_ICR0_IFTYPE_IO|STP4020_ICR0_IOIE
978 |STP4020_ICR0_SPKREN; 978 |STP4020_ICR0_SPKREN;
979 v |= h->sbus_intno ? STP4020_ICR0_IOILVL_SB1 979 v |= h->sbus_intno ? STP4020_ICR0_IOILVL_SB1
980 : STP4020_ICR0_IOILVL_SB0; 980 : STP4020_ICR0_IOILVL_SB0;
981#ifndef SUN4U 981#ifndef SUN4U
982 h->int_enable = v; 982 h->int_enable = v;
983 h->int_disable = v & ~STP4020_ICR0_IOIE; 983 h->int_disable = v & ~STP4020_ICR0_IOIE;
984#endif 984#endif
985 DPRINTF(("%s: configuring card for IO useage\n", device_xname(h->sc->sc_dev))); 985 DPRINTF(("%s: configuring card for IO usage\n", device_xname(h->sc->sc_dev)));
986 } else { 986 } else {
987 v |= STP4020_ICR0_IFTYPE_MEM; 987 v |= STP4020_ICR0_IFTYPE_MEM;
988#ifndef SUN4U 988#ifndef SUN4U
989 h->int_enable = h->int_disable = v; 989 h->int_enable = h->int_disable = v;
990#endif 990#endif
991 DPRINTF(("%s: configuring card for IO useage\n", device_xname(h->sc->sc_dev))); 991 DPRINTF(("%s: configuring card for IO usage\n", device_xname(h->sc->sc_dev)));
992 DPRINTF(("%s: configuring card for MEM ONLY useage\n", device_xname(h->sc->sc_dev))); 992 DPRINTF(("%s: configuring card for MEM ONLY usage\n", device_xname(h->sc->sc_dev)));
993 } 993 }
994 stp4020_wr_sockctl(h, STP4020_ICR0_IDX, v); 994 stp4020_wr_sockctl(h, STP4020_ICR0_IDX, v);
995} 995}
996 996
997void 997void
998stp4020_chip_socket_disable(pcmcia_chipset_handle_t pch) 998stp4020_chip_socket_disable(pcmcia_chipset_handle_t pch)
999{ 999{
1000 struct stp4020_socket *h = (struct stp4020_socket *)pch; 1000 struct stp4020_socket *h = (struct stp4020_socket *)pch;
1001 int v; 1001 int v;
1002 1002
1003 /* 1003 /*
1004 * Disable socket I/O interrupts. 1004 * Disable socket I/O interrupts.
1005 */ 1005 */

cvs diff -r1.69 -r1.70 src/sys/net/ppp_tty.c (expand / switch to unified diff)

--- src/sys/net/ppp_tty.c 2021/12/13 02:53:43 1.69
+++ src/sys/net/ppp_tty.c 2022/05/04 07:48:35 1.70
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ppp_tty.c,v 1.69 2021/12/13 02:53:43 msaitoh Exp $ */ 1/* $NetBSD: ppp_tty.c,v 1.70 2022/05/04 07:48:35 andvar Exp $ */
2/* Id: ppp_tty.c,v 1.3 1996/07/01 01:04:11 paulus Exp */ 2/* Id: ppp_tty.c,v 1.3 1996/07/01 01:04:11 paulus Exp */
3 3
4/* 4/*
5 * ppp_tty.c - Point-to-Point Protocol (PPP) driver for asynchronous 5 * ppp_tty.c - Point-to-Point Protocol (PPP) driver for asynchronous
6 * tty devices. 6 * tty devices.
7 * 7 *
8 * Copyright (c) 1984-2000 Carnegie Mellon University. All rights reserved. 8 * Copyright (c) 1984-2000 Carnegie Mellon University. All rights reserved.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 13 *
14 * 1. Redistributions of source code must retain the above copyright 14 * 1. Redistributions of source code must retain the above copyright
@@ -83,27 +83,27 @@ @@ -83,27 +83,27 @@
83 * caused system crashes and packet corruption. Changed pppstart 83 * caused system crashes and packet corruption. Changed pppstart
84 * so that it doesn't just give up with a "collision" if the whole 84 * so that it doesn't just give up with a "collision" if the whole
85 * packet doesn't fit in the output ring buffer. 85 * packet doesn't fit in the output ring buffer.
86 * 86 *
87 * Added priority queueing for interactive IP packets, following 87 * Added priority queueing for interactive IP packets, following
88 * the model of if_sl.c, plus hooks for bpf. 88 * the model of if_sl.c, plus hooks for bpf.
89 * Paul Mackerras (paulus@cs.anu.edu.au). 89 * Paul Mackerras (paulus@cs.anu.edu.au).
90 */ 90 */
91 91
92/* from if_sl.c,v 1.11 84/10/04 12:54:47 rick Exp */ 92/* from if_sl.c,v 1.11 84/10/04 12:54:47 rick Exp */
93/* from NetBSD: if_ppp.c,v 1.15.2.2 1994/07/28 05:17:58 cgd Exp */ 93/* from NetBSD: if_ppp.c,v 1.15.2.2 1994/07/28 05:17:58 cgd Exp */
94 94
95#include <sys/cdefs.h> 95#include <sys/cdefs.h>
96__KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.69 2021/12/13 02:53:43 msaitoh Exp $"); 96__KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.70 2022/05/04 07:48:35 andvar Exp $");
97 97
98#ifdef _KERNEL_OPT 98#ifdef _KERNEL_OPT
99#include "ppp.h" 99#include "ppp.h"
100#include "opt_ppp.h" 100#include "opt_ppp.h"
101#endif 101#endif
102#define VJC 102#define VJC
103#define PPP_COMPRESS 103#define PPP_COMPRESS
104 104
105#include <sys/param.h> 105#include <sys/param.h>
106#include <sys/proc.h> 106#include <sys/proc.h>
107#include <sys/mbuf.h> 107#include <sys/mbuf.h>
108#include <sys/dkstat.h> 108#include <sys/dkstat.h>
109#include <sys/socket.h> 109#include <sys/socket.h>
@@ -303,27 +303,27 @@ pppasyncrelinq(struct ppp_softc *sc) @@ -303,27 +303,27 @@ pppasyncrelinq(struct ppp_softc *sc)
303/* 303/*
304 * Line specific (tty) read routine. 304 * Line specific (tty) read routine.
305 */ 305 */
306static int 306static int
307pppread(struct tty *tp, struct uio *uio, int flag) 307pppread(struct tty *tp, struct uio *uio, int flag)
308{ 308{
309 struct ppp_softc *sc = (struct ppp_softc *)tp->t_sc; 309 struct ppp_softc *sc = (struct ppp_softc *)tp->t_sc;
310 struct mbuf *m, *m0; 310 struct mbuf *m, *m0;
311 int error = 0; 311 int error = 0;
312 312
313 if (sc == NULL) 313 if (sc == NULL)
314 return 0; 314 return 0;
315 /* 315 /*
316 * Loop waiting for input, checking that nothing disasterous 316 * Loop waiting for input, checking that nothing disastrous
317 * happens in the meantime. 317 * happens in the meantime.
318 */ 318 */
319 mutex_spin_enter(&tty_lock); 319 mutex_spin_enter(&tty_lock);
320 for (;;) { 320 for (;;) {
321 if (tp != (struct tty *) sc->sc_devp || 321 if (tp != (struct tty *) sc->sc_devp ||
322 tp->t_linesw != &ppp_disc) { 322 tp->t_linesw != &ppp_disc) {
323 mutex_spin_exit(&tty_lock); 323 mutex_spin_exit(&tty_lock);
324 return 0; 324 return 0;
325 } 325 }
326 if (sc->sc_inq.ifq_head != NULL) 326 if (sc->sc_inq.ifq_head != NULL)
327 break; 327 break;
328 if ((tp->t_state & TS_CARR_ON) == 0 && (tp->t_cflag & CLOCAL) == 0 328 if ((tp->t_state & TS_CARR_ON) == 0 && (tp->t_cflag & CLOCAL) == 0
329 && (tp->t_state & TS_ISOPEN)) { 329 && (tp->t_state & TS_ISOPEN)) {