From 2dd1186c7e1249993053bbb35dc0acc716c148f4 Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Fri, 27 Jan 2017 21:18:23 +0000 Subject: [PATCH 01/51] Rename LLD_AS_LD to LLD_IS_LD, for consistency with CLANG_IS_CC An additional case missed in r312855 --- tools/build/mk/OptionalObsoleteFiles.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc index 13d327b9770b..166998a7a2d4 100644 --- a/tools/build/mk/OptionalObsoleteFiles.inc +++ b/tools/build/mk/OptionalObsoleteFiles.inc @@ -221,7 +221,7 @@ OLD_DIRS+=usr/share/examples/bhyve .if ${MK_BINUTILS} == no OLD_FILES+=usr/bin/as -.if ${MK_LLD_AS_LD} == no +.if ${MK_LLD_IS_LD} == no OLD_FILES+=usr/bin/ld .endif OLD_FILES+=usr/bin/ld.bfd From 5be48d84bed3ed2544b3f70a3fee1120dd9e8073 Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Fri, 27 Jan 2017 21:31:32 +0000 Subject: [PATCH 02/51] add octeon+ as an alias for octeon in GCC & binutils In r208737 jmallett@ added support for the "mips64r2" architecture and "octeon" CPU, and the saa/saad instructions. Upstream binutils also added the "octeon+" CPU, and the saa/saad instructions are only available in octeon+, not octeon. Since our base system tool chain already accepts saa/saad with -march=octeon, just allow octeon+ as an alias. This allows the use of octeon+ in kernel config files, for use with both external tool chain and in-tree GCC/binutils. PR: 216516 MFC after: 1 month Sponsored by: The FreeBSD Foundation --- contrib/binutils/gas/config/tc-mips.c | 1 + contrib/gcc/config/mips/mips.c | 1 + contrib/gcc/config/mips/mips.h | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/contrib/binutils/gas/config/tc-mips.c b/contrib/binutils/gas/config/tc-mips.c index 80fdfd01af41..d1f745e1a1ea 100644 --- a/contrib/binutils/gas/config/tc-mips.c +++ b/contrib/binutils/gas/config/tc-mips.c @@ -15156,6 +15156,7 @@ static const struct mips_cpu_info mips_cpu_info_table[] = /* Cavium Networks Octeon CPU core */ { "octeon", 0, ISA_MIPS64R2, CPU_OCTEON }, + { "octeon+", 0, ISA_MIPS64R2, CPU_OCTEON }, /* End marker */ { NULL, 0, 0, 0 } diff --git a/contrib/gcc/config/mips/mips.c b/contrib/gcc/config/mips/mips.c index faa4e4639077..5a7792ccb7c0 100644 --- a/contrib/gcc/config/mips/mips.c +++ b/contrib/gcc/config/mips/mips.c @@ -765,6 +765,7 @@ const struct mips_cpu_info mips_cpu_info_table[] = { /* MIPS64R2 */ { "octeon", PROCESSOR_OCTEON, 65 }, + { "octeon+", PROCESSOR_OCTEON, 65 }, /* End marker */ { 0, 0, 0 } diff --git a/contrib/gcc/config/mips/mips.h b/contrib/gcc/config/mips/mips.h index 1ba14029b29a..cba35a27f1c6 100644 --- a/contrib/gcc/config/mips/mips.h +++ b/contrib/gcc/config/mips/mips.h @@ -285,7 +285,10 @@ extern const struct mips_rtx_cost_data *mips_cost; \ macro = concat ((PREFIX), "_", (INFO)->name, NULL); \ for (p = macro; *p != 0; p++) \ - *p = TOUPPER (*p); \ + if (*p == '+') \ + *p = 'P'; \ + else \ + *p = TOUPPER (*p); \ \ builtin_define (macro); \ builtin_define_with_value ((PREFIX), (INFO)->name, 1); \ From bf1a88953595ed52bf6b29180dcfed22b37f7b5d Mon Sep 17 00:00:00 2001 From: Scott Long Date: Fri, 27 Jan 2017 21:55:47 +0000 Subject: [PATCH 03/51] Squash a couple of uses of xpt_print_path() Sponsored by: Netflix --- sys/cam/cam_xpt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index 7754e9b1487a..f6cab5b81124 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -3062,8 +3062,8 @@ xpt_action_default(union ccb *start_ccb) case XPT_TERM_IO: case XPT_ENG_INQ: /* XXX Implement */ - xpt_print_path(start_ccb->ccb_h.path); - printf("%s: CCB type %#x %s not supported\n", __func__, + xpt_print(start_ccb->ccb_h.path, + "%s: CCB type %#x %s not supported\n", __func__, start_ccb->ccb_h.func_code, xpt_action_name(start_ccb->ccb_h.func_code)); start_ccb->ccb_h.status = CAM_PROVIDE_FAIL; @@ -3944,8 +3944,8 @@ xpt_bus_register(struct cam_sim *sim, device_t parent, u_int32_t bus) } } if (new_bus->xport == NULL) { - xpt_print_path(path); - printf("No transport found for %d\n", cpi.transport); + xpt_print(path, + "No transport found for %d\n", cpi.transport); xpt_release_bus(new_bus); free(path, M_CAMXPT); return (CAM_RESRC_UNAVAIL); From f1f7f1cb29e025497080881406abacf7355df58c Mon Sep 17 00:00:00 2001 From: Mateusz Guzik Date: Fri, 27 Jan 2017 22:13:15 +0000 Subject: [PATCH 04/51] hwpmc: partially depessimize mmap handling if the module is not loaded In particular this means the pmc sx lock is no longer taken when an executable mapping succeeds. MFC after: 1 week --- sys/kern/vfs_vnops.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 06a9e129e6b0..064786426cb6 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -2460,10 +2460,12 @@ vn_mmap(struct file *fp, vm_map_t map, vm_offset_t *addr, vm_size_t size, } #ifdef HWPMC_HOOKS /* Inform hwpmc(4) if an executable is being mapped. */ - if (error == 0 && (prot & VM_PROT_EXECUTE) != 0) { - pkm.pm_file = vp; - pkm.pm_address = (uintptr_t) *addr; - PMC_CALL_HOOK(td, PMC_FN_MMAP, (void *) &pkm); + if (PMC_HOOK_INSTALLED(PMC_FN_MMAP)) { + if ((prot & VM_PROT_EXECUTE) != 0 && error == 0) { + pkm.pm_file = vp; + pkm.pm_address = (uintptr_t) *addr; + PMC_CALL_HOOK(td, PMC_FN_MMAP, (void *) &pkm); + } } #endif return (error); From 95839d3d256bb5e095c2feb736b73c930b90ff41 Mon Sep 17 00:00:00 2001 From: Mateusz Guzik Date: Fri, 27 Jan 2017 22:14:42 +0000 Subject: [PATCH 05/51] hwpmc: annotate pmc_hook and pmc_intr as __read_mostly MFC after: 1 month --- sys/kern/kern_pmc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_pmc.c b/sys/kern/kern_pmc.c index 09dc6edbcffe..43943da72213 100644 --- a/sys/kern/kern_pmc.c +++ b/sys/kern/kern_pmc.c @@ -59,10 +59,10 @@ MALLOC_DEFINE(M_PMCHOOKS, "pmchooks", "Memory space for PMC hooks"); const int pmc_kernel_version = PMC_KERNEL_VERSION; /* Hook variable. */ -int (*pmc_hook)(struct thread *td, int function, void *arg) = NULL; +int __read_mostly (*pmc_hook)(struct thread *td, int function, void *arg) = NULL; /* Interrupt handler */ -int (*pmc_intr)(int cpu, struct trapframe *tf) = NULL; +int __read_mostly (*pmc_intr)(int cpu, struct trapframe *tf) = NULL; /* Bitmask of CPUs requiring servicing at hardclock time */ volatile cpuset_t pmc_cpumask; From 96eeabefbe7b3d14e195815f4913c7c08a52b716 Mon Sep 17 00:00:00 2001 From: Sean Bruno Date: Fri, 27 Jan 2017 22:30:27 +0000 Subject: [PATCH 06/51] Replace customized busmaster code with standardized setup call. Reported by: jhb --- sys/net/iflib.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index acad313c51cc..23a548e6dd96 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -4781,12 +4781,9 @@ iflib_msix_init(if_ctx_t ctx) ** successfully initialize us. */ { - uint16_t pci_cmd_word; int msix_ctrl, rid; - pci_cmd_word = pci_read_config(dev, PCIR_COMMAND, 2); - pci_cmd_word |= PCIM_CMD_BUSMASTEREN; - pci_write_config(dev, PCIR_COMMAND, pci_cmd_word, 2); + pci_enable_busmaster(dev); rid = 0; if (pci_find_cap(dev, PCIY_MSIX, &rid) == 0 && rid != 0) { rid += PCIR_MSIX_CTRL; From b67915014d098c85d619aa84154507070dd8522b Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Fri, 27 Jan 2017 23:03:28 +0000 Subject: [PATCH 07/51] Don't drop a reference to the TOE PCB in undo_offload_socket(). undo_offload_socket() is only called by t4_connect() during a connection setup failure, but t4_connect() still owns the TOE PCB and frees ita after undo_offload_socket() returns. Release a reference in undo_offload_socket() resulted in a double-free which panicked when t4_connect() performed the second free. The reference release was added to undo_offload_socket() incorrectly in r299210. MFC after: 1 week Sponsored by: Chelsio Communications --- sys/dev/cxgbe/tom/t4_tom.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/dev/cxgbe/tom/t4_tom.c b/sys/dev/cxgbe/tom/t4_tom.c index 1448aad009f8..cf69c5fbb343 100644 --- a/sys/dev/cxgbe/tom/t4_tom.c +++ b/sys/dev/cxgbe/tom/t4_tom.c @@ -273,8 +273,6 @@ undo_offload_socket(struct socket *so) mtx_lock(&td->toep_list_lock); TAILQ_REMOVE(&td->toep_list, toep, link); mtx_unlock(&td->toep_list_lock); - - free_toepcb(toep); } static void From e035717e570f7c97ddc94712119941dbfb96b2a7 Mon Sep 17 00:00:00 2001 From: Sean Bruno Date: Fri, 27 Jan 2017 23:08:06 +0000 Subject: [PATCH 08/51] IFLIB updates: We found routing performance dropped significantly when configuring FreeBSD as a router, we are applying the following changes in order to resolve those issues and hopefully perform better. - don't prefetch the flags array, we usually don't need it - prefetch the next cache line of each of the software descriptor arrays as well as the first cache line of each of the next four packets' mbufs and clusters - reduce max copy size to 63 bytes - convert rx soft descriptors from array of structures to a structure of arrays - update copyrights Submitted by: Matt Macy --- sys/net/iflib.c | 271 ++++++++++++++++++++++++++++++------------------ sys/net/iflib.h | 2 +- 2 files changed, 170 insertions(+), 103 deletions(-) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 23a548e6dd96..c6cc40535904 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014-2016, Matthew Macy + * Copyright (c) 2014-2017, Matthew Macy * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -264,18 +264,12 @@ iflib_get_sctx(if_ctx_t ctx) #define RX_SW_DESC_INUSE (1 << 3) #define TX_SW_DESC_MAPPED (1 << 4) -typedef struct iflib_sw_rx_desc { - bus_dmamap_t ifsd_map; /* bus_dma map for packet */ - struct mbuf *ifsd_m; /* rx: uninitialized mbuf */ - caddr_t ifsd_cl; /* direct cluster pointer for rx */ - uint16_t ifsd_flags; -} *iflib_rxsd_t; - -typedef struct iflib_sw_tx_desc_val { - bus_dmamap_t ifsd_map; /* bus_dma map for packet */ - struct mbuf *ifsd_m; /* pkthdr mbuf */ - uint8_t ifsd_flags; -} *iflib_txsd_val_t; +typedef struct iflib_sw_rx_desc_array { + bus_dmamap_t *ifsd_map; /* bus_dma maps for packet */ + struct mbuf **ifsd_m; /* pkthdr mbufs */ + caddr_t *ifsd_cl; /* direct cluster pointer for rx */ + uint8_t *ifsd_flags; +} iflib_rxsd_array_t; typedef struct iflib_sw_tx_desc_array { bus_dmamap_t *ifsd_map; /* bus_dma maps for packet */ @@ -287,7 +281,7 @@ typedef struct iflib_sw_tx_desc_array { /* magic number that should be high enough for any hardware */ #define IFLIB_MAX_TX_SEGS 128 #define IFLIB_MAX_RX_SEGS 32 -#define IFLIB_RX_COPY_THRESH 128 +#define IFLIB_RX_COPY_THRESH 63 #define IFLIB_MAX_RX_REFRESH 32 #define IFLIB_QUEUE_IDLE 0 #define IFLIB_QUEUE_HUNG 1 @@ -383,7 +377,7 @@ struct iflib_fl { uint16_t ifl_buf_size; uint16_t ifl_cltype; uma_zone_t ifl_zone; - iflib_rxsd_t ifl_sds; + iflib_rxsd_array_t ifl_sds; iflib_rxq_t ifl_rxq; uint8_t ifl_id; bus_dma_tag_t ifl_desc_tag; @@ -909,7 +903,7 @@ iflib_netmap_rxsync(struct netmap_kring *kring, int flags) ring->slot[nm_i].len = ri.iri_len - crclen; ring->slot[nm_i].flags = slot_flags; bus_dmamap_sync(fl->ifl_ifdi->idi_tag, - fl->ifl_sds[nic_i].ifsd_map, BUS_DMASYNC_POSTREAD); + fl->ifl_sds.ifsd_map[nic_i], BUS_DMASYNC_POSTREAD); nm_i = nm_next(nm_i, lim); nic_i = nm_next(nic_i, lim); } @@ -949,14 +943,14 @@ iflib_netmap_rxsync(struct netmap_kring *kring, int flags) vaddr = addr; if (slot->flags & NS_BUF_CHANGED) { /* buffer has changed, reload map */ - netmap_reload_map(na, fl->ifl_ifdi->idi_tag, fl->ifl_sds[nic_i].ifsd_map, addr); + netmap_reload_map(na, fl->ifl_ifdi->idi_tag, fl->ifl_sds.ifsd_map[nic_i], addr); slot->flags &= ~NS_BUF_CHANGED; } /* * XXX we should be batching this operation - TODO */ ctx->isc_rxd_refill(ctx->ifc_softc, rxq->ifr_id, fl->ifl_id, nic_i, &paddr, &vaddr, 1, fl->ifl_buf_size); - bus_dmamap_sync(fl->ifl_ifdi->idi_tag, fl->ifl_sds[nic_i].ifsd_map, + bus_dmamap_sync(fl->ifl_ifdi->idi_tag, fl->ifl_sds.ifsd_map[nic_i], BUS_DMASYNC_PREREAD); nm_i = nm_next(nm_i, lim); nic_i = nm_next(nic_i, lim); @@ -1030,22 +1024,22 @@ iflib_netmap_rxq_init(if_ctx_t ctx, iflib_rxq_t rxq) { struct netmap_adapter *na = NA(ctx->ifc_ifp); struct netmap_slot *slot; - iflib_rxsd_t sd; + bus_dmamap_t *map; int nrxd; slot = netmap_reset(na, NR_RX, rxq->ifr_id, 0); if (slot == 0) return; - sd = rxq->ifr_fl[0].ifl_sds; + map = rxq->ifr_fl[0].ifl_sds.ifsd_map; nrxd = ctx->ifc_softc_ctx.isc_nrxd[0]; - for (int i = 0; i < nrxd; i++, sd++) { + for (int i = 0; i < nrxd; i++, map++) { int sj = netmap_idx_n2k(&na->rx_rings[rxq->ifr_id], i); uint64_t paddr; void *addr; caddr_t vaddr; vaddr = addr = PNMB(na, slot + sj, &paddr); - netmap_load_map(na, rxq->ifr_fl[0].ifl_ifdi->idi_tag, sd->ifsd_map, addr); + netmap_load_map(na, rxq->ifr_fl[0].ifl_ifdi->idi_tag, *map, addr); /* Update descriptor and the cached value */ ctx->isc_rxd_refill(ctx->ifc_softc, rxq->ifr_id, 0 /* fl_id */, i, &paddr, &vaddr, 1, rxq->ifr_fl[0].ifl_buf_size); } @@ -1476,7 +1470,6 @@ iflib_rxsd_alloc(iflib_rxq_t rxq) if_softc_ctx_t scctx = &ctx->ifc_softc_ctx; device_t dev = ctx->ifc_dev; iflib_fl_t fl; - iflib_rxsd_t rxsd; int err; MPASS(scctx->isc_nrxd[0] > 0); @@ -1484,13 +1477,6 @@ iflib_rxsd_alloc(iflib_rxq_t rxq) fl = rxq->ifr_fl; for (int i = 0; i < rxq->ifr_nfl; i++, fl++) { - fl->ifl_sds = malloc(sizeof(struct iflib_sw_rx_desc) * - scctx->isc_nrxd[rxq->ifr_fl_offset], M_IFLIB, - M_WAITOK | M_ZERO); - if (fl->ifl_sds == NULL) { - device_printf(dev, "Unable to allocate rx sw desc memory\n"); - return (ENOMEM); - } fl->ifl_size = scctx->isc_nrxd[rxq->ifr_fl_offset]; /* this isn't necessarily the same */ err = bus_dma_tag_create(bus_get_dma_tag(dev), /* parent */ 1, 0, /* alignment, bounds */ @@ -1509,17 +1495,49 @@ iflib_rxsd_alloc(iflib_rxq_t rxq) __func__, err); goto fail; } + if (!(fl->ifl_sds.ifsd_flags = + (uint8_t *) malloc(sizeof(uint8_t) * + scctx->isc_nrxd[rxq->ifr_fl_offset], M_IFLIB, M_NOWAIT | M_ZERO))) { + device_printf(dev, "Unable to allocate tx_buffer memory\n"); + err = ENOMEM; + goto fail; + } + if (!(fl->ifl_sds.ifsd_m = + (struct mbuf **) malloc(sizeof(struct mbuf *) * + scctx->isc_nrxd[rxq->ifr_fl_offset], M_IFLIB, M_NOWAIT | M_ZERO))) { + device_printf(dev, "Unable to allocate tx_buffer memory\n"); + err = ENOMEM; + goto fail; + } + if (!(fl->ifl_sds.ifsd_cl = + (caddr_t *) malloc(sizeof(caddr_t) * + scctx->isc_nrxd[rxq->ifr_fl_offset], M_IFLIB, M_NOWAIT | M_ZERO))) { + device_printf(dev, "Unable to allocate tx_buffer memory\n"); + err = ENOMEM; + goto fail; + } - rxsd = fl->ifl_sds; - for (int i = 0; i < scctx->isc_nrxd[rxq->ifr_fl_offset]; i++, rxsd++) { - err = bus_dmamap_create(fl->ifl_desc_tag, 0, &rxsd->ifsd_map); - if (err) { - device_printf(dev, "%s: bus_dmamap_create failed: %d\n", - __func__, err); + /* Create the descriptor buffer dma maps */ +#if defined(ACPI_DMAR) || (!(defined(__i386__) && !defined(__amd64__))) + if ((ctx->ifc_flags & IFC_DMAR) == 0) + continue; + + if (!(fl->ifl_sds.ifsd_map = + (bus_dmamap_t *) malloc(sizeof(bus_dmamap_t) * scctx->isc_nrxd[rxq->ifr_fl_offset], M_IFLIB, M_NOWAIT | M_ZERO))) { + device_printf(dev, "Unable to allocate tx_buffer map memory\n"); + err = ENOMEM; + goto fail; + } + + for (int i = 0; i < scctx->isc_nrxd[rxq->ifr_fl_offset]; i++) { + err = bus_dmamap_create(fl->ifl_desc_tag, 0, &fl->ifl_sds.ifsd_map[i]); + if (err != 0) { + device_printf(dev, "Unable to create TX DMA map\n"); goto fail; } } } +#endif return (0); fail: @@ -1568,13 +1586,21 @@ static void _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int count) { struct mbuf *m; - int pidx = fl->ifl_pidx; - iflib_rxsd_t rxsd = &fl->ifl_sds[pidx]; - caddr_t cl; + int idx, pidx = fl->ifl_pidx; + caddr_t cl, *sd_cl; + struct mbuf **sd_m; + uint8_t *sd_flags; + bus_dmamap_t *sd_map; int n, i = 0; uint64_t bus_addr; int err; + sd_m = fl->ifl_sds.ifsd_m; + sd_map = fl->ifl_sds.ifsd_map; + sd_cl = fl->ifl_sds.ifsd_cl; + sd_flags = fl->ifl_sds.ifsd_flags; + idx = pidx; + n = count; MPASS(n > 0); MPASS(fl->ifl_credits + n <= fl->ifl_size); @@ -1597,8 +1623,8 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int count) * * If the cluster is still set then we know a minimum sized packet was received */ - if ((cl = rxsd->ifsd_cl) == NULL) { - if ((cl = rxsd->ifsd_cl = m_cljget(NULL, M_NOWAIT, fl->ifl_buf_size)) == NULL) + if ((cl = sd_cl[idx]) == NULL) { + if ((cl = sd_cl[idx] = m_cljget(NULL, M_NOWAIT, fl->ifl_buf_size)) == NULL) break; #if MEMORY_LOGGING fl->ifl_cl_enqueued++; @@ -1613,16 +1639,16 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int count) DBG_COUNTER_INC(rx_allocs); #ifdef notyet - if ((rxsd->ifsd_flags & RX_SW_DESC_MAP_CREATED) == 0) { + if ((sd_flags[pidx] & RX_SW_DESC_MAP_CREATED) == 0) { int err; - if ((err = bus_dmamap_create(fl->ifl_ifdi->idi_tag, 0, &rxsd->ifsd_map))) { + if ((err = bus_dmamap_create(fl->ifl_ifdi->idi_tag, 0, &sd_map[idx]))) { log(LOG_WARNING, "bus_dmamap_create failed %d\n", err); uma_zfree(fl->ifl_zone, cl); n = 0; goto done; } - rxsd->ifsd_flags |= RX_SW_DESC_MAP_CREATED; + sd_flags[idx] |= RX_SW_DESC_MAP_CREATED; } #endif #if defined(__i386__) || defined(__amd64__) @@ -1636,7 +1662,7 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int count) cb_arg.error = 0; q = fl->ifl_rxq; - err = bus_dmamap_load(fl->ifl_desc_tag, rxsd->ifsd_map, + err = bus_dmamap_load(fl->ifl_desc_tag, sd_map[idx], cl, fl->ifl_buf_size, _rxq_refill_cb, &cb_arg, 0); if (err != 0 || cb_arg.error) { @@ -1651,28 +1677,28 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int count) } bus_addr = cb_arg.seg.ds_addr; } - rxsd->ifsd_flags |= RX_SW_DESC_INUSE; + sd_flags[idx] |= RX_SW_DESC_INUSE; - MPASS(rxsd->ifsd_m == NULL); - rxsd->ifsd_cl = cl; - rxsd->ifsd_m = m; + MPASS(sd_m[idx] == NULL); + sd_cl[idx] = cl; + sd_m[idx] = m; fl->ifl_bus_addrs[i] = bus_addr; fl->ifl_vm_addrs[i] = cl; - rxsd++; fl->ifl_credits++; i++; MPASS(fl->ifl_credits <= fl->ifl_size); - if (++fl->ifl_pidx == fl->ifl_size) { - fl->ifl_pidx = 0; + if (++idx == fl->ifl_size) { fl->ifl_gen = 1; - rxsd = fl->ifl_sds; + idx = 0; } if (n == 0 || i == IFLIB_MAX_RX_REFRESH) { ctx->isc_rxd_refill(ctx->ifc_softc, fl->ifl_rxq->ifr_id, fl->ifl_id, pidx, fl->ifl_bus_addrs, fl->ifl_vm_addrs, i, fl->ifl_buf_size); i = 0; - pidx = fl->ifl_pidx; + pidx = idx; } + fl->ifl_pidx = idx; + } done: DBG_COUNTER_INC(rxd_flush); @@ -1706,28 +1732,33 @@ iflib_fl_bufs_free(iflib_fl_t fl) uint32_t i; for (i = 0; i < fl->ifl_size; i++) { - iflib_rxsd_t d = &fl->ifl_sds[i]; + struct mbuf **sd_m = &fl->ifl_sds.ifsd_m[i]; + uint8_t *sd_flags = &fl->ifl_sds.ifsd_flags[i]; + caddr_t *sd_cl = &fl->ifl_sds.ifsd_cl[i]; - if (d->ifsd_flags & RX_SW_DESC_INUSE) { - bus_dmamap_unload(fl->ifl_desc_tag, d->ifsd_map); - bus_dmamap_destroy(fl->ifl_desc_tag, d->ifsd_map); - if (d->ifsd_m != NULL) { - m_init(d->ifsd_m, M_NOWAIT, MT_DATA, 0); - uma_zfree(zone_mbuf, d->ifsd_m); + if (*sd_flags & RX_SW_DESC_INUSE) { + if (fl->ifl_sds.ifsd_map != NULL) { + bus_dmamap_t sd_map = fl->ifl_sds.ifsd_map[i]; + bus_dmamap_unload(fl->ifl_desc_tag, sd_map); + bus_dmamap_destroy(fl->ifl_desc_tag, sd_map); } - if (d->ifsd_cl != NULL) - uma_zfree(fl->ifl_zone, d->ifsd_cl); - d->ifsd_flags = 0; + if (*sd_m != NULL) { + m_init(*sd_m, M_NOWAIT, MT_DATA, 0); + uma_zfree(zone_mbuf, *sd_m); + } + if (*sd_cl != NULL) + uma_zfree(fl->ifl_zone, *sd_cl); + *sd_flags = 0; } else { - MPASS(d->ifsd_cl == NULL); - MPASS(d->ifsd_m == NULL); + MPASS(*sd_cl == NULL); + MPASS(*sd_m == NULL); } #if MEMORY_LOGGING fl->ifl_m_dequeued++; fl->ifl_cl_dequeued++; #endif - d->ifsd_cl = NULL; - d->ifsd_m = NULL; + *sd_cl = NULL; + *sd_m = NULL; } /* * Reset free list values @@ -1807,10 +1838,14 @@ iflib_rx_sds_free(iflib_rxq_t rxq) bus_dma_tag_destroy(fl->ifl_desc_tag); fl->ifl_desc_tag = NULL; } + free(fl->ifl_sds.ifsd_m, M_IFLIB); + free(fl->ifl_sds.ifsd_cl, M_IFLIB); + /* XXX destroy maps first */ + free(fl->ifl_sds.ifsd_map, M_IFLIB); + fl->ifl_sds.ifsd_m = NULL; + fl->ifl_sds.ifsd_cl = NULL; + fl->ifl_sds.ifsd_map = NULL; } - if (rxq->ifr_fl->ifl_sds != NULL) - free(rxq->ifr_fl->ifl_sds, M_IFLIB); - free(rxq->ifr_fl, M_IFLIB); rxq->ifr_fl = NULL; rxq->ifr_cq_gen = rxq->ifr_cq_cidx = rxq->ifr_cq_pidx = 0; @@ -1995,13 +2030,33 @@ iflib_stop(if_ctx_t ctx) } } -static iflib_rxsd_t -rxd_frag_to_sd(iflib_rxq_t rxq, if_rxd_frag_t irf, int *cltype, int unload) +static inline void +prefetch_pkts(iflib_fl_t fl, int cidx) +{ + int nextptr; + int nrxd = fl->ifl_size; + + nextptr = (cidx + CACHE_PTR_INCREMENT) & (nrxd-1); + prefetch(&fl->ifl_sds.ifsd_m[nextptr]); + prefetch(&fl->ifl_sds.ifsd_cl[nextptr]); + prefetch(fl->ifl_sds.ifsd_m[(cidx + 1) & (nrxd-1)]); + prefetch(fl->ifl_sds.ifsd_m[(cidx + 2) & (nrxd-1)]); + prefetch(fl->ifl_sds.ifsd_m[(cidx + 3) & (nrxd-1)]); + prefetch(fl->ifl_sds.ifsd_m[(cidx + 4) & (nrxd-1)]); + prefetch(fl->ifl_sds.ifsd_cl[(cidx + 1) & (nrxd-1)]); + prefetch(fl->ifl_sds.ifsd_cl[(cidx + 2) & (nrxd-1)]); + prefetch(fl->ifl_sds.ifsd_cl[(cidx + 3) & (nrxd-1)]); + prefetch(fl->ifl_sds.ifsd_cl[(cidx + 4) & (nrxd-1)]); +} + +static void +rxd_frag_to_sd(iflib_rxq_t rxq, if_rxd_frag_t irf, int *cltype, int unload, iflib_fl_t *pfl, int *pcidx) { int flid, cidx; - iflib_rxsd_t sd; + bus_dmamap_t map; iflib_fl_t fl; iflib_dma_info_t di; + int next; flid = irf->irf_flid; cidx = irf->irf_idx; @@ -2012,16 +2067,22 @@ rxd_frag_to_sd(iflib_rxq_t rxq, if_rxd_frag_t irf, int *cltype, int unload) if (cltype) fl->ifl_cl_dequeued++; #endif - sd = &fl->ifl_sds[cidx]; - di = fl->ifl_ifdi; - bus_dmamap_sync(di->idi_tag, di->idi_map, - BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); + prefetch_pkts(fl, cidx); + if (fl->ifl_sds.ifsd_map != NULL) { + next = (cidx + CACHE_PTR_INCREMENT) & (fl->ifl_size-1); + prefetch(&fl->ifl_sds.ifsd_map[next]); + map = fl->ifl_sds.ifsd_map[cidx]; + di = fl->ifl_ifdi; + next = (cidx + CACHE_LINE_SIZE) & (fl->ifl_size-1); + prefetch(&fl->ifl_sds.ifsd_flags[next]); + bus_dmamap_sync(di->idi_tag, di->idi_map, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); /* not valid assert if bxe really does SGE from non-contiguous elements */ - MPASS(fl->ifl_cidx == cidx); - if (unload) - bus_dmamap_unload(fl->ifl_desc_tag, sd->ifsd_map); - + MPASS(fl->ifl_cidx == cidx); + if (unload) + bus_dmamap_unload(fl->ifl_desc_tag, map); + } if (__predict_false(++fl->ifl_cidx == fl->ifl_size)) { fl->ifl_cidx = 0; fl->ifl_gen = 0; @@ -2029,35 +2090,38 @@ rxd_frag_to_sd(iflib_rxq_t rxq, if_rxd_frag_t irf, int *cltype, int unload) /* YES ick */ if (cltype) *cltype = fl->ifl_cltype; - return (sd); + *pfl = fl; + *pcidx = cidx; } static struct mbuf * assemble_segments(iflib_rxq_t rxq, if_rxd_info_t ri) { int i, padlen , flags, cltype; - struct mbuf *m, *mh, *mt; - iflib_rxsd_t sd; - caddr_t cl; + struct mbuf *m, *mh, *mt, *sd_m; + iflib_fl_t fl; + int cidx; + caddr_t cl, sd_cl; i = 0; mh = NULL; do { - sd = rxd_frag_to_sd(rxq, &ri->iri_frags[i], &cltype, TRUE); + rxd_frag_to_sd(rxq, &ri->iri_frags[i], &cltype, TRUE, &fl, &cidx); + sd_m = fl->ifl_sds.ifsd_m[cidx]; + sd_cl = fl->ifl_sds.ifsd_cl[cidx]; - MPASS(sd->ifsd_cl != NULL); - MPASS(sd->ifsd_m != NULL); + MPASS(sd_cl != NULL); + MPASS(sd_m != NULL); /* Don't include zero-length frags */ if (ri->iri_frags[i].irf_len == 0) { /* XXX we can save the cluster here, but not the mbuf */ - m_init(sd->ifsd_m, M_NOWAIT, MT_DATA, 0); - m_free(sd->ifsd_m); - sd->ifsd_m = NULL; + m_init(sd_m, M_NOWAIT, MT_DATA, 0); + m_free(sd_m); + fl->ifl_sds.ifsd_m[cidx] = NULL; continue; } - - m = sd->ifsd_m; + m = sd_m; if (mh == NULL) { flags = M_PKTHDR|M_EXT; mh = mt = m; @@ -2069,9 +2133,9 @@ assemble_segments(iflib_rxq_t rxq, if_rxd_info_t ri) /* assuming padding is only on the first fragment */ padlen = 0; } - sd->ifsd_m = NULL; - cl = sd->ifsd_cl; - sd->ifsd_cl = NULL; + fl->ifl_sds.ifsd_m[cidx] = NULL; + cl = fl->ifl_sds.ifsd_cl[cidx]; + fl->ifl_sds.ifsd_cl[cidx] = NULL; /* Can these two be made one ? */ m_init(m, M_NOWAIT, MT_DATA, flags); @@ -2094,16 +2158,19 @@ static struct mbuf * iflib_rxd_pkt_get(iflib_rxq_t rxq, if_rxd_info_t ri) { struct mbuf *m; - iflib_rxsd_t sd; + iflib_fl_t fl; + caddr_t sd_cl; + int cidx; /* should I merge this back in now that the two paths are basically duplicated? */ if (ri->iri_nfrags == 1 && ri->iri_frags[0].irf_len <= IFLIB_RX_COPY_THRESH) { - sd = rxd_frag_to_sd(rxq, &ri->iri_frags[0], NULL, FALSE); - m = sd->ifsd_m; - sd->ifsd_m = NULL; + rxd_frag_to_sd(rxq, &ri->iri_frags[0], NULL, FALSE, &fl, &cidx); + m = fl->ifl_sds.ifsd_m[cidx]; + fl->ifl_sds.ifsd_m[cidx] = NULL; + sd_cl = fl->ifl_sds.ifsd_cl[cidx]; m_init(m, M_NOWAIT, MT_DATA, M_PKTHDR); - memcpy(m->m_data, sd->ifsd_cl, ri->iri_len); + memcpy(m->m_data, sd_cl, ri->iri_len); m->m_len = ri->iri_frags[0].irf_len; } else { m = assemble_segments(rxq, ri); diff --git a/sys/net/iflib.h b/sys/net/iflib.h index a2f8fcc7d33a..9c8a8c95e13e 100644 --- a/sys/net/iflib.h +++ b/sys/net/iflib.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014-2015, Matthew Macy (mmacy@nextbsd.org) + * Copyright (c) 2014-2017, Matthew Macy (mmacy@nextbsd.org) * All rights reserved. * * Redistribution and use in source and binary forms, with or without From fbb779cca99ce76c0ff86dda4f9ffd0291e175bd Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Fri, 27 Jan 2017 23:08:30 +0000 Subject: [PATCH 09/51] Unregister CPL handlers for TOE-related messages when unloading TOM. MFC after: 1 week Sponsored by: Chelsio Communications --- sys/dev/cxgbe/tom/t4_connect.c | 8 ++++++++ sys/dev/cxgbe/tom/t4_cpl_io.c | 12 ++++++------ sys/dev/cxgbe/tom/t4_listen.c | 10 ++++++++++ sys/dev/cxgbe/tom/t4_tom.c | 4 ++++ sys/dev/cxgbe/tom/t4_tom.h | 2 ++ 5 files changed, 30 insertions(+), 6 deletions(-) diff --git a/sys/dev/cxgbe/tom/t4_connect.c b/sys/dev/cxgbe/tom/t4_connect.c index bd78c7fced61..ebd5766081c2 100644 --- a/sys/dev/cxgbe/tom/t4_connect.c +++ b/sys/dev/cxgbe/tom/t4_connect.c @@ -275,6 +275,14 @@ t4_init_connect_cpl_handlers(void) t4_register_cpl_handler(CPL_ACT_OPEN_RPL, do_act_open_rpl); } +void +t4_uninit_connect_cpl_handlers(void) +{ + + t4_register_cpl_handler(CPL_ACT_ESTABLISH, NULL); + t4_register_cpl_handler(CPL_ACT_OPEN_RPL, NULL); +} + #define DONT_OFFLOAD_ACTIVE_OPEN(x) do { \ reason = __LINE__; \ rc = (x); \ diff --git a/sys/dev/cxgbe/tom/t4_cpl_io.c b/sys/dev/cxgbe/tom/t4_cpl_io.c index 25ad1e355348..9742da01124c 100644 --- a/sys/dev/cxgbe/tom/t4_cpl_io.c +++ b/sys/dev/cxgbe/tom/t4_cpl_io.c @@ -1848,12 +1848,12 @@ void t4_uninit_cpl_io_handlers(void) { - t4_register_cpl_handler(CPL_PEER_CLOSE, do_peer_close); - t4_register_cpl_handler(CPL_CLOSE_CON_RPL, do_close_con_rpl); - t4_register_cpl_handler(CPL_ABORT_REQ_RSS, do_abort_req); - t4_register_cpl_handler(CPL_ABORT_RPL_RSS, do_abort_rpl); - t4_register_cpl_handler(CPL_RX_DATA, do_rx_data); - t4_register_cpl_handler(CPL_FW4_ACK, do_fw4_ack); + t4_register_cpl_handler(CPL_PEER_CLOSE, NULL); + t4_register_cpl_handler(CPL_CLOSE_CON_RPL, NULL); + t4_register_cpl_handler(CPL_ABORT_REQ_RSS, NULL); + t4_register_cpl_handler(CPL_ABORT_RPL_RSS, NULL); + t4_register_cpl_handler(CPL_RX_DATA, NULL); + t4_register_cpl_handler(CPL_FW4_ACK, NULL); } /* diff --git a/sys/dev/cxgbe/tom/t4_listen.c b/sys/dev/cxgbe/tom/t4_listen.c index 0368cef10d8f..f59d9a0930d9 100644 --- a/sys/dev/cxgbe/tom/t4_listen.c +++ b/sys/dev/cxgbe/tom/t4_listen.c @@ -1622,4 +1622,14 @@ t4_init_listen_cpl_handlers(void) t4_register_cpl_handler(CPL_PASS_ACCEPT_REQ, do_pass_accept_req); t4_register_cpl_handler(CPL_PASS_ESTABLISH, do_pass_establish); } + +void +t4_uninit_listen_cpl_handlers(void) +{ + + t4_register_cpl_handler(CPL_PASS_OPEN_RPL, NULL); + t4_register_cpl_handler(CPL_CLOSE_LISTSRV_RPL, NULL); + t4_register_cpl_handler(CPL_PASS_ACCEPT_REQ, NULL); + t4_register_cpl_handler(CPL_PASS_ESTABLISH, NULL); +} #endif diff --git a/sys/dev/cxgbe/tom/t4_tom.c b/sys/dev/cxgbe/tom/t4_tom.c index cf69c5fbb343..11558c23bfa5 100644 --- a/sys/dev/cxgbe/tom/t4_tom.c +++ b/sys/dev/cxgbe/tom/t4_tom.c @@ -1227,6 +1227,10 @@ t4_tom_mod_unload(void) t4_ddp_mod_unload(); + t4_uninit_connect_cpl_handlers(); + t4_uninit_listen_cpl_handlers(); + t4_uninit_cpl_io_handlers(); + return (0); } #endif /* TCP_OFFLOAD */ diff --git a/sys/dev/cxgbe/tom/t4_tom.h b/sys/dev/cxgbe/tom/t4_tom.h index 29d819252b4d..18bc1f291c55 100644 --- a/sys/dev/cxgbe/tom/t4_tom.h +++ b/sys/dev/cxgbe/tom/t4_tom.h @@ -326,12 +326,14 @@ void release_lip(struct tom_data *, struct clip_entry *); /* t4_connect.c */ void t4_init_connect_cpl_handlers(void); +void t4_uninit_connect_cpl_handlers(void); int t4_connect(struct toedev *, struct socket *, struct rtentry *, struct sockaddr *); void act_open_failure_cleanup(struct adapter *, u_int, u_int); /* t4_listen.c */ void t4_init_listen_cpl_handlers(void); +void t4_uninit_listen_cpl_handlers(void); int t4_listen_start(struct toedev *, struct tcpcb *); int t4_listen_stop(struct toedev *, struct tcpcb *); void t4_syncache_added(struct toedev *, void *); From 6134aabe38c854d60cbe1028a16821c269f174a5 Mon Sep 17 00:00:00 2001 From: Hiren Panchasara Date: Fri, 27 Jan 2017 23:10:46 +0000 Subject: [PATCH 10/51] Add a knob to change default behavior of inheriting listen socket's tcp stack regardless of what the default stack for the system is set to. With current/default behavior, after changing the default tcp stack, the application needs to be restarted to pick up that change. Setting this new knob net.inet.tcp.functions_inherit_listen_socket_stack to '0' would change that behavior and make any new connection use the newly selected default tcp stack. Reviewed by: rrs MFC after: 2 weeks Sponsored by: Limelight Networks --- sys/netinet/tcp_syncache.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c index 725d821e4bca..2eba51d64269 100644 --- a/sys/netinet/tcp_syncache.c +++ b/sys/netinet/tcp_syncache.c @@ -120,6 +120,14 @@ SYSCTL_INT(_net_inet_tcp, OID_AUTO, syncookies_only, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_syncookiesonly), 0, "Use only TCP SYN cookies"); +static VNET_DEFINE(int, functions_inherit_listen_socket_stack) = 1; +#define V_functions_inherit_listen_socket_stack \ + VNET(functions_inherit_listen_socket_stack) +SYSCTL_INT(_net_inet_tcp, OID_AUTO, functions_inherit_listen_socket_stack, + CTLFLAG_VNET | CTLFLAG_RW, + &VNET_NAME(functions_inherit_listen_socket_stack), 0, + "Inherit listen socket's stack"); + #ifdef TCP_OFFLOAD #define ADDED_BY_TOE(sc) ((sc)->sc_tod != NULL) #endif @@ -830,7 +838,7 @@ syncache_socket(struct syncache *sc, struct socket *lso, struct mbuf *m) tcp_rcvseqinit(tp); tcp_sendseqinit(tp); blk = sototcpcb(lso)->t_fb; - if (blk != tp->t_fb) { + if (V_functions_inherit_listen_socket_stack && blk != tp->t_fb) { /* * Our parents t_fb was not the default, * we need to release our ref on tp->t_fb and From 978f10562f7e4737ce527326b0d0a94cb804f7d6 Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Sat, 28 Jan 2017 00:00:10 +0000 Subject: [PATCH 11/51] ERL: set -march=octeon+ for use with external toolchain Upstream GCC and devel/mips64-gcc use "octeon+" as the CPU setting for the Octeon processor in the EdgeRouter Lite. As of r312899 the base system GCC 4.2.1 accepts octeon+ as an alias for the Octeon support added in r208737 for the same CPU. Sponsored by: The FreeBSD Foundation --- sys/mips/conf/ERL | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/mips/conf/ERL b/sys/mips/conf/ERL index 59ea84d70f35..2c4fd26ba99c 100644 --- a/sys/mips/conf/ERL +++ b/sys/mips/conf/ERL @@ -21,7 +21,7 @@ ident ERL -makeoptions ARCH_FLAGS="-march=octeon -mabi=64" +makeoptions ARCH_FLAGS="-march=octeon+ -mabi=64" makeoptions LDSCRIPT_NAME=ldscript.mips.octeon1 makeoptions KERNLOADADDR=0xffffffff80100000 From 34bac11eba2841255bf6319ec78728f0f941c6ac Mon Sep 17 00:00:00 2001 From: Sean Bruno Date: Sat, 28 Jan 2017 00:40:36 +0000 Subject: [PATCH 12/51] Add iflib man pages for developers. Doc review is probably waranted here for editing. Submitted by: Nicole Graziano --- share/man/man9/Makefile | 3 + share/man/man9/iflibdd.9 | 181 +++++++++++++++++++++++++++++++++++++ share/man/man9/iflibdi.9 | 152 +++++++++++++++++++++++++++++++ share/man/man9/iflibtxrx.9 | 165 +++++++++++++++++++++++++++++++++ 4 files changed, 501 insertions(+) create mode 100644 share/man/man9/iflibdd.9 create mode 100644 share/man/man9/iflibdi.9 create mode 100644 share/man/man9/iflibtxrx.9 diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index d11500ba48dc..691de720fb79 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -158,6 +158,9 @@ MAN= accept_filter.9 \ ieee80211_regdomain.9 \ ieee80211_scan.9 \ ieee80211_vap.9 \ + iflibdd.9 \ + iflibdi.9 \ + iflibtxrx.9 \ ifnet.9 \ inittodr.9 \ insmntque.9 \ diff --git a/share/man/man9/iflibdd.9 b/share/man/man9/iflibdd.9 new file mode 100644 index 000000000000..e1273da226e4 --- /dev/null +++ b/share/man/man9/iflibdd.9 @@ -0,0 +1,181 @@ +.\" $FreeBSD$ +.Dd January 27, 2017 +.Dt IFlIBDD(9) +.Os +.Sh NAME +.Nm iflibdd +.Nd Device Dependent Configuration Functions +.Sh SYNOPSIS +.In "ifdi_if.h" +.Ss "Soft Queue Setup and Teardown Functions" +.Ss "Mandatory Functions" +.Ft int +.Fn ifdi_queues_alloc "if_ctx_t ctx, caddr_t *vaddrs, uint64_t *paddrs, int nqs" +.Ft int +.Fn ifdi_queues_free "if_ctx_t ctx" +.Ss "Optional Functions" +.Ft int +.Fn ifdi_txq_setup "if_ctx_t ctx, uint16_t qid" +.Ft int +.Fn ifdi_rxq_setup "if_ctx_t ctx, uint16_t qid" +.Ss "Device Setup and Teardown Functions" +.Ss "Mandatory Functions" +.Ft int +.Fn ifdi_attach_pre "if_ctx_t ctx" +.Ft int +.Fn ifdi_attach_post "if_ctx_t ctx" +.Ft int +.Fn ifdi_detach "if_ctx_t ctx" +.Ss "Optional Functions" +.Ft void +.Fn ifdi_vlan_register "if_ctx_t ctx, uint16_t vtag" +.Ft void +.Fn ifdi_vlan_unregister "if_ctx_t ctx, uint16_t vtag" +.Ft int +.Fn ifdi_suspend "if_ctx_t ctx" +.Ft int +.Fn ifdi_resume "if_ctx_t ctx" +.Ss "Device Configuration Functions" +.Ss "Mandatory Functions" +.Ft void +.Fn ifdi_init "if_ctx_t ctx" +.Ft void +.Fn ifdi_stop "if_ctx_t ctx" +.Ft void +.Fn ifdi_multi_set "if_ctx_t ctx" +.Ft int +.Fn ifdi_mtu_set "if_ctx_t ctx, uint32_t mtu" +.Ft void +.Fn ifdi_media_status "if_ctx_t ctx, struct ifmediareq *ifr" +.Ft int +.Fn ifdi_media_change "if_ctx_t ctx" +.Ft void +.Fn ifdi_promisc_set "if_ctx_t ctx, int flags" +.Ft uint64_t +.Fn ifdi_get_counter "if_ctx_t ctx, ift_counter cnt" +.Ft void +.Fn ifdi_update_admin_status "if_ctx_t ctx" +.Ss "Optional Functions" +.Ft void +.Fn ifdi_media_set "if_ctx_t ctx" +.Ss "Interrupt enable/disable" +.Ss "Mandatory Functions" +.Ft void +.Fn ifdi_intr_enable "if_ctx_t ctx" +.Ft void +.Fn ifdi_queue_intr_enable "if_ctx_t ctx, uint16_t qid" +.Ft void +.Fn ifdi_intr_disable "if_ctx_t ctx" +.Ss IOV Support +.Ft init +.Fn iov_init "if_ctx_t, uint16_t num_vfs, const nvlist_t *params" +.Ft void +.Fn iov_uinit "if_ctx_t ctx" +.Ft void +.Fn ifdi_vflr_handle "if_ctx_t ctx" +.Ft int +.Fn ifdi_vf_add "if_ctx_t ctx, uint16_t vfnum, const nvlist_t *params" +.Ss "Optional Functions" +.Ft void +.Fn ifdi_link_intr_enable "if_ctx_t ctx" +.Ss "Optional Service Routines" +.Ft void +.Fn ifdi_timer "if_ctx_t ctx" +.Ft void +.Fn ifdi_watchdog_reset "if_ctx_t ctx" +.Ss "Additional Functions" +.Ft void +.Fn ifdi_led_func "if_ctx_t ctx, int onoff" +.Ft int +.Fn ifdi_sysctl_int_delay "if_ctx_t ctx, if_int_delay_info_t iidi" +.Ft int +.Fn ifdi_i2c_req "if_ctx_t ctx, struct ifi2creq *req" +.Sh FUNCTIONS +The above named functions are device dependent configuration functions. These routines are registerd with iflib by the driver and are called from the corresponding iflib function to configure device specific functions and registers. +.Ss Device Dependent Functions +.Ss Soft Queue Setup and Teardown +.Bl -ohang -offset indent +.It Fn ifdi_queues_alloc +Manditory queues allocation function that is called during iflib_attach. vaddrs and paddrs are arrays of virtual and physical addresses respectively of the hardware transmit and receive queues, and if relevany, any command completion queues. nqs is the number of queues per qset. For example, a driver with a single receive and transmit queue would have a nqs equal to 2. +.It Fn ifdi_queues_free +Mandatory function that frees the allocated queues and associated transmit buffers. +.It Fn ifdi_txq_setup +Optional function for each transmit queue that handles device specific initialization. +.It Fn ifdi_rxq_setup +Optional function for each receive queue that handles device specific initialization. +.El +.Ss Device Setup and Teardown +.Bl -ohang -offset indent +.It Fn ifdi_attach_pre +Mandatory function implemented by the driver to perform any attach logic that procedes interrupt and queue allocation, queue setup, and interrupt assignment. +.It Fn ifdi_attach_post +Mandatory function implemented by the driver to perform any attach logic that occurs after ifdi_attach_pre, and iflib's queue setup and MSI/MSIX(X) or legacy interrupt assignment. +.It Fn ifdi_detach +Mandatory function that frees any resources allocated by the driver in ifdi_attach_pre and ifdi_attach_post. +.It Fn ifdi_vlan_register +Optional function called by the VLAN config eventhandler. _vtag is the new VLAN tag. +.It Fn ifdi_vlan_unregister +Optional function called by the VLAN unconfig eventhandler. +.It Fn ifdi_suspend +Optional function that suspends the driver. +.It Fn ifdi_resume +Optional function that resumes a driver. +.El +.Ss Device Configuration Functions +.Bl -ohang -offset indent +.It Fn ifdi_init +Mandatory function that will initialize and bring up the hardware. For example, it will reset the chip and enable the receiver unit. It should mark the interface running, but not active (IFF_DRV_RUNNING, ~IIF_DRV_OACTIVE). +.It Fn ifdi_stop +Mandatory function that should disable all traffic on the interface by issuing a global reset on the MAC and deallocating the TX and RX buffers. +.It Fn ifdi_multi_set +Programs the interfaces multicast addresses +.It Fn ifdi_media_status +Media Ioctl Callback. Function is called whenever the user queries the status of the interface using ifconfig. The driver sets the appropriate link type and speed in ifmr->ifm_active. +.It Fn ifdi_mtu_set +Sets the mtu interface to the value of the second function parameter mtu. +.It Fn ifdi_media_change +Function is called when the user changes speed/duplex using the media/mediaopt option with ifconfig. +.It Fn ifdi_promisc_set +Enables or disables promisc settings depending upon the flags value. Flags contains the interfaces' ifnet flags. +.It Fn ifdi_get_counter +Returns the value for counter cnt depending upon counter type. +.It Fn ifdi_update_admin_status +Sets the link_up state to TRUE or FALSE depending upon the OS link state. A real check of the hardware only happens with a link interrupt. +.It Fn ifdi_media_set +Need to define +.El +.Ss Interrupt Enable/Disable +.Bl -ohang -offset indent +.It Fn ifdi_intr_enable +Mandatory function that enables all interrupts. +.It Fn ifdi_intr_disable +Mandatory function that disables all interrupts. +.It Fn ifdi_queue_intr_enable +Mandatory function that enables interrupts on queue qid. +.It Fn iov_init +Initialize num_vfs VFs. +.It Fn io_uninit +Tear down the context for all VFs. +.It Fn ifdi_vflr_handle +Handle any VFs that have reset themselves via a Function Level Reset(FLR). +.It Fn ifdi_vf_add +Set parameters in params in VF vfnum. +.El +.Ss Service Routines +.Bl -ohang -offset indent +.It ifdi_timer +Optional timer routine that will be run every 500ms. +.It ifdi_watchdog_reset +Optional function to run when a transmit queue is hung. +.El +.Ss Additional Functions +.Bl -ohang -offset indent +.It ifdi_led_func +.It ifdi_sysctl_int_delay +.It ifdi_i2c_req +.El +.Sh "SEE ALSO" + iflibtxrx(9), iflibdd(9) +.Sh AUTHORS +This manual page was written by +.An Nicole Graziano diff --git a/share/man/man9/iflibdi.9 b/share/man/man9/iflibdi.9 new file mode 100644 index 000000000000..fed23a9e9af8 --- /dev/null +++ b/share/man/man9/iflibdi.9 @@ -0,0 +1,152 @@ +.\" $FreeBSD$ +.Dd January 27, 2017 +.Dt IFlIBDI(9) +.Os +.Sh NAME +.Nm iflibdi +.Nd Device Independent Configuration Functions +.Sh SYNOPSIS +.In "ifdi_if.h" +.Ss "Device Independent Functions" +.Ft int +.Fn iflib_device_attach "device_t dev" +.Ft int +.Fn iflib_device_detach "device_t dev" +.Ft int +.Fn iflib_device_suspend "device_t dev" +.Ft int +.Fn iflib_device_resume "device_t dev" +.Ft int +.Fn iflib_device_register "device_t dev, void *softc, if_shared_ctx_t sctx, if_ctx_t *ctxp" +.Ft int +.Fn iflib_device_deregister "if_ctx_t ctx" +.Ft int +.Fn iflib_irq_alloc "if_ctx_t ctx, if_irq_t irq_info, int rid, driver_filter_t filter, void *filter_arg, driver_intr_t handler, void *arg, char *name" +.Ft int +.Fn iflib_irq_alloc_generic "if_ctx_t, ctx, if_irq_t irq, int rid, intr_type_t type, driver_filter_t *filter, void *filter_arg, int qid, char *name" +.Ft void +.Fn iflib_led_create "if_ctx_t ctx" +.Ft void +.Fn iflib_tx_intr_deferred "if_ctx_t ctx, int txqid" +.Ft void +.Fn iflib_rx_intr_deferred "if_ctx_t ctx, int rxqid" +.Ft void +.Fn iflib_link_intr_deferred "if_ctx_t ctx" +.Ft void +.Fn iflib_link_state_change "if_ctx_t ctx, int linkstate" +.Ft void +.Fn iflib_led_create "if_ctx_t ctx" +.Ft void +.Fn iflib_add_int_delay_sysctl "if_ctx_t ctx, const char *, const char *, if_int_delay_info_t, int, int" +.Ss "Global Variables" +.Vt extern struct if_txrx +.Sh DATA STRUCTURES +The \fIif_ctx_t\fP Structure is the device independent data structure that contains statistics and identifying information used to transmit and receive data packets. The interface is associated with an array of queues assigned sequentially. Each queu has its own transmit (iflib_txq_t) and receive (iflib_rxq_t) queue. The transmit queue is used to hold packets while the interface is in the process of sending another. The receive queue is used to receive packets that are awaiting processing. +.Pp +.Ss The if_ctx_t Structure +The fields of +.Vt "struct if_ctx_t" +are as follows: +.Bl -tag -width ".Va if_capabilities" -offset indent +.It Va if_softc +.Pq Vt "void" +A pointer to the driver's private state block. +.It Va ifc_dev +.Pq Vt "device_t" +The underlying device structure. +.It Va ifc_ip +.Pq Vt "if_t" +A link back to the interface structure +.It Va ifc_cpus +.Pq Vt "cpuset_t" +.It Va ifc_mutex +.Pq Vt "struct mtx" +Mutex lock used to maintain data integrity +.It Va ifc_mtx_name +.Pq Vt "char *" +The name of the mutex +.It Va ifc_txqs +.Pq Vt "iflib_txq_t" +Device independent transmit queue maintained internally by iflib +.It Va ifc_rxqs +.Pq Vt "iflib_rxq_t" +Device independent receive queue maintained internally by iflib +.It Va ifc_qsets +.Pq Vt "iflib_qset_t" + Output queue that contains a single transmit (ifc_txq_t) and receive (ifc_rxq_t) queue +.It Va ifc_if_flags +.Pq Vt "uint32_t" +Flags describing the operational parameter of the interface +.It Va ifc_in_detach +.Pq Vt "int" +.It Va ifc_link_state +.Pq Vt "int" +Describes the current link state of the Ethernet interface. It's possible values are either active or inactive. +.It Va ifc_link_irq +.Pq Vt "int" +.It Va ifc_vlan_attach_event +.Pq Vt "eventhandler_tag" +.It Va ifc_vlan_detach_event +.Pq Vt "eventhandler_tag" +.It Va ifc_pause_frames +.Pq Vt "int" +.It Va ifc_watchdog_events +.Pq Vt "int" +.It Va ifc_mac +.Pq Vt "uint8_t" +.It Va ifc_msix_mem +.Pq Vt "struct resource *" +.It Va ifc_legacy_irq +.Pq Vt "struct if_irq" +.It Va ifc_admin_task +.Pq Vt "struct grouptask" +Taskqueue task scheduled for link state change events of the interface +.It Va ifc_filter_info +.Pq Vt "struct iflib_filter_info" +Statistics and information relating to the interface device filter +.It Va ifc_media +.Pq Vt "struct ifmedia" +.It Va ifc_txrx +.Pq Vt "struct if_txrx" +.El +.Sh FUNCTIONS + The above named functions are found exclusively in iflib. They are independent of the underlying hardware type or configuration. +.Ss Device Independent Functions +.Bl -ohang -offset indent +.It Fn iflib_device_attach +Function initiates a device registration with the iflib framework. It calls the iflib_register function, which is responsible for allocating and initializing the \fIif_ctx_t\fP structure. +.It Fn iflib_device_detach +Shutdown and detach the device. Unregister vlan events, drain any dependent tasks, and release irq, pci, and msix memory. +.It Fn iflib_device_suspend +Suspend a device by calling the device dependent suspend function and bus_generic_suspend. +.It Fn iflib_device_resume +Resume a device by calling the device dependent resume function, the iflib_init_locked function, and bus_generic_resume. +.It Fn iflib_device_register +Register a device with the iflib framework. Allocate and initialize the \fIif_ctx_t\fP structure. Setup and initialize the MSI or MSI/X interrupt queues if necessary. Allocate memory for queues and qset structure setup. +.It Fn iflib_device_irq_alloc +Allocate an interrupt resource for a given rid value with an associated filter and handler function. +.It Fn iflib_device_irq_alloc_generic +Performs the same function as iflib_device_irq_alloc along with the additional functionality of adding a taskgroup. The data fields and callback function are determined by the type of interrupt, such as IFLIB_INTR_TX, IFLIB_INTR_RX, and IFLIB_INTR_ADMIN. +.It Fn iflib_led_create +Calls led_create to initialize the ctx->ifc_led_dev field +.It Fn iflib_tx_intr_deferred +Calls GROUPTASK_ENQUEUE to enqueue the transfer queues ift_task. +.It Fn iflib_rx_intr_deferred +Calls GROUPTASK_ENQUEUE to enqueue the receive queues ifr_task. +.It Fn iflib_link_intr_deferred +Calls GROUPTASK_ENQUEUE to enqueue the link task +.It Fn iflib_link_state_change +Change the interface link status to either LINK_STATE_UP or LINK_STATE_DOWN as specified by the second argument to the function. +\fBInterface Link States\fP +The following link states are currently defined: + + LINK_STATE_UP The link is up. + LINK_STATE_DOWN The link is down. +.It Fn iflib_add_int_delay_sysctl +Modifies settings to user defined values for a given set of variables. +.El +.Sh "SEE ALSO" + iflibtxrx(9), iflibdd(9) +.Sh AUTHORS +This manual page was written by +.An Nicole Graziano diff --git a/share/man/man9/iflibtxrx.9 b/share/man/man9/iflibtxrx.9 new file mode 100644 index 000000000000..86242162e333 --- /dev/null +++ b/share/man/man9/iflibtxrx.9 @@ -0,0 +1,165 @@ +.\" $FreeBSD$ +.Dd January 27, 2017 +.Dt IFlIBTXTX(9) +.Os +.Sh NAME +.Nm iflibtxrx +.Nd Device Dependent Transmit and Receive Functions +.Sh SYNOPSIS +.In "ifdi_if.h" +.Ss "Interface Manipulation Functions" +.Ft int +.Fn isc_txd_encap "void *sc, if_pkt_into_t pi" +.Ft void +.Fn isc_txd_flush "void *sc, uint16_t qid, uint32_t _pidx_or_credits_" +.Ft int * +.Fn isc_txd_credits_update "void *sc, uint16_t qid, uint32_t credits" +.Ft int * +.Fn isc_rxd_available "void *sc, uint16_t qsid, uint32_t cidx" +.Ft void * +.Fn isc_rxd_refill "void *sc, uint16_t qsid, uint8_t flid, uint32_t pidx, uint64_t *paddrs, caddr_t *vaddrs, uint16_t count" +.Ft void * +.Fn isc_rxd_flush "void *sc, uint16_t qsid, uint8_t flid, uint32_t pidx" +.Ft int +.Fn isc_rxd_pkt_get "void *sc, if_rxd_info_t ri" +.Ss "Global Variables" +.Vt extern struct if_txrx +.Sh DATA STRUCTURES +The device dependent mechanisms for handling packet transmit and receive are primarily defined by the functions named above. The if_pkt_info data structure contains statistics and identifying info necessary for packet transmission. While the data structure for packet receipt is the if_rxd_info structure. +.Pp +.Ss The if_pkt_info Structure +The fields of +.Vt "struct if_pkt_info" +are as follows: +.Bl -tag -width ".Va if_capabilities" -offset indent +.It Va ipi_len +.Pq Vt "uint32_t" +Denotes the size of packet to be sent on the transmit queue. +.It Va ipi_segs +.Pq Vt "bus_dma_segment_t *" +A pointer to the bus_dma_segment of the device independent transfer queue defined in iflib. +.It Va ipi_qsidx +Unique index value assigned sequentially to each transmit queue. Used to reference the currently transmitting queue. +.It Va ipi_nsegs +.Pq Vt "uint16_t" +Number of descriptors to be read into the device dependent transfer descriptors. +.It Va ipi_ndescs +.Pq Vt "uint16_t" +Number of descriptors in use. Calculated by subtracting the old pidx value from the new pidx value. +.It Va ipi_flags +.Pq Vt "uint16_t" +Flags defined on a per packet basis. +.It Va ipi_pidx +.Pq Vt "uint32_t" +Value of first pidx sent to the isc_encap function for encapsulation and subsequent transmission. +.It Va ipi_new_pidx +.Pq Vt "uint32_t" +Value set after the termination of the isc_encap function. This value will become the first pidx sent to the isc-encap the next time that the function is called. +.It Va \fBThe Following Fields Are Used For Offload Handling\fP +.It Va ipi_csum_flags +.Pq Vt "uint64_t" +Flags describing the checksum values. Used on a per packet basis. +.It Va ipi_tso_segsz +.Pq Vt "uint16_t" +Size of the TSO Segment Size. +.It Va ipi_mflags +.Pq Vt "uint16_t" +Flags describing the operational parameters of the mbuf. +.It Va ipi_vtag +.Pq Vt "uint16_t" +Contains the VLAN information in the Ethernet Frame. +.It Va ipi_etype +.Pq Vt "uint16_t" +Type of ethernet header protocol as contained by the struct ether_vlan_header. +.It Va ipi_ehrdlen +.Pq Vt "uint8_t" +Length of the Ethernet Header. +.It Va ipi_ip_hlen +.Pq Vt "uint8_t" +Length of the TCP Header +.It Va ipi_tcp_hlen +.Pq Vt "uint8_t" +Length of the TCP Header. +.It Va ipi_tcp_hflags +.Pq Vt "uint8_t" +Flags describing the operational parameters of the TCP Header. +.It Va ipi_ipproto +.Pq Vt "uint8_t" +Specifies the type of IP Protocol in use. Example TCP, UDP, or SCTP. +.El +.Ss The if_rxd_info Structure +The fields of +.Vt "struct if_rxd_info" +are as follows: +.Bl -tag -width ".Va if_capabilities" -offset indent +.It Va iri_qsidx +.Pq Vt "uint16_t" +Unique index value assigned sequentially to each receive queue. Used to reference the currently receiving queue. +.It Va iri_vtag +.Pq Vt "uint16_t" +Contains the VLAN information in the Ethernet Frame. +.It Va iri_len +.Pq Vt "uint16_t" +Denotes the size of a received packet. +.It Va iri_next_offset +.Pq Vt "uint16_t" +Denotes the offset value for the next packet to be receive. A Null value signifies the end of packet. +.It Va iri_cidx +.Pq Vt "uint32_t" +Denotes the index value of the packet currently being processed in the consumer queue. +.It Va iri_flowid +.Pq Vt "uint32_t" +Value of the RSS hash for the packet. +.It Va iri_flags +.Pq Vt "uint" + Flags describing the operational parameters of the mbuf contained in the receive packet. +.It Va iri_csum_flags +.Pq Vt "uint32_t" +Flags describing the checksum value contained in the receive packet. +.It Va iri_csum_data +.Pq Vt "uint32_t" +Checksum data contained in the mbuf packet header. +.It Va iri_m +.Pq Vt "struct mbuf *" +A mbuf for drivers that manage their own receive queues. +.It Va iri_ifp +.Pq Vt "struct ifnet *" +A link back to the interface structure. Utilized by drivers that have multiple interface per softc. +.It Va iri_rsstype +.Pq Vt "uint8_t" +The value of the RSS hash type. +.It Va iri_pad +.Pq Vt "uint8_t" +The length of any padding contained by the received data. +.It Va iri_qidx +.Pq Vt "uint8_t" +Represents the type of queue event. If value >= 0 then it is the freelist id otherwise it is a completion queue event. +.El +.Sh FUNCTIONS +All function calls are associated exclusively with either packet transmission or receipt. +The void *sc passed as the first arguement to all of the following functions repressents the driver's softc. +.Ss Transmit Packet Functions +.Bl -ohang -offset indent +.It Fn isc_txd_encap + Transmit function that sends a packet on an interface. The if_pkt_info data structure contains data information fields describing the packet. This function returns 0 if successful, otherwise an error value is returned. +.It Fn isc_txd_flush +Flush function is called immediately after the isc_txd_encap function transmits a packet. It updates the hardware producer index or increments the descriptors used to pidx_or_credits in the queue designated by the qid number. This is often referred to as poking the doorbell register. +.It Fn isc_txd_credits_update +Credit function advances the buffer ring and calculates the credits (descriptors) processed. Until the I/O is complete it cleans the range in case of multisegments and updates the count of processed packets. The function returns the number of processed credits. +.El +.Ss Receive Packet Functions +.Bl -ohang -offset indent +.It Fn isc_rxd_available +Function calculates the remaining number of descriptors from a position given by idx. The function returns this value. +.It Fn isc_rxd_refill +Starting with the physical address paddrs, the function reads a packet into the rx_ring until a value designated by count is reached. vaddrs is typically not needed and is provided for devices that place their own metadata in the packet header. +.It Fn isc_rxd_flush +Flush function updates the producer pointer on the free list flid in queue set number qid to pidx to reflect the presence of new buffers. +.It Fn isc_rxd_pkt_get +Process a single software descriptor. rxr->rx_base[i] contains a descriptor that describes a received packet. Hardware specific information about the buffer referred to by ri is returned in the data structure if_rxd_info +.El +.Sh "SEE ALSO" + iflibdd(9), iflibdi(9) +.Sh AUTHORS +This manual page was written by +.An Nicole Graziano From 2b375b4edd1b98884c3031d6ccd61acb10bd895d Mon Sep 17 00:00:00 2001 From: Yoshihiro Takahashi Date: Sat, 28 Jan 2017 02:22:15 +0000 Subject: [PATCH 13/51] Remove pc98 support completely. I thank all developers and contributors for pc98. Relnotes: yes --- Makefile | 5 +- Makefile.inc1 | 1 - ObsoleteFiles.inc | 11 + etc/etc.pc98/ttys | 49 - etc/rc.d/syscons | 1 - lib/libsysdecode/Makefile | 2 +- lib/libsysdecode/mkioctls | 10 +- libexec/Makefile.pc98 | 4 - release/doc/README | 2 +- .../doc/en_US.ISO8859-1/hardware/article.xml | 215 +- .../doc/en_US.ISO8859-1/readme/article.xml | 3 +- .../doc/share/examples/Makefile.relnotesng | 2 +- release/doc/share/misc/dev.archlist.txt | 102 +- release/doc/share/xml/release.ent | 1 - release/pc98/mkisoimages.sh | 45 - release/rc.local | 6 +- rescue/rescue/Makefile | 4 - sbin/Makefile.pc98 | 5 - sbin/bsdlabel/bsdlabel.8 | 4 +- sbin/bsdlabel/bsdlabel.c | 3 +- sbin/fdisk_pc98/Makefile | 13 - sbin/fdisk_pc98/Makefile.depend | 17 - sbin/fdisk_pc98/fdisk.8 | 486 -- sbin/fdisk_pc98/fdisk.c | 910 ---- sbin/geom/class/part/gpart.8 | 11 - share/examples/bootforth/frames.4th | 63 +- share/man/man4/adv.4 | 6 - share/man/man4/ahc.4 | 8 - share/man/man4/apic.4 | 2 +- share/man/man4/ed.4 | 49 - share/man/man4/esp.4 | 2 - share/man/man4/fxp.4 | 6 - share/man/man4/geom.4 | 2 - share/man/man4/man4.i386/Makefile | 2 - share/man/man4/man4.i386/aic.4 | 4 - share/man/man4/man4.i386/ct.4 | 162 - share/man/man4/man4.i386/snc.4 | 142 - share/man/man4/ncr.4 | 9 - share/man/man4/ncv.4 | 2 - share/man/man4/sym.4 | 4 - share/mk/bsd.stand.mk | 3 - share/mk/local.meta.sys.mk | 3 +- share/syscons/keymaps/INDEX.keymaps | 14 - share/syscons/keymaps/Makefile | 2 +- share/syscons/keymaps/jp.pc98.iso.kbd | 134 - share/syscons/keymaps/jp.pc98.kbd | 134 - share/vt/keymaps/INDEX.keymaps | 14 - share/vt/keymaps/Makefile | 2 - share/vt/keymaps/jp.pc98.iso.kbd | 134 - share/vt/keymaps/jp.pc98.kbd | 134 - sys/Makefile | 2 +- sys/boot/Makefile.pc98 | 3 - sys/boot/common/Makefile.inc | 2 - sys/boot/common/isapnp.h | 6 - sys/boot/ficl/loader.c | 4 +- sys/boot/forth/frames.4th | 63 +- sys/boot/pc98/Makefile | 5 - sys/boot/pc98/Makefile.inc | 29 - sys/boot/pc98/boot0.5/Makefile | 26 - sys/boot/pc98/boot0.5/boot.s | 174 - sys/boot/pc98/boot0.5/boot0.5.s | 293 -- sys/boot/pc98/boot0.5/disk.s | 296 -- sys/boot/pc98/boot0.5/ldscript | 12 - sys/boot/pc98/boot0.5/putssjis.s | 137 - sys/boot/pc98/boot0.5/selector.s | 450 -- sys/boot/pc98/boot0.5/start.s | 73 - sys/boot/pc98/boot0.5/support.s | 94 - sys/boot/pc98/boot0.5/syscons.s | 253 - sys/boot/pc98/boot0/Makefile | 19 - sys/boot/pc98/boot0/boot0.s | 108 - sys/boot/pc98/boot2/Makefile | 116 - sys/boot/pc98/boot2/boot1.S | 395 -- sys/boot/pc98/boot2/boot2.c | 803 --- sys/boot/pc98/btx/Makefile | 5 - sys/boot/pc98/btx/Makefile.inc | 3 - sys/boot/pc98/btx/btx/Makefile | 33 - sys/boot/pc98/btx/btx/btx.S | 1104 ----- sys/boot/pc98/btx/btxldr/Makefile | 21 - sys/boot/pc98/btx/btxldr/btxldr.S | 430 -- sys/boot/pc98/btx/lib/Makefile | 10 - sys/boot/pc98/btx/lib/btxcsu.S | 49 - sys/boot/pc98/btx/lib/btxsys.s | 40 - sys/boot/pc98/btx/lib/btxv86.h | 67 - sys/boot/pc98/btx/lib/btxv86.s | 85 - sys/boot/pc98/cdboot/Makefile | 18 - sys/boot/pc98/cdboot/cdboot.S | 805 --- sys/boot/pc98/kgzldr/Makefile | 20 - sys/boot/pc98/kgzldr/crt.s | 89 - sys/boot/pc98/libpc98/Makefile | 51 - sys/boot/pc98/libpc98/bioscd.c | 420 -- sys/boot/pc98/libpc98/biosdisk.c | 1120 ----- sys/boot/pc98/libpc98/biosmem.c | 64 - sys/boot/pc98/libpc98/biossmap.c | 38 - sys/boot/pc98/libpc98/comconsole.c | 367 -- sys/boot/pc98/libpc98/libpc98.h | 29 - sys/boot/pc98/libpc98/pc98_sys.c | 78 - sys/boot/pc98/libpc98/time.c | 98 - sys/boot/pc98/libpc98/vidconsole.c | 596 --- sys/boot/pc98/loader/Makefile | 99 - sys/boot/pc98/loader/conf.c | 116 - sys/boot/pc98/loader/help.pc98 | 38 - sys/boot/pc98/loader/main.c | 322 -- sys/boot/pc98/pc98boot/Makefile | 25 - sys/cam/cam_xpt.c | 9 +- sys/conf/Makefile.pc98 | 52 - sys/conf/NOTES | 7 +- sys/conf/config.mk | 1 - sys/conf/files | 4 - sys/conf/files.amd64 | 2 +- sys/conf/files.i386 | 2 +- sys/conf/files.pc98 | 279 -- sys/conf/options | 2 - sys/conf/options.pc98 | 104 - sys/crypto/aesni/aesni.h | 2 +- sys/crypto/via/padlock.c | 4 +- sys/crypto/via/padlock_hash.c | 2 +- sys/dev/aic/aic_cbus.c | 265 - sys/dev/ata/ata-all.h | 6 - sys/dev/ata/ata-cbus.c | 349 -- sys/dev/ct/bshw_machdep.c | 743 --- sys/dev/ct/bshwvar.h | 96 - sys/dev/ct/ct.c | 1242 ----- sys/dev/ct/ct_isa.c | 382 -- sys/dev/ct/ct_machdep.h | 186 - sys/dev/ct/ctvar.h | 129 - sys/dev/ed/if_ed98.h | 108 - sys/dev/ed/if_ed_cbus.c | 1629 ------ sys/dev/ep/if_ep_isa.c | 12 - sys/dev/exca/excareg.h | 17 - sys/dev/fb/fb.c | 2 - sys/dev/fb/splash_bmp.c | 42 - sys/dev/fdc/fdc.c | 240 +- sys/dev/fdc/fdc_cbus.c | 184 - sys/dev/fdc/fdcvar.h | 2 - sys/dev/fe/if_fe.c | 9 - sys/dev/fe/if_fe_cbus.c | 1020 ---- sys/dev/fe/if_fereg.h | 8 - sys/dev/ic/i8251.h | 111 - sys/dev/ic/wd33c93reg.h | 165 - sys/dev/kbd/kbd.c | 12 - sys/dev/le/am79900.c | 4 +- sys/dev/le/if_le_cbus.c | 443 -- sys/dev/mse/mse_cbus.c | 301 -- sys/dev/mse/msevar.h | 3 - sys/dev/pccbb/pccbb_isa.c | 2 - sys/dev/pci/vga_pci.c | 2 +- sys/dev/ppc/ppc.c | 50 - sys/dev/ppc/ppcreg.h | 8 - sys/dev/sio/sio_pccard.c | 3 - sys/dev/sio/sio_pci.c | 4 +- sys/dev/sio/sio_puc.c | 4 +- sys/dev/sio/siovar.h | 30 - sys/dev/snc/dp83932.c | 1198 ----- sys/dev/snc/dp83932reg.h | 271 - sys/dev/snc/dp83932subr.c | 839 ---- sys/dev/snc/dp83932subr.h | 78 - sys/dev/snc/dp83932var.h | 286 -- sys/dev/snc/if_snc.c | 255 - sys/dev/snc/if_snc_cbus.c | 211 - sys/dev/snc/if_snc_pccard.c | 164 - sys/dev/snc/if_sncreg.h | 140 - sys/dev/snc/if_sncvar.h | 47 - sys/dev/sound/isa/mss.c | 25 - sys/dev/sound/isa/mss.h | 8 - sys/dev/sound/isa/sbc.c | 60 - sys/dev/syscons/daemon/daemon_saver.c | 10 +- sys/dev/syscons/dragon/dragon_saver.c | 19 - sys/dev/syscons/fire/fire_saver.c | 4 - sys/dev/syscons/logo/logo_saver.c | 4 - sys/dev/syscons/plasma/plasma_saver.c | 2 - sys/dev/syscons/rain/rain_saver.c | 4 - sys/dev/syscons/scmouse.c | 2 - sys/dev/syscons/scvidctl.c | 26 - sys/dev/syscons/star/star_saver.c | 15 +- sys/dev/syscons/syscons.c | 16 - sys/dev/syscons/syscons.h | 8 - sys/dev/syscons/warp/warp_saver.c | 4 - sys/dev/uart/uart.h | 4 - sys/dev/uart/uart_bus_isa.c | 21 +- sys/dev/uart/uart_cpu_pc98.c | 132 - sys/geom/geom_bsd.c | 10 - sys/geom/geom_pc98.c | 372 -- sys/geom/geom_pc98_enc.c | 78 - sys/geom/part/g_part_pc98.c | 617 --- sys/i386/bios/apm.c | 135 +- sys/i386/bios/apm.h | 5 - sys/i386/i386/genassym.c | 7 - sys/i386/i386/initcpu.c | 106 +- sys/i386/i386/locore.s | 43 - sys/i386/i386/machdep.c | 291 -- sys/i386/i386/mp_machdep.c | 10 +- sys/i386/i386/mpboot.s | 2 +- sys/i386/i386/vm_machdep.c | 17 - sys/i386/isa/elink.h | 4 - sys/i386/isa/npx.c | 2 - sys/i386/pci/pci_pir.c | 5 - sys/isa/isareg.h | 4 - sys/isa/isavar.h | 13 - sys/isa/pnp.c | 37 - sys/isa/pnpreg.h | 5 - sys/modules/Makefile | 11 +- sys/modules/Makefile.inc | 4 - sys/modules/aic/Makefile | 8 +- sys/modules/apm/Makefile | 6 - sys/modules/ata/Makefile | 4 - sys/modules/canbepm/Makefile | 8 - sys/modules/canbus/Makefile | 8 - sys/modules/ct/Makefile | 10 - sys/modules/drm2/Makefile | 12 +- sys/modules/ed/Makefile | 4 - sys/modules/fdc/Makefile | 4 - sys/modules/fe/Makefile | 8 +- sys/modules/geom/geom_part/Makefile | 1 - .../geom/geom_part/geom_part_pc98/Makefile | 10 - sys/modules/geom/geom_pc98/Makefile | 8 - sys/modules/i2c/controllers/Makefile | 4 - sys/modules/le/Makefile | 6 +- sys/modules/mse/Makefile | 8 +- sys/modules/pmc/Makefile | 9 - sys/modules/ppc/Makefile | 9 +- sys/modules/sio/Makefile | 16 +- sys/modules/snc/Makefile | 9 - sys/modules/sound/sound/Makefile | 3 +- sys/pc98/apm/apm_bioscall.S | 87 - sys/pc98/cbus/30line.h | 130 - sys/pc98/cbus/cbus.h | 63 - sys/pc98/cbus/cbus_dma.c | 534 -- sys/pc98/cbus/cbus_dmareg.h | 44 - sys/pc98/cbus/gdc.c | 1487 ------ sys/pc98/cbus/nmi.c | 69 - sys/pc98/cbus/olpt.c | 648 --- sys/pc98/cbus/olptreg.h | 48 - sys/pc98/cbus/pckbd.c | 999 ---- sys/pc98/cbus/pckbdtables.h | 203 - sys/pc98/cbus/pcrtc.c | 249 - sys/pc98/cbus/pmc.c | 244 - sys/pc98/cbus/sc_machdep.h | 52 - sys/pc98/cbus/scgdcrndr.c | 208 - sys/pc98/cbus/scterm-sck.c | 1229 ----- sys/pc98/cbus/sctermvar.h | 432 -- sys/pc98/cbus/scvtb.c | 399 -- sys/pc98/cbus/sio.c | 4387 ----------------- sys/pc98/cbus/sio_cbus.c | 119 - sys/pc98/cbus/syscons_cbus.c | 202 - sys/pc98/conf/DEFAULTS | 31 - sys/pc98/conf/GENERIC | 262 - sys/pc98/conf/GENERIC-NODEBUG | 38 - sys/pc98/conf/GENERIC.hints | 294 -- sys/pc98/conf/Makefile | 5 - sys/pc98/conf/NOTES | 628 --- sys/pc98/include/_align.h | 6 - sys/pc98/include/_bus.h | 43 - sys/pc98/include/_inttypes.h | 6 - sys/pc98/include/_limits.h | 6 - sys/pc98/include/_stdint.h | 6 - sys/pc98/include/_types.h | 6 - sys/pc98/include/apm_bios.h | 55 - sys/pc98/include/apm_segments.h | 6 - sys/pc98/include/asm.h | 6 - sys/pc98/include/asmacros.h | 6 - sys/pc98/include/atomic.h | 6 - sys/pc98/include/bootinfo.h | 6 - sys/pc98/include/bus.h | 648 --- sys/pc98/include/bus_dma.h | 6 - sys/pc98/include/clock.h | 6 - sys/pc98/include/counter.h | 6 - sys/pc98/include/cpu.h | 6 - sys/pc98/include/cpufunc.h | 6 - sys/pc98/include/cputypes.h | 6 - sys/pc98/include/cserial.h | 6 - sys/pc98/include/db_machdep.h | 6 - sys/pc98/include/dump.h | 6 - sys/pc98/include/efi.h | 14 - sys/pc98/include/elf.h | 6 - sys/pc98/include/endian.h | 6 - sys/pc98/include/exec.h | 6 - sys/pc98/include/float.h | 6 - sys/pc98/include/floatingpoint.h | 6 - sys/pc98/include/frame.h | 6 - sys/pc98/include/gdb_machdep.h | 6 - sys/pc98/include/ieeefp.h | 6 - sys/pc98/include/in_cksum.h | 6 - sys/pc98/include/intr_machdep.h | 6 - sys/pc98/include/ioctl_bt848.h | 6 - sys/pc98/include/ioctl_meteor.h | 6 - sys/pc98/include/iodev.h | 6 - sys/pc98/include/kdb.h | 6 - sys/pc98/include/limits.h | 6 - sys/pc98/include/md_var.h | 51 - sys/pc98/include/memdev.h | 6 - sys/pc98/include/metadata.h | 6 - sys/pc98/include/minidump.h | 6 - sys/pc98/include/mp_watchdog.h | 6 - sys/pc98/include/nexusvar.h | 6 - sys/pc98/include/npx.h | 6 - sys/pc98/include/ofw_machdep.h | 6 - sys/pc98/include/param.h | 33 - sys/pc98/include/pc/bios.h | 6 - sys/pc98/include/pc/display.h | 39 - sys/pc98/include/pcaudioio.h | 6 - sys/pc98/include/pcb.h | 6 - sys/pc98/include/pcb_ext.h | 6 - sys/pc98/include/pci_cfgreg.h | 39 - sys/pc98/include/pcpu.h | 6 - sys/pc98/include/perfmon.h | 6 - sys/pc98/include/pmap.h | 6 - sys/pc98/include/pmc_mdep.h | 6 - sys/pc98/include/ppireg.h | 48 - sys/pc98/include/proc.h | 6 - sys/pc98/include/profile.h | 6 - sys/pc98/include/psl.h | 6 - sys/pc98/include/ptrace.h | 6 - sys/pc98/include/reg.h | 6 - sys/pc98/include/reloc.h | 6 - sys/pc98/include/resource.h | 6 - sys/pc98/include/runq.h | 6 - sys/pc98/include/segments.h | 6 - sys/pc98/include/setjmp.h | 6 - sys/pc98/include/sf_buf.h | 6 - sys/pc98/include/sigframe.h | 6 - sys/pc98/include/signal.h | 6 - sys/pc98/include/smapi.h | 6 - sys/pc98/include/smp.h | 6 - sys/pc98/include/speaker.h | 6 - sys/pc98/include/specialreg.h | 6 - sys/pc98/include/stack.h | 6 - sys/pc98/include/stdarg.h | 6 - sys/pc98/include/sysarch.h | 6 - sys/pc98/include/timerreg.h | 54 - sys/pc98/include/trap.h | 6 - sys/pc98/include/tss.h | 6 - sys/pc98/include/ucontext.h | 6 - sys/pc98/include/varargs.h | 6 - sys/pc98/include/vdso.h | 6 - sys/pc98/include/vm.h | 6 - sys/pc98/include/vm86.h | 6 - sys/pc98/include/vmparam.h | 6 - sys/pc98/linux/linux.h | 6 - sys/pc98/linux/linux_ipc64.h | 6 - sys/pc98/linux/linux_proto.h | 6 - sys/pc98/pc98/busio.s | 1774 ------- sys/pc98/pc98/busiosubr.c | 331 -- sys/pc98/pc98/canbepm.c | 137 - sys/pc98/pc98/canbus.c | 441 -- sys/pc98/pc98/canbus.h | 39 - sys/pc98/pc98/canbus_if.m | 69 - sys/pc98/pc98/canbusvars.h | 110 - sys/pc98/pc98/genassym.c | 3 - sys/pc98/pc98/pc98_machdep.c | 320 -- sys/pc98/pc98/pc98_machdep.h | 102 - sys/sys/consio.h | 6 - sys/sys/copyright.h | 11 +- sys/sys/disk/pc98.h | 75 - sys/sys/diskpc98.h | 47 - sys/sys/fbio.h | 8 - sys/sys/fdcio.h | 22 - sys/x86/isa/atpic.c | 38 +- sys/x86/isa/clock.c | 99 +- sys/x86/isa/icu.h | 19 - sys/x86/isa/isa.c | 98 - sys/x86/x86/autoconf.c | 41 +- sys/x86/x86/cpu_machdep.c | 12 +- sys/x86/x86/intr_machdep.c | 4 - sys/x86/x86/mptable.c | 11 +- sys/x86/x86/nexus.c | 36 +- targets/pseudo/userland/Makefile.depend | 5 - targets/pseudo/userland/misc/Makefile.depend | 1 - tools/build/mk/OptionalObsoleteFiles.inc | 2 - tools/tools/kerninclude/kerninclude.sh | 10 +- tools/tools/sysdoc/sysdoc.sh | 2 +- tools/tools/vt/keymaps/KBDFILES.map | 2 - tools/tools/vt/keymaps/convert-keymap.pl | 3 - usr.bin/mkimg/Makefile | 1 - usr.bin/mkimg/pc98.c | 118 - .../mkimg/tests/img-1x1-4096-pc98.qcow.gz.uu | 127 - .../mkimg/tests/img-1x1-4096-pc98.qcow2.gz.uu | 21 - .../mkimg/tests/img-1x1-4096-pc98.raw.gz.uu | 11 - .../mkimg/tests/img-1x1-4096-pc98.vhd.gz.uu | 18 - .../mkimg/tests/img-1x1-4096-pc98.vhdf.gz.uu | 14 - .../mkimg/tests/img-1x1-4096-pc98.vmdk.gz.uu | 82 - .../mkimg/tests/img-1x1-512-pc98.qcow.gz.uu | 127 - .../mkimg/tests/img-1x1-512-pc98.qcow2.gz.uu | 21 - .../mkimg/tests/img-1x1-512-pc98.raw.gz.uu | 11 - .../mkimg/tests/img-1x1-512-pc98.vhd.gz.uu | 18 - .../mkimg/tests/img-1x1-512-pc98.vhdf.gz.uu | 14 - .../mkimg/tests/img-1x1-512-pc98.vmdk.gz.uu | 82 - .../tests/img-63x255-4096-pc98.qcow.gz.uu | 126 - .../tests/img-63x255-4096-pc98.qcow2.gz.uu | 22 - .../tests/img-63x255-4096-pc98.raw.gz.uu | 12 - .../tests/img-63x255-4096-pc98.vhd.gz.uu | 18 - .../tests/img-63x255-4096-pc98.vhdf.gz.uu | 15 - .../tests/img-63x255-4096-pc98.vmdk.gz.uu | 84 - .../tests/img-63x255-512-pc98.qcow.gz.uu | 126 - .../tests/img-63x255-512-pc98.qcow2.gz.uu | 22 - .../mkimg/tests/img-63x255-512-pc98.raw.gz.uu | 12 - .../mkimg/tests/img-63x255-512-pc98.vhd.gz.uu | 18 - .../tests/img-63x255-512-pc98.vhdf.gz.uu | 15 - .../tests/img-63x255-512-pc98.vmdk.gz.uu | 84 - usr.bin/mkimg/tests/mkimg.sh | 6 +- usr.sbin/Makefile.i386 | 20 +- usr.sbin/boot98cfg/Makefile | 10 - usr.sbin/boot98cfg/Makefile.depend | 17 - usr.sbin/boot98cfg/boot98cfg.8 | 104 - usr.sbin/boot98cfg/boot98cfg.c | 319 -- usr.sbin/bsdinstall/partedit/gpart_ops.c | 9 +- usr.sbin/bsdinstall/partedit/part_wizard.c | 2 +- usr.sbin/bsdinstall/partedit/partedit_pc98.c | 83 - usr.sbin/bsdinstall/partedit/scripted.c | 2 +- .../snmp_hostres/hostres_partition_tbl.c | 4 - usr.sbin/config/config.5 | 7 - usr.sbin/fdcontrol/Makefile | 4 - usr.sbin/fdformat/Makefile | 4 - usr.sbin/fdread/Makefile | 4 - usr.sbin/fdread/fdutil.c | 25 - usr.sbin/kgzip/kgzip.8 | 2 +- .../backend-partmanager/create-part.sh | 1 - usr.sbin/pnpinfo/Makefile | 4 - usr.sbin/vidcontrol/vidcontrol.c | 12 +- 418 files changed, 215 insertions(+), 46737 deletions(-) delete mode 100644 etc/etc.pc98/ttys delete mode 100644 libexec/Makefile.pc98 delete mode 100644 release/pc98/mkisoimages.sh delete mode 100644 sbin/Makefile.pc98 delete mode 100644 sbin/fdisk_pc98/Makefile delete mode 100644 sbin/fdisk_pc98/Makefile.depend delete mode 100644 sbin/fdisk_pc98/fdisk.8 delete mode 100644 sbin/fdisk_pc98/fdisk.c delete mode 100644 share/man/man4/man4.i386/ct.4 delete mode 100644 share/man/man4/man4.i386/snc.4 delete mode 100644 share/syscons/keymaps/jp.pc98.iso.kbd delete mode 100644 share/syscons/keymaps/jp.pc98.kbd delete mode 100644 share/vt/keymaps/jp.pc98.iso.kbd delete mode 100644 share/vt/keymaps/jp.pc98.kbd delete mode 100644 sys/boot/Makefile.pc98 delete mode 100644 sys/boot/pc98/Makefile delete mode 100644 sys/boot/pc98/Makefile.inc delete mode 100644 sys/boot/pc98/boot0.5/Makefile delete mode 100644 sys/boot/pc98/boot0.5/boot.s delete mode 100644 sys/boot/pc98/boot0.5/boot0.5.s delete mode 100644 sys/boot/pc98/boot0.5/disk.s delete mode 100644 sys/boot/pc98/boot0.5/ldscript delete mode 100644 sys/boot/pc98/boot0.5/putssjis.s delete mode 100644 sys/boot/pc98/boot0.5/selector.s delete mode 100644 sys/boot/pc98/boot0.5/start.s delete mode 100644 sys/boot/pc98/boot0.5/support.s delete mode 100644 sys/boot/pc98/boot0.5/syscons.s delete mode 100644 sys/boot/pc98/boot0/Makefile delete mode 100644 sys/boot/pc98/boot0/boot0.s delete mode 100644 sys/boot/pc98/boot2/Makefile delete mode 100644 sys/boot/pc98/boot2/boot1.S delete mode 100644 sys/boot/pc98/boot2/boot2.c delete mode 100644 sys/boot/pc98/btx/Makefile delete mode 100644 sys/boot/pc98/btx/Makefile.inc delete mode 100644 sys/boot/pc98/btx/btx/Makefile delete mode 100644 sys/boot/pc98/btx/btx/btx.S delete mode 100644 sys/boot/pc98/btx/btxldr/Makefile delete mode 100644 sys/boot/pc98/btx/btxldr/btxldr.S delete mode 100644 sys/boot/pc98/btx/lib/Makefile delete mode 100644 sys/boot/pc98/btx/lib/btxcsu.S delete mode 100644 sys/boot/pc98/btx/lib/btxsys.s delete mode 100644 sys/boot/pc98/btx/lib/btxv86.h delete mode 100644 sys/boot/pc98/btx/lib/btxv86.s delete mode 100644 sys/boot/pc98/cdboot/Makefile delete mode 100644 sys/boot/pc98/cdboot/cdboot.S delete mode 100644 sys/boot/pc98/kgzldr/Makefile delete mode 100644 sys/boot/pc98/kgzldr/crt.s delete mode 100644 sys/boot/pc98/libpc98/Makefile delete mode 100644 sys/boot/pc98/libpc98/bioscd.c delete mode 100644 sys/boot/pc98/libpc98/biosdisk.c delete mode 100644 sys/boot/pc98/libpc98/biosmem.c delete mode 100644 sys/boot/pc98/libpc98/biossmap.c delete mode 100644 sys/boot/pc98/libpc98/comconsole.c delete mode 100644 sys/boot/pc98/libpc98/libpc98.h delete mode 100644 sys/boot/pc98/libpc98/pc98_sys.c delete mode 100644 sys/boot/pc98/libpc98/time.c delete mode 100644 sys/boot/pc98/libpc98/vidconsole.c delete mode 100644 sys/boot/pc98/loader/Makefile delete mode 100644 sys/boot/pc98/loader/conf.c delete mode 100644 sys/boot/pc98/loader/help.pc98 delete mode 100644 sys/boot/pc98/loader/main.c delete mode 100644 sys/boot/pc98/pc98boot/Makefile delete mode 100644 sys/conf/Makefile.pc98 delete mode 100644 sys/conf/files.pc98 delete mode 100644 sys/conf/options.pc98 delete mode 100644 sys/dev/aic/aic_cbus.c delete mode 100644 sys/dev/ata/ata-cbus.c delete mode 100644 sys/dev/ct/bshw_machdep.c delete mode 100644 sys/dev/ct/bshwvar.h delete mode 100644 sys/dev/ct/ct.c delete mode 100644 sys/dev/ct/ct_isa.c delete mode 100644 sys/dev/ct/ct_machdep.h delete mode 100644 sys/dev/ct/ctvar.h delete mode 100644 sys/dev/ed/if_ed98.h delete mode 100644 sys/dev/ed/if_ed_cbus.c delete mode 100644 sys/dev/fdc/fdc_cbus.c delete mode 100644 sys/dev/fe/if_fe_cbus.c delete mode 100644 sys/dev/ic/i8251.h delete mode 100644 sys/dev/ic/wd33c93reg.h delete mode 100644 sys/dev/le/if_le_cbus.c delete mode 100644 sys/dev/mse/mse_cbus.c delete mode 100644 sys/dev/snc/dp83932.c delete mode 100644 sys/dev/snc/dp83932reg.h delete mode 100644 sys/dev/snc/dp83932subr.c delete mode 100644 sys/dev/snc/dp83932subr.h delete mode 100644 sys/dev/snc/dp83932var.h delete mode 100644 sys/dev/snc/if_snc.c delete mode 100644 sys/dev/snc/if_snc_cbus.c delete mode 100644 sys/dev/snc/if_snc_pccard.c delete mode 100644 sys/dev/snc/if_sncreg.h delete mode 100644 sys/dev/snc/if_sncvar.h delete mode 100644 sys/dev/uart/uart_cpu_pc98.c delete mode 100644 sys/geom/geom_pc98.c delete mode 100644 sys/geom/geom_pc98_enc.c delete mode 100644 sys/geom/part/g_part_pc98.c delete mode 100644 sys/modules/canbepm/Makefile delete mode 100644 sys/modules/canbus/Makefile delete mode 100644 sys/modules/ct/Makefile delete mode 100644 sys/modules/geom/geom_part/geom_part_pc98/Makefile delete mode 100644 sys/modules/geom/geom_pc98/Makefile delete mode 100644 sys/modules/pmc/Makefile delete mode 100644 sys/modules/snc/Makefile delete mode 100644 sys/pc98/apm/apm_bioscall.S delete mode 100644 sys/pc98/cbus/30line.h delete mode 100644 sys/pc98/cbus/cbus.h delete mode 100644 sys/pc98/cbus/cbus_dma.c delete mode 100644 sys/pc98/cbus/cbus_dmareg.h delete mode 100644 sys/pc98/cbus/gdc.c delete mode 100644 sys/pc98/cbus/nmi.c delete mode 100644 sys/pc98/cbus/olpt.c delete mode 100644 sys/pc98/cbus/olptreg.h delete mode 100644 sys/pc98/cbus/pckbd.c delete mode 100644 sys/pc98/cbus/pckbdtables.h delete mode 100644 sys/pc98/cbus/pcrtc.c delete mode 100644 sys/pc98/cbus/pmc.c delete mode 100644 sys/pc98/cbus/sc_machdep.h delete mode 100644 sys/pc98/cbus/scgdcrndr.c delete mode 100644 sys/pc98/cbus/scterm-sck.c delete mode 100644 sys/pc98/cbus/sctermvar.h delete mode 100644 sys/pc98/cbus/scvtb.c delete mode 100644 sys/pc98/cbus/sio.c delete mode 100644 sys/pc98/cbus/sio_cbus.c delete mode 100644 sys/pc98/cbus/syscons_cbus.c delete mode 100644 sys/pc98/conf/DEFAULTS delete mode 100644 sys/pc98/conf/GENERIC delete mode 100644 sys/pc98/conf/GENERIC-NODEBUG delete mode 100644 sys/pc98/conf/GENERIC.hints delete mode 100644 sys/pc98/conf/Makefile delete mode 100644 sys/pc98/conf/NOTES delete mode 100644 sys/pc98/include/_align.h delete mode 100644 sys/pc98/include/_bus.h delete mode 100644 sys/pc98/include/_inttypes.h delete mode 100644 sys/pc98/include/_limits.h delete mode 100644 sys/pc98/include/_stdint.h delete mode 100644 sys/pc98/include/_types.h delete mode 100644 sys/pc98/include/apm_bios.h delete mode 100644 sys/pc98/include/apm_segments.h delete mode 100644 sys/pc98/include/asm.h delete mode 100644 sys/pc98/include/asmacros.h delete mode 100644 sys/pc98/include/atomic.h delete mode 100644 sys/pc98/include/bootinfo.h delete mode 100644 sys/pc98/include/bus.h delete mode 100644 sys/pc98/include/bus_dma.h delete mode 100644 sys/pc98/include/clock.h delete mode 100644 sys/pc98/include/counter.h delete mode 100644 sys/pc98/include/cpu.h delete mode 100644 sys/pc98/include/cpufunc.h delete mode 100644 sys/pc98/include/cputypes.h delete mode 100644 sys/pc98/include/cserial.h delete mode 100644 sys/pc98/include/db_machdep.h delete mode 100644 sys/pc98/include/dump.h delete mode 100644 sys/pc98/include/efi.h delete mode 100644 sys/pc98/include/elf.h delete mode 100644 sys/pc98/include/endian.h delete mode 100644 sys/pc98/include/exec.h delete mode 100644 sys/pc98/include/float.h delete mode 100644 sys/pc98/include/floatingpoint.h delete mode 100644 sys/pc98/include/frame.h delete mode 100644 sys/pc98/include/gdb_machdep.h delete mode 100644 sys/pc98/include/ieeefp.h delete mode 100644 sys/pc98/include/in_cksum.h delete mode 100644 sys/pc98/include/intr_machdep.h delete mode 100644 sys/pc98/include/ioctl_bt848.h delete mode 100644 sys/pc98/include/ioctl_meteor.h delete mode 100644 sys/pc98/include/iodev.h delete mode 100644 sys/pc98/include/kdb.h delete mode 100644 sys/pc98/include/limits.h delete mode 100644 sys/pc98/include/md_var.h delete mode 100644 sys/pc98/include/memdev.h delete mode 100644 sys/pc98/include/metadata.h delete mode 100644 sys/pc98/include/minidump.h delete mode 100644 sys/pc98/include/mp_watchdog.h delete mode 100644 sys/pc98/include/nexusvar.h delete mode 100644 sys/pc98/include/npx.h delete mode 100644 sys/pc98/include/ofw_machdep.h delete mode 100644 sys/pc98/include/param.h delete mode 100644 sys/pc98/include/pc/bios.h delete mode 100644 sys/pc98/include/pc/display.h delete mode 100644 sys/pc98/include/pcaudioio.h delete mode 100644 sys/pc98/include/pcb.h delete mode 100644 sys/pc98/include/pcb_ext.h delete mode 100644 sys/pc98/include/pci_cfgreg.h delete mode 100644 sys/pc98/include/pcpu.h delete mode 100644 sys/pc98/include/perfmon.h delete mode 100644 sys/pc98/include/pmap.h delete mode 100644 sys/pc98/include/pmc_mdep.h delete mode 100644 sys/pc98/include/ppireg.h delete mode 100644 sys/pc98/include/proc.h delete mode 100644 sys/pc98/include/profile.h delete mode 100644 sys/pc98/include/psl.h delete mode 100644 sys/pc98/include/ptrace.h delete mode 100644 sys/pc98/include/reg.h delete mode 100644 sys/pc98/include/reloc.h delete mode 100644 sys/pc98/include/resource.h delete mode 100644 sys/pc98/include/runq.h delete mode 100644 sys/pc98/include/segments.h delete mode 100644 sys/pc98/include/setjmp.h delete mode 100644 sys/pc98/include/sf_buf.h delete mode 100644 sys/pc98/include/sigframe.h delete mode 100644 sys/pc98/include/signal.h delete mode 100644 sys/pc98/include/smapi.h delete mode 100644 sys/pc98/include/smp.h delete mode 100644 sys/pc98/include/speaker.h delete mode 100644 sys/pc98/include/specialreg.h delete mode 100644 sys/pc98/include/stack.h delete mode 100644 sys/pc98/include/stdarg.h delete mode 100644 sys/pc98/include/sysarch.h delete mode 100644 sys/pc98/include/timerreg.h delete mode 100644 sys/pc98/include/trap.h delete mode 100644 sys/pc98/include/tss.h delete mode 100644 sys/pc98/include/ucontext.h delete mode 100644 sys/pc98/include/varargs.h delete mode 100644 sys/pc98/include/vdso.h delete mode 100644 sys/pc98/include/vm.h delete mode 100644 sys/pc98/include/vm86.h delete mode 100644 sys/pc98/include/vmparam.h delete mode 100644 sys/pc98/linux/linux.h delete mode 100644 sys/pc98/linux/linux_ipc64.h delete mode 100644 sys/pc98/linux/linux_proto.h delete mode 100644 sys/pc98/pc98/busio.s delete mode 100644 sys/pc98/pc98/busiosubr.c delete mode 100644 sys/pc98/pc98/canbepm.c delete mode 100644 sys/pc98/pc98/canbus.c delete mode 100644 sys/pc98/pc98/canbus.h delete mode 100644 sys/pc98/pc98/canbus_if.m delete mode 100644 sys/pc98/pc98/canbusvars.h delete mode 100644 sys/pc98/pc98/genassym.c delete mode 100644 sys/pc98/pc98/pc98_machdep.c delete mode 100644 sys/pc98/pc98/pc98_machdep.h delete mode 100644 sys/sys/disk/pc98.h delete mode 100644 sys/sys/diskpc98.h delete mode 100644 usr.bin/mkimg/pc98.c delete mode 100644 usr.bin/mkimg/tests/img-1x1-4096-pc98.qcow.gz.uu delete mode 100644 usr.bin/mkimg/tests/img-1x1-4096-pc98.qcow2.gz.uu delete mode 100644 usr.bin/mkimg/tests/img-1x1-4096-pc98.raw.gz.uu delete mode 100644 usr.bin/mkimg/tests/img-1x1-4096-pc98.vhd.gz.uu delete mode 100644 usr.bin/mkimg/tests/img-1x1-4096-pc98.vhdf.gz.uu delete mode 100644 usr.bin/mkimg/tests/img-1x1-4096-pc98.vmdk.gz.uu delete mode 100644 usr.bin/mkimg/tests/img-1x1-512-pc98.qcow.gz.uu delete mode 100644 usr.bin/mkimg/tests/img-1x1-512-pc98.qcow2.gz.uu delete mode 100644 usr.bin/mkimg/tests/img-1x1-512-pc98.raw.gz.uu delete mode 100644 usr.bin/mkimg/tests/img-1x1-512-pc98.vhd.gz.uu delete mode 100644 usr.bin/mkimg/tests/img-1x1-512-pc98.vhdf.gz.uu delete mode 100644 usr.bin/mkimg/tests/img-1x1-512-pc98.vmdk.gz.uu delete mode 100644 usr.bin/mkimg/tests/img-63x255-4096-pc98.qcow.gz.uu delete mode 100644 usr.bin/mkimg/tests/img-63x255-4096-pc98.qcow2.gz.uu delete mode 100644 usr.bin/mkimg/tests/img-63x255-4096-pc98.raw.gz.uu delete mode 100644 usr.bin/mkimg/tests/img-63x255-4096-pc98.vhd.gz.uu delete mode 100644 usr.bin/mkimg/tests/img-63x255-4096-pc98.vhdf.gz.uu delete mode 100644 usr.bin/mkimg/tests/img-63x255-4096-pc98.vmdk.gz.uu delete mode 100644 usr.bin/mkimg/tests/img-63x255-512-pc98.qcow.gz.uu delete mode 100644 usr.bin/mkimg/tests/img-63x255-512-pc98.qcow2.gz.uu delete mode 100644 usr.bin/mkimg/tests/img-63x255-512-pc98.raw.gz.uu delete mode 100644 usr.bin/mkimg/tests/img-63x255-512-pc98.vhd.gz.uu delete mode 100644 usr.bin/mkimg/tests/img-63x255-512-pc98.vhdf.gz.uu delete mode 100644 usr.bin/mkimg/tests/img-63x255-512-pc98.vmdk.gz.uu delete mode 100644 usr.sbin/boot98cfg/Makefile delete mode 100644 usr.sbin/boot98cfg/Makefile.depend delete mode 100644 usr.sbin/boot98cfg/boot98cfg.8 delete mode 100644 usr.sbin/boot98cfg/boot98cfg.c delete mode 100644 usr.sbin/bsdinstall/partedit/partedit_pc98.c diff --git a/Makefile b/Makefile index 7e76ac915fc7..8b02703bda5d 100644 --- a/Makefile +++ b/Makefile @@ -236,7 +236,7 @@ _MAKE+= MK_META_MODE=no # Guess machine architecture from machine type, and vice versa. .if !defined(TARGET_ARCH) && defined(TARGET) -_TARGET_ARCH= ${TARGET:S/pc98/i386/:S/arm64/aarch64/} +_TARGET_ARCH= ${TARGET:S/arm64/aarch64/} .elif !defined(TARGET) && defined(TARGET_ARCH) && \ ${TARGET_ARCH} != ${MACHINE_ARCH} _TARGET= ${TARGET_ARCH:C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v6)?(eb)?/arm/:C/aarch64/arm64/:C/powerpc64/powerpc/:C/powerpcspe/powerpc/:C/riscv64(sf)?/riscv/} @@ -417,13 +417,12 @@ worlds: .PHONY # existing system is. # .if make(universe) || make(universe_kernels) || make(tinderbox) || make(targets) -TARGETS?=amd64 arm arm64 i386 mips pc98 powerpc sparc64 +TARGETS?=amd64 arm arm64 i386 mips powerpc sparc64 _UNIVERSE_TARGETS= ${TARGETS} TARGET_ARCHES_arm?= arm armeb armv6 TARGET_ARCHES_arm64?= aarch64 TARGET_ARCHES_mips?= mipsel mips mips64el mips64 mipsn32 mipselhf mipshf mips64elhf mips64hf TARGET_ARCHES_powerpc?= powerpc powerpc64 powerpcspe -TARGET_ARCHES_pc98?= i386 .for target in ${TARGETS} TARGET_ARCHES_${target}?= ${target} .endfor diff --git a/Makefile.inc1 b/Makefile.inc1 index 3d505a5ed4e1..e9ed22493df1 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -349,7 +349,6 @@ KNOWN_ARCHES?= aarch64/arm64 \ armeb/arm \ armv6/arm \ i386 \ - i386/pc98 \ mips \ mipsel/mips \ mips64el/mips \ diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index e97bb0099470..ef441e97696d 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -38,6 +38,17 @@ # xargs -n1 | sort | uniq -d; # done +# 20170128: remove pc98 support +OLD_FILES+=usr/include/dev/ic/i8251.h +OLD_FILES+=usr/include/dev/ic/wd33c93reg.h +OLD_FILES+=usr/include/sys/disk/pc98.h +OLD_FILES+=usr/include/sys/diskpc98.h +OLD_FILES+=usr/share/man/man4/i386/ct.4.gz +OLD_FILES+=usr/share/man/man4/i386/snc.4.gz +OLD_FILES+=usr/share/syscons/keymaps/jp.pc98.iso.kbd +OLD_FILES+=usr/share/syscons/keymaps/jp.pc98.kbd +OLD_FILES+=usr/share/vt/keymaps/jp.pc98.iso.kbd +OLD_FILES+=usr/share/vt/keymaps/jp.pc98.kbd # 20170110: Four files from ggate tests consolidated into one OLD_FILES+=usr/tests/sys/geom/class/gate/1_test OLD_FILES+=usr/tests/sys/geom/class/gate/2_test diff --git a/etc/etc.pc98/ttys b/etc/etc.pc98/ttys deleted file mode 100644 index d75cf053ab0d..000000000000 --- a/etc/etc.pc98/ttys +++ /dev/null @@ -1,49 +0,0 @@ -# -# $FreeBSD$ -# @(#)ttys 5.1 (Berkeley) 4/17/89 -# -# This file specifies various information about terminals on the system. -# It is used by several different programs. Common entries for the -# various columns include: -# -# name The name of the terminal device. -# -# getty The program to start running on the terminal. Typically a -# getty program, as the name implies. Other common entries -# include none, when no getty is needed, and xdm, to start the -# X Window System. -# -# type The initial terminal type for this port. For hardwired -# terminal lines, this will contain the type of terminal used. -# For virtual consoles, the correct type is typically cons25w. -# Other common values include dialup for incoming modem ports, and -# unknown when the terminal type cannot be predetermined. -# -# status Must be on or off. If on, init will run the getty program on -# the specified port. If the word "secure" appears, this tty -# allows root login. -# -# name getty type status comments -# -# If console is marked "insecure", then init will ask for the root password -# when going to single-user mode. -console none unknown off secure -# -ttyv0 "/usr/libexec/getty Pc" cons25w on secure -# Virtual terminals -ttyv1 "/usr/libexec/getty Pc" cons25w on secure -ttyv2 "/usr/libexec/getty Pc" cons25w on secure -ttyv3 "/usr/libexec/getty Pc" cons25w on secure -ttyv4 "/usr/libexec/getty Pc" cons25w on secure -ttyv5 "/usr/libexec/getty Pc" cons25w on secure -ttyv6 "/usr/libexec/getty Pc" cons25w on secure -ttyv7 "/usr/libexec/getty Pc" cons25w on secure -ttyv8 "/usr/local/bin/xdm -nodaemon" xterm off secure -# Serial terminals -# The 'dialup' keyword identifies dialin lines to login, fingerd etc. -ttyu0 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu1 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu2 "/usr/libexec/getty 3wire" vt100 onifconsole secure -ttyu3 "/usr/libexec/getty 3wire" vt100 onifconsole secure -# Dumb console -dcons "/usr/libexec/getty std.9600" vt100 off secure diff --git a/etc/rc.d/syscons b/etc/rc.d/syscons index 3a6ff18f6ec4..7c0c8035be2e 100755 --- a/etc/rc.d/syscons +++ b/etc/rc.d/syscons @@ -112,7 +112,6 @@ icelandic.iso) echo is;; it.iso) echo it;; jp.106x) echo jp.capsctrl;; jp.106) echo jp;; -#?? jp.pc98.iso) echo jp.pc98;; kk.pt154.io) echo kz.io;; kk.pt154.kst) echo kz.kst;; latinamerican.iso.acc) echo latinamerican.acc;; diff --git a/lib/libsysdecode/Makefile b/lib/libsysdecode/Makefile index bde9460fee75..7f4b302d5deb 100644 --- a/lib/libsysdecode/Makefile +++ b/lib/libsysdecode/Makefile @@ -120,7 +120,7 @@ tables.h: mktables ioctl.c: .PHONY .endif ioctl.c: mkioctls .META - env MACHINE=${MACHINE} CPP="${CPP}" \ + env CPP="${CPP}" \ /bin/sh ${.CURDIR}/mkioctls ${DESTDIR}${INCLUDEDIR} > ${.TARGET} beforedepend: ioctl.c tables.h diff --git a/lib/libsysdecode/mkioctls b/lib/libsysdecode/mkioctls index b99ff19f2486..e5bcee2338e8 100644 --- a/lib/libsysdecode/mkioctls +++ b/lib/libsysdecode/mkioctls @@ -24,15 +24,7 @@ ioctl_includes=$( awk '{printf("#include <%s>\\n", $1)}' ) -: ${MACHINE=$(uname -m)} -case "${MACHINE}" in -*pc98*) - ioctl_includes="$ioctl_includes#include \\n" - ;; -*) - ioctl_includes="$ioctl_includes#include \\n" - ;; -esac +ioctl_includes="$ioctl_includes#include \\n" awk -v x="$ioctl_includes" 'BEGIN {print x}' | $CPP -nostdinc -I$includedir -dM -DCOMPAT_43TTY - | diff --git a/libexec/Makefile.pc98 b/libexec/Makefile.pc98 deleted file mode 100644 index a755298888a6..000000000000 --- a/libexec/Makefile.pc98 +++ /dev/null @@ -1,4 +0,0 @@ -# $FreeBSD$ - -# Because i386 adds extra stuff we don't need or want for PC98 we need -# an empty file so it doesn't get added. diff --git a/release/doc/README b/release/doc/README index a46779d78f1f..b9d06f573119 100644 --- a/release/doc/README +++ b/release/doc/README @@ -99,7 +99,7 @@ element will be included. For example: SPARC64-specific text -The currently-supported architectures are amd64, arm, i386, pc98, +The currently-supported architectures are amd64, arm, i386, powerpc and sparc64. An element may appear for multiple architectures by specifying a comma-separated list of architectures (i.e. arch="sparc64,amd64"). diff --git a/release/doc/en_US.ISO8859-1/hardware/article.xml b/release/doc/en_US.ISO8859-1/hardware/article.xml index 0168b3630f91..ee5f66cf76e5 100644 --- a/release/doc/en_US.ISO8859-1/hardware/article.xml +++ b/release/doc/en_US.ISO8859-1/hardware/article.xml @@ -252,35 +252,6 @@ more information. - - pc98 - - NEC PC-9801/9821 series with almost all &i386;-compatible - processors, including 80486, &pentium;, &pentium; Pro, - &pentium; II, and variants. All &i386;-compatible processors - by AMD, Cyrix, IBM, and IDT are also supported. - - NEC FC-9801/9821 series, and NEC SV-98 series (both of - them are compatible with PC-9801/9821 series) should be - supported. - - EPSON PC-386/486/586 series, which are compatible with NEC - PC-9801 series are supported. - - High-resolution mode is not supported. NEC - PC-98XA/XL/RL/XL^2, and NEC PC-H98 series are supported in - normal (PC-9801 compatible) mode only. - - Although there are some multi-processor systems (such as - Rs20/B20), SMP-related features of &os; are not supported - yet. - - PC-9801/9821 standard bus (called C-Bus), PC-9801NOTE - expansion bus (110pin), and PCI bus are supported. New Extend - Standard Architecture (NESA) bus (used in PC-H98, SV-H98, and - FC-H98 series) is not supported. - - powerpc @@ -636,17 +607,9 @@ Disk Controllers - [&arch.amd64;, &arch.i386;, &arch.pc98;, &arch.sparc64;] + [&arch.amd64;, &arch.i386;, &arch.sparc64;] IDE/ATA controllers (&man.ata.4; driver) - [&arch.pc98;] IDE/ATA controllers (wdc driver) - - - - On-board IDE controller - - - &hwlist.aac; &hwlist.adv; @@ -673,8 +636,6 @@ &hwlist.ciss; - &hwlist.ct; - &hwlist.dpt; @@ -894,8 +855,6 @@ &hwlist.sn; - &hwlist.snc; - &hwlist.ste; &hwlist.stge; @@ -904,7 +863,7 @@ &hwlist.tl; - [&arch.amd64;, &arch.i386;, &arch.pc98;] SMC 83c17x + [&arch.amd64;, &arch.i386;] SMC 83c17x (EPIC)-based Ethernet NICs (&man.tx.4; driver) &hwlist.txp; @@ -934,8 +893,7 @@ FDDI Interfaces - [&arch.i386;, &arch.pc98;] DEC DEFPA PCI (&man.fpa.4; - driver) + [&arch.i386;] DEC DEFPA PCI (&man.fpa.4; driver) [&arch.i386;] DEC DEFEA EISA (&man.fpa.4; driver) @@ -943,28 +901,28 @@ ATM Interfaces - [&arch.i386;, &arch.pc98;] Midway-based ATM interfaces + [&arch.i386;] Midway-based ATM interfaces (&man.en.4; driver) - [&arch.i386;, &arch.pc98; &arch.sparc64;] FORE Systems, + [&arch.i386;, &arch.sparc64;] FORE Systems, Inc. PCA-200E ATM PCI Adapters (hfa and &man.fatm.4; drivers) - [&arch.i386;, &arch.pc98;] IDT NICStAR 77201/211-based ATM + [&arch.i386;] IDT NICStAR 77201/211-based ATM Adapters (&man.idt.4; driver) - [&arch.i386;, &arch.pc98; &arch.sparc64;] FORE Systems, + [&arch.i386;, &arch.sparc64;] FORE Systems, Inc. HE155 and HE622 ATM interfaces (&man.hatm.4; driver) - [&arch.i386;, &arch.pc98;] IDT77252-based ATM cards + [&arch.i386;] IDT77252-based ATM cards (&man.patm.4; driver) Wireless Network Interfaces - [&arch.amd64;, &arch.i386;, &arch.pc98;] Cisco/Aironet + [&arch.amd64;, &arch.i386;] Cisco/Aironet 802.11b wireless adapters (&man.an.4; driver) &hwlist.ath; @@ -1016,7 +974,7 @@ &hwlist.urtw; - [&arch.amd64;, &arch.i386;, &arch.pc98;] Lucent + [&arch.amd64;, &arch.i386;] Lucent Technologies WaveLAN/IEEE 802.11b wireless network adapters and workalikes using the Lucent Hermes, Intersil PRISM-II, Intersil PRISM-2.5, Intersil Prism-3, and Symbol Spectrum24 @@ -1214,77 +1172,6 @@ &hwlist.rc; - [&arch.pc98;] Internel serial interfaces (&man.sio.4; - driver) - - - - PC-9801 on-board - - - PC-9821 2'nd CCU (flags 0x12000000) - - - - [&arch.pc98;] NEC PC-9861K, PC-9801-101 and Midori-Denshi - MDC-926Rs (&man.sio.4; driver) - - - - COM2 (flags 0x01000000) - - - - COM3 (flags 0x02000000) - - - - [&arch.pc98;] NEC PC-9801-120 (&man.sio.4; driver) - - - "flags 0x11000000" is necessary in kernel - configuration. - - - [&arch.pc98;] Microcore MC-16550, MC-16550II, MC-RS98 - (&man.sio.4; driver) - - - "flags 0x14000?01" is necessary in kernel - configuration. - - - [&arch.pc98;] Media Intelligent RSB-2000, RSB-3000 and - AIWA B98-02 (&man.sio.4; driver) - - - "flags 0x15000?01" is necessary in kernel - configuration. - - - [&arch.pc98;] Media Intelligent RSB-384 (&man.sio.4; - driver) - - - "flags 0x16000001" is necessary in kernel - configuration. - - - [&arch.pc98;] I-O DATA RSA-98III (&man.sio.4; - driver) - - - "flags 0x18000?01" is necessary in kernel - configuration. - - - [&arch.pc98;] Hayes ESP98 (&man.sio.4; driver) - - - "options COM_ESP" and "flags 0x19000000" are necessary - in kernel configuration. - - @@ -1350,35 +1237,6 @@ &hwlist.snd.vibes; - [&arch.pc98;] NEC PC-9801-73, 86 and compatibles (nss - driver) - - - - NEC A-MATE internal sound - - - - Q-Vision WaveStar, WaveMaster - - - - [&arch.pc98;] NEC X-MATE, CanBe, ValueStar internal (mss - driver) - - [&arch.pc98;] Creative Technologies SoundBlaster(98) - (&man.sb.4; driver) - - [&arch.pc98;] I-O DATA CD-BOX (&man.sb.4; driver) - - [&arch.pc98;] MPU-401 and compatible interfaces (mpu - driver) - - - - Q-Vision WaveStar - - @@ -1392,7 +1250,7 @@ USB Devices - [&arch.amd64;, &arch.i386;, &arch.pc98;] A + [&arch.amd64;, &arch.i386;] A range of USB peripherals are supported; devices known to work are listed in this section. Owing to the generic nature of most USB devices, with some exceptions any device of a given @@ -1400,14 +1258,14 @@ here. - [&arch.amd64;, &arch.i386;, &arch.pc98;] + [&arch.amd64;, &arch.i386;] USB Ethernet adapters can be found in the section listing Ethernet interfaces. - [&arch.amd64;, &arch.i386;, &arch.pc98;] + [&arch.amd64;, &arch.i386;] USB Bluetooth adapters can be found in Bluetooth section. @@ -1415,18 +1273,15 @@ &hwlist.uhci; - [&arch.amd64;, &arch.i386;, &arch.pc98;] USB + [&arch.amd64;, &arch.i386;] USB 2.0 controllers using the EHCI interface (&man.ehci.4; driver) - [&arch.amd64;, &arch.i386;, &arch.pc98;] - Hubs + [&arch.amd64;, &arch.i386;] Hubs - [&arch.amd64;, &arch.i386;, &arch.pc98;] - Keyboards (&man.ukbd.4; driver) + [&arch.amd64;, &arch.i386;] Keyboards (&man.ukbd.4; driver) - [&arch.amd64;, &arch.i386;, &arch.pc98;] - Miscellaneous + [&arch.amd64;, &arch.i386;] Miscellaneous @@ -1454,8 +1309,7 @@ &hwlist.umodem; - [&arch.amd64;, &arch.i386;, &arch.pc98;] Mice - (&man.ums.4; driver) + [&arch.amd64;, &arch.i386;] Mice (&man.ums.4; driver) &hwlist.ulpt; @@ -1471,7 +1325,7 @@ &hwlist.umass; - [&arch.amd64;, &arch.i386;, &arch.pc98;] Audio Devices + [&arch.amd64;, &arch.i386;] Audio Devices (&man.uaudio.4; driver) &hwlist.uvisor; @@ -1507,8 +1361,7 @@ Miscellaneous - [&arch.amd64;, &arch.i386;, &arch.pc98;] - FAX-Modem/PCCARD + [&arch.amd64;, &arch.i386;] FAX-Modem/PCCARD @@ -1521,7 +1374,7 @@ - [&arch.amd64;, &arch.i386;, &arch.pc98;] Floppy drives + [&arch.amd64;, &arch.i386;] Floppy drives (&man.fdc.4; driver) [&arch.amd64;, &arch.i386;] VGA-compatible video cards @@ -1533,8 +1386,7 @@ found at http://www.x.org/. - [&arch.amd64;, &arch.i386;, &arch.pc98;] - Keyboards including: + [&arch.amd64;, &arch.i386;] Keyboards including: @@ -1548,21 +1400,17 @@ - [&arch.pc98;] Standard keyboards - - - - [&arch.amd64;, &arch.i386;, &arch.pc98;] + [&arch.amd64;, &arch.i386;] USB keyboards (&man.ukbd.4; driver) - [&arch.amd64;, &arch.i386;, &arch.pc98;] + [&arch.amd64;, &arch.i386;] Pointing devices including: - [&arch.amd64;, &arch.i386;, &arch.pc98;] Bus mice and + [&arch.amd64;, &arch.i386;] Bus mice and compatible devices (&man.mse.4; driver) @@ -1577,7 +1425,7 @@ - [&arch.amd64;, &arch.i386;, &arch.pc98;] + [&arch.amd64;, &arch.i386;] USB mice (&man.ums.4; driver) @@ -1591,17 +1439,10 @@ [&arch.amd64;, &arch.i386;] PC standard parallel ports (&man.ppc.4; driver) - [&arch.pc98;] PC-9821 standard parallel - ports (&man.ppc.4; driver) - [&arch.i386;, &arch.amd64;] PC-compatible joysticks (&man.joy.4; driver) - [&arch.pc98;] Joystick port of SoundBlaster(98) - (&man.joy.4; driver) - - [&arch.i386;, &arch.pc98;] PHS Data Communication - Card/PCCARD + [&arch.i386;] PHS Data Communication Card/PCCARD @@ -1621,8 +1462,6 @@ cards compatible with the HOT1 from Virtual Computers (xrpu driver). - [&arch.pc98;] Power Management Controller of NEC PC-98 - Note (pmc driver) diff --git a/release/doc/en_US.ISO8859-1/readme/article.xml b/release/doc/en_US.ISO8859-1/readme/article.xml index ffebcc32d4c1..cbca329ea50e 100644 --- a/release/doc/en_US.ISO8859-1/readme/article.xml +++ b/release/doc/en_US.ISO8859-1/readme/article.xml @@ -69,7 +69,6 @@ &os; is an operating system based on 4.4 BSD Lite for AMD64 and Intel EM64T based PC hardware (&arch.amd64;), Intel, AMD, Cyrix or NexGen x86 based PC hardware (&arch.i386;), - NEC PC-9801/9821 series PCs and compatibles (&arch.pc98;), and &ultrasparc; machines (&arch.sparc64;). Versions for the &arm; (&arch.arm;), &mips; (&arch.mips;), and &powerpc; (&arch.powerpc;) architectures are currently under @@ -324,7 +323,7 @@ On platforms that support &man.bsdinstall.8; (currently - &arch.amd64;, &arch.i386;, &arch.pc98;, and &arch.sparc64;), these documents are generally available via the + &arch.amd64;, &arch.i386;, and &arch.sparc64;), these documents are generally available via the Documentation menu during installation. Once the system is installed, you can revisit this menu by re-running the &man.bsdinstall.8; utility. diff --git a/release/doc/share/examples/Makefile.relnotesng b/release/doc/share/examples/Makefile.relnotesng index 9607e283a071..5bbc1a110900 100644 --- a/release/doc/share/examples/Makefile.relnotesng +++ b/release/doc/share/examples/Makefile.relnotesng @@ -6,7 +6,7 @@ # the build tree. # -ARCHS= amd64 i386 pc98 powerpc sparc64 +ARCHS= amd64 i386 powerpc sparc64 MULTITEXTS= UNITEXTS= hardware readme relnotes errata diff --git a/release/doc/share/misc/dev.archlist.txt b/release/doc/share/misc/dev.archlist.txt index 5f62f48fecb5..7ad81543e989 100644 --- a/release/doc/share/misc/dev.archlist.txt +++ b/release/doc/share/misc/dev.archlist.txt @@ -36,43 +36,42 @@ # [,...] # aac i386,amd64 -adv i386,pc98,amd64 -adw i386,pc98,amd64 +adv i386,amd64 +adw i386,amd64 aha i386 ahb i386 ahd i386,sparc64,amd64 -aic i386,pc98,amd64 -amd i386,pc98,amd64 +aic i386,amd64 +amd i386,amd64 arcmsr i386,amd64 asr i386 -ath i386,pc98,amd64,sparc64 -aue i386,pc98,amd64,powerpc -axe i386,pc98,amd64,powerpc +ath i386,amd64,sparc64 +aue i386,amd64,powerpc +axe i386,amd64,powerpc bce i386,amd64 -bge i386,pc98,sparc64,amd64 -bktr i386,pc98 +bge i386,sparc64,amd64 +bktr i386 bt i386,amd64 bxe i386,amd64 -cdce i386,pc98,amd64,powerpc +cdce i386,amd64,powerpc ciss i386,amd64 -ce i386,pc98 +ce i386 cm i386 -cnw i386,pc98,amd64 -cp i386,pc98 -ct pc98 +cnw i386,amd64 +cp i386 ctau i386 -cue i386,pc98,amd64,powerpc +cue i386,amd64,powerpc cx i386 cxgb i386,amd64 -de i386,pc98,amd64 +de i386,amd64 dpt i386,amd64 -ed i386,pc98 -ep i386,pc98,amd64 +ed i386 +ep i386,amd64 esp sparc64 ex i386,amd64 -fe i386,pc98,amd64 +fe i386,amd64 fwohci i386,sparc64,amd64,powerpc -hifn i386,pc98,amd64 +hifn i386,amd64 hpt27xx i386,amd64 hptiop i386,amd64 hptmv i386,amd64 @@ -83,26 +82,26 @@ iir i386,amd64 ips i386,amd64 isci i386,amd64 ixgb i386,amd64 -kue i386,pc98,amd64,powerpc -lge i386,pc98,amd64 +kue i386,amd64,powerpc +lge i386,amd64 mfi i386,amd64 mlx i386,amd64 mly i386,amd64 msk i386,amd64 mxge i386,amd64 -my i386,pc98 -ncr i386,pc98,amd64 -ncv i386,pc98 +my i386 +ncr i386,amd64 +ncv i386 nfe i386,amd64 -ng_bt3c i386,pc98,amd64 -ng_ubt i386,pc98,amd64 -nsp i386,pc98 +ng_bt3c i386,amd64 +ng_ubt i386,amd64 +nsp i386 nxge i386,amd64 oce i386,amd64 -ohci i386,pc98,amd64,powerpc +ohci i386,amd64,powerpc oltr i386 otus i386,amd64 -pcn i386,pc98,amd64 +pcn i386,amd64 pst i386 qlxgb amd64 qlxgbe amd64 @@ -110,14 +109,13 @@ qlxge amd64 rc i386 ral i386,amd64 rsu i386,amd64 -rue i386,pc98,amd64 +rue i386,amd64 rum i386,amd64 run i386,amd64 -safe i386,pc98,amd64 +safe i386,amd64 sbp i386,sparc64,amd64 sfgxe amd64 sn i386,amd64 -snc pc98 snd_ad1816 i386,amd64 snd_als4000 i386 snd_atiixp i386,amd64 @@ -148,31 +146,31 @@ snd_t4dwave i386,amd64,sparc64 snd_via8233 i386,amd64 snd_via82c686 i386,amd64 snd_vibes i386,amd64 -stg i386,pc98 -ti i386,pc98,amd64,sparc64 -tl i386,pc98,amd64 +stg i386 +ti i386,amd64,sparc64 +tl i386,amd64 trm i386,amd64 twa i386,amd64 twe i386,amd64 tws i386,amd64 -ubsa i386,pc98,amd64 -ubsec i386,pc98,amd64 -ubser i386,pc98,amd64 -ucycom i386,pc98,amd64 -udav i386,pc98,amd64 -uftdi i386,pc98,amd64 -uhci i386,pc98,amd64,powerpc -ulpt i386,pc98,amd64,powerpc -umass i386,pc98,amd64,powerpc -umodem i386,pc98,amd64 -uplcom i386,pc98,amd64 +ubsa i386,amd64 +ubsec i386,amd64 +ubser i386,amd64 +ucycom i386,amd64 +udav i386,amd64 +uftdi i386,amd64 +uhci i386,amd64,powerpc +ulpt i386,amd64,powerpc +umass i386,amd64,powerpc +umodem i386,amd64 +uplcom i386,amd64 ural i386,amd64 -urio i386,pc98,amd64,powerpc -uvisor i386,pc98,amd64 -uvscom i386,pc98,amd64 +urio i386,amd64,powerpc +uvisor i386,amd64 +uvscom i386,amd64 vpo i386 -vx i386,pc98,amd64 +vx i386,amd64 vxge i386,amd64 -wb i386,pc98,amd64 +wb i386,amd64 xe i386,amd64 zyd i386,amd64 diff --git a/release/doc/share/xml/release.ent b/release/doc/share/xml/release.ent index 0ce9177ebc86..cacc43401fba 100644 --- a/release/doc/share/xml/release.ent +++ b/release/doc/share/xml/release.ent @@ -73,7 +73,6 @@ - diff --git a/release/pc98/mkisoimages.sh b/release/pc98/mkisoimages.sh deleted file mode 100644 index 5e7a046147aa..000000000000 --- a/release/pc98/mkisoimages.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh -# -# Module: mkisoimages.sh -# Author: Jordan K Hubbard -# Date: 22 June 2001 -# -# $FreeBSD$ -# -# This script is used by release/Makefile to build the (optional) ISO images -# for a FreeBSD release. It is considered architecture dependent since each -# platform has a slightly unique way of making bootable CDs. This script -# is also allowed to generate any number of images since that is more of -# publishing decision than anything else. -# -# Usage: -# -# mkisoimages.sh [-b] image-label image-name base-bits-dir [extra-bits-dir] -# -# Where -b is passed if the ISO image should be made "bootable" by -# whatever standards this architecture supports (may be unsupported), -# image-label is the ISO image label, image-name is the filename of the -# resulting ISO image, base-bits-dir contains the image contents and -# extra-bits-dir, if provided, contains additional files to be merged -# into base-bits-dir as part of making the image. - -if [ "x$1" = "x-b" ]; then - # This is highly x86-centric and will be used directly below. - bootable="-o generic-bootimage=$4/boot/cdboot" - shift -else - bootable="" -fi - -if [ $# -lt 3 ]; then - echo "Usage: $0 [-b] image-label image-name base-bits-dir [extra-bits-dir]" - exit 1 -fi - -LABEL=`echo "$1" | tr '[:lower:]' '[:upper:]'`; shift -NAME="$1"; shift - -publisher="The FreeBSD Project. http://www.FreeBSD.org/" -echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > "$1/etc/fstab" -makefs -t cd9660 $bootable -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME" "$@" -rm -f "$1/etc/fstab" diff --git a/release/rc.local b/release/rc.local index cb442273c303..8162cd1efff6 100755 --- a/release/rc.local +++ b/release/rc.local @@ -16,11 +16,7 @@ mkdir /tmp/bsdinstall_etc kbdcontrol -d >/dev/null 2>&1 if [ $? -eq 0 ]; then # Syscons: use xterm, start interesting things on other VTYs - if [ ${MACHINE} = "pc98" ]; then - TERM=cons25w - else - TERM=xterm - fi + TERM=xterm # Don't send ESC on function-key 62/63 (left/right command key) kbdcontrol -f 62 '' > /dev/null 2>&1 diff --git a/rescue/rescue/Makefile b/rescue/rescue/Makefile index 70d3a3724a08..12aef08a8a54 100644 --- a/rescue/rescue/Makefile +++ b/rescue/rescue/Makefile @@ -141,10 +141,6 @@ CRUNCH_ALIAS_bsdlabel= disklabel #CRUNCH_LIBS+= -lsmb .endif -.if ${MACHINE} == "pc98" -CRUNCH_SRCDIR_fdisk= $(.CURDIR)/../../sbin/fdisk_pc98 -.endif - .if ${MACHINE_CPUARCH} == "sparc64" CRUNCH_PROGS_sbin+= bsdlabel sunlabel .endif diff --git a/sbin/Makefile.pc98 b/sbin/Makefile.pc98 deleted file mode 100644 index 4aab559ad6dd..000000000000 --- a/sbin/Makefile.pc98 +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD$ - -SUBDIR += bsdlabel -SUBDIR += fdisk_pc98 -SUBDIR += sconfig diff --git a/sbin/bsdlabel/bsdlabel.8 b/sbin/bsdlabel/bsdlabel.8 index 994320665cb1..799a623aae18 100644 --- a/sbin/bsdlabel/bsdlabel.8 +++ b/sbin/bsdlabel/bsdlabel.8 @@ -109,9 +109,9 @@ argument forces .Nm to use a layout suitable for a different architecture. Current valid values are -.Cm i386 , amd64 , +.Cm i386 and -.Cm pc98 . +.Cm amd64 . If this option is omitted, .Nm will use a layout suitable for the current machine. diff --git a/sbin/bsdlabel/bsdlabel.c b/sbin/bsdlabel/bsdlabel.c index 072c4cfa0884..83df67ae0fe3 100644 --- a/sbin/bsdlabel/bsdlabel.c +++ b/sbin/bsdlabel/bsdlabel.c @@ -164,8 +164,7 @@ main(int argc, char *argv[]) break; case 'm': if (!strcmp(optarg, "i386") || - !strcmp(optarg, "amd64") || - !strcmp(optarg, "pc98")) { + !strcmp(optarg, "amd64")) { labelsoffset = 1; labeloffset = 0; bbsize = 8192; diff --git a/sbin/fdisk_pc98/Makefile b/sbin/fdisk_pc98/Makefile deleted file mode 100644 index 7bfa0632612d..000000000000 --- a/sbin/fdisk_pc98/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# $FreeBSD$ - -PACKAGE=runtime -PROG= fdisk -SRCS= fdisk.c geom_pc98_enc.c -WARNS?= 4 -MAN= fdisk.8 - -.PATH: ${.CURDIR}/../../sys/geom - -LIBADD= geom - -.include diff --git a/sbin/fdisk_pc98/Makefile.depend b/sbin/fdisk_pc98/Makefile.depend deleted file mode 100644 index 2df49d098af1..000000000000 --- a/sbin/fdisk_pc98/Makefile.depend +++ /dev/null @@ -1,17 +0,0 @@ -# $FreeBSD$ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - gnu/lib/libgcc \ - include \ - include/xlocale \ - lib/${CSU_DIR} \ - lib/libc \ - lib/libgeom \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif diff --git a/sbin/fdisk_pc98/fdisk.8 b/sbin/fdisk_pc98/fdisk.8 deleted file mode 100644 index eea55590baa9..000000000000 --- a/sbin/fdisk_pc98/fdisk.8 +++ /dev/null @@ -1,486 +0,0 @@ -.\" $FreeBSD$ -.\" -.Dd October 5, 2016 -.Dt FDISK 8 -.Os -.Sh NAME -.Nm fdisk -.Nd NEC PC-98x1 slice table maintenance utility -.Sh SYNOPSIS -.Nm -.Op Fl BIaistuv -.Op Fl 12345678 -.Op Ar disk -.Nm -.Fl f Ar configfile -.Op Fl itv -.Op Ar disk -.Sh PROLOGUE -In order for the BIOS to boot the kernel, -certain conventions must be adhered to. -Sector 0 of the disk must contain boot code, -a slice table, -and a magic number. -BIOS slices can be used to break the disk up into several pieces. -The BIOS brings in sector 0 and verifies the magic number. -The sector -0 boot code then searches the slice table to determine which -slice is marked -.Dq active . -This boot code then brings in the bootstrap from the -active slice and, if marked bootable, runs it. -Under -.Tn DOS , -you can have one or more slices with one active. -The -.Tn DOS -.Nm -utility can be used to divide space on the disk into slices and set one -active. -.Sh DESCRIPTION -The -.Fx -utility, -.Nm , -serves a similar purpose to the -.Tn DOS -utility. -The first form is used to -display slice information or to interactively edit the slice -table. -The second is used to write a slice table using a -.Ar configfile , -and is designed to be used by other scripts/programs. -.Pp -Options are: -.Bl -tag -width indent -.It Fl a -Change the active slice only. -Ignored if -.Fl f -is given. -.It Fl B -Reinitialize the boot code contained in sector 0 of the disk. -Ignored if -.Fl f -is given. -.It Fl f Ar configfile -Set slice values using the file -.Ar configfile . -The -.Ar configfile -always modifies existing slices, unless -.Fl i -is also given, in which case all existing slices are deleted (marked -as -.Dq unused ) -before the -.Ar configfile -is read. -The -.Ar configfile -can be -.Sq Fl , -in which case standard input is read. -See -.Sx CONFIGURATION FILE , -below, for file syntax. -.Pp -.Em WARNING : -when -.Fl f -is used, you are not asked if you really want to write the slices -table (as you are in the interactive mode). -Use with caution! -.It Fl i -Initialize sector 0 of the disk. -This implies -.Fl u , -unless -.Fl f -is given. -.It Fl I -Initialize sector 0 slice table -for one -.Fx -slice covering the entire disk. -Some space at the start of the disk will reserved for the IPL program -and the pc98 slice table itself. -.It Fl s -Print summary information and exit. -.It Fl t -Test mode; do not write slice values. -Generally used with the -.Fl f -option to see what would be written to the slice table. -Implies -.Fl v . -.It Fl u -Update (edit) the disk's sector 0 slice table. -Ignored if -.Fl f -is given. -.It Fl v -Be verbose. -Slices that are unused are suppressed unless this flag is specified. -When -.Fl f -is used, -.Nm -prints out the slice table that is written to the disk. -.It Fl 12345678 -Operate on a single slice table entry only. -Ignored if -.Fl f -is given. -.El -.Pp -The final disk name can be provided as a -.Dq bare -disk name only, e.g.\& -.Pa da0 , -or as a full pathname. -If omitted, -.Nm -tries to figure out the default disk device name from the -mounted root device. -.Pp -When called with no arguments, it prints the sector 0 slice table. -An example follows: -.Bd -literal - ******* Working on device /dev/da0 ******* - parameters extracted from in-core disklabel are: - cylinders=33075 heads=8 sectors/track=32 (256 blks/cyl) - - parameters to be used for BIOS calculations are: - cylinders=33075 heads=8 sectors/track=32 (256 blks/cyl) - - Media sector size is 512 - Warning: BIOS sector numbering starts with sector 1 - Information from DOS bootblock is: - The data for partition 1 is: - sysmid 148,(FreeBSD/NetBSD/386BSD) - start 256, size 2490112 (1215 Meg), sid 196 - beg: cyl 1/ sector 0/ head 0; - end: cyl 9727/ sector 0/ head 0 - system Name FreeBSD(98) - The data for partition 2 is: - sysmid 148,(FreeBSD/NetBSD/386BSD) - start 2490368, size 5505024 (2688 Meg), sid 196 - beg: cyl 9728/ sector 0/ head 0; - end: cyl 31231/ sector 0/ head 0 - system Name FreeBSD(98) - The data for partition 3 is: - - The data for partition 4 is: - - The data for partition 5 is: - - The data for partition 6 is: - - The data for partition 7 is: - - The data for partition 8 is: - - The data for partition 9 is: - - The data for partition 10 is: - - The data for partition 11 is: - - The data for partition 12 is: - - The data for partition 13 is: - - The data for partition 14 is: - - The data for partition 15 is: - - The data for partition 16 is: - -.Ed -.Pp -The disk is divided into three slices that happen to fill the disk. -The second slice overlaps the end of the first. -(Used for debugging purposes.) -.Bl -tag -width ".Em cyl , sector No and Em head" -.It Em sysmid -is used to label the slice. -.Fx -reserves the -magic number 148 decimal (94 in hex). -.It Xo -.Em start -and -.Em size -.Xc -fields provide the start address -and size of a slice in sectors. -.It Xo -.Em cyl , sector -and -.Em head -.Xc -fields are used to specify the beginning and end addresses of the slice. -.It Em "system Name" -is the name of the slice. -.El -.Pp -.Em Note : -these numbers are calculated using BIOS's understanding of the disk geometry -and saved in the bootblock. -.Pp -The -.Fl i -and -.Fl u -flags are used to indicate that the slice data is to be updated. -Unless the -.Fl f -option is also given, -.Nm -will enter a conversational mode. -In this mode, no changes will be written to disk unless you explicitly tell -.Nm -to. -.Pp -The -.Nm -utility will display each slice and ask whether you want to edit it. -If you say yes, -.Nm -will step through each field, show you the old value, -and ask you for a new one. -When you are done with the slice, -.Nm -will display it and ask you whether it is correct. -It will then proceed to the next entry. -.Pp -Getting the -.Em cyl , sector , -and -.Em head -fields correct is tricky, so by default, -they will be calculated for you; -you can specify them if you choose to though. -.Pp -After all the slices are processed, -you are given the option to change the -.Dq active -slice. -Finally, when all the new data for sector 0 has been accumulated, -you are asked to confirm whether you really want to rewrite it. -.Pp -The difference between the -.Fl u -and -.Fl i -flags is that -the -.Fl u -flag edits (updates) the existing slice parameters -while the -.Fl i -flag is used to -.Dq initialize -them (old values will be ignored); -it will setup the last BIOS slice to use the whole disk for -.Fx ; -and make it active. -.Sh NOTES -The automatic calculation of starting cylinder etc.\& uses -a set of figures that represent what the BIOS thinks the -geometry of the drive is. -These figures are taken from the in-core disklabel by default, -but -.Nm -initially gives you an opportunity to change them. -This allows you to create a bootblock that can work with drives -that use geometry translation under the BIOS. -.Pp -If you hand craft your disk layout, -please make sure that the -.Fx -slice starts on a cylinder boundary. -.Pp -Editing an existing slice will most likely result in the loss of -all data in that slice. -.Pp -You should run -.Nm -interactively once or twice to see how it works. -This is completely safe as long as you answer the last question -in the negative. -There are subtleties that -.Nm -detects that are not fully explained in this manual page. -.Sh CONFIGURATION FILE -When the -.Fl f -option is given, a disk's slice table can be written using values -from a -.Ar configfile . -The syntax of this file is very simple; -each line is either a comment or a specification, as follows: -.Bl -tag -width indent -.It Ic # Ar comment ... -Lines beginning with a -.Ic # -are comments and are ignored. -.It Ic g Ar spec1 spec2 spec3 -Set the BIOS geometry used in slice calculations. -There must be -three values specified, with a letter preceding each number: -.Bl -tag -width indent -.It Cm c Ns Ar num -Set the number of cylinders to -.Ar num . -.It Cm h Ns Ar num -Set the number of heads to -.Ar num . -.It Cm s Ns Ar num -Set the number of sectors/track to -.Ar num . -.El -.Pp -These specs can occur in any order, as the leading letter determines -which value is which; however, all three must be specified. -.Pp -This line must occur before any lines that specify slice -information. -.Pp -It is an error if the following is not true: -.Bd -literal -offset indent -1 <= number of cylinders -1 <= number of heads <= 256 -1 <= number of sectors/track < 64 -.Ed -.Pp -The number of cylinders should be less than or equal to 1024, but this -is not enforced, although a warning will be printed. -Note that bootable -.Fx -slices (the -.Dq Pa / -file system) must lie completely within the -first 1024 cylinders; if this is not true, booting may fail. -Non-bootable slices do not have this restriction. -.Pp -Example (all of these are equivalent), for a disk with 1019 cylinders, -39 heads, and 63 sectors: -.Bd -literal -offset indent -g c1019 h39 s63 -g h39 c1019 s63 -g s63 h39 c1019 -.Ed -.It Ic p Ar slice type start length -Set the slice given by -.Ar slice -(1-8) to type -.Ar type , -starting at sector -.Ar start -for -.Ar length -sectors. -.Pp -Only those slices explicitly mentioned by these lines are modified; -any slice not referenced by a -.Ic p -line will not be modified. -However, if an invalid slice table is present, or the -.Fl i -option is specified, all existing slice entries will be cleared -(marked as unused), and these -.Ic p -lines will have to be used to -explicitly set slice information. -If multiple slices need to be -set, multiple -.Ic p -lines must be specified; one for each slice. -.Pp -These slice lines must occur after any geometry specification lines, -if one is present. -.Pp -The -.Ar type -is 165 for -.Fx -slices. -Specifying a slice type of zero is -the same as clearing the slice and marking it as unused; however, -dummy values (such as -.Dq 0 ) -must still be specified for -.Ar start -and -.Ar length . -.Pp -Note: the start offset will be rounded upwards to a head boundary if -necessary, and the end offset will be rounded downwards to a cylinder -boundary if necessary. -.Pp -Example: to clear slice 4 and mark it as unused: -.Pp -.Dl "p 4 0 0 0" -.Pp -Example: to set slice 1 to a -.Fx -slice, starting at sector 1 -for 2503871 sectors (note: these numbers will be rounded upwards and -downwards to correspond to head and cylinder boundaries): -.Pp -.Dl "p 1 165 1 2503871" -.It Ic a Ar slice -Make -.Ar slice -the active slice. -Can occur anywhere in the config file, but only -one must be present. -.Pp -Example: to make slice 1 the active slice: -.Pp -.Dl "a 1" -.El -.Sh SEE ALSO -.Xr boot98cfg 8 , -.Xr bsdlabel 8 , -.Xr gpart 8 , -.Xr newfs 8 -.Sh HISTORY -A version of -.Nm -first appeared in the Mach Operating System. -It was subsequently ported to -.Bx 386 . -.Sh AUTHORS -.An -nosplit -.Nm -for Mach Operating System was written by -.An Robert Baron Aq Mt rvb@cs.cmu.edu . -It was ported to -.Bx 386 -by -.An Julian Elischer Aq Mt julian@tfs.com . -.Sh BUGS -The default boot code will not necessarily handle all slice types -correctly, in particular those introduced since -.Tn MS-DOS -6.x. -.Pp -The entire utility should be made more user-friendly. -.Pp -Most users new to -.Fx -do not understand the difference between -.Dq slice -and -.Dq partition , -causing difficulty to adjust. -.Pp -You cannot use this command to completely dedicate a disk to -.Fx . -The -.Xr bsdlabel 8 -command must be used for this. diff --git a/sbin/fdisk_pc98/fdisk.c b/sbin/fdisk_pc98/fdisk.c deleted file mode 100644 index 7b840535df80..000000000000 --- a/sbin/fdisk_pc98/fdisk.c +++ /dev/null @@ -1,910 +0,0 @@ -/* - * Mach Operating System - * Copyright (c) 1992 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -int iotest; - -#define LBUF 100 -static char lbuf[LBUF]; - -/* - * - * Ported to 386bsd by Julian Elischer Thu Oct 15 20:26:46 PDT 1992 - * - * 14-Dec-89 Robert Baron (rvb) at Carnegie-Mellon University - * Copyright (c) 1989 Robert. V. Baron - * Created. - */ - -#define Decimal(str, ans, tmp) if (decimal(str, &tmp, ans)) ans = tmp -#define String(str, ans, len) {char *z = ans; char **dflt = &z; if (string(str, dflt)) strncpy(ans, *dflt, len); } - -#define MAX_SEC_SIZE 2048 /* maximum section size that is supported */ -#define MIN_SEC_SIZE 512 /* the sector size to start sensing at */ -static int secsize = 0; /* the sensed sector size */ - -static char *disk; - -static int cyls, sectors, heads, cylsecs, disksecs; - -struct mboot { - unsigned char padding[2]; /* force the longs to be long aligned */ - unsigned char bootinst[510]; - unsigned short int signature; - struct pc98_partition parts[8]; - unsigned char large_sector_overflow[MAX_SEC_SIZE-MIN_SEC_SIZE]; -}; - -static struct mboot mboot; -static int fd; - -static uint dos_cyls; -static uint dos_heads; -static uint dos_sectors; -static uint dos_cylsecs; - -#define MAX_ARGS 10 - -typedef struct cmd { - char cmd; - int n_args; - struct arg { - char argtype; - int arg_val; - } args[MAX_ARGS]; -} CMD; - -static int B_flag = 0; /* replace boot code */ -static int I_flag = 0; /* Inizialize disk to defaults */ -static int a_flag = 0; /* set active partition */ -static int i_flag = 0; /* replace partition data */ -static int u_flag = 0; /* update partition data */ -static int s_flag = 0; /* Print a summary and exit */ -static int t_flag = 0; /* test only */ -static char *f_flag = NULL; /* Read config info from file */ -static int v_flag = 0; /* Be verbose */ - -static struct part_type -{ - unsigned char type; - const char *name; -} part_types[] = { - {0x00, "unused"} - ,{0x01, "Primary DOS with 12 bit FAT"} - ,{0x11, "MSDOS"} - ,{0x20, "MSDOS"} - ,{0x21, "MSDOS"} - ,{0x22, "MSDOS"} - ,{0x23, "MSDOS"} - ,{0x02, "XENIX / file system"} - ,{0x03, "XENIX /usr file system"} - ,{0x04, "PC-UX"} - ,{0x05, "Extended DOS"} - ,{0x06, "Primary 'big' DOS (> 32MB)"} - ,{0x07, "OS/2 HPFS, QNX or Advanced UNIX"} - ,{0x08, "AIX file system"} - ,{0x09, "AIX boot partition or Coherent"} - ,{0x0A, "OS/2 Boot Manager or OPUS"} - ,{0x10, "OPUS"} - ,{0x14, "FreeBSD/NetBSD/386BSD"} - ,{0x94, "FreeBSD/NetBSD/386BSD"} - ,{0x40, "VENIX 286"} - ,{0x50, "DM"} - ,{0x51, "DM"} - ,{0x52, "CP/M or Microport SysV/AT"} - ,{0x56, "GB"} - ,{0x61, "Speed"} - ,{0x63, "ISC UNIX, other System V/386, GNU HURD or Mach"} - ,{0x64, "Novell Netware 2.xx"} - ,{0x65, "Novell Netware 3.xx"} - ,{0x75, "PCIX"} - ,{0x40, "Minix"} -}; - -static void print_s0(int which); -static void print_part(int i); -static void init_sector0(unsigned long start); -static void init_boot(void); -static void change_part(int i, int force); -static void print_params(void); -static void change_active(int which); -static void change_code(void); -static void get_params_to_use(void); -static char *get_rootdisk(void); -static void dos(u_int32_t start, u_int32_t size, struct pc98_partition *partp); -static int open_disk(int flag); -static ssize_t read_disk(off_t sector, void *buf); -static int write_disk(off_t sector, void *buf); -static int get_params(void); -static int read_s0(void); -static int write_s0(void); -static int ok(const char *str); -static int decimal(const char *str, int *num, int deflt); -static const char *get_type(int type); -static void usage(void); -static int string(const char *str, char **ans); -static void reset_boot(void); - -int -main(int argc, char *argv[]) -{ - struct stat sb; - int c, i; - int partition = -1; - struct pc98_partition *partp; - - while ((c = getopt(argc, argv, "BIa:f:istuv12345678")) != -1) - switch (c) { - case 'B': - B_flag = 1; - break; - case 'I': - I_flag = 1; - break; - case 'a': - a_flag = 1; - break; - case 'f': - f_flag = optarg; - break; - case 'i': - i_flag = 1; - break; - case 's': - s_flag = 1; - break; - case 't': - t_flag = 1; - break; - case 'u': - u_flag = 1; - break; - case 'v': - v_flag = 1; - break; - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - partition = c - '0'; - break; - default: - usage(); - } - if (f_flag || i_flag) - u_flag = 1; - if (t_flag) - v_flag = 1; - argc -= optind; - argv += optind; - - if (argc == 0) { - disk = get_rootdisk(); - } else { - if (stat(argv[0], &sb) == 0) { - /* OK, full pathname given */ - disk = argv[0]; - } else if (errno == ENOENT && argv[0][0] != '/') { - /* Try prepending "/dev" */ - asprintf(&disk, "%s%s", _PATH_DEV, argv[0]); - if (disk == NULL) - errx(1, "out of memory"); - } else { - /* other stat error, let it fail below */ - disk = argv[0]; - } - } - if (open_disk(u_flag) < 0) - err(1, "cannot open disk %s", disk); - - if (s_flag) { - if (read_s0()) - err(1, "read_s0"); - printf("%s: %d cyl %d hd %d sec\n", disk, dos_cyls, dos_heads, - dos_sectors); - printf("Part %11s %11s %4s %4s %-16s\n", "Start", "Size", "MID", - "SID", "Name"); - for (i = 0; i < PC98_NPARTS; i++) { - partp = ((struct pc98_partition *) &mboot.parts) + i; - if (partp->dp_sid == 0) - continue; - printf("%4d: %11u %11u 0x%02x 0x%02x %-16.16s\n", i + 1, - partp->dp_scyl * cylsecs, - (partp->dp_ecyl - partp->dp_scyl + 1) * cylsecs, - partp->dp_mid, partp->dp_sid, partp->dp_name); - } - exit(0); - } - - printf("******* Working on device %s *******\n",disk); - - if (I_flag) { - read_s0(); - reset_boot(); - partp = (struct pc98_partition *) (&mboot.parts[0]); - partp->dp_mid = DOSMID_386BSD; - partp->dp_sid = DOSSID_386BSD; - strncpy(partp->dp_name, "FreeBSD", sizeof(partp->dp_name)); - /* Start c/h/s. */ - partp->dp_scyl = partp->dp_ipl_cyl = 1; - partp->dp_shd = partp->dp_ipl_head = 1; - partp->dp_ssect = partp->dp_ipl_sct = 0; - - /* End c/h/s. */ - partp->dp_ecyl = dos_cyls - 1; - partp->dp_ehd = dos_cylsecs / dos_sectors; - partp->dp_esect = dos_sectors; - - if (v_flag) - print_s0(-1); - if (!t_flag) - write_s0(); - exit(0); - } - - if (f_flag) { - if (v_flag) - print_s0(-1); - if (!t_flag) - write_s0(); - } else { - if(u_flag) - get_params_to_use(); - else - print_params(); - - if (read_s0()) - init_sector0(dos_sectors); - - printf("Media sector size is %d\n", secsize); - printf("Warning: BIOS sector numbering starts with sector 1\n"); - printf("Information from DOS bootblock is:\n"); - if (partition == -1) - for (i = 1; i <= PC98_NPARTS; i++) - change_part(i, v_flag); - else - change_part(partition, 1); - - if (u_flag || a_flag) - change_active(partition); - - if (B_flag) - change_code(); - - if (u_flag || a_flag || B_flag) { - if (!t_flag) { - printf("\nWe haven't changed the partition table yet. "); - printf("This is your last chance.\n"); - } - print_s0(-1); - if (!t_flag) { - if (ok("Should we write new partition table?")) - write_s0(); - } else { - printf("\n-t flag specified -- partition table not written.\n"); - } - } - } - - exit(0); -} - -static void -usage() -{ - fprintf(stderr, "%s%s", - "usage: fdisk [-BIaistu] [-12345678] [disk]\n", - " fdisk -f configfile [-itv] [disk]\n"); - exit(1); -} - -static struct pc98_partition mtpart; - -static int -part_unused(int i) -{ - struct pc98_partition *partp; - - partp = ((struct pc98_partition *) &mboot.parts) + i - 1; - return (bcmp(partp, &mtpart, sizeof (struct pc98_partition)) == 0); -} - -static void -print_s0(int which) -{ - int i; - - print_params(); - printf("Information from DOS bootblock is:\n"); - if (which == -1) { - for (i = 1; i <= PC98_NPARTS; i++) - if (v_flag || !part_unused(i)) { - printf("%d: ", i); - print_part(i); - } - } - else - print_part(which); -} - -static void -print_part(int i) -{ - struct pc98_partition *partp; - u_int64_t part_sz, part_mb; - - if (part_unused(i)) { - printf("\n"); - return; - } - /* - * Be careful not to overflow. - */ - partp = ((struct pc98_partition *) &mboot.parts) + i - 1; - part_sz = (partp->dp_ecyl - partp->dp_scyl + 1) * cylsecs; - part_mb = part_sz * secsize; - part_mb /= (1024 * 1024); - printf("sysmid %d (%#04x),(%s)\n", partp->dp_mid, partp->dp_mid, - get_type(partp->dp_mid)); - printf(" start %lu, size %lu (%ju Meg), sid %d\n", - (u_long)(partp->dp_scyl * cylsecs), (u_long)part_sz, - (uintmax_t)part_mb, partp->dp_sid); - printf("\tbeg: cyl %d/ head %d/ sector %d;\n\tend: cyl %d/ head %d/ sector %d\n" - ,partp->dp_scyl - ,partp->dp_shd - ,partp->dp_ssect - ,partp->dp_ecyl - ,partp->dp_ehd - ,partp->dp_esect); - printf ("\tsystem Name %.16s\n", partp->dp_name); -} - - -static void -init_boot(void) -{ - - mboot.signature = PC98_MAGIC; -} - - -static void -init_sector0(unsigned long start) -{ - struct pc98_partition *partp = - (struct pc98_partition *)(&mboot.parts[0]); - - init_boot(); - - partp->dp_mid = DOSMID_386BSD; - partp->dp_sid = DOSSID_386BSD; - - dos(start, disksecs - start, partp); -} - -static void -change_part(int i, int force) -{ - struct pc98_partition *partp = - ((struct pc98_partition *) &mboot.parts) + i - 1; - - if (!force && part_unused(i)) - return; - - printf("The data for partition %d is:\n", i); - print_part(i); - - if (u_flag && ok("Do you want to change it?")) { - int tmp; - - if (i_flag) { - bzero((char *)partp, sizeof (struct pc98_partition)); - if (i == 1) { - init_sector0(1); - printf("\nThe static data for the slice 1 has been reinitialized to:\n"); - print_part(i); - } - } - do { - int x_start = partp->dp_scyl * cylsecs ; - int x_size = (partp->dp_ecyl - partp->dp_scyl + 1) * cylsecs; - Decimal("sysmid", partp->dp_mid, tmp); - Decimal("syssid", partp->dp_sid, tmp); - String ("system name", partp->dp_name, 16); - Decimal("start", x_start, tmp); - Decimal("size", x_size, tmp); - - if (ok("Explicitly specify beg/end address ?")) - { - int tsec,tcyl,thd; - tcyl = partp->dp_scyl; - thd = partp->dp_shd; - tsec = partp->dp_ssect; - Decimal("beginning cylinder", tcyl, tmp); - Decimal("beginning head", thd, tmp); - Decimal("beginning sector", tsec, tmp); - partp->dp_scyl = tcyl; - partp->dp_ssect = tsec; - partp->dp_shd = thd; - partp->dp_ipl_cyl = partp->dp_scyl; - partp->dp_ipl_sct = partp->dp_ssect; - partp->dp_ipl_head = partp->dp_shd; - - tcyl = partp->dp_ecyl; - thd = partp->dp_ehd; - tsec = partp->dp_esect; - Decimal("ending cylinder", tcyl, tmp); - Decimal("ending head", thd, tmp); - Decimal("ending sector", tsec, tmp); - partp->dp_ecyl = tcyl; - partp->dp_esect = tsec; - partp->dp_ehd = thd; - } else - dos(x_start, x_size, partp); - - print_part(i); - } while (!ok("Are we happy with this entry?")); - } -} - -static void -print_params() -{ - printf("parameters extracted from in-core disklabel are:\n"); - printf("cylinders=%d heads=%d sectors/track=%d (%d blks/cyl)\n\n" - ,cyls,heads,sectors,cylsecs); - if (dos_cyls > 65535 || dos_heads > 255 || dos_sectors > 255) - printf("Figures below won't work with BIOS for partitions not in cyl 1\n"); - printf("parameters to be used for BIOS calculations are:\n"); - printf("cylinders=%d heads=%d sectors/track=%d (%d blks/cyl)\n\n" - ,dos_cyls,dos_heads,dos_sectors,dos_cylsecs); -} - -static void -change_active(int which) -{ - struct pc98_partition *partp = &mboot.parts[0]; - int active, i, new, tmp; - - active = -1; - for (i = 0; i < PC98_NPARTS; i++) { - if ((partp[i].dp_sid & PC98_SID_ACTIVE) == 0) - continue; - printf("Partition %d is marked active\n", i + 1); - if (active == -1) - active = i + 1; - } - if (a_flag && which != -1) - active = which; - else if (active == -1) - active = 1; - - if (!ok("Do you want to change the active partition?")) - return; -setactive: - do { - new = active; - Decimal("active partition", new, tmp); - if (new < 1 || new > 8) { - printf("Active partition number must be in range 1-8." - " Try again.\n"); - goto setactive; - } - active = new; - } while (!ok("Are you happy with this choice")); - if (active > 0 && active <= 8) - partp[active-1].dp_sid |= PC98_SID_ACTIVE; -} - -static void -change_code() -{ - if (ok("Do you want to change the boot code?")) - init_boot(); -} - -void -get_params_to_use() -{ - int tmp; - print_params(); - if (ok("Do you want to change our idea of what BIOS thinks ?")) - { - do - { - Decimal("BIOS's idea of #cylinders", dos_cyls, tmp); - Decimal("BIOS's idea of #heads", dos_heads, tmp); - Decimal("BIOS's idea of #sectors", dos_sectors, tmp); - dos_cylsecs = dos_heads * dos_sectors; - print_params(); - } - while(!ok("Are you happy with this choice")); - } -} - - -/***********************************************\ -* Change real numbers into strange dos numbers * -\***********************************************/ -static void -dos(u_int32_t start, u_int32_t size, struct pc98_partition *partp) -{ - u_int32_t end; - - if (partp->dp_mid == 0 && partp->dp_sid == 0 && - start == 0 && size == 0) { - memcpy(partp, &mtpart, sizeof(*partp)); - return; - } - - /* Start c/h/s. */ - partp->dp_scyl = partp->dp_ipl_cyl = start / dos_cylsecs; - partp->dp_shd = partp->dp_ipl_head = start % dos_cylsecs / dos_sectors; - partp->dp_ssect = partp->dp_ipl_sct = start % dos_sectors; - - /* End c/h/s. */ - end = start + size - cylsecs; - partp->dp_ecyl = end / dos_cylsecs; - partp->dp_ehd = end % dos_cylsecs / dos_sectors; - partp->dp_esect = end % dos_sectors; -} - -static int -open_disk(int flag) -{ - struct stat st; - int rwmode; - - if (stat(disk, &st) == -1) { - if (errno == ENOENT) - return -2; - warnx("can't get file status of %s", disk); - return -1; - } - if ( !(st.st_mode & S_IFCHR) ) - warnx("device %s is not character special", disk); - rwmode = I_flag || a_flag || B_flag || flag ? O_RDWR : O_RDONLY; - fd = open(disk, rwmode); - if (fd == -1 && errno == EPERM && rwmode == O_RDWR) - fd = open(disk, O_RDONLY); - if (fd == -1 && errno == ENXIO) - return -2; - if (fd == -1) { - warnx("can't open device %s", disk); - return -1; - } - if (get_params() == -1) { - warnx("can't get disk parameters on %s", disk); - return -1; - } - return fd; -} - -static ssize_t -read_disk(off_t sector, void *buf) -{ - - lseek(fd, (sector * 512), 0); - return read(fd, buf, - secsize > MIN_SEC_SIZE ? secsize : MIN_SEC_SIZE * 2); -} - -static int -write_disk(off_t sector, void *buf) -{ - int error; - struct gctl_req *grq; - const char *q; - char fbuf[BUFSIZ]; - int i, fdw, sz; - - sz = secsize > MIN_SEC_SIZE ? secsize : MIN_SEC_SIZE * 2; - grq = gctl_get_handle(); - gctl_ro_param(grq, "verb", -1, "write PC98"); - gctl_ro_param(grq, "class", -1, "PC98"); - q = strrchr(disk, '/'); - if (q == NULL) - q = disk; - else - q++; - gctl_ro_param(grq, "geom", -1, q); - gctl_ro_param(grq, "data", sz, buf); - q = gctl_issue(grq); - if (q == NULL) { - gctl_free(grq); - return(0); - } - warnx("Geom problem: %s", q); - gctl_free(grq); - - warnx("Warning: Partitioning via geom failed, trying raw write"); - error = pwrite(fd, buf, sz, sector * 512); - if (error == sz) - return (0); - - for (i = 0; i < PC98_NPARTS; i++) { - sprintf(fbuf, "%ss%d", disk, i + 1); - fdw = open(fbuf, O_RDWR, 0); - if (fdw < 0) - continue; - error = ioctl(fdw, DIOCSPC98, buf); - close(fdw); - if (error == 0) - return (0); - } - warnx("Failed to write sector zero"); - return(EINVAL); -} - -static int -get_params() -{ - int error; - u_int u; - off_t o; - - error = ioctl(fd, DIOCGFWSECTORS, &u); - if (error == 0) - sectors = dos_sectors = u; - else - sectors = dos_sectors = 17; - - error = ioctl(fd, DIOCGFWHEADS, &u); - if (error == 0) - heads = dos_heads = u; - else - heads = dos_heads = 8; - - dos_cylsecs = cylsecs = heads * sectors; - disksecs = cyls * heads * sectors; - - error = ioctl(fd, DIOCGSECTORSIZE, &u); - if (error != 0 || u == 0) - u = 512; - secsize = u; - - error = ioctl(fd, DIOCGMEDIASIZE, &o); - if (error == 0) { - disksecs = o / u; - cyls = dos_cyls = o / (u * dos_heads * dos_sectors); - } - - return (disksecs); -} - - -static int -read_s0() -{ - - if (read_disk(0, (char *) mboot.bootinst) == -1) { - warnx("can't read fdisk partition table"); - return -1; - } - if (mboot.signature != PC98_MAGIC) { - warnx("invalid fdisk partition table found"); - /* So should we initialize things */ - return -1; - } - - return 0; -} - -static int -write_s0() -{ - - if (iotest) { - print_s0(-1); - return 0; - } - - /* - * write enable label sector before write (if necessary), - * disable after writing. - * needed if the disklabel protected area also protects - * sector 0. (e.g. empty disk) - */ - if (write_disk(0, (char *) mboot.bootinst) == -1) { - warn("can't write fdisk partition table"); - return -1; - } - - return(0); -} - - -static int -ok(const char *str) -{ - printf("%s [n] ", str); - fflush(stdout); - if (fgets(lbuf, LBUF, stdin) == NULL) - exit(1); - lbuf[strlen(lbuf)-1] = 0; - - if (*lbuf && - (!strcmp(lbuf, "yes") || !strcmp(lbuf, "YES") || - !strcmp(lbuf, "y") || !strcmp(lbuf, "Y"))) - return 1; - else - return 0; -} - -static int -decimal(const char *str, int *num, int deflt) -{ - int acc = 0, c; - char *cp; - - while (1) { - printf("Supply a decimal value for \"%s\" [%d] ", str, deflt); - fflush(stdout); - if (fgets(lbuf, LBUF, stdin) == NULL) - exit(1); - lbuf[strlen(lbuf)-1] = 0; - - if (!*lbuf) - return 0; - - cp = lbuf; - while ((c = *cp) && (c == ' ' || c == '\t')) cp++; - if (!c) - return 0; - while ((c = *cp++)) { - if (c <= '9' && c >= '0') - acc = acc * 10 + c - '0'; - else - break; - } - if (c == ' ' || c == '\t') - while ((c = *cp) && (c == ' ' || c == '\t')) cp++; - if (!c) { - *num = acc; - return 1; - } else - printf("%s is an invalid decimal number. Try again.\n", - lbuf); - } - -} - -static int -string(const char *str, char **ans) -{ - int i, c; - char *cp = lbuf; - - while (1) { - printf("Supply a string value for \"%s\" [%s] ", str, *ans); - fgets(lbuf, LBUF, stdin); - lbuf[strlen(lbuf)-1] = 0; - - if (!*lbuf) - return 0; - - while ((c = *cp) && (c == ' ' || c == '\t')) cp++; - if (c == '"') { - c = *++cp; - *ans = cp; - while ((c = *cp) && c != '"') cp++; - } else { - *ans = cp; - while ((c = *cp) && c != ' ' && c != '\t') cp++; - } - - for (i = strlen(*ans); i < 16; i++) - (*ans)[i] = ' '; - (*ans)[16] = 0; - - return 1; - } -} - -static const char * -get_type(int type) -{ - size_t i; - - for (i = 0; i < nitems(part_types); i++) - if (part_types[i].type == (type & 0x7f)) - return(part_types[i].name); - return("unknown"); -} - -/* - * Try figuring out the root device's canonical disk name. - * The following choices are considered: - * /dev/ad0s1a => /dev/ad0 - * /dev/da0a => /dev/da0 - * /dev/vinum/root => /dev/vinum/root - */ -static char * -get_rootdisk(void) -{ - struct statfs rootfs; - regex_t re; -#define NMATCHES 2 - regmatch_t rm[NMATCHES]; - char *s; - int rv; - - if (statfs("/", &rootfs) == -1) - err(1, "statfs(\"/\")"); - - if ((rv = regcomp(&re, "^(/dev/[a-z]+[0-9]+)([sp][0-9]+)?[a-h]?$", - REG_EXTENDED)) != 0) - errx(1, "regcomp() failed (%d)", rv); - if ((rv = regexec(&re, rootfs.f_mntfromname, NMATCHES, rm, 0)) != 0) - errx(1, -"mounted root fs resource doesn't match expectations (regexec returned %d)", - rv); - if ((s = malloc(rm[1].rm_eo - rm[1].rm_so + 1)) == NULL) - errx(1, "out of memory"); - memcpy(s, rootfs.f_mntfromname + rm[1].rm_so, - rm[1].rm_eo - rm[1].rm_so); - s[rm[1].rm_eo - rm[1].rm_so] = 0; - - return s; -} - -static void -reset_boot(void) -{ - int i; - struct pc98_partition *partp; - - init_boot(); - for (i = 1; i <= PC98_NPARTS; i++) { - partp = ((struct pc98_partition *) &mboot.parts) + i - 1; - bzero((char *)partp, sizeof (struct pc98_partition)); - } -} diff --git a/sbin/geom/class/part/gpart.8 b/sbin/geom/class/part/gpart.8 index f9384ad9af53..7b81c21c933b 100644 --- a/sbin/geom/class/part/gpart.8 +++ b/sbin/geom/class/part/gpart.8 @@ -543,11 +543,6 @@ The option enables backward compatibility for partition names in the EBR scheme. It also prevents any type of actions on such partitions. -.It Cm PC98 -An MBR variant for NEC PC-98 and compatible computers. -Requires the -.Cm GEOM_PART_PC98 -kernel option. .It Cm VTOC8 Sun's SMI Volume Table Of Contents, used by .Tn SPARC64 @@ -945,12 +940,6 @@ The scheme-specific attributes for MBR: .Bl -tag -width ".Cm active" .It Cm active .El -.Pp -The scheme-specific attributes for PC98: -.Bl -tag -width ".Cm bootable" -.It Cm active -.It Cm bootable -.El .Sh BOOTSTRAPPING .Fx supports several partitioning schemes and each scheme uses different diff --git a/share/examples/bootforth/frames.4th b/share/examples/bootforth/frames.4th index 3b1f4046891f..4f1f9b812a03 100644 --- a/share/examples/bootforth/frames.4th +++ b/share/examples/bootforth/frames.4th @@ -12,49 +12,26 @@ variable rt_el variable rb_el variable fill -s" arch-pc98" environment? [if] - \ Single frames - 149 constant sh_el - 150 constant sv_el - 152 constant slt_el - 154 constant slb_el - 153 constant srt_el - 155 constant srb_el - \ Double frames - 149 constant dh_el - 150 constant dv_el - 152 constant dlt_el - 154 constant dlb_el - 153 constant drt_el - 155 constant drb_el - \ Fillings - 0 constant fill_none - 32 constant fill_blank - 135 constant fill_dark - 135 constant fill_med - 135 constant fill_bright -[else] - \ Single frames - 196 constant sh_el - 179 constant sv_el - 218 constant slt_el - 192 constant slb_el - 191 constant srt_el - 217 constant srb_el - \ Double frames - 205 constant dh_el - 186 constant dv_el - 201 constant dlt_el - 200 constant dlb_el - 187 constant drt_el - 188 constant drb_el - \ Fillings - 0 constant fill_none - 32 constant fill_blank - 176 constant fill_dark - 177 constant fill_med - 178 constant fill_bright -[then] +\ Single frames +196 constant sh_el +179 constant sv_el +218 constant slt_el +192 constant slb_el +191 constant srt_el +217 constant srb_el +\ Double frames +205 constant dh_el +186 constant dv_el +201 constant dlt_el +200 constant dlb_el +187 constant drt_el +188 constant drb_el +\ Fillings +0 constant fill_none +32 constant fill_blank +176 constant fill_dark +177 constant fill_med +178 constant fill_bright : hline ( len x y -- ) \ Draw horizontal single line at-xy \ move cursor diff --git a/share/man/man4/adv.4 b/share/man/man4/adv.4 index 366441d92572..0aaf93fff0ff 100644 --- a/share/man/man4/adv.4 +++ b/share/man/man4/adv.4 @@ -204,12 +204,6 @@ AdvanSys ABP950 AdvanSys ABP980, ABP980U .It AdvanSys ABP980UA/3980UA -.It -MELCO IFC-USP (PC-98) -.It -RATOC REX-PCI30 (PC-98) -.It -@Nifty FNECHARD IFC-USUP-TX (PC-98) .El .Sh SEE ALSO .Xr adw 4 , diff --git a/share/man/man4/ahc.4 b/share/man/man4/ahc.4 index 3e47a8b21cf5..cbd3937184b3 100644 --- a/share/man/man4/ahc.4 +++ b/share/man/man4/ahc.4 @@ -349,14 +349,6 @@ Adaptec Adaptec .Tn 4944UW .It -NEC PC-9821Xt13 (PC-98) -.It -NEC RvII26 (PC-98) -.It -NEC PC-9821X-B02L/B09 (PC-98) -.It -NEC SV-98/2-B03 (PC-98) -.It Many motherboards with on-board .Tn SCSI support diff --git a/share/man/man4/apic.4 b/share/man/man4/apic.4 index 2fb5b8cff521..1e7cc18070cd 100644 --- a/share/man/man4/apic.4 +++ b/share/man/man4/apic.4 @@ -32,7 +32,7 @@ .Nd Advanced Programmable Interrupt Controller (APIC) driver .Sh SYNOPSIS This driver is a mandatory part of amd64 kernel. -To compile this driver into i386 or pc98 kernel, +To compile this driver into i386 kernel, place the following line in your kernel configuration file: .Bd -ragged -offset indent diff --git a/share/man/man4/ed.4 b/share/man/man4/ed.4 index bfa5972d3d95..e7594c60c70a 100644 --- a/share/man/man4/ed.4 +++ b/share/man/man4/ed.4 @@ -133,12 +133,6 @@ Accton EN2212/EN2216/UE2216 .It Allied Telesis CentreCOM LA100-PCM_V2 .It -Allied Telesis LA-98 (flags 0x000000) (PC-98) -.It -Allied Telesis SIC-98, SIC-98NOTE (110pin), SIU-98 (flags 0x600000) (PC-98) -.It -Allied Telesis SIU-98-D (flags 0x610000) (PC-98) -.It AmbiCom 10BaseT card (8002, 8002T, 8010 and 8610) .It Bay Networks NETGEAR FA410TXC Fast Ethernet @@ -163,12 +157,6 @@ Compex Net-A adapter .It Compex RL2000 .It -Contec C-NET(98), RT-1007(98), C-NET(9N) (110pin) (flags 0xa00000) (PC-98) -.It -Contec C-NET(98)E-A, C-NET(98)L-A, C-NET(98)P (flags 0x300000) (PC-98) -.It -Corega Ether98-T (flags 0x000000) (PC-98) -.It Corega Ether PCC-T/EtherII PCC-T/FEther PCC-TXF/PCC-TXD PCC-T/Fether II TXD .It Corega LAPCCTXD (TC5299J) @@ -179,16 +167,10 @@ DEC EtherWorks DE305 .It Danpex EN-6200P2 .It -D-Link DE-298, DE-298P (flags 0x500000) (PC-98) -.It D-Link DE-660, DE-660+ .It D-Link IC-CARD/IC-CARD+ Ethernet .It -ELECOM LD-98P (flags 0x500000) (PC-98) -.It -ELECOM LD-BDN, LD-NW801G (flags 0x200000) (PC-98) -.It ELECOM Laneed LD-CDL/TX, LD-CDF, LD-CDS, LD-10/100CD, LD-CDWA (DP83902A) .It Hawking PN652TX PC Card (AX88790) @@ -198,17 +180,10 @@ HP PC Lan+ 27247B and 27252A .It IBM Creditcard Ethernet I/II .It -ICM AD-ET2-T, DT-ET-25, DT-ET-T5, IF-2766ET, IF-2771ET, NB-ET-T (110pin) -(flags 0x500000) (PC-98) -.It -I-O DATA LA/T-98, LA/T-98SB, LA2/T-98, ET/T-98 (flags 0x900000) (PC-98) -.It I-O DATA ET2/T-PCI .It I-O DATA PCLATE .It -Kansai KLA-98C/T (flags 0x900000) (PC-98) -.It Kingston KNE-PC2, CIO10T, KNE-PCM/x Ethernet .It KTI ET32P2 PCI @@ -217,28 +192,14 @@ Linksys EC2T/PCMPC100/PCM100, PCMLM56 .It Linksys EtherFast 10/100 PC Card, Combo PCMCIA Ethernet Card (PCMPC100 V2) .It -Logitec LAN-98T (flags 0xb00000) (PC-98) -.It MACNICA Ethernet ME1 for JEIDA .It -MACNICA ME98 (flags 0x900000) (PC-98) -.It -MACNICA NE2098 (flags 0x400000) (PC-98) -.It -MELCO EGY-98 (flags 0x300000) (PC-98) -.It -MELCO LGH-98, LGY-98, LGY-98-N (110pin), IND-SP, IND-SS (flags 0x400000) (PC-98) -.It MELCO LGY-PCI-TR .It MELCO LPC-T/LPC2-T/LPC2-CLT/LPC2-TX/LPC3-TX/LPC3-CLX .It NDC Ethernet Instant-Link .It -NEC PC-9801-77, PC-9801-78 (flags 0x910000) (PC-98) -.It -NEC PC-9801-107, PC-9801-108 (flags 0x800000) (PC-98) -.It National Semiconductor InfoMover NE4100 .It NetGear FA-410TX @@ -247,10 +208,6 @@ NetVin NV5000SC .It Network Everywhere Ethernet 10BaseT PC Card .It -Networld 98X3 (flags 0xd00000) (PC-98) -.It -Networld EC-98X, EP-98X (flags 0xd10000) (PC-98) -.It New Media LANSurfer 10+56 Ethernet/Modem .It New Media LANSurfer @@ -259,10 +216,6 @@ Novell NE1000/NE2000/NE2100 .It PLANEX ENW-8300-T .It -PLANEX EN-2298-C (flags 0x200000) (PC-98) -.It -PLANEX EN-2298P-T, EN-2298-T (flags 0x500000) (PC-98) -.It PLANEX FNW-3600-T .It Psion 10/100 LANGLOBAL Combine iT @@ -277,8 +230,6 @@ SMC Elite 16 WD8013 .It SMC Elite Ultra .It -SMC EtherEZ98 (flags 0x000000) (PC-98) -.It SMC WD8003E/WD8003EBT/WD8003S/WD8003SBT/WD8003W/WD8013EBT/WD8013W and clones .It SMC EZCard PC Card, 8040-TX, 8041-TX (AX88x90), 8041-TX V.2 (TC5299J) diff --git a/share/man/man4/esp.4 b/share/man/man4/esp.4 index ccb574ce5e9e..74676f8f03f9 100644 --- a/share/man/man4/esp.4 +++ b/share/man/man4/esp.4 @@ -66,8 +66,6 @@ driver include: .Pp .Bl -bullet -compact .It -MELCO IFC-DP (PC-98) -.It Sun ESP family .It Sun FAS family diff --git a/share/man/man4/fxp.4 b/share/man/man4/fxp.4 index 521c326ed09c..26367a51a984 100644 --- a/share/man/man4/fxp.4 +++ b/share/man/man4/fxp.4 @@ -137,12 +137,6 @@ Intel PRO/100 M Desktop Adapter .It Intel PRO/100 S Desktop, Server and Dual-Port Server Adapters .It -Contec C-NET(PI)-100TX (PC-98) -.It -NEC PC-9821Ra20, Rv20, Xv13, Xv20 internal 100Base-TX (PC-98) -.It -NEC PC-9821X-B06 (PC-98) -.It Many on-board network interfaces on Intel motherboards .El .Sh LOADER TUNABLES diff --git a/share/man/man4/geom.4 b/share/man/man4/geom.4 index e03b65b3146e..1d0e13e0d1e9 100644 --- a/share/man/man4/geom.4 +++ b/share/man/man4/geom.4 @@ -65,9 +65,7 @@ .Cd options GEOM_PART_GPT .Cd options GEOM_PART_LDM .Cd options GEOM_PART_MBR -.Cd options GEOM_PART_PC98 .Cd options GEOM_PART_VTOC8 -.Cd options GEOM_PC98 .Cd options GEOM_RAID .Cd options GEOM_RAID3 .Cd options GEOM_SHSEC diff --git a/share/man/man4/man4.i386/Makefile b/share/man/man4/man4.i386/Makefile index 328379b3a0cc..cdc623ef7f35 100644 --- a/share/man/man4/man4.i386/Makefile +++ b/share/man/man4/man4.i386/Makefile @@ -8,7 +8,6 @@ MAN= aic.4 \ cp.4 \ CPU_ELAN.4 \ cs.4 \ - ct.4 \ ctau.4 \ cx.4 \ ep.4 \ @@ -26,7 +25,6 @@ MAN= aic.4 \ pnpbios.4 \ sbni.4 \ smapi.4 \ - snc.4 \ streams.4 \ svr4.4 \ vpd.4 \ diff --git a/share/man/man4/man4.i386/aic.4 b/share/man/man4/man4.i386/aic.4 index 991a0c50be99..2af6e5fc97fb 100644 --- a/share/man/man4/man4.i386/aic.4 +++ b/share/man/man4/man4.i386/aic.4 @@ -62,10 +62,6 @@ Adaptec AHA-1535 (ISA) Creative Labs SoundBlaster SCSI host adapter (ISA) .It Adaptec AHA-1460, AHA-1460B, AHA-1460C, AHA-1460D (PC Card) -.It -Adaptec AHA-1030B, AHA-1030P (PC98) -.It -NEC PC-9801-100 (PC98) .El .Sh SEE ALSO .Xr aha 4 , diff --git a/share/man/man4/man4.i386/ct.4 b/share/man/man4/man4.i386/ct.4 deleted file mode 100644 index 28208a16893f..000000000000 --- a/share/man/man4/man4.i386/ct.4 +++ /dev/null @@ -1,162 +0,0 @@ -.\" Copyright (c) 2003 Noriaki MITSUNAGA. All rights reserved. -.\" Copyright (c) 2003 Hideyuki KURASHINA. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd November 18, 2003 -.Dt CT 4 i386 -.Os -.Sh NAME -.Nm ct -.Nd "WD33C93[ABC] based CBUS SCSI host adapter driver" -.Sh SYNOPSIS -.Cd "device ct" -.Cd "device scbus" -.Pp -In -.Pa /boot/device.hints: -.Pp -For most PC-9801-55, -92 and compatibles: -.Cd hint.ct.0.at="isa" -.Pp -For ELECOM bus-master -.Tn SCSI -adapters: -.Cd hint.ct.0.at="isa" -.Cd hint.ct.0.flags="0x30000" -.Pp -For I-O DATA SC98 adapters: -.Cd hint.ct.0.at="isa" -.Cd hint.ct.0.flags="0x10000" -.Pp -For LOGITEC adapters: -.Cd hint.ct.0.at="isa" -.Cd hint.ct.0.flags="0x50000" -.Pp -For TEXA adapters: -.Cd hint.ct.0.at="isa" -.Cd hint.ct.0.flags="0x20000" -.Pp -For adapters with SMIT transfer mode to enable SMIT transfer: -.Cd hint.ct.0.at="isa" -.Cd hint.ct.0.flags="0x40000" -.Cd hint.ct.0.maddr="0xdc000" -.Pp -Flags meaning: -.Bl -tag -offset indent -compact -width 0x000000 -.It 0x00000 -DMA transfer mode for an NEC PC-9801-55, -92 (or -compatibles), ICM IF-2660, Midori-Denshi MDC-554NA, or -Logitec LHA-N151 -.It 0x10000 -DMA transfer mode for an I-O DATA SC-98II -.It 0x20000 -bus-master transfer mode for a TEXA HA-55BS2, its -successors, or Midori-Denshi MDC-926R -.It 0x30000 -bus-master transfer mode for an ELECOM bus-master SCSI -adapter -.It 0x40000 -SMIT transfer mode (for supported adapters only) -.It 0x50000 -bus-master transfer mode for a Logitec LHA-20x series, -ICM IF-2766, IF-2766ET, IF-2767 or IF-2769 -.El -.Sh DESCRIPTION -The -.Nm -driver provides access to the -.Tn SCSI -bus connected to a WD33C93[ABC] based host adapter. -.Sh HARDWARE -The -.Nm -driver supports the following adapters: -.Pp -.Bl -bullet -compact -.It -ELECOM bus-master -.Tn SCSI -adapters -.It -I-O DATA SC-98II -.It -ICM IF-2660, IF-2766, IF-2766ET, IF-2767 and IF-2769 -.It -Logitec LHA-N151 and LHA-20x series -.It -Midori-Denshi MDC-554NA and MDC-926R -.It -NEC PC-9801-55, 92 and compatibles -.It -SMIT transfer type -.Tn SCSI -host adapters -.It -TEXA HA-55BS2 and its later models -.El -.Sh SEE ALSO -.Xr cd 4 , -.Xr ch 4 , -.Xr ctau 4 , -.Xr da 4 , -.Xr intro 4 , -.Xr sa 4 , -.Xr scsi 4 -.Sh NOTES -Historically, the driver for the Cronyx Tau WAN adapters was -.Dq ct . -This device name was changed to -.Dq ctau -to avoid conflicts -with this pc98 -.Nm -driver. -The network device name for -.Xr ctau 4 -is -.Dq Li ct . -Please see -.Xr ctau 4 -for the details for that device. -.Sh HISTORY -The -.Nm -device driver has been developed for -.Nx Ns /pc98 -and ported for -.Fx . -It first appeared in -.Fx 4.4 . -.Sh AUTHORS -.An -nosplit -The -.Nm -driver was written by -.An Naofumi HONDA . -.Pp -This manual page was written by -.An Noriaki MITSUNAGA Aq Mt non@FreeBSD.org -and -.An Hideyuki KURASHINA Aq Mt rushani@FreeBSD.org . diff --git a/share/man/man4/man4.i386/snc.4 b/share/man/man4/man4.i386/snc.4 deleted file mode 100644 index 6f826907352f..000000000000 --- a/share/man/man4/man4.i386/snc.4 +++ /dev/null @@ -1,142 +0,0 @@ -.\" -.\" Copyright (c) 2004 Tom Rhodes -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd September 4, 2004 -.Dt SNC 4 i386 -.Os -.Sh NAME -.Nm snc -.Nd National Semiconductor DP8393X SONIC Ethernet adapter driver -.Sh SYNOPSIS -.Cd device isa -.Cd device snc -.Sh DESCRIPTION -The -.Nm -driver provides support for the -.Tn National -.Tn Semiconductor -.Tn SONIC -Ethernet adapters. -.Sh HARDWARE -The -.Nm -driver supports the following cards: -.Pp -.Bl -bullet -compact -.It -National Semiconductor DP83934AVQB -.It -NEC PC-9801-83 -.It -NEC PC-9801-84 -.It -NEC PC-9801-103 -.It -NEC PC-9801-104 -.It -NEC PC-9801N-15 -.It -NEC PC-9801N-25 -.It -NEC PC-9801N-J02 PCMCIA -.It -NEC PC-9801N-J02R PCMCIA -.El -.Pp -The -.Nm -driver also includes support for the -.Tn National -.Tn Semiconductor -.Tn NS46C46 -as -64 * 16 bits Microwave Serial -.Tn EEPROM . -.Sh IMPLEMENTATION NOTES -Accessing -.Tn SONIC -card data structures and registers as 32 bit values -makes code endianness independent. -The -.Tn SONIC -is however always in big-endian mode so it is necessary to -ensure that data structures shared -between the -.Tn CPU -and the -.Tn SONIC -card are always in big-endian order. -The -.Nm -driver supports the -.Tn PC-98 -C-Bus, -and -.Tn PnP -buses. -Support is also provided for the legacy C-Bus. -.Sh DIAGNOSTICS -The following driver specific error messages -may be reported: -.Bl -diag -.It "snc%d: snc_nec16_register_irq: unsupported irq (%d)" -The card returned an -.Tn IRQ -which is not supported by the driver. -.It "snc%d: invalid packet length %d bytes" -An attempt to transfer a data packet failed due to an -invalid packet length. -.El -.Sh SEE ALSO -.Xr netintro 4 , -.Xr bus_alloc_resource_any 9 -.Sh HISTORY -The -.Nm -driver was ported from -.Nx -by -.An -nosplit -.An Motomichi Matsuzaki Aq Mt mzaki@e-mail.ne.jp -and -.An Hiroshi Yamashita Aq Mt bluemoon@msj.biglobe.ne.jp . -It first appeared in -.Fx 4.2 . -This manual page first appeared in -.Fx 5.3 . -.Sh AUTHORS -This manual page was written by -.An Tom Rhodes Aq Mt trhodes@FreeBSD.org . -.Sh BUGS -Currently the -.Nm -driver only works on the -.Tn PC-98 -architecture. -It should probably work on the i386 architecture -as well. diff --git a/share/man/man4/ncr.4 b/share/man/man4/ncr.4 index 0521b4d9e1fc..a20418cbfdd4 100644 --- a/share/man/man4/ncr.4 +++ b/share/man/man4/ncr.4 @@ -72,15 +72,6 @@ chips: .It .Tn 53C1510D .El -.Pp -The following add-on boards are known to be supported: -.Pp -.Bl -bullet -compact -.It -I-O DATA SC-98/PCI (PC-98) -.It -I-O DATA SC-PCI (PC-98) -.El .Sh SEE ALSO .Xr cd 4 , .Xr ch 4 , diff --git a/share/man/man4/ncv.4 b/share/man/man4/ncv.4 index 01cdc93f5302..c7bdc30c523b 100644 --- a/share/man/man4/ncv.4 +++ b/share/man/man4/ncv.4 @@ -72,8 +72,6 @@ Macnica Miracle SCSI-II mPS110 .It Media Intelligent MSC-110, MSC-200 .It -NEC PC-9801N-J03R -.It New Media Corporation BASICS SCSI .It Qlogic Fast SCSI diff --git a/share/man/man4/sym.4 b/share/man/man4/sym.4 index 205fe8650563..dd92eff75bda 100644 --- a/share/man/man4/sym.4 +++ b/share/man/man4/sym.4 @@ -329,10 +329,6 @@ DawiControl DC2976UW .It Diamond FirePort (all) .It -I-O DATA SC-UPCI (PC-98) -.It -Logitec LHA-521UA (PC-98) -.It NCR cards (all) .It Symbios cards (all) diff --git a/share/mk/bsd.stand.mk b/share/mk/bsd.stand.mk index 42e01d451319..c4d30874733a 100644 --- a/share/mk/bsd.stand.mk +++ b/share/mk/bsd.stand.mk @@ -18,9 +18,6 @@ CFLAGS.gcc+= -mpreferred-stack-boundary=2 .if ${MACHINE_CPUARCH} == "amd64" CFLAGS+= -fPIC -mno-red-zone .endif -.if ${MACHINE} == "pc98" -CFLAGS+= -Os -.endif .if ${MACHINE_CPUARCH} == "aarch64" CFLAGS+= -mgeneral-regs-only .endif diff --git a/share/mk/local.meta.sys.mk b/share/mk/local.meta.sys.mk index 3a4e8f1352bd..2706683f210b 100644 --- a/share/mk/local.meta.sys.mk +++ b/share/mk/local.meta.sys.mk @@ -47,7 +47,6 @@ TARGET_ARCHES_arm?= arm armeb armv6 TARGET_ARCHES_arm64?= aarch64 TARGET_ARCHES_mips?= mipsel mips mips64el mips64 mipsn32 mipsn32el TARGET_ARCHES_powerpc?= powerpc powerpc64 powerpcspe -TARGET_ARCHES_pc98?= i386 TARGET_ARCHES_riscv?= riscv64 riscv64sf # some corner cases @@ -55,7 +54,7 @@ BOOT_MACHINE_DIR.amd64 = boot/i386 MACHINE_ARCH.host = ${_HOST_ARCH} # the list of machines we support -ALL_MACHINE_LIST?= amd64 arm arm64 i386 mips pc98 powerpc riscv sparc64 +ALL_MACHINE_LIST?= amd64 arm arm64 i386 mips powerpc riscv sparc64 .for m in ${ALL_MACHINE_LIST:O:u} MACHINE_ARCH_LIST.$m?= ${TARGET_ARCHES_${m}:U$m} MACHINE_ARCH.$m?= ${MACHINE_ARCH_LIST.$m:[1]} diff --git a/share/syscons/keymaps/INDEX.keymaps b/share/syscons/keymaps/INDEX.keymaps index d8ca7360cae1..2ce16dd3a710 100644 --- a/share/syscons/keymaps/INDEX.keymaps +++ b/share/syscons/keymaps/INDEX.keymaps @@ -294,20 +294,6 @@ jp.106x.kbd:pt:Japon jp.106x.kbd:es:Japonés 106x jp.106x.kbd:uk:ñÐÏÎÓØËÁ 106x -jp.pc98.kbd:en:Japanese PC-98x1 -jp.pc98.kbd:de:Japanisch PC-98x1 -jp.pc98.kbd:fr:Japonais PC-98x1 -jp.pc98.kbd:pt:Japonês PC-98x1 -jp.pc98.kbd:es:Japonés PC-98x1 -jp.pc98.kbd:uk:ñÐÏÎÓØËÁ PC-98x1 - -jp.pc98.iso.kbd:en:Japanese PC-98x1 (ISO) -jp.pc98.iso.kbd:de:Japanisch PC-98x1 (ISO) -jp.pc98.iso.kbd:fr:Japonais PC-98x1 (ISO) -jp.pc98.iso.kbd:pt:Japonês PC-98x1 (ISO) -jp.pc98.iso.kbd:es:Japonés PC-98x1 (ISO) -jp.pc98.iso.kbd:uk:ñÐÏÎÓØËÁ PC-98x1 (ISO) - kk.pt154.kst.kbd:en:Kazakh PT154 codepage kk.pt154.kst.kbd:de:Kasachisch PT154 codepage kk.pt154.kst.kbd:fr:Kazakh PT154 code page diff --git a/share/syscons/keymaps/Makefile b/share/syscons/keymaps/Makefile index 83ed4ae4d8b5..00b3ebe2a6c3 100644 --- a/share/syscons/keymaps/Makefile +++ b/share/syscons/keymaps/Makefile @@ -26,7 +26,7 @@ FILES= INDEX.keymaps \ icelandic.iso.kbd icelandic.iso.acc.kbd \ it.iso.kbd \ iw.iso8.kbd \ - jp.106.kbd jp.106x.kbd jp.pc98.kbd jp.pc98.iso.kbd \ + jp.106.kbd jp.106x.kbd \ kk.pt154.kst.kbd kk.pt154.io.kbd \ latinamerican.kbd latinamerican.iso.acc.kbd \ lt.iso4.kbd \ diff --git a/share/syscons/keymaps/jp.pc98.iso.kbd b/share/syscons/keymaps/jp.pc98.iso.kbd deleted file mode 100644 index 43719f51737c..000000000000 --- a/share/syscons/keymaps/jp.pc98.iso.kbd +++ /dev/null @@ -1,134 +0,0 @@ -# $FreeBSD$ -# alt -# scan cntrl alt alt cntrl lock -# code base shift cntrl shift alt shift cntrl shift state -# ------------------------------------------------------------------ - 000 esc esc esc esc esc esc debug esc O - 001 '1' '!' '!' '!' '1' '!' '!' '!' O - 002 '2' '@' sub sub '2' '"' nul nul O - 003 '3' '#' esc esc '3' '#' esc esc O - 004 '4' '$' fs fs '4' '$' fs fs O - 005 '5' '%' gs gs '5' '%' gs gs O - 006 '6' '^' rs rs '6' '&' rs rs O - 007 '7' '&' '&' '&' '7' ''' us us O - 008 '8' '*' bs bs '8' '(' del del O - 009 '9' '(' '(' '(' '9' ')' '9' '9' O - 010 '0' ')' ')' ')' '0' nop '0' '0' O - 011 '-' '_' us us '-' '=' '-' '-' O - 012 '=' '+' '+' '+' '^' '`' rs rs O - 013 '\' '|' fs fs '\' '|' fs fs O - 014 bs bs bs bs bs bs bs bs O - 015 ht btab ht btab ht btab ht btab O - 016 'q' 'Q' dc1 dc1 'q' 'Q' dc1 dc1 C - 017 'w' 'W' etb etb 'w' 'W' etb etb C - 018 'e' 'E' enq enq 'e' 'E' enq enq C - 019 'r' 'R' dc2 dc2 'r' 'R' dc2 dc2 C - 020 't' 'T' dc4 dc4 't' 'T' dc4 dc4 C - 021 'y' 'Y' em em 'y' 'Y' em em C - 022 'u' 'U' nak nak 'u' 'U' nak nak C - 023 'i' 'I' ht ht 'i' 'I' ht ht C - 024 'o' 'O' si si 'o' 'O' si si C - 025 'p' 'P' dle dle 'p' 'P' dle dle C - 026 '[' '{' esc esc '@' '~' nul nul O - 027 ']' '}' gs gs '[' '{' esc esc O - 028 cr cr nl nl cr cr nl nl O - 029 'a' 'A' soh soh 'a' 'A' soh soh C - 030 's' 'S' dc3 dc3 's' 'S' dc3 dc3 C - 031 'd' 'D' eot eot 'd' 'D' eot eot C - 032 'f' 'F' ack ack 'f' 'F' ack ack C - 033 'g' 'G' bel bel 'g' 'G' bel bel C - 034 'h' 'H' bs bs 'h' 'H' bs bs C - 035 'j' 'J' nl nl 'j' 'J' nl nl C - 036 'k' 'K' vt vt 'k' 'K' vt vt C - 037 'l' 'L' ff ff 'l' 'L' ff ff C - 038 ';' ':' ';' ';' ';' '+' ';' ';' O - 039 ''' '"' ''' ''' ':' '*' ':' ':' O - 040 '`' '~' '~' '~' ']' '}' gs gs O - 041 'z' 'Z' sub sub 'z' 'Z' sub sub C - 042 'x' 'X' can can 'x' 'X' can can C - 043 'c' 'C' etx etx 'c' 'C' etx etx C - 044 'v' 'V' syn syn 'v' 'V' syn syn C - 045 'b' 'B' stx stx 'b' 'B' stx stx C - 046 'n' 'N' so so 'n' 'N' so so C - 047 'm' 'M' cr cr 'm' 'M' cr cr C - 048 ',' '<' '<' '<' ',' '<' '<' '<' O - 049 '.' '>' '>' '>' '.' '>' '>' '>' O - 050 '/' '?' del del '/' '?' del del O - 051 '\' '|' fs fs nop '_' us us O - 052 ' ' ' ' nul nul ' ' ' ' nul nul O - 053 esc esc esc esc esc esc esc esc O - 054 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 O - 055 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 O - 056 fkey60 fkey60 fkey60 fkey60 fkey60 fkey60 fkey60 fkey60 O - 057 del del del del del del boot boot N - 058 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 O - 059 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 O - 060 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 O - 061 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 O - 062 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 O - 063 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 O - 064 '-' '-' '-' '-' '-' '-' '-' '-' O - 065 '/' '/' '/' '/' '/' '/' '/' '/' O - 066 '7' '7' '7' '7' '7' '7' '7' '7' O - 067 '8' '8' '8' '8' '8' '8' '8' '8' O - 068 '9' '9' '9' '9' '9' '9' '9' '9' O - 069 '*' '*' '*' '*' '*' '*' '*' '*' O - 070 '4' '4' '4' '4' '4' '4' '4' '4' O - 071 '5' '5' '5' '5' '5' '5' '5' '5' O - 072 '6' '6' '6' '6' '6' '6' '6' '6' O - 073 '+' '+' '+' '+' '+' '+' '+' '+' O - 074 '1' '1' '1' '1' '1' '1' '1' '1' O - 075 '2' '2' '2' '2' '2' '2' '2' '2' O - 076 '3' '3' '3' '3' '3' '3' '3' '3' O - 077 '=' '=' '=' '=' '=' '=' '=' '=' O - 078 '0' '0' '0' '0' '0' '0' '0' '0' O - 079 ',' ',' ',' ',' ',' ',' ',' ',' O - 080 '.' '.' '.' '.' '.' '.' '.' '.' O - 081 meta meta meta meta meta meta meta meta O - 082 fkey11 fkey23 fkey35 fkey47 scr11 scr11 scr11 scr11 O - 083 fkey12 fkey24 fkey36 fkey48 scr12 scr12 scr12 scr12 O - 084 slock slock slock slock slock slock slock slock O - 085 nop nop nop nop nop nop nop nop O - 086 nop nop nop nop nop nop nop nop O - 087 nop nop nop nop nop nop nop nop O - 088 nop nop nop nop nop nop nop nop O - 089 nop nop nop nop nop nop nop nop O - 090 nop nop nop nop nop nop nop nop O - 091 nop nop nop nop nop nop nop nop O - 092 nop nop nop nop nop nop nop nop O - 093 nop nop nop nop nop nop nop nop O - 094 nop nop nop nop nop nop nop nop O - 095 nop nop nop nop nop nop nop nop O - 096 slock saver slock saver susp nop susp nop O - 097 nscr nscr debug debug nop nop nop nop O - 098 fkey01 fkey13 fkey25 fkey37 scr01 scr01 scr01 scr01 O - 099 fkey02 fkey14 fkey26 fkey38 scr02 scr02 scr02 scr02 O - 100 fkey03 fkey15 fkey27 fkey39 scr03 scr03 scr03 scr03 O - 101 fkey04 fkey16 fkey28 fkey40 scr04 scr04 scr04 scr04 O - 102 fkey05 fkey17 fkey29 fkey41 scr05 scr05 scr05 scr05 O - 103 fkey06 fkey18 fkey30 fkey42 scr06 scr06 scr06 scr06 O - 104 fkey07 fkey19 fkey31 fkey43 scr07 scr07 scr07 scr07 O - 105 fkey08 fkey20 fkey32 fkey44 scr08 scr08 scr08 scr08 O - 106 fkey09 fkey21 fkey33 fkey45 scr09 scr09 scr09 scr09 O - 107 fkey10 fkey22 fkey34 fkey46 scr10 scr10 scr10 scr10 O - 108 nop nop nop nop nop nop nop nop O - 109 nop nop nop nop nop nop nop nop O - 110 nop nop nop nop nop nop nop nop O - 111 nop nop nop nop nop nop nop nop O - 112 lshift lshift lshift lshift lshift lshift lshift lshift O - 113 clock clock clock clock clock clock clock clock O - 114 lalt lalt lalt lalt lalt lalt lalt lalt O - 115 lalt lalt lalt lalt lalt lalt lalt lalt O - 116 lctrl lctrl lctrl lctrl lctrl lctrl lctrl lctrl O - 117 nop nop nop nop nop nop nop nop O - 118 nop nop nop nop nop nop nop nop O - 119 nop nop nop nop nop nop nop nop O - 120 nop nop nop nop nop nop nop nop O - 121 nop nop nop nop nop nop nop nop O - 122 nop nop nop nop nop nop nop nop O - 123 nop nop nop nop nop nop nop nop O - 124 nop nop nop nop nop nop nop nop O - 125 nop nop nop nop nop nop nop nop O - 126 nop nop nop nop nop nop nop nop O - 127 nop nop nop nop nop nop nop nop O - diff --git a/share/syscons/keymaps/jp.pc98.kbd b/share/syscons/keymaps/jp.pc98.kbd deleted file mode 100644 index d9a5d44a36b0..000000000000 --- a/share/syscons/keymaps/jp.pc98.kbd +++ /dev/null @@ -1,134 +0,0 @@ -# $FreeBSD$ -# alt -# scan cntrl alt alt cntrl lock -# code base shift cntrl shift alt shift cntrl shift state -# ------------------------------------------------------------------ - 000 esc esc esc esc esc esc debug esc O - 001 '1' '!' '!' '!' '1' '!' '!' '!' O - 002 '2' '"' sub sub '2' '@' nul nul O - 003 '3' '#' esc esc '3' '#' esc esc O - 004 '4' '$' fs fs '4' '$' fs fs O - 005 '5' '%' gs gs '5' '%' gs gs O - 006 '6' '&' rs rs '6' '^' rs rs O - 007 '7' ''' us us '7' '&' '&' '&' O - 008 '8' '(' del del '8' '*' bs bs O - 009 '9' ')' '9' '9' '9' '(' '(' '(' O - 010 '0' nop '0' '0' '0' ')' ')' ')' O - 011 '-' '=' '-' '-' '-' '_' us us O - 012 '^' '`' rs rs '=' '+' '+' '+' O - 013 '\' '|' fs fs '\' '|' fs fs O - 014 bs bs bs bs bs bs bs bs O - 015 ht btab ht btab ht btab ht btab O - 016 'q' 'Q' dc1 dc1 'q' 'Q' dc1 dc1 C - 017 'w' 'W' etb etb 'w' 'W' etb etb C - 018 'e' 'E' enq enq 'e' 'E' enq enq C - 019 'r' 'R' dc2 dc2 'r' 'R' dc2 dc2 C - 020 't' 'T' dc4 dc4 't' 'T' dc4 dc4 C - 021 'y' 'Y' em em 'y' 'Y' em em C - 022 'u' 'U' nak nak 'u' 'U' nak nak C - 023 'i' 'I' ht ht 'i' 'I' ht ht C - 024 'o' 'O' si si 'o' 'O' si si C - 025 'p' 'P' dle dle 'p' 'P' dle dle C - 026 '@' '~' nul nul '[' '{' esc esc O - 027 '[' '{' esc esc ']' '}' gs gs O - 028 cr cr nl nl cr cr nl nl O - 029 'a' 'A' soh soh 'a' 'A' soh soh C - 030 's' 'S' dc3 dc3 's' 'S' dc3 dc3 C - 031 'd' 'D' eot eot 'd' 'D' eot eot C - 032 'f' 'F' ack ack 'f' 'F' ack ack C - 033 'g' 'G' bel bel 'g' 'G' bel bel C - 034 'h' 'H' bs bs 'h' 'H' bs bs C - 035 'j' 'J' nl nl 'j' 'J' nl nl C - 036 'k' 'K' vt vt 'k' 'K' vt vt C - 037 'l' 'L' ff ff 'l' 'L' ff ff C - 038 ';' '+' ';' ';' ';' ':' ';' ';' O - 039 ':' '*' ':' ':' ''' '"' ''' ''' O - 040 ']' '}' gs gs '`' '~' '~' '~' O - 041 'z' 'Z' sub sub 'z' 'Z' sub sub C - 042 'x' 'X' can can 'x' 'X' can can C - 043 'c' 'C' etx etx 'c' 'C' etx etx C - 044 'v' 'V' syn syn 'v' 'V' syn syn C - 045 'b' 'B' stx stx 'b' 'B' stx stx C - 046 'n' 'N' so so 'n' 'N' so so C - 047 'm' 'M' cr cr 'm' 'M' cr cr C - 048 ',' '<' '<' '<' ',' '<' '<' '<' O - 049 '.' '>' '>' '>' '.' '>' '>' '>' O - 050 '/' '?' del del '/' '?' del del O - 051 nop '_' us us '\' '|' fs fs O - 052 ' ' ' ' nul nul ' ' ' ' nul nul O - 053 esc esc esc esc esc esc esc esc O - 054 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 O - 055 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 O - 056 fkey60 fkey60 fkey60 fkey60 fkey60 fkey60 fkey60 fkey60 O - 057 del del del del del del boot boot N - 058 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 O - 059 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 O - 060 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 O - 061 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 O - 062 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 O - 063 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 O - 064 '-' '-' '-' '-' '-' '-' '-' '-' O - 065 '/' '/' '/' '/' '/' '/' '/' '/' O - 066 '7' '7' '7' '7' '7' '7' '7' '7' O - 067 '8' '8' '8' '8' '8' '8' '8' '8' O - 068 '9' '9' '9' '9' '9' '9' '9' '9' O - 069 '*' '*' '*' '*' '*' '*' '*' '*' O - 070 '4' '4' '4' '4' '4' '4' '4' '4' O - 071 '5' '5' '5' '5' '5' '5' '5' '5' O - 072 '6' '6' '6' '6' '6' '6' '6' '6' O - 073 '+' '+' '+' '+' '+' '+' '+' '+' O - 074 '1' '1' '1' '1' '1' '1' '1' '1' O - 075 '2' '2' '2' '2' '2' '2' '2' '2' O - 076 '3' '3' '3' '3' '3' '3' '3' '3' O - 077 '=' '=' '=' '=' '=' '=' '=' '=' O - 078 '0' '0' '0' '0' '0' '0' '0' '0' O - 079 ',' ',' ',' ',' ',' ',' ',' ',' O - 080 '.' '.' '.' '.' '.' '.' '.' '.' O - 081 meta meta meta meta meta meta meta meta O - 082 fkey11 fkey23 fkey35 fkey47 scr11 scr11 scr11 scr11 O - 083 fkey12 fkey24 fkey36 fkey48 scr12 scr12 scr12 scr12 O - 084 slock slock slock slock slock slock slock slock O - 085 nop nop nop nop nop nop nop nop O - 086 nop nop nop nop nop nop nop nop O - 087 nop nop nop nop nop nop nop nop O - 088 nop nop nop nop nop nop nop nop O - 089 nop nop nop nop nop nop nop nop O - 090 nop nop nop nop nop nop nop nop O - 091 nop nop nop nop nop nop nop nop O - 092 nop nop nop nop nop nop nop nop O - 093 nop nop nop nop nop nop nop nop O - 094 nop nop nop nop nop nop nop nop O - 095 nop nop nop nop nop nop nop nop O - 096 slock saver slock saver susp nop susp nop O - 097 nscr nscr debug debug nop nop nop nop O - 098 fkey01 fkey13 fkey25 fkey37 scr01 scr01 scr01 scr01 O - 099 fkey02 fkey14 fkey26 fkey38 scr02 scr02 scr02 scr02 O - 100 fkey03 fkey15 fkey27 fkey39 scr03 scr03 scr03 scr03 O - 101 fkey04 fkey16 fkey28 fkey40 scr04 scr04 scr04 scr04 O - 102 fkey05 fkey17 fkey29 fkey41 scr05 scr05 scr05 scr05 O - 103 fkey06 fkey18 fkey30 fkey42 scr06 scr06 scr06 scr06 O - 104 fkey07 fkey19 fkey31 fkey43 scr07 scr07 scr07 scr07 O - 105 fkey08 fkey20 fkey32 fkey44 scr08 scr08 scr08 scr08 O - 106 fkey09 fkey21 fkey33 fkey45 scr09 scr09 scr09 scr09 O - 107 fkey10 fkey22 fkey34 fkey46 scr10 scr10 scr10 scr10 O - 108 nop nop nop nop nop nop nop nop O - 109 nop nop nop nop nop nop nop nop O - 110 nop nop nop nop nop nop nop nop O - 111 nop nop nop nop nop nop nop nop O - 112 lshift lshift lshift lshift lshift lshift lshift lshift O - 113 clock clock clock clock clock clock clock clock O - 114 lalt lalt lalt lalt lalt lalt lalt lalt O - 115 lalt lalt lalt lalt lalt lalt lalt lalt O - 116 lctrl lctrl lctrl lctrl lctrl lctrl lctrl lctrl O - 117 nop nop nop nop nop nop nop nop O - 118 nop nop nop nop nop nop nop nop O - 119 nop nop nop nop nop nop nop nop O - 120 nop nop nop nop nop nop nop nop O - 121 nop nop nop nop nop nop nop nop O - 122 nop nop nop nop nop nop nop nop O - 123 nop nop nop nop nop nop nop nop O - 124 nop nop nop nop nop nop nop nop O - 125 nop nop nop nop nop nop nop nop O - 126 nop nop nop nop nop nop nop nop O - 127 nop nop nop nop nop nop nop nop O - diff --git a/share/vt/keymaps/INDEX.keymaps b/share/vt/keymaps/INDEX.keymaps index 3fac998eb3b7..487058c2a5a7 100644 --- a/share/vt/keymaps/INDEX.keymaps +++ b/share/vt/keymaps/INDEX.keymaps @@ -301,20 +301,6 @@ jp.capsctrl.kbd:pt:Japonês 106x jp.capsctrl.kbd:es:Japonés 106x jp.capsctrl.kbd:uk:ЯпонÑька 106x -jp.pc98.kbd:en:Japanese PC-98x1 -jp.pc98.kbd:de:Japanisch PC-98x1 -jp.pc98.kbd:fr:Japonais PC-98x1 -jp.pc98.kbd:pt:Japonês PC-98x1 -jp.pc98.kbd:es:Japonés PC-98x1 -jp.pc98.kbd:uk:ЯпонÑька PC-98x1 - -jp.pc98.iso.kbd:en:Japanese PC-98x1 (ISO) -jp.pc98.iso.kbd:de:Japanisch PC-98x1 (ISO) -jp.pc98.iso.kbd:fr:Japonais PC-98x1 (ISO) -jp.pc98.iso.kbd:pt:Japonês PC-98x1 (ISO) -jp.pc98.iso.kbd:es:Japonés PC-98x1 (ISO) -jp.pc98.iso.kbd:uk:ЯпонÑька PC-98x1 (ISO) - kz.kst.kbd:en:Kazakh kz.kst.kbd:de:Kasachisch kz.kst.kbd:fr:Kazakh diff --git a/share/vt/keymaps/Makefile b/share/vt/keymaps/Makefile index 283c3482d372..e1242bbeeb88 100644 --- a/share/vt/keymaps/Makefile +++ b/share/vt/keymaps/Makefile @@ -48,8 +48,6 @@ FILES= INDEX.keymaps \ it.kbd \ jp.capsctrl.kbd \ jp.kbd \ - jp.pc98.iso.kbd \ - jp.pc98.kbd \ kz.io.kbd \ kz.kst.kbd \ latinamerican.acc.kbd \ diff --git a/share/vt/keymaps/jp.pc98.iso.kbd b/share/vt/keymaps/jp.pc98.iso.kbd deleted file mode 100644 index b60375c9f051..000000000000 --- a/share/vt/keymaps/jp.pc98.iso.kbd +++ /dev/null @@ -1,134 +0,0 @@ -# $FreeBSD$ -# alt -# scan cntrl alt alt cntrl lock -# code base shift cntrl shift alt shift cntrl shift state -# ------------------------------------------------------------------ - 000 esc esc esc esc esc esc debug esc O - 001 '1' '!' '!' '!' '1' '!' '!' '!' O - 002 '2' '@' sub sub '2' '"' nul nul O - 003 '3' '#' esc esc '3' '#' esc esc O - 004 '4' '$' fs fs '4' '$' fs fs O - 005 '5' '%' gs gs '5' '%' gs gs O - 006 '6' '^' rs rs '6' '&' rs rs O - 007 '7' '&' '&' '&' '7' ''' us us O - 008 '8' '*' bs bs '8' '(' del del O - 009 '9' '(' '(' '(' '9' ')' '9' '9' O - 010 '0' ')' ')' ')' '0' nop '0' '0' O - 011 '-' '_' us us '-' '=' '-' '-' O - 012 '=' '+' '+' '+' '^' '`' rs rs O - 013 0xa5 '|' fs fs 0xa5 '|' fs fs O - 014 bs bs bs bs bs bs bs bs O - 015 ht btab ht btab ht btab ht btab O - 016 'q' 'Q' dc1 dc1 'q' 'Q' dc1 dc1 C - 017 'w' 'W' etb etb 'w' 'W' etb etb C - 018 'e' 'E' enq enq 'e' 'E' enq enq C - 019 'r' 'R' dc2 dc2 'r' 'R' dc2 dc2 C - 020 't' 'T' dc4 dc4 't' 'T' dc4 dc4 C - 021 'y' 'Y' em em 'y' 'Y' em em C - 022 'u' 'U' nak nak 'u' 'U' nak nak C - 023 'i' 'I' ht ht 'i' 'I' ht ht C - 024 'o' 'O' si si 'o' 'O' si si C - 025 'p' 'P' dle dle 'p' 'P' dle dle C - 026 '[' '{' esc esc '@' '~' nul nul O - 027 ']' '}' gs gs '[' '{' esc esc O - 028 cr cr nl nl cr cr nl nl O - 029 'a' 'A' soh soh 'a' 'A' soh soh C - 030 's' 'S' dc3 dc3 's' 'S' dc3 dc3 C - 031 'd' 'D' eot eot 'd' 'D' eot eot C - 032 'f' 'F' ack ack 'f' 'F' ack ack C - 033 'g' 'G' bel bel 'g' 'G' bel bel C - 034 'h' 'H' bs bs 'h' 'H' bs bs C - 035 'j' 'J' nl nl 'j' 'J' nl nl C - 036 'k' 'K' vt vt 'k' 'K' vt vt C - 037 'l' 'L' ff ff 'l' 'L' ff ff C - 038 ';' ':' ';' ';' ';' '+' ';' ';' O - 039 ''' '"' ''' ''' ':' '*' ':' ':' O - 040 '`' '~' '~' '~' ']' '}' gs gs O - 041 'z' 'Z' sub sub 'z' 'Z' sub sub C - 042 'x' 'X' can can 'x' 'X' can can C - 043 'c' 'C' etx etx 'c' 'C' etx etx C - 044 'v' 'V' syn syn 'v' 'V' syn syn C - 045 'b' 'B' stx stx 'b' 'B' stx stx C - 046 'n' 'N' so so 'n' 'N' so so C - 047 'm' 'M' cr cr 'm' 'M' cr cr C - 048 ',' '<' '<' '<' ',' '<' '<' '<' O - 049 '.' '>' '>' '>' '.' '>' '>' '>' O - 050 '/' '?' del del '/' '?' del del O - 051 '\' '|' fs fs nop '_' us us O - 052 ' ' ' ' nul nul ' ' ' ' nul nul O - 053 esc esc esc esc esc esc esc esc O - 054 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 O - 055 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 O - 056 fkey60 fkey60 fkey60 fkey60 fkey60 fkey60 fkey60 fkey60 O - 057 del del del del del del boot boot N - 058 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 O - 059 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 O - 060 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 O - 061 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 O - 062 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 O - 063 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 O - 064 '-' '-' '-' '-' '-' '-' '-' '-' O - 065 '/' '/' '/' '/' '/' '/' '/' '/' O - 066 '7' '7' '7' '7' '7' '7' '7' '7' O - 067 '8' '8' '8' '8' '8' '8' '8' '8' O - 068 '9' '9' '9' '9' '9' '9' '9' '9' O - 069 '*' '*' '*' '*' '*' '*' '*' '*' O - 070 '4' '4' '4' '4' '4' '4' '4' '4' O - 071 '5' '5' '5' '5' '5' '5' '5' '5' O - 072 '6' '6' '6' '6' '6' '6' '6' '6' O - 073 '+' '+' '+' '+' '+' '+' '+' '+' O - 074 '1' '1' '1' '1' '1' '1' '1' '1' O - 075 '2' '2' '2' '2' '2' '2' '2' '2' O - 076 '3' '3' '3' '3' '3' '3' '3' '3' O - 077 '=' '=' '=' '=' '=' '=' '=' '=' O - 078 '0' '0' '0' '0' '0' '0' '0' '0' O - 079 ',' ',' ',' ',' ',' ',' ',' ',' O - 080 '.' '.' '.' '.' '.' '.' '.' '.' O - 081 meta meta meta meta meta meta meta meta O - 082 fkey11 fkey23 fkey35 fkey47 scr11 scr11 scr11 scr11 O - 083 fkey12 fkey24 fkey36 fkey48 scr12 scr12 scr12 scr12 O - 084 slock slock slock slock slock slock slock slock O - 085 nop nop nop nop nop nop nop nop O - 086 nop nop nop nop nop nop nop nop O - 087 nop nop nop nop nop nop nop nop O - 088 nop nop nop nop nop nop nop nop O - 089 nop nop nop nop nop nop nop nop O - 090 nop nop nop nop nop nop nop nop O - 091 nop nop nop nop nop nop nop nop O - 092 nop nop nop nop nop nop nop nop O - 093 nop nop nop nop nop nop nop nop O - 094 nop nop nop nop nop nop nop nop O - 095 nop nop nop nop nop nop nop nop O - 096 slock saver slock saver susp nop susp nop O - 097 nscr nscr debug debug nop nop nop nop O - 098 fkey01 fkey13 fkey25 fkey37 scr01 scr01 scr01 scr01 O - 099 fkey02 fkey14 fkey26 fkey38 scr02 scr02 scr02 scr02 O - 100 fkey03 fkey15 fkey27 fkey39 scr03 scr03 scr03 scr03 O - 101 fkey04 fkey16 fkey28 fkey40 scr04 scr04 scr04 scr04 O - 102 fkey05 fkey17 fkey29 fkey41 scr05 scr05 scr05 scr05 O - 103 fkey06 fkey18 fkey30 fkey42 scr06 scr06 scr06 scr06 O - 104 fkey07 fkey19 fkey31 fkey43 scr07 scr07 scr07 scr07 O - 105 fkey08 fkey20 fkey32 fkey44 scr08 scr08 scr08 scr08 O - 106 fkey09 fkey21 fkey33 fkey45 scr09 scr09 scr09 scr09 O - 107 fkey10 fkey22 fkey34 fkey46 scr10 scr10 scr10 scr10 O - 108 nop nop nop nop nop nop nop nop O - 109 nop nop nop nop nop nop nop nop O - 110 nop nop nop nop nop nop nop nop O - 111 nop nop nop nop nop nop nop nop O - 112 lshift lshift lshift lshift lshift lshift lshift lshift O - 113 clock clock clock clock clock clock clock clock O - 114 lalt lalt lalt lalt lalt lalt lalt lalt O - 115 lalt lalt lalt lalt lalt lalt lalt lalt O - 116 lctrl lctrl lctrl lctrl lctrl lctrl lctrl lctrl O - 117 nop nop nop nop nop nop nop nop O - 118 nop nop nop nop nop nop nop nop O - 119 nop nop nop nop nop nop nop nop O - 120 nop nop nop nop nop nop nop nop O - 121 nop nop nop nop nop nop nop nop O - 122 nop nop nop nop nop nop nop nop O - 123 nop nop nop nop nop nop nop nop O - 124 nop nop nop nop nop nop nop nop O - 125 nop nop nop nop nop nop nop nop O - 126 nop nop nop nop nop nop nop nop O - 127 nop nop nop nop nop nop nop nop O - diff --git a/share/vt/keymaps/jp.pc98.kbd b/share/vt/keymaps/jp.pc98.kbd deleted file mode 100644 index 6c8a4d656fc8..000000000000 --- a/share/vt/keymaps/jp.pc98.kbd +++ /dev/null @@ -1,134 +0,0 @@ -# $FreeBSD$ -# alt -# scan cntrl alt alt cntrl lock -# code base shift cntrl shift alt shift cntrl shift state -# ------------------------------------------------------------------ - 000 esc esc esc esc esc esc debug esc O - 001 '1' '!' '!' '!' '1' '!' '!' '!' O - 002 '2' '"' sub sub '2' '@' nul nul O - 003 '3' '#' esc esc '3' '#' esc esc O - 004 '4' '$' fs fs '4' '$' fs fs O - 005 '5' '%' gs gs '5' '%' gs gs O - 006 '6' '&' rs rs '6' '^' rs rs O - 007 '7' ''' us us '7' '&' '&' '&' O - 008 '8' '(' del del '8' '*' bs bs O - 009 '9' ')' '9' '9' '9' '(' '(' '(' O - 010 '0' nop '0' '0' '0' ')' ')' ')' O - 011 '-' '=' '-' '-' '-' '_' us us O - 012 '^' '`' rs rs '=' '+' '+' '+' O - 013 '\' '|' fs fs 0xa5 '|' fs fs O - 014 bs bs bs bs bs bs bs bs O - 015 ht btab ht btab ht btab ht btab O - 016 'q' 'Q' dc1 dc1 'q' 'Q' dc1 dc1 C - 017 'w' 'W' etb etb 'w' 'W' etb etb C - 018 'e' 'E' enq enq 'e' 'E' enq enq C - 019 'r' 'R' dc2 dc2 'r' 'R' dc2 dc2 C - 020 't' 'T' dc4 dc4 't' 'T' dc4 dc4 C - 021 'y' 'Y' em em 'y' 'Y' em em C - 022 'u' 'U' nak nak 'u' 'U' nak nak C - 023 'i' 'I' ht ht 'i' 'I' ht ht C - 024 'o' 'O' si si 'o' 'O' si si C - 025 'p' 'P' dle dle 'p' 'P' dle dle C - 026 '@' '~' nul nul '[' '{' esc esc O - 027 '[' '{' esc esc ']' '}' gs gs O - 028 cr cr nl nl cr cr nl nl O - 029 'a' 'A' soh soh 'a' 'A' soh soh C - 030 's' 'S' dc3 dc3 's' 'S' dc3 dc3 C - 031 'd' 'D' eot eot 'd' 'D' eot eot C - 032 'f' 'F' ack ack 'f' 'F' ack ack C - 033 'g' 'G' bel bel 'g' 'G' bel bel C - 034 'h' 'H' bs bs 'h' 'H' bs bs C - 035 'j' 'J' nl nl 'j' 'J' nl nl C - 036 'k' 'K' vt vt 'k' 'K' vt vt C - 037 'l' 'L' ff ff 'l' 'L' ff ff C - 038 ';' '+' ';' ';' ';' ':' ';' ';' O - 039 ':' '*' ':' ':' ''' '"' ''' ''' O - 040 ']' '}' gs gs '`' '~' '~' '~' O - 041 'z' 'Z' sub sub 'z' 'Z' sub sub C - 042 'x' 'X' can can 'x' 'X' can can C - 043 'c' 'C' etx etx 'c' 'C' etx etx C - 044 'v' 'V' syn syn 'v' 'V' syn syn C - 045 'b' 'B' stx stx 'b' 'B' stx stx C - 046 'n' 'N' so so 'n' 'N' so so C - 047 'm' 'M' cr cr 'm' 'M' cr cr C - 048 ',' '<' '<' '<' ',' '<' '<' '<' O - 049 '.' '>' '>' '>' '.' '>' '>' '>' O - 050 '/' '?' del del '/' '?' del del O - 051 nop '_' us us '\' '|' fs fs O - 052 ' ' ' ' nul nul ' ' ' ' nul nul O - 053 esc esc esc esc esc esc esc esc O - 054 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 O - 055 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 O - 056 fkey60 fkey60 fkey60 fkey60 fkey60 fkey60 fkey60 fkey60 O - 057 del del del del del del boot boot N - 058 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 fkey50 O - 059 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 fkey53 O - 060 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 fkey55 O - 061 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 fkey58 O - 062 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 O - 063 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 O - 064 '-' '-' '-' '-' '-' '-' '-' '-' O - 065 '/' '/' '/' '/' '/' '/' '/' '/' O - 066 '7' '7' '7' '7' '7' '7' '7' '7' O - 067 '8' '8' '8' '8' '8' '8' '8' '8' O - 068 '9' '9' '9' '9' '9' '9' '9' '9' O - 069 '*' '*' '*' '*' '*' '*' '*' '*' O - 070 '4' '4' '4' '4' '4' '4' '4' '4' O - 071 '5' '5' '5' '5' '5' '5' '5' '5' O - 072 '6' '6' '6' '6' '6' '6' '6' '6' O - 073 '+' '+' '+' '+' '+' '+' '+' '+' O - 074 '1' '1' '1' '1' '1' '1' '1' '1' O - 075 '2' '2' '2' '2' '2' '2' '2' '2' O - 076 '3' '3' '3' '3' '3' '3' '3' '3' O - 077 '=' '=' '=' '=' '=' '=' '=' '=' O - 078 '0' '0' '0' '0' '0' '0' '0' '0' O - 079 ',' ',' ',' ',' ',' ',' ',' ',' O - 080 '.' '.' '.' '.' '.' '.' '.' '.' O - 081 meta meta meta meta meta meta meta meta O - 082 fkey11 fkey23 fkey35 fkey47 scr11 scr11 scr11 scr11 O - 083 fkey12 fkey24 fkey36 fkey48 scr12 scr12 scr12 scr12 O - 084 slock slock slock slock slock slock slock slock O - 085 nop nop nop nop nop nop nop nop O - 086 nop nop nop nop nop nop nop nop O - 087 nop nop nop nop nop nop nop nop O - 088 nop nop nop nop nop nop nop nop O - 089 nop nop nop nop nop nop nop nop O - 090 nop nop nop nop nop nop nop nop O - 091 nop nop nop nop nop nop nop nop O - 092 nop nop nop nop nop nop nop nop O - 093 nop nop nop nop nop nop nop nop O - 094 nop nop nop nop nop nop nop nop O - 095 nop nop nop nop nop nop nop nop O - 096 slock saver slock saver susp nop susp nop O - 097 nscr nscr debug debug nop nop nop nop O - 098 fkey01 fkey13 fkey25 fkey37 scr01 scr01 scr01 scr01 O - 099 fkey02 fkey14 fkey26 fkey38 scr02 scr02 scr02 scr02 O - 100 fkey03 fkey15 fkey27 fkey39 scr03 scr03 scr03 scr03 O - 101 fkey04 fkey16 fkey28 fkey40 scr04 scr04 scr04 scr04 O - 102 fkey05 fkey17 fkey29 fkey41 scr05 scr05 scr05 scr05 O - 103 fkey06 fkey18 fkey30 fkey42 scr06 scr06 scr06 scr06 O - 104 fkey07 fkey19 fkey31 fkey43 scr07 scr07 scr07 scr07 O - 105 fkey08 fkey20 fkey32 fkey44 scr08 scr08 scr08 scr08 O - 106 fkey09 fkey21 fkey33 fkey45 scr09 scr09 scr09 scr09 O - 107 fkey10 fkey22 fkey34 fkey46 scr10 scr10 scr10 scr10 O - 108 nop nop nop nop nop nop nop nop O - 109 nop nop nop nop nop nop nop nop O - 110 nop nop nop nop nop nop nop nop O - 111 nop nop nop nop nop nop nop nop O - 112 lshift lshift lshift lshift lshift lshift lshift lshift O - 113 clock clock clock clock clock clock clock clock O - 114 lalt lalt lalt lalt lalt lalt lalt lalt O - 115 lalt lalt lalt lalt lalt lalt lalt lalt O - 116 lctrl lctrl lctrl lctrl lctrl lctrl lctrl lctrl O - 117 nop nop nop nop nop nop nop nop O - 118 nop nop nop nop nop nop nop nop O - 119 nop nop nop nop nop nop nop nop O - 120 nop nop nop nop nop nop nop nop O - 121 nop nop nop nop nop nop nop nop O - 122 nop nop nop nop nop nop nop nop O - 123 nop nop nop nop nop nop nop nop O - 124 nop nop nop nop nop nop nop nop O - 125 nop nop nop nop nop nop nop nop O - 126 nop nop nop nop nop nop nop nop O - 127 nop nop nop nop nop nop nop nop O - diff --git a/sys/Makefile b/sys/Makefile index fa8941ef3378..7d88c4ecdf22 100644 --- a/sys/Makefile +++ b/sys/Makefile @@ -8,7 +8,7 @@ CSCOPEDIRS= boot bsm cam cddl compat conf contrib crypto ddb dev fs gdb \ rpc security sys ufs vm xdr xen ${CSCOPE_ARCHDIR} .if !defined(CSCOPE_ARCHDIR) .if defined(ALL_ARCH) -CSCOPE_ARCHDIR = amd64 arm arm64 i386 mips pc98 powerpc riscv sparc64 x86 +CSCOPE_ARCHDIR = amd64 arm arm64 i386 mips powerpc riscv sparc64 x86 .else CSCOPE_ARCHDIR = ${MACHINE} .if ${MACHINE} != ${MACHINE_CPUARCH} diff --git a/sys/boot/Makefile.pc98 b/sys/boot/Makefile.pc98 deleted file mode 100644 index 84683991a645..000000000000 --- a/sys/boot/Makefile.pc98 +++ /dev/null @@ -1,3 +0,0 @@ -# $FreeBSD$ - -SUBDIR+= libstand32 diff --git a/sys/boot/common/Makefile.inc b/sys/boot/common/Makefile.inc index 1b2080a7772d..c83f00975814 100644 --- a/sys/boot/common/Makefile.inc +++ b/sys/boot/common/Makefile.inc @@ -7,8 +7,6 @@ SRCS+= module.c panic.c .if ${MACHINE} == "i386" || ${MACHINE_CPUARCH} == "amd64" SRCS+= load_elf32.c load_elf32_obj.c reloc_elf32.c SRCS+= load_elf64.c load_elf64_obj.c reloc_elf64.c -.elif ${MACHINE} == "pc98" -SRCS+= load_elf32.c load_elf32_obj.c reloc_elf32.c .elif ${MACHINE_CPUARCH} == "aarch64" SRCS+= load_elf64.c reloc_elf64.c .elif ${MACHINE_CPUARCH} == "arm" diff --git a/sys/boot/common/isapnp.h b/sys/boot/common/isapnp.h index 0f9956c4f183..a5b8f28304f7 100644 --- a/sys/boot/common/isapnp.h +++ b/sys/boot/common/isapnp.h @@ -45,15 +45,9 @@ /* Static ports to access PnP state machine */ #ifndef _KERNEL -#ifdef PC98 -/* pnp.h is included from pnpinfo.c. */ -#define _PNP_ADDRESS 0x259 -#define _PNP_WRITE_DATA 0xa59 -#else #define _PNP_ADDRESS 0x279 #define _PNP_WRITE_DATA 0xa79 #endif -#endif /* PnP Registers. Write to ADDRESS and then use WRITE/READ_DATA */ #define SET_RD_DATA 0x00 diff --git a/sys/boot/ficl/loader.c b/sys/boot/ficl/loader.c index 224619065790..50f70642cc5c 100644 --- a/sys/boot/ficl/loader.c +++ b/sys/boot/ficl/loader.c @@ -827,9 +827,7 @@ void ficlCompilePlatform(FICL_SYSTEM *pSys) SET_FOREACH(fnpp, Xficl_compile_set) (*fnpp)(pSys); -#if defined(PC98) - ficlSetEnv(pSys, "arch-pc98", FICL_TRUE); -#elif defined(__i386__) +#if defined(__i386__) ficlSetEnv(pSys, "arch-i386", FICL_TRUE); ficlSetEnv(pSys, "arch-powerpc", FICL_FALSE); #elif defined(__powerpc__) diff --git a/sys/boot/forth/frames.4th b/sys/boot/forth/frames.4th index 0f8d460aa7b4..b237afe7ac43 100644 --- a/sys/boot/forth/frames.4th +++ b/sys/boot/forth/frames.4th @@ -46,49 +46,26 @@ variable fill 124 constant ascii_pipe 43 constant ascii_plus -s" arch-pc98" environment? [if] - \ Single frames - 149 constant sh_el - 150 constant sv_el - 152 constant slt_el - 154 constant slb_el - 153 constant srt_el - 155 constant srb_el - \ Double frames - 149 constant dh_el - 150 constant dv_el - 152 constant dlt_el - 154 constant dlb_el - 153 constant drt_el - 155 constant drb_el - \ Fillings - 0 constant fill_none - 32 constant fill_blank - 135 constant fill_dark - 135 constant fill_med - 135 constant fill_bright -[else] - \ Single frames - 196 constant sh_el - 179 constant sv_el - 218 constant slt_el - 192 constant slb_el - 191 constant srt_el - 217 constant srb_el - \ Double frames - 205 constant dh_el - 186 constant dv_el - 201 constant dlt_el - 200 constant dlb_el - 187 constant drt_el - 188 constant drb_el - \ Fillings - 0 constant fill_none - 32 constant fill_blank - 176 constant fill_dark - 177 constant fill_med - 178 constant fill_bright -[then] +\ Single frames +196 constant sh_el +179 constant sv_el +218 constant slt_el +192 constant slb_el +191 constant srt_el +217 constant srb_el +\ Double frames +205 constant dh_el +186 constant dv_el +201 constant dlt_el +200 constant dlb_el +187 constant drt_el +188 constant drb_el +\ Fillings +0 constant fill_none +32 constant fill_blank +176 constant fill_dark +177 constant fill_med +178 constant fill_bright only forth definitions also frame-drawing diff --git a/sys/boot/pc98/Makefile b/sys/boot/pc98/Makefile deleted file mode 100644 index e8f9dbffe1e0..000000000000 --- a/sys/boot/pc98/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD$ - -SUBDIR= boot0 boot0.5 pc98boot btx boot2 cdboot kgzldr libpc98 loader - -.include diff --git a/sys/boot/pc98/Makefile.inc b/sys/boot/pc98/Makefile.inc deleted file mode 100644 index 829793d63bd3..000000000000 --- a/sys/boot/pc98/Makefile.inc +++ /dev/null @@ -1,29 +0,0 @@ -# Common defines for all of /sys/boot/pc98/ -# -# $FreeBSD$ - -BINDIR?= /boot - -LOADER_ADDRESS?=0x200000 -CFLAGS+= -march=i386 -ffreestanding -CFLAGS.gcc+= -mpreferred-stack-boundary=2 -CFLAGS+= ${CFLAGS_NO_SIMD} -msoft-float -CFLAGS+= -Os -DPC98 -LDFLAGS+= -nostdlib - -# BTX components -.if exists(${.OBJDIR}/../btx) -BTXDIR= ${.OBJDIR}/../btx -.else -BTXDIR= ${.CURDIR}/../btx -.endif -BTXLDR= ${BTXDIR}/btxldr/btxldr -BTXKERN= ${BTXDIR}/btx/btx -BTXCRT= ${BTXDIR}/lib/crt0.o - -# compact binary with no padding between text, data, bss -LDSCRIPT= ${SRCTOP}/sys/boot/i386/boot.ldscript -LDFLAGS_BIN=-e start -Ttext ${ORG} -Wl,-T,${LDSCRIPT},-S,--oformat,binary -LD_FLAGS_BIN=-static -T ${LDSCRIPT} --gc-sections - -.include "../Makefile.inc" diff --git a/sys/boot/pc98/boot0.5/Makefile b/sys/boot/pc98/boot0.5/Makefile deleted file mode 100644 index ec40fe536ece..000000000000 --- a/sys/boot/pc98/boot0.5/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -# $FreeBSD$ - -PROG= ${BOOT}.out -INTERNALPROG= -FILES= ${BOOT} -MAN= -SRCS= start.s boot.s boot0.5.s disk.s selector.s support.s syscons.s \ - putssjis.s -CLEANFILES= ${BOOT} ${BOOT}.bin - -BOOT= boot0.5 - -# The base address that we the boot0 code to to run it. Don't change this -# unless you are glutton for punishment. -BOOT_BOOT0_ORG?= 0x0000 - -LDFLAGS=-e start -Ttext ${BOOT_BOOT0_ORG} -Wl,-N,-T,${.CURDIR}/ldscript - -# The size of boot0.5 must be 7168 bytes -${BOOT}: ${BOOT}.bin - cat ${BOOT}.bin /dev/zero | ${DD} of=${BOOT} bs=1 count=7168 - -${BOOT}.bin: ${BOOT}.out - ${OBJCOPY} -S -O binary ${BOOT}.out ${.TARGET} - -.include diff --git a/sys/boot/pc98/boot0.5/boot.s b/sys/boot/pc98/boot0.5/boot.s deleted file mode 100644 index 9d11206a882b..000000000000 --- a/sys/boot/pc98/boot0.5/boot.s +++ /dev/null @@ -1,174 +0,0 @@ -# Copyright (c) KATO Takenori, 1999, 2000. -# -# All rights reserved. Unpublished rights reserved under the copyright -# laws of Japan. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer as -# the first lines of this file unmodified. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# $FreeBSD$ -# - - .code16 - - .text - .global boot -# -# Read bootstrap program and jump to it. -# -boot: - # Step 1: Save parameters - movw curdevice, %si - movb daua(%si), %al - movb %al, b_daua - shlw %si - movw secsize(%si), %ax - movw %ax, b_secsize - - movw curpartition, %si - movb partnum(%si), %al # %al = real partition number - xorb %ah, %ah - movw %ax, b_partn # save real parttion number - movb $5, %cl - shlw %cl, %si # %si = offset to parttable - addw $4, %si - movb parttable(%si), %al # IPLS - movb %al, b_sector - incw %si - movb parttable(%si), %al # IPLH - movb %al, b_head - incw %si # IPLC - movw parttable(%si), %ax - movw %ax, b_cylinder - - # Step 2: Calculate the segment address of the bootstrap routine - movw $0x1d00, %ax - movw b_secsize, %cx - shrw %cx - shrw %cx - subw %cx, %ax - subw $0x100, %ax - movw %ax, b_bootseg - - # Step 3: Read bootstrap code - movb $6, %ah - movb b_daua, %al - movw b_secsize, %bx - shlw %bx # 2 sectors - movw b_cylinder, %cx - movb b_head, %dh - movb b_sector, %dl - movw b_bootseg, %es - xorw %bp, %bp - int $0x1b - jc boot_error - - # Step 4: Set DA/UA into BIOS work area - xorw %ax, %ax - movw %ax, %es - movw $0x584, %bx # DISK_BOOT - movb b_daua, %dl - call write_biosparam - - call sc_clean - # Step 5: Set registers - # %ah: 00 - # %al: DA/UA - # %bx: Sector size * 2 - # %cx: cylinder number of boot partition - # %si: pointer to partition table - movw b_partn, %ax - movb $5, %cl - shl %cl, %ax # %ax = partition number * 32 - addw b_secsize, %ax - movw %ax, %si # %si = pointer to partition table - movw b_cylinder, %cx # %cx = cylinder - movb b_head, %dh # %dh = head - movb b_sector, %dl # %dl = sector - movw b_bootseg, %es # %es = boot segment - movb b_daua, %al # %al = DA/UA - movw b_secsize, %bx - shlw %bx # %bx = sector size * 2 - cli - movw %cs:iniss, %ss # Restore stack pointer - movw %cs:inisp, %sp - push %es # Boot segment - xorw %bp, %bp - push %bp # 0 - movw %ax, %di # Save %ax - xorw %ax, %ax - movw %ax, %ds # %ds = 0 - movw %di, %ax # Restore %ax - xorb %ah, %ah # %ah = 0 - xorw %di, %di # %di = 0 - sti - - # Jump to bootstrap code - lret - # NOTREACHED - -boot_error: - ret - -# -# Try to boot from default partition. -# - .global trydefault -trydefault: - movw ndevice, %cx - xorw %si, %si -trydefault_loop: - movw %si, curdevice - push %cx - push %si - call read_ipl - pop %si - pop %cx - cmpb $0x80, defpartflag - jne nodefpart - # Default partition is defined. - push %cx - movw npartition, %cx -srch_part: - movw %cx, %bx - decw %bx - movb defpartnum, %al # %al = real partition number - cmpb partnum(%bx), %al - jne not_match - movw %bx, curpartition # Store partition number - call boot -not_match: - loop srch_part - pop %cx -nodefpart: - incw %si - loop trydefault_loop - ret - - .data -b_daua: .byte 0 # DA/UA -b_head: .byte 0 # SYSH -b_sector: .byte 0 # SYSS -b_cylinder: .word 0 # SYSC -b_bootseg: .word 0 -b_secsize: .word 0 -b_partn: .word 0 # Real partition number diff --git a/sys/boot/pc98/boot0.5/boot0.5.s b/sys/boot/pc98/boot0.5/boot0.5.s deleted file mode 100644 index f87800656767..000000000000 --- a/sys/boot/pc98/boot0.5/boot0.5.s +++ /dev/null @@ -1,293 +0,0 @@ -# Copyright (c) KATO Takenori, 1999, 2000, 2007. -# -# All rights reserved. Unpublished rights reserved under the copyright -# laws of Japan. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer as -# the first lines of this file unmodified. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# $FreeBSD$ -# - .global main - .code16 - - .text -main: - # Check hireso mode - movw $0x501, %bx # BIOS_FLAG - call read_biosparam - testb $0x08, %dl - jz normalmode - movb $1, ishireso -normalmode: - call sc_init - - # Display title and copyright. - movw $title, %di - call sc_puts - xorw %cx, %cx - movw $1, %dx - call sc_goto - movw $copyright, %di - call sc_puts - - # Scan hard drives - xorw %si, %si # number of partition - call scan_sasi # SASI/IDE - call scan_scsi # SCSI - movw %si, ndevice - orw %si, %si - jnz drives_found - jmp exit # No hard drives - -drives_found: - # Setup sector size dependent parameters - movw %si, %cx # %cx = number of devices -setup_loop: - movw %cx, %di - decw %di - shlw %di - movw secsize(%di), %ax - cmpw $1024, %ax - je setup_1024 - cmpw $512, %ax - je setup_512 - # 256 bytes/sector - movw $0x100, partoff(%di) - movw $0x0fa, defflagoff(%di) - movw $0x0fb, defpartoff(%di) - movw $8, maxpart(%di) - jmp setup_secsize_end - # 1024 bytes/sector -setup_1024: - # XXX Fix me! - movw $0x400, partoff(%di) - movw $0x3fa, defflagoff(%di) - movw $0x3fb, defpartoff(%di) - movb $32, maxpart(%di) - jmp setup_secsize_end - # 512 bytes/sector -setup_512: - movw $0x200, partoff(%di) - movw $0x1fa, defflagoff(%di) - movw $0x1fb, defpartoff(%di) - movb $16, maxpart(%di) -setup_secsize_end: - loop setup_loop - - # For debug with floppy, fake the parameter. - movw $0x584, %bx # DISK_BOOT - call read_biosparam - andb $0xf0, %dl - cmpb $0x90, %ah - jne boot_from_hdd - movb daua, %dl - call write_biosparam - -boot_from_hdd: - movw $500, %cx -wait_0_5: - call wait1ms - loop wait_0_5 - - # If the TAB is pressed, don't try to boot from default partition - xorw %di, %di # flag -wait_key_release: - call sc_iskeypress - orw %ax, %ax - jz key_release # KBD buffer empty. - call sc_getc - cmpb $0x0f, %ah # TAB - jne wait_key_release - # TAB pressed - movw $1, %di - jmp wait_key_release -key_release: - orw %di, %di - jnz dont_try_default # TAB pressed. - call trydefault - # Default partition not found. -dont_try_default: - call show_usage - call showdevices - call selector -exit: - ret -# -# Display usage -# -show_usage: - movw $44, %cx - movw $3, %dx - call sc_goto - movw $msg_usage1, %di - call sc_puts - movw $44, %cx - movw $4, %dx - call sc_goto - movw $msg_usage2, %di - call sc_puts - movw $44, %cx - movw $5, %dx - call sc_goto - movw $msg_usage3, %di - call sc_puts - movw $44, %cx - movw $7, %dx - call sc_goto - movw $msg_usage4, %di - call sc_puts - movw $44, %cx - movw $8, %dx - call sc_goto - movw $msg_usage5, %di - call sc_puts - movw $44, %cx - movw $9, %dx - call sc_goto - movw $msg_usage6, %di - call sc_puts - movw $44, %cx - movw $10, %dx - call sc_goto - movw $msg_usage7, %di - call sc_puts - movw $44, %cx - movw $11, %dx - call sc_goto - movw $msg_usage8, %di - call sc_puts - movw $44, %cx - movw $16, %dx - call sc_goto - movw $msg_usage9, %di - call sc_puts - movw $44, %cx - movw $17, %dx - call sc_goto - movw $msg_usage10, %di - call sc_puts - movw $44, %cx - movw $18, %dx - call sc_goto - movw $msg_usage11, %di - call sc_puts - movw $44, %cx - movw $19, %dx - call sc_goto - movw $msg_usage12, %di - call sc_puts - ret - -# -# Display device list -# -showdevices: - movw $2, %cx - movw $4, %dx - call sc_goto - movw $msg_device, %di - call sc_puts - xorw %si, %si # %si = device number - movw ndevice, %cx # %cx = number of devices -showdev_loop: - push %cx - movw $2, %cx - movw $5, %dx - addw %si, %dx - call sc_goto - # Check DA - movb daua(%si), %al - push %ax - andb $0xf0, %al - cmpb $0x80, %al - je show_sasi - cmpb $0xa0, %al - je show_scsi - # unknown device - movw $msg_unknown, %di - call sc_puts - jmp showunit - # SASI -show_sasi: - movw $msg_sasi, %di - call sc_puts - jmp showunit - # SCSI -show_scsi: - movw $msg_scsi, %di - call sc_puts - # Display unit number. -showunit: - pop %ax - andb $0x0f, %al - addb $'0', %al - call sc_putc - incw %si - pop %cx - loop showdev_loop - movw ndevice, %dx - addw $5, %dx - movw $2, %cx - call sc_goto - movw $msg_exitmenu, %di - call sc_puts - ret - - .data - .global curdevice, ndevice -ndevice: .word 0 # number of device -curdevice: .word 0 # current device - - .global ishireso -ishireso: .byte 0 - -title: .asciz "PC98 Boot Selector Version 1.2" -copyright: .ascii "(C)Copyright 1999-2007 KATO Takenori. " - .asciz "All rights reserved." -msg_device: .asciz "Device" -msg_sasi: .asciz "SASI/IDE unit " -msg_scsi: .asciz "SCSI ID " -msg_unknown: .asciz "unknown unit " -msg_exitmenu: .asciz "Exit this menu" -msg_usage1: .asciz "Device list" -msg_usage2: .asciz "UP, DOWN: select boot device" -msg_usage3: .asciz "RETURN: move to slice list" -msg_usage4: .asciz "Slice list" -msg_usage5: .asciz "UP, DOWN: select boot slice" -msg_usage6: .asciz "RETURN: boot" -msg_usage7: .asciz "SPACE: toggle default" -msg_usage8: .asciz "ESC: move to device list" -msg_usage9: .asciz "LEGEND" -msg_usage10: .asciz ">>: selected device/slice" -msg_usage11: .asciz "*: default slice to boot" -msg_usage12: .asciz "!: unbootable slice" - - .bss - .global daua, secsize, defflagoff, defpartoff - .global maxpart, partoff -daua: .space 12 # DA/DU list -secsize: .space 12 * 2 # Sector soize -defflagoff: .space 12 * 2 -defpartoff: .space 12 * 2 -maxpart: .space 12 * 2 -partoff: .space 12 * 2 diff --git a/sys/boot/pc98/boot0.5/disk.s b/sys/boot/pc98/boot0.5/disk.s deleted file mode 100644 index 6e8034898c82..000000000000 --- a/sys/boot/pc98/boot0.5/disk.s +++ /dev/null @@ -1,296 +0,0 @@ -# Copyright (c) KATO Takenori, 1999, 2000. -# -# All rights reserved. Unpublished rights reserved under the copyright -# laws of Japan. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer as -# the first lines of this file unmodified. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# $FreeBSD$ -# - - .code16 - .text -# -# Check magic number at the end of the sector 0 -# -check_magic: - movw curdevice, %si - shlw %si - movw secsize(%si), %bx - decw %bx - decw %bx - movw iplbuf(%bx), %ax - cmpw $0xaa55, %ax - je magic_ok - movw $1, %ax - ret -magic_ok: - xorw %ax, %ax - ret - -# -# Copy partition table from buffer to parttable. -# -setup_partition: - push %cs - pop %es - movw curdevice, %bx - shlw %bx - movw maxpart(%bx), %cx # %cx = max num of partitions - movw partoff(%bx), %di - movw %di, %bx # %bx = offset to partition table - xorw %dx, %dx # %dx = partition number -setup_partition_loop: - push %cx - movw %dx, %si - movb $5, %cl - shlw %cl, %si - addw %bx, %si - movb iplbuf(%si), %al - orb %al, %al - jz unused_partition - addw $iplbuf, %si - movw npartition, %ax - movw %ax, %di - movb $5, %cl - shlw %cl, %di - addw $parttable, %di - movw $32, %cx - rep - movsb - movw %ax, %di - addw $partnum, %di - movb %dl, (%di) - incw npartition -unused_partition: - incw %dx - pop %cx - loop setup_partition_loop - ret - -# -# Read IPL and partition table in the current device. -# - .global read_ipl -read_ipl: - movw curdevice, %ax - movw %ax, %si # %si = device number - movw %ax, %di - shlw %di - - movw %cs, %ax - movw %ax, %es - movb $6, %ah - movb daua(%si), %al - movw $0x400, %bx - xorw %cx, %cx - xorw %dx, %dx - movw $iplbuf, %bp - int $0x1b - jc read_ipl_error - movw defflagoff(%di), %bx - movb iplbuf(%bx), %al - movb %al, defpartflag - incw %bx - movb iplbuf(%bx), %al - movb %al, defpartnum - movw $0, npartition - call check_magic - orw %ax, %ax - jnz no_magic - call setup_partition -no_magic: - xorw %ax, %ax -read_ipl_error: - xorw %bx, %bx - movw %bx, %es - ret - -# -# Restore IPL from the buffer -# - .global write_ipl -write_ipl: - movw curdevice, %ax - movw %ax, %si - movw %ax, %di - shlw %di - - # Restore default boot partition info. - movw defflagoff(%di), %bx - movb defpartflag, %al - movb %al, iplbuf(%bx) - incw %bx - movb defpartnum, %al - movb %al, iplbuf(%bx) - - movw %cs, %ax - movw %ax, %es - movb $5, %ah - movb daua(%si), %al - movw secsize(%di), %bx - xorw %cx, %cx - xorw %dx, %dx - movw $iplbuf, %bp - int $0x1b - jc write_ipl_error - xorw %ax, %ax -write_ipl_error: - xorw %bx, %bx - movw %bx, %es - ret - -# -# Scan HDD devices -# - .global scan_sasi, scan_scsi - # Scan SASI disk -scan_sasi: - # SASI Disk - movw $4, %cx - movw $0x0001, %ax # %ah = unit number, %al = for bit operation - -sasi_loop: - movw %si, %di - shlw %di - movw $0x55d, %bx # DISK_EQUIP - call read_biosparam - testb %al, %dl - jz no_sasi_unit - movb $0x80, %dh - addb %ah, %dh # %dh = DA/UA - movb %dh, daua(%si) # Store DA/UA - - # Try new sense command - push %ax - push %cx - movb %dh, %al - movb $0x84, %ah - int $0x1b - pop %cx - pop %ax - jc err_newsense - movw %bx, %dx - jmp found_sasi_unit - -err_newsense: - movw $0x457, %bx # capacity & sector size of IDE HDD - call read_biosparam - orb %ah, %ah - jz sasi_1 - cmpb $1, %ah - jz sasi_2 - - # SASI #3/#4 - movw $512, %dx # XXX - jmp found_sasi_unit - -sasi_1: - # SASI #1 - testb $0x80, %dl - jz sasi_256 - jmp sasi_512 -sasi_2: - # SASI #2 - testb $0x40, %dl - jz sasi_256 - jmp sasi_512 - -sasi_256: - movw $256, %dx - jmp found_sasi_unit -sasi_512: - movw $512, %dx -found_sasi_unit: - movw %dx, secsize(%di) - incw %si -no_sasi_unit: - incb %ah - shlb %al - loop sasi_loop - ret - -# -# Scan SCSI disk -# SI number of disks -# destroyed: %ax, %bx, %cx, %dx -scan_scsi: - movw $8, %cx - movw $0x0001, %ax # %ah = ID number, %al = for bit operation -scsi_loop: - # Check whether drive exist. - movw %si, %di - shlw %di - movw $0x482, %bx # DISK_EQUIPS - call read_biosparam - testb %al, %dl - jz no_scsi_unit - xorw %bx, %bx - movb %ah, %bl - shlw %bx - shlw %bx - addw $0x460, %bx # SCSI parameter block - call read_biosparam - orb %dl, %dl - jz no_scsi_unit - - # SCSI harddrive found. - movb $0xa0, %dh - addb %ah, %dh - movb %dh, daua(%si) - - # Check sector size. - addw $3, %bx - call read_biosparam - andb $0x30, %dl - cmpb $0x20, %dl - je scsi_1024 - cmpb $0x10, %dl - je scsi_512 - movw $256, %dx - jmp found_scsi -scsi_1024: - movw $1024, %dx - jmp found_scsi -scsi_512: - movw $512, %dx -found_scsi: - movw %dx, secsize(%di) - incw %si -no_scsi_unit: - incb %ah - shlb %al - loop scsi_loop - ret - - .data - .global defpartflag, defpartnum, npartition -defpartflag: .byte 0 -defpartnum: .byte 0 -npartition: .word 0 # number of partitions - - .bss - .global partnum, parttable -iplbuf: .space 0x400 # Read buffer for IPL -partnum: .space 32 # Index of parttable -parttable: .space 1024 # Copy of valid partition table diff --git a/sys/boot/pc98/boot0.5/ldscript b/sys/boot/pc98/boot0.5/ldscript deleted file mode 100644 index 49044abfb159..000000000000 --- a/sys/boot/pc98/boot0.5/ldscript +++ /dev/null @@ -1,12 +0,0 @@ -/* - * $FreeBSD$ - */ - -SECTIONS -{ - .text : { *(.text) } - .data : { *(.data) } - . = 0x1243; - .putssjis : { *(.putssjis) } - .bss : { *(.bss) } -} diff --git a/sys/boot/pc98/boot0.5/putssjis.s b/sys/boot/pc98/boot0.5/putssjis.s deleted file mode 100644 index 221b9e67818b..000000000000 --- a/sys/boot/pc98/boot0.5/putssjis.s +++ /dev/null @@ -1,137 +0,0 @@ -# Copyright (c) KATO Takenori, 2007. -# -# All rights reserved. Unpublished rights reserved under the copyright -# laws of Japan. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer as -# the first lines of this file unmodified. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# $FreeBSD$ -# - - .code16 - .section .putssjis, "awx", @progbits - - # - # Display string with Shift-JIS support - # %si: address of string, %di: T-VRAM address, %cx: count - # - - # Absolute address of putssjis_entry must be 0x1243. -putssjis_entry: - push %es - push %ax - # Setup the T-VRAM segement address. - xorw %ax, %ax - movw %ax, %es - movw $0xa000, %ax - testb $0x08, %es:0x501 - jz normalmode - movw $0xe000, %ax -normalmode: - movw %ax, %es - -putssjis_loop: - lodsw - call check_sjis - jc put_2byte_char - - # 1 byte character - xorb %ah, %ah - testb $0xe0, %al # Check control code. - jnz put_1byte_char - movb $0x20, %al # Convert control code into the space. -put_1byte_char: - stosw - decw %si - jmp putssjis_loop_end - -put_2byte_char: - subb $0x20, %al - - # Check 2byte "hankaku" - cmp $0x09, %al - je put_2byte_hankaku - cmp $0x0a, %al - je put_2byte_hankaku - cmp $0x0b, %al - je put_2byte_hankaku - jmp put_2byte_zenkaku - -put_2byte_hankaku: - stosw - jmp putssjis_loop_end - -put_2byte_zenkaku: - stosw - orb $0x80, %ah - stosw - decw %cx - -putssjis_loop_end: - loop putssjis_loop - - pop %ax - pop %es - ret - - # Check 2-byte code. -check_sjis: - cmpb $0x80, %al - jbe found_ank_kana - cmpb $0xa0, %al - jb found_2byte_char - cmpb $0xe0, %al - jb found_ank_kana - cmpb $0xf0, %al - jae found_ank_kana - jmp found_2byte_char -found_ank_kana: - clc - ret - -found_2byte_char: - # Convert Shift-JIS into JIS. - cmpb $0x9f, %al - ja sjis_h_2 # Upper > 0x9f - subb $0x71, %al # Upper -= 0x71 - jmp sjis_lower -sjis_h_2: - subb $0xb1, %al # Upper -= 0xb1 -sjis_lower: - salb %al # Upper *= 2 - incb %al # Upper += 1 - - cmpb $0x7f, %ah - jbe sjis_l_2 - decb %ah # Lower -= 1 if lower > 0x7f -sjis_l_2: - cmpb $0x9e, %ah - jb sjis_l_3 - subb $0x7d, %ah # Lower -= 0x7d - incb %al # Upper += 1 - jmp check_2byte_end -sjis_l_3: - subb $0x1f, %ah # Lower -= 0x1f -check_2byte_end: - stc - ret diff --git a/sys/boot/pc98/boot0.5/selector.s b/sys/boot/pc98/boot0.5/selector.s deleted file mode 100644 index 9d98ef866d17..000000000000 --- a/sys/boot/pc98/boot0.5/selector.s +++ /dev/null @@ -1,450 +0,0 @@ -# Copyright (c) KATO Takenori, 1999, 2000, 2007. -# -# All rights reserved. Unpublished rights reserved under the copyright -# laws of Japan. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer as -# the first lines of this file unmodified. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# $FreeBSD$ -# - - .code16 - - .text -# -# Display partition table. -# -showpartitions: - # Clear partition table area - movw $16, %cx -clear_part: - push %cx - movw %cx, %dx - decw %dx - addw $5, %dx - movw $20, %cx - call sc_goto - movw $msg_spc, %di - call sc_puts - pop %cx - loop clear_part - - # Check `Exit' menu - movw curdevice, %ax - cmpw ndevice, %ax - je no_slice - - # XXX Move this to a suitable place! - movw $22, %cx - movw $4, %dx - call sc_goto - movw $msg_slice, %di - call sc_puts - - # Check the number of partitions - movw npartition, %cx - orw %cx, %cx - jnz partitionexist -no_slice: - # Just show the `no slice' message. - movw $22, %cx - movw $5, %dx - call sc_goto - movw $msg_noslice, %di - call sc_puts - ret -partitionexist: - xorw %si, %si # %si = partition number -showpart_loop: - push %cx # %cx = number of partitions - movw $22, %cx - movw %si, %dx - addw $5, %dx - call sc_goto - movw %si, %di - movb $5, %cl - shlw %cl, %di - addw $0x10, %di # SYSM field - # SYSM: space filled string. Don't use sc_puts. - movw $16, %cx -showpart_name: - push %cx - movb parttable(%di), %al - call sc_putc - incw %di - pop %cx - loop showpart_name - incw %si - pop %cx - loop showpart_loop - ret - -# -# Show default slice indicator -# If the default boot slice exists, `*' indicator will be showed. -# -showdefaultslicemark: - cmpb $0x80, defpartflag - je defpartexist - ret -defpartexist: - movw npartition, %cx -defslice_loop: - movw %cx, %bx - decw %bx - push %cx - push %bx - movw $40, %cx - movw %bx, %dx - addw $5, %dx - call sc_goto - - pop %bx - pop %cx - movb defpartnum, %al - cmpb partnum(%bx), %al - jne nomatch - movb $'*', %al - call sc_putc - jmp defslice_done -nomatch: - movb $' ', %al - call sc_putc -defslice_done: - loop defslice_loop - ret - -# -# Hide default slice indicator -# -hidedefaultslicemark: - movw $16, %cx -hidedefslice_loop: - push %cx - movw %cx, %dx - addw $4, %dx - movw $40, %cx - call sc_goto - movb $' ', %al - call sc_putc - pop %cx - loop hidedefslice_loop - ret - -# -# Toggle default slice -# -toggle_default: - cmpb $0x80, defpartflag - jne set_default - # Clear default - movb $0, defpartflag - call write_ipl # Restore - call hidedefaultslicemark - ret - # Set default slice -set_default: - movw curpartition, %si - movb partnum(%si), %al # %al = real partition number - movb $5, %cl - shlw %cl, %si - # Default slice must be bootable - testb $0x80, parttable(%si) - jnz curpart_bootable - # Current partition is not bootable. - ret -curpart_bootable: - movb $0x80, defpartflag - movb %al, defpartnum - call write_ipl # Restore - call showdefaultslicemark - ret - -# -# Show/hide cursor -# -show_devcurs: - xorw %cx, %cx - movw curdevice, %dx - addw $5, %dx - call sc_goto - movb $'>', %al - call sc_putc - movb $'>', %al - call sc_putc - ret - -hide_devcurs: - xorw %cx, %cx - movw curdevice, %dx - addw $5, %dx - call sc_goto - movb $' ', %al - call sc_putc - movb $' ', %al - call sc_putc - ret - -show_slicecurs: - movw $20, %cx - movw curpartition, %dx - addw $5, %dx - call sc_goto - movb $'>', %al - call sc_putc - movb $'>', %al - call sc_putc - ret - -hide_slicecurs: - movw $20, %cx - movw curpartition, %dx - addw $5, %dx - call sc_goto - movb $' ', %al - call sc_putc - movb $' ', %al - call sc_putc - ret - -isforceboot: - xorw %cx, %cx - movw $20, %dx - call sc_goto - movw $msg_force, %di - call sc_puts - call sc_getc - push %ax - xorw %cx, %cx - movw $20, %dx - call sc_goto - movw $msg_forceclr, %di - call sc_puts - pop %ax - cmpb $0x15, %ah - je force_yes - xorw %ax, %ax - ret -force_yes: - movw $1, %ax - ret - -# -# Main loop for device mode -# -devmode: - call read_ipl - call hidedefaultslicemark - call showpartitions - call showdefaultslicemark - call show_devcurs - - movw $2, %cx - movw $4, %dx - call sc_goto - movb $0xe5, %al - movw $6, %cx - call sc_setattr - movw $22, %cx - movw $4, %dx - call sc_goto - movb $0xe1, %al - movw $5, %cx - call sc_setattr - movw $44, %cx - movw $3, %dx - call sc_goto - movb $0xe5, %al - movw $11, %cx - call sc_setattr - movw $44, %cx - movw $7, %dx - call sc_goto - movb $0xe1, %al - movw $10, %cx - call sc_setattr - -devmode_loop: - call sc_getc - movw ndevice, %bx - cmpb $0x3a, %ah # UP - je dev_up - cmpb $0x3d, %ah # DOWN - je dev_down - cmpb $0x3c, %ah # RIGHT - je dev_right - cmpb $0x1c, %ah # RETURN - jne devmode_loop - cmpw curdevice, %bx - jne dev_right - movw $3, mode # N88-BASIC - ret - - # XXX - .space 5, 0x90 - ret # Dummy ret @0x9ab - -dev_up: - cmpw $0, curdevice - je devmode_loop - call hide_devcurs - decw curdevice - call read_ipl - call hidedefaultslicemark - call showpartitions - call showdefaultslicemark - call show_devcurs - jmp devmode_loop -dev_down: - cmpw curdevice, %bx - je devmode_loop - call hide_devcurs - incw curdevice - call read_ipl - call hidedefaultslicemark - call showpartitions - call showdefaultslicemark - call show_devcurs - jmp devmode_loop -dev_right: - cmpw curdevice, %bx - je devmode_loop - movw $1, mode # Slice mode - ret - -# -# main loop for slice mode -# -slicemode: - movw $0, curpartition - call show_slicecurs - movw $2, %cx - movw $4, %dx - call sc_goto - movb $0xe1, %al - movw $6, %cx - call sc_setattr - movw $22, %cx - movw $4, %dx - call sc_goto - movb $0xe5, %al - movw $5, %cx - call sc_setattr - movw $44, %cx - movw $3, %dx - call sc_goto - movb $0xe1, %al - movw $11, %cx - call sc_setattr - movw $44, %cx - movw $7, %dx - call sc_goto - movb $0xe5, %al - movw $10, %cx - call sc_setattr - -slicemode_loop: - call sc_getc - cmpb $0x3a, %ah # UP - je slice_up - cmpb $0x3d, %ah # DOWN - je slice_down - cmpb $0x3b, %ah # LEFT - je slice_esc - cmpb $0x00, %ah # ESC - je slice_esc - cmpb $0x1c, %ah # RETURN - je slice_ret - cmpb $0x34, %ah # SPC - je slice_spc - cmpb $0x62, %ah # f1 - je slice_spc - jmp slicemode_loop -slice_up: - cmpw $0, curpartition - je slicemode_loop - call hide_slicecurs - decw curpartition - call show_slicecurs - jmp slicemode_loop -slice_down: - movw curpartition, %bx - movw npartition, %ax - decw %ax - cmpw %bx, %ax - je slicemode_loop - call hide_slicecurs - incw curpartition - call show_slicecurs - jmp slicemode_loop -slice_esc: - movw $0, mode # Device mode - ret -slice_spc: - call toggle_default - jmp slicemode_loop -slice_ret: - # Test bit 7 of mid - movw curpartition, %si - movb $5, %cl - shlw %cl, %si - testb $0x80, parttable(%si) - jnz bootable_slice - call isforceboot - orw %ax, %ax - jz slicemode_loop -bootable_slice: - call boot - jmp slicemode_loop - -# -# Main loop -# - .global selector -selector: - movw $0, curdevice # trydefault may change the curdevice. - movw $0, mode - -selector_loop: - cmpw $0, mode - je status_dev - cmpw $1, mode - je status_slice - ret -status_dev: - call devmode - jmp selector_loop -status_slice: - call slicemode - jmp selector_loop - - .data - .global curpartition -curpartition: .word 0 # current patition -mode: .word 0 - -msg_spc: .asciz " " -msg_slice: .asciz "Slice" -msg_noslice: .asciz "no slice" -msg_force: .asciz "This slice is not bootable. Continue? (Y / [N])" -msg_forceclr: .asciz " " diff --git a/sys/boot/pc98/boot0.5/start.s b/sys/boot/pc98/boot0.5/start.s deleted file mode 100644 index 008ae66b15e3..000000000000 --- a/sys/boot/pc98/boot0.5/start.s +++ /dev/null @@ -1,73 +0,0 @@ -# Copyright (c) KATO Takenori, 1999, 2000, 2007. -# -# All rights reserved. Unpublished rights reserved under the copyright -# laws of Japan. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer as -# the first lines of this file unmodified. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# $FreeBSD$ -# - .global start - .code16 - - .text -start: - jmp start1 - - # Magic - .org 0x053, 0x20 - .byte 0x4e, 0x45, 0x43 - - .org 0x8f - .byte 0x32, 0x2e, 0x37, 0x30 - - .org 0x2d4 -start1: - # The instruction 'call 0x9ab' can be here. See also selector.s. - nop - nop - nop - cli - movw %cs, %ax - movw %ax, %ds - movw %ss, iniss - movw %sp, inisp - movw %ax, %ss - movw $0xfffe, %sp - sti - xorw %ax, %ax - movw %ax, %es - call main - - cli - movw %cs:iniss, %ss - movw %cs:inisp, %sp - sti - int $0x1e - # NOTREACHED - lret - - .data - .global iniss, inisp -iniss: .word 0 -inisp: .word 0 diff --git a/sys/boot/pc98/boot0.5/support.s b/sys/boot/pc98/boot0.5/support.s deleted file mode 100644 index df1115bdaaeb..000000000000 --- a/sys/boot/pc98/boot0.5/support.s +++ /dev/null @@ -1,94 +0,0 @@ -# Copyright (c) KATO Takenori, 1999, 2000. -# -# All rights reserved. Unpublished rights reserved under the copyright -# laws of Japan. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer as -# the first lines of this file unmodified. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# $FreeBSD$ -# - - .code16 - - .text -# -# Wait 1ms -# - .global wait1ms -wait1ms: - push %cx - movw $800, %cx -wait_loop: - outb %al, $0x5f - loop wait_loop - pop %cx - ret - -# -# Read one byte from BIOS parameter block -# %bx offset -# %dl value -# - .global read_biosparam -read_biosparam: - movb %es:(%bx), %dl - ret - -# -# Write one byte to BIOS parameter block -# %bx offset -# %dl value -# - .global write_biosparam -write_biosparam: - movb %dl, %es:(%bx) - ret - -# -# beep -# - .global beep_on, beep_off, beep -beep_on: - movb $0x17, %ah - int $0x18 - ret - -beep_off: - movb $0x18, %ah - int $0x18 - ret - -beep: - push %cx - call beep_on - movw $100, %cx -beep_loop1: - call wait1ms - loop beep_loop1 - call beep_off - movw $50, %cx -beep_loop2: - call wait1ms - loop beep_loop2 - pop %cx - ret diff --git a/sys/boot/pc98/boot0.5/syscons.s b/sys/boot/pc98/boot0.5/syscons.s deleted file mode 100644 index 150b835f795d..000000000000 --- a/sys/boot/pc98/boot0.5/syscons.s +++ /dev/null @@ -1,253 +0,0 @@ -# Copyright (c) KATO Takenori, 1999, 2000. -# -# All rights reserved. Unpublished rights reserved under the copyright -# laws of Japan. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer as -# the first lines of this file unmodified. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# $FreeBSD$ -# - - .code16 - - .text -# -# %al character code -# destroyed: %al, %bx -# -put_character: - movw $0xe000, %bx - movb ishireso, %ah - orb %ah, %ah - jne hireso_ch - movw $0xa000, %bx -hireso_ch: - movw %bx, %es - xorb %ah, %ah - movw curpos, %bx - movw %ax, %es:(%bx) - xorw %ax, %ax - movw %ax, %es - ret - -# -# %al attribute -# destroyed: %ah, %cx -# -set_attribute: - movw $0xe200, %bx - movb ishireso, %ah - orb %ah, %ah - jne hireso_ch - movw $0xa200, %bx -hireso_attr: - movw %bx, %es - xorb %ah, %ah - movw curpos, %bx - movw %ax, %es:(%bx) - xorw %bx, %bx - movw %bx, %es - ret - -# -# Put a character -# %al: character code -# destroyed: %ah, %bx, %cx -# - .global sc_putc -sc_putc: - call put_character - incw curpos - incw curpos - cmpw $4000, curpos - jng putc_end - movw $0, curpos -putc_end: - ret - -# -# Put a null terminated string -# %di: pointer to string -# destroyed: %ah, %cx, %di -# - .global sc_puts -sc_puts: - movb (%di), %al - orb %al, %al - jz puts_end - call sc_putc - incw %di - jmp sc_puts -puts_end: - ret - -# -# Change the current cursor position -# %cx: X -# %dx: Y -# destroyed: %ax, %bx -# - .global sc_goto -sc_goto: - movw %dx, %ax # AX=Y - shlw %ax # AX=Y*64 - shlw %ax - shlw %ax - shlw %ax - shlw %ax - shlw %ax - movw %dx, %bx # BX=Y - shlw %bx # BX=Y*16 - shlw %bx - shlw %bx - shlw %bx - addw %bx, %ax # AX=Y*64+Y*16=Y*80 - addw %cx, %ax - shlw %ax - movw %ax, curpos - ret - -# -# Clear screen -# destroyed: %ax, %bx -# - .global sc_clean -sc_clean: - movb $0x16, %ah - movw $0xe120, %dx - int $0x18 # KBD/CRT BIOS - movw $0, curpos - ret - -# -# Set sttribute code -# %al: attribute -# %cx: count -# destroyed: %ax, %bx, %cx -# - .global sc_setattr -sc_setattr: - call set_attribute - incw curpos - incw curpos - loop sc_setattr - -# -# Sense the state of shift key -# destroyed: %ax -# - .global sc_getshiftkey -sc_getshiftkey: - movb $2, %ah # Sense KB_SHIFT_COD - int $0x18 # KBD/CRT BIOS - xorb %ah, %ah - ret - -# -# Check KBD buffer -# - .global sc_iskeypress -sc_iskeypress: - mov $1, %ah - int $0x18 # KBD/CRT BIOS - testb $1, %bh - jz no_key - movw $1, %ax - ret -no_key: - xorw %ax, %ax - ret - -# -# Read from KBD -# - .global sc_getc -sc_getc: - xorb %ah, %ah - int $0x18 - ret - -# -# Initialize CRT (normal mode) -# -init_screen_normal: - # Disable graphic screen - movb $0x41, %ah - int $0x18 - # Init graphic screen - movb $0x42, %al - movb $0xc0, %ch - int $0x18 - # 80x25 mode - movw $0x0a00, %ax - int $0x18 - ret - -# -# Initialize CRT (hireso mode) -# -init_screen_hireso: - # Init RAM window - movb $8, %al - outb %al, $0x91 - movb $0x0a, %al - outb %al, $0x93 - # 80x31 mode - movw $0x0a00, %ax - int $0x18 - ret - -# -# Initialize screen (internal) -# -init_screen: - movb ishireso, %ah - orb %ah, %ah - jne hireso_ini - call init_screen_normal - jmp init_next -hireso_ini: - call init_screen_hireso -init_next: - movb $0x0c, %ah - int $0x18 - # cursor home and off - xorw %dx, %dx - movb $0x13, %ah - int $0x18 - movb $0x12, %ah - int $0x18 - ret - -# -# Initialize screeen -# - .global sc_init -sc_init: - call init_screen - call sc_clean - movw $0, curpos - ret - - .data -curpos: .word 0 # Current cursor position diff --git a/sys/boot/pc98/boot0/Makefile b/sys/boot/pc98/boot0/Makefile deleted file mode 100644 index d348f6020e41..000000000000 --- a/sys/boot/pc98/boot0/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -# $FreeBSD$ - -PROG= ${BOOT} -INTERNALPROG= -FILES= ${BOOT} -MAN= -SRCS= ${BOOT}.s -CLEANFILES= ${BOOT} - -BOOT= boot0 - -# The base address that we the boot0 code to to run it. Don't change this -# unless you are glutton for punishment. -BOOT_BOOT0_ORG?= 0x0000 -ORG=${BOOT_BOOT0_ORG} - -LDFLAGS=${LDFLAGS_BIN} - -.include diff --git a/sys/boot/pc98/boot0/boot0.s b/sys/boot/pc98/boot0/boot0.s deleted file mode 100644 index 508e2521157a..000000000000 --- a/sys/boot/pc98/boot0/boot0.s +++ /dev/null @@ -1,108 +0,0 @@ -# Copyright (c) KATO Takenori, 1999, 2000. -# -# All rights reserved. Unpublished rights reserved under the copyright -# laws of Japan. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer as -# the first lines of this file unmodified. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. The name of the author may not be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# $FreeBSD$ - - .globl start - .code16 -start: - jmp main - - .org 4 - .ascii "IPL1" - .byte 0, 0, 0 - - .globl start -main: - xor %ax, %ax - mov %ax, %ds - mov (0x584), %al # DA/UA - mov %al, %ah - and $0xf0, %ah - cmp $0x90, %ah - je fdd - - # hdd - mov $6, %ah - mov $0x3000, %bx - mov %bx, %es - mov $0x2000, %bx - xor %cx, %cx - xor %dx, %dx - xor %bp, %bp - int $0x1b - jc error_hdd - - push %ax - mov %es, %ax - add $0x40, %ax - mov %ax, %es - pop %ax - push %es - push %bp - lret - - # fdd -fdd: - xor %di, %di -fdd_retry: - mov $0xd6, %ah - mov $0x3000, %bx - mov %bx, %es - mov $0x2000, %bx - mov $0x0200, %cx - mov $0x0001, %dx - xor %bp, %bp - int $0x1b - jc error - push %ax - mov %es, %ax - add $0x40, %ax - mov %ax, %es - pop %ax - push %es - push %bp - lret - -error: - or %di, %di - jnz error_hdd - and $0x0f, %al - or $0x30, %al - jmp fdd_retry - -error_hdd: - jmp error - - .org 0x1fa - .byte 0 # defflag_off - .byte 0 # defpart_off - .byte 1 # menu version - .byte 0 - .word 0xaa55 diff --git a/sys/boot/pc98/boot2/Makefile b/sys/boot/pc98/boot2/Makefile deleted file mode 100644 index 2db0590964a2..000000000000 --- a/sys/boot/pc98/boot2/Makefile +++ /dev/null @@ -1,116 +0,0 @@ -# $FreeBSD$ - -.include - -FILES= boot boot1 boot2 - -NM?= nm - -BOOT_COMCONSOLE_PORT?= 0x238 -BOOT_COMCONSOLE_SPEED?= 9600 -B2SIOFMT?= 0x3 - -REL1= 0x700 -ORG1= 0 -ORG2= 0x2000 - -# Decide level of UFS support. -BOOT2_UFS?= UFS1_AND_UFS2 -#BOOT2_UFS?= UFS2_ONLY -#BOOT2_UFS?= UFS1_ONLY - -CFLAGS= -fomit-frame-pointer \ - -mrtd \ - -mregparm=3 \ - -D${BOOT2_UFS} \ - -DFLAGS=${BOOT_BOOT1_FLAGS} \ - -DSIOPRT=${BOOT_COMCONSOLE_PORT} \ - -DSIOFMT=${B2SIOFMT} \ - -DSIOSPD=${BOOT_COMCONSOLE_SPEED} \ - -I${.CURDIR}/../../.. \ - -I${.CURDIR}/../../i386/boot2 \ - -I${.CURDIR}/../../common \ - -I${.CURDIR}/../btx/lib -I. \ - -Wall -Waggregate-return -Wbad-function-cast -Wcast-align \ - -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ - -Wpointer-arith -Wshadow -Wstrict-prototypes -Wwrite-strings \ - -Winline - -CFLAGS.gcc+= -Os \ - -fno-guess-branch-probability \ - -fno-unit-at-a-time \ - --param max-inline-insns-single=100 -.if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} <= 40201 -CFLAGS.gcc+= -mno-align-long-strings -.endif - -# Set machine type to PC98_SYSTEM_PARAMETER -#CFLAGS+= -DSET_MACHINE_TYPE - -# Initialize the bi_bios_geom using the BIOS geometry -#CFLAGS+= -DGET_BIOSGEOM - -CFLAGS.clang+= -Oz ${CLANG_OPT_SMALL} - -LD_FLAGS=${LD_FLAGS_BIN} - -# Pick up ../Makefile.inc early. -.include - -.PATH: ${.CURDIR}/../../i386/boot2 - -CLEANFILES= boot - -boot: boot1 boot2 - cat boot1 boot2 > boot - -CLEANFILES+= boot1 boot1.out boot1.o - -boot1: boot1.out - ${OBJCOPY} -S -O binary boot1.out ${.TARGET} - -boot1.out: boot1.o - ${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o ${.TARGET} boot1.o - -CLEANFILES+= boot2 boot2.ld boot2.ldr boot2.bin boot2.out boot2.o \ - boot2.s boot2.s.tmp boot2.h sio.o - -boot2: boot2.ld - @set -- `ls -l boot2.ld`; x=$$((7680-$$5)); \ - echo "$$x bytes available"; test $$x -ge 0 - ${DD} if=boot2.ld of=${.TARGET} obs=7680 conv=osync - -boot2.ld: boot2.ldr boot2.bin ${BTXKERN} - btxld -v -E ${ORG2} -f bin -b ${BTXKERN} -l boot2.ldr \ - -o ${.TARGET} -P 1 boot2.bin - -boot2.ldr: - ${DD} if=/dev/zero of=${.TARGET} bs=276 count=1 - -boot2.bin: boot2.out - ${OBJCOPY} -S -O binary boot2.out ${.TARGET} - -boot2.out: ${BTXCRT} boot2.o sio.o - ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o ${.TARGET} ${.ALLSRC} - -boot2.o: boot2.s - ${CC} ${ACFLAGS} -c boot2.s - -SRCS= boot2.c boot2.h - -boot2.s: boot2.c boot2.h ${.CURDIR}/../../common/ufsread.c - ${CC} ${CFLAGS} -S -o boot2.s.tmp ${.CURDIR}/boot2.c - sed -e '/align/d' -e '/nop/d' < boot2.s.tmp > boot2.s - rm -f boot2.s.tmp - -boot2.h: boot1.out - ${NM} -t d ${.ALLSRC} | awk '/([0-9])+ T (read|putc)/ \ - { x = $$1 - ORG1; \ - printf("#define %sORG %#x\n", toupper($$3), REL1 + x) }' \ - ORG1=`printf "%d" ${ORG1}` \ - REL1=`printf "%d" ${REL1}` > ${.TARGET} - -.include - -# XXX: clang integrated-as doesn't grok .codeNN directives yet -CFLAGS.boot1.S= ${CLANG_NO_IAS} diff --git a/sys/boot/pc98/boot2/boot1.S b/sys/boot/pc98/boot2/boot1.S deleted file mode 100644 index 5c972061d07c..000000000000 --- a/sys/boot/pc98/boot2/boot1.S +++ /dev/null @@ -1,395 +0,0 @@ -/*- - * Copyright (c) 2008-2009 TAKAHASHI Yoshihiro - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -/* Memory Locations */ - .set STACK_OFF,0x6000 # Stack offset - .set LOAD_SIZE,8192 # Load size - .set DAUA,0x0584 # DA/UA - .set MEM_REL,0x700 # Relocation address - .set MEM_ARG,0x900 # Arguments - .set MEM_BUF,0x8cec # Load area - .set MEM_BTX,0x9000 # BTX start - .set MEM_JMP,0x9010 # BTX entry point - .set MEM_USR,0xa000 # Client start - -/* PC98 machine type from sys/pc98/pc98/pc98_machdep.h */ - .set MEM_SYS, 0xa100 # System common area segment - .set PC98_MACHINE_TYPE, 0x0620 # PC98 machine type - .set EPSON_ID, 0x0624 # EPSON machine id - - .set M_NEC_PC98, 0x0001 - .set M_EPSON_PC98, 0x0002 - .set M_NOT_H98, 0x0010 - .set M_H98, 0x0020 - .set M_NOTE, 0x0040 - .set M_NORMAL, 0x1000 - .set M_8M, 0x8000 - -/* Partition Constants */ - .set PRT_OFF,0x1be # Partition offset - -/* Misc. Constants */ - .set SIZ_PAG,0x1000 # Page size - .set SIZ_SEC,0x200 # Sector size - - .set NSECT,0x10 - - .globl start - .globl read - .globl putc - .code16 - -start: jmp main - -boot_cyl: .org 4 - .ascii "IPL1 " - -main: cld - - /* Setup the stack */ - xor %si,%si - mov %si,%ss - mov $STACK_OFF,%sp - - push %cx - - /* Relocate ourself to MEM_REL */ - push %cs - pop %ds - mov %si,%es - mov $MEM_REL,%di - mov $SIZ_SEC,%cx - rep - movsb - - /* Transfer PC-9801 system common area */ - xor %ax,%ax - mov %ax,%si - mov %ax,%ds - mov %ax,%di - mov $MEM_SYS,%ax - mov %ax,%es - mov $0x0600,%cx - rep - movsb - - /* Transfer EPSON machine type */ - mov $0xfd00,%ax - mov %ax,%ds - mov (0x804),%eax - and $0x00ffffff,%eax - mov %eax,%es:(EPSON_ID) - - /* Set machine type to PC98_SYSTEM_PARAMETER */ -#ifdef SET_MACHINE_TYPE - call set_machine_type -#else - mov $M_NEC_PC98+M_NOT_H98,%eax - mov %eax,%es:(PC98_MACHINE_TYPE) -#endif - - /* Setup graphic screen */ - mov $0x42,%ah /* 640x400 */ - mov $0xc0,%ch - int $0x18 - mov $0x40,%ah /* graph on */ - int $0x18 - - /* Setup text screen */ - mov $0x0a00,%ax /* 80x25 */ - int $0x18 - mov $0x0c,%ah /* text on */ - int $0x18 - mov $0x13,%ah /* cursor home */ - xor %dx,%dx - int $0x18 - mov $0x11,%ah /* cursor on */ - int $0x18 - - /* Setup keyboard */ - mov $0x03,%ah - int $0x18 - - pop %cx - - /* bootstrap passes */ - xor %edi,%edi - mov %di,%ds - mov %di,%es - mov %cs,%bx - cmp $0x1fe0,%bx - jz boot_fd - cmp $0x1fc0,%bx - jnz boot_hd - xor %cx,%cx - mov (DAUA),%al - and $0xf0,%al - cmp $0x30,%al - jz boot_fd - cmp $0x90,%al - jnz boot_hd -boot_fd: xor %cx,%cx - jmp boot_load -boot_hd: test %cx,%cx - jnz boot_load - mov %cs:(boot_cyl),%cx -boot_load: mov %cx,MEM_ARG /* Save cylinder number */ - mov %cx,%di - xor %dx,%dx - mov $LOAD_SIZE,%bx - mov $MEM_BUF,%bp - push %cs - callw read - jc error - - /* Transfer boot2.bin */ - mov $MEM_BTX,%bx - mov 0xa(%bx),%si /* BTX size */ - add %bx,%si /* start of boot2.bin */ - mov $MEM_USR+SIZ_PAG*2,%di - mov $MEM_BTX+(NSECT-1)*SIZ_SEC,%cx - sub %si,%cx - rep - movsb - - /* Enable A20 */ - xor %ax,%ax - outb %al,$0xf2 - mov $0x02,%al - outb %al,$0xf6 - - /* Start BTX */ - ljmp $0x0000,$MEM_JMP - -/* - * Reads sectors from the disk. - * Call with: - * - * %bx - bytes to read - * %cx - cylinder - * %dh - head - * %dl - sector - * %edi - lba - * %es:(%bp) - buffer to read data into - */ -read: xor %ax,%ax - mov %ax,%ds - mov $0x06,%ah - mov (DAUA),%al - mov %ax,%si - and $0xf0,%al - cmp $0x30,%al /* 1.44MB FDD */ - jz read_fd - cmp $0x90,%al /* 1MB FDD */ - jz read_fd - cmp $0xa0,%al /* Is SCSI device? */ - jnz read_load - push %cx - mov %si,%cx - and $0x0f,%cl - inc %cl - mov (0x482),%ah - shr %cl,%ah /* Is SCSI HDD? */ - pop %cx - jc read_load - and $0xff7f,%si /* SCSI MO */ - mov %di,%cx - shr $16,%edi - mov %di,%dx - jmp read_load -read_fd: or $0xd000,%si - or $0x0200,%cx - inc %dx -read_load: mov %si,%ax - int $0x1b - lret - -/* - * Print out the error message, wait for a keypress, and then reboot - * the machine. - */ -error: push %cs - pop %ds - mov $msg_eread,%si - call putstr - xor %ax,%ax /* Get keypress */ - int $0x18 - xor %ax,%ax /* CPU reset */ - outb %al,$0xf0 -halt: hlt - jmp halt /* Spin */ - -/* - * Display a null-terminated string. - */ -putstr.0: push %cs - callw putc -putstr: lodsb - test %al,%al - jne putstr.0 - ret - -/* - * Display a single char. - */ -putc: pusha - xor %dx,%dx - mov %dx,%ds - mov MEM_REL+cursor-start,%di - mov $0xa000,%bx - mov %bx,%es - mov $(80*2),%cx - - cmp $0x08,%al - je putc.bs - cmp $0x0d,%al - je putc.cr - cmp $0x0a,%al - je putc.lf - cmp $0x5c,%al /* \ */ - jne 1f - mov $0xfc,%al -1: movb $0xe1,%es:0x2000(%di) - stosw - jmp putc.scr -putc.bs: test %di,%di - jz putc.move - dec %di - dec %di - movb $0xe1,%es:0x2000(%di) - movw $0x20,%es:(%di) - jmp putc.move -putc.cr: mov %di,%ax - div %cx - sub %dx,%di - jmp putc.move -putc.lf: add %cx,%di -putc.scr: cmp $(80*2*25),%di /* Scroll screen */ - jb putc.move - push %ds - mov %bx,%ds - mov $(80*2),%si - xor %di,%di - mov $(80*24/2),%cx - rep - movsl - xor %ax,%ax - mov $0x20,%al - mov $80,%cl - rep - stosw - pop %ds - mov $(80*24*2),%di -putc.move: mov %di,MEM_REL+cursor-start /* Move cursor */ - mov $0x13,%ah - mov %di,%dx - int $0x18 - popa - lret - -cursor: .word 0 - -#ifdef SET_MACHINE_TYPE -/* - * Set machine type to PC98_SYSTEM_PARAMETER. - */ -set_machine_type: - xor %edx,%edx - mov %dx,%ds -// mov $MEM_SYS,%ax -// mov %ax,%es - - /* Wait V-SYNC */ -vsync.1: inb $0x60,%al - test $0x20,%al - jnz vsync.1 -vsync.2: inb $0x60,%al - test $0x20,%al - jz vsync.2 - - /* ANK 'A' font */ - xor %al,%al - outb %al,$0xa1 - mov $0x41,%al - outb %al,$0xa3 - - /* Get 'A' font from CG window */ - push %ds - mov $0xa400,%ax - mov %ax,%ds - xor %eax,%eax - xor %bx,%bx - mov $4,%cx -font.1: add (%bx),%eax - add $4,%bx - loop font.1 - pop %ds - cmp $0x6efc58fc,%eax - jnz m_epson - -m_pc98: or $M_NEC_PC98,%edx - mov $0x0458,%bx - mov (%bx),%al - test $0x80,%al - jz m_not_h98 - or $M_H98,%edx - jmp 1f -m_epson: or $M_EPSON_PC98,%edx -m_not_h98: or $M_NOT_H98,%edx - -1: inb $0x42,%al - test $0x20,%al - jz 1f - or $M_8M,%edx - -1: mov $0x0400,%bx - mov (%bx),%al - test $0x80,%al - jz 1f - or $M_NOTE,%edx - -1: mov $PC98_MACHINE_TYPE,%bx - mov %edx,%es:(%bx) - ret -#endif - -/* Messages */ - -msg_eread: .asciz "Error\r\n" - - .org PRT_OFF,0x90 - -/* Partition table */ - - .fill 0x30,0x1,0x0 - .byte 0x80, 0x00, 0x01, 0x00 - .byte 0xa5, 0xff, 0xff, 0xff - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x50, 0xc3, 0x00, 0x00 - - .word 0xaa55 # Magic number diff --git a/sys/boot/pc98/boot2/boot2.c b/sys/boot/pc98/boot2/boot2.c deleted file mode 100644 index b5825168d84e..000000000000 --- a/sys/boot/pc98/boot2/boot2.c +++ /dev/null @@ -1,803 +0,0 @@ -/*- - * Copyright (c) 2008-2009 TAKAHASHI Yoshihiro - * Copyright (c) 1998 Robert Nordier - * All rights reserved. - * - * Redistribution and use in source and binary forms are freely - * permitted provided that the above copyright notice and this - * paragraph and the following disclaimer are duplicated in all - * such forms. - * - * This software is provided "AS IS" and without any express or - * implied warranties, including, without limitation, the implied - * warranties of merchantability and fitness for a particular - * purpose. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include - -#include - -#include "boot2.h" -#include "lib.h" -#include "paths.h" -#include "rbx.h" - -/* Define to 0 to omit serial support */ -#ifndef SERIAL -#define SERIAL 0 -#endif - -#define IO_KEYBOARD 1 -#define IO_SERIAL 2 - -#if SERIAL -#define DO_KBD (ioctrl & IO_KEYBOARD) -#define DO_SIO (ioctrl & IO_SERIAL) -#else -#define DO_KBD (1) -#define DO_SIO (0) -#endif - -#define SECOND 1 /* Circa that many ticks in a second. */ - -#define ARGS 0x900 -#define NOPT 14 -#define NDEV 3 - -#define DRV_DISK 0xf0 -#define DRV_UNIT 0x0f - -#define TYPE_AD 0 -#define TYPE_DA 1 -#define TYPE_FD 2 - -extern uint32_t _end; - -static const char optstr[NOPT] = "DhaCcdgmnpqrsv"; /* Also 'P', 'S' */ -static const unsigned char flags[NOPT] = { - RBX_DUAL, - RBX_SERIAL, - RBX_ASKNAME, - RBX_CDROM, - RBX_CONFIG, - RBX_KDB, - RBX_GDB, - RBX_MUTE, - RBX_NOINTR, - RBX_PAUSE, - RBX_QUIET, - RBX_DFLTROOT, - RBX_SINGLE, - RBX_VERBOSE -}; - -static const char *const dev_nm[NDEV] = {"ad", "da", "fd"}; -static const unsigned char dev_maj[NDEV] = {30, 4, 2}; -static const unsigned char dev_daua[NDEV] = {0x80, 0xa0, 0x90}; - -static struct dsk { - unsigned daua; - unsigned type; - unsigned disk; - unsigned unit; - unsigned head; - unsigned sec; - uint8_t slice; - uint8_t part; - unsigned start; -} dsk; -static char cmd[512], cmddup[512], knamebuf[1024]; -static const char *kname; -uint32_t opts; -static struct bootinfo bootinfo; -#if SERIAL -static int comspeed = SIOSPD; -static uint8_t ioctrl = IO_KEYBOARD; -#endif - -int main(void); -void exit(int); -static void load(void); -static int parse(void); -static int dskread(void *, unsigned, unsigned); -static void printf(const char *,...); -static void putchar(int); -static int drvread(void *, unsigned); -static int keyhit(unsigned); -static int xputc(int); -static int xgetc(int); -static inline int getc(int); - -static void memcpy(void *, const void *, int); -static void -memcpy(void *dst, const void *src, int len) -{ - const char *s = src; - char *d = dst; - - while (len--) - *d++ = *s++; -} - -static inline int -strcmp(const char *s1, const char *s2) -{ - for (; *s1 == *s2 && *s1; s1++, s2++); - return (unsigned char)*s1 - (unsigned char)*s2; -} - -#define UFS_SMALL_CGBASE -#include "ufsread.c" - -static inline int -xfsread(ufs_ino_t inode, void *buf, size_t nbyte) -{ - if ((size_t)fsread(inode, buf, nbyte) != nbyte) { - printf("Invalid %s\n", "format"); - return -1; - } - return 0; -} - -static inline void -getstr(void) -{ - char *s; - int c; - - s = cmd; - for (;;) { - switch (c = xgetc(0)) { - case 0: - break; - case '\177': - case '\b': - if (s > cmd) { - s--; - printf("\b \b"); - } - break; - case '\n': - case '\r': - *s = 0; - return; - default: - if (s - cmd < sizeof(cmd) - 1) - *s++ = c; - putchar(c); - } - } -} - -static inline void -putc(int c) -{ - - v86.ctl = V86_ADDR | V86_CALLF | V86_FLAGS; - v86.addr = PUTCORG; /* call to putc in boot1 */ - v86.eax = c; - v86int(); - v86.ctl = V86_FLAGS; -} - -static inline int -is_scsi_hd(void) -{ - - if ((*(u_char *)PTOV(0x482) >> dsk.unit) & 0x01) - return 1; - - return 0; -} - -static inline void -fix_sector_size(void) -{ - u_char *p; - - p = (u_char *)PTOV(0x460 + dsk.unit * 4); /* SCSI equipment parameter */ - - if ((p[0] & 0x1f) == 7) { /* SCSI MO */ - if (!(p[3] & 0x30)) { /* 256B / sector */ - p[3] |= 0x10; /* forced set 512B / sector */ - p[3 + 0xa1000] |= 0x10; - } - } -} - -static inline uint32_t -get_diskinfo(void) -{ - - if (dsk.disk == 0x30) { /* 1440KB FD */ - /* 80 cylinders, 2 heads, 18 sectors */ - return (80 << 16) | (2 << 8) | 18; - } else if (dsk.disk == 0x90) { /* 1200KB FD */ - /* 80 cylinders, 2 heads, 15 sectors */ - return (80 << 16) | (2 << 8) | 15; - } else if (dsk.disk == 0x80 || is_scsi_hd()) { /* IDE or SCSI HDD */ - v86.addr = 0x1b; - v86.eax = 0x8400 | dsk.daua; - v86int(); - return (v86.ecx << 16) | v86.edx; - } - - /* SCSI MO or CD */ - fix_sector_size(); /* SCSI MO */ - - /* other SCSI devices */ - return (65535 << 16) | (8 << 8) | 32; -} - -static void -set_dsk(void) -{ - uint32_t di; - - di = get_diskinfo(); - - dsk.head = (di >> 8) & 0xff; - dsk.sec = di & 0xff; - dsk.start = 0; -} - -#ifdef GET_BIOSGEOM -static uint32_t -bd_getbigeom(int bunit) -{ - int hds = 0; - int unit = 0x80; /* IDE HDD */ - u_int addr = 0x55d; - - while (unit < 0xa7) { - if (*(u_char *)PTOV(addr) & (1 << (unit & 0x0f))) - if (hds++ == bunit) - break; - - if (unit >= 0xA0) { - int media = ((unsigned *)PTOV(0x460))[unit & 0x0F] & 0x1F; - - if (media == 7 && hds++ == bunit) /* SCSI MO */ - return(0xFFFE0820); /* C:65535 H:8 S:32 */ - } - if (++unit == 0x84) { - unit = 0xA0; /* SCSI HDD */ - addr = 0x482; - } - } - if (unit == 0xa7) - return 0x4F020F; /* 1200KB FD C:80 H:2 S:15 */ - v86.addr = 0x1b; - v86.eax = 0x8400 | unit; - v86int(); - if (V86_CY(v86.efl)) - return 0x4F020F; /* 1200KB FD C:80 H:2 S:15 */ - return ((v86.ecx & 0xffff) << 16) | (v86.edx & 0xffff); -} -#endif - -static int -check_slice(void) -{ - struct pc98_partition *dp; - char *sec; - unsigned i, cyl; - - sec = dmadat->secbuf; - cyl = *(uint16_t *)PTOV(ARGS); - set_dsk(); - - if (dsk.type == TYPE_FD) - return (WHOLE_DISK_SLICE); - if (drvread(sec, PC98_BBSECTOR)) - return (WHOLE_DISK_SLICE); /* Read error */ - dp = (void *)(sec + PC98_PARTOFF); - for (i = 0; i < PC98_NPARTS; i++) { - if (dp[i].dp_mid == DOSMID_386BSD) { - if (dp[i].dp_scyl <= cyl && cyl <= dp[i].dp_ecyl) - return (BASE_SLICE + i); - } - } - - return (WHOLE_DISK_SLICE); -} - -int -main(void) -{ -#ifdef GET_BIOSGEOM - int i; -#endif - uint8_t autoboot; - ufs_ino_t ino; - size_t nbyte; - - dmadat = (void *)(roundup2(__base + (int32_t)&_end, 0x10000) - __base); - v86.ctl = V86_FLAGS; - v86.efl = PSL_RESERVED_DEFAULT | PSL_I; - dsk.daua = *(uint8_t *)PTOV(0x584); - dsk.disk = dsk.daua & DRV_DISK; - dsk.unit = dsk.daua & DRV_UNIT; - if (dsk.disk == 0x80) - dsk.type = TYPE_AD; - else if (dsk.disk == 0xa0) - dsk.type = TYPE_DA; - else /* if (dsk.disk == 0x30 || dsk.disk == 0x90) */ - dsk.type = TYPE_FD; - dsk.slice = check_slice(); -#ifdef GET_BIOSGEOM - for (i = 0; i < N_BIOS_GEOM; i++) - bootinfo.bi_bios_geom[i] = bd_getbigeom(i); -#endif - bootinfo.bi_version = BOOTINFO_VERSION; - bootinfo.bi_size = sizeof(bootinfo); - - /* Process configuration file */ - - autoboot = 1; - - if ((ino = lookup(PATH_CONFIG)) || - (ino = lookup(PATH_DOTCONFIG))) { - nbyte = fsread(ino, cmd, sizeof(cmd) - 1); - cmd[nbyte] = '\0'; - } - - if (*cmd) { - memcpy(cmddup, cmd, sizeof(cmd)); - if (parse()) - autoboot = 0; - if (!OPT_CHECK(RBX_QUIET)) - printf("%s: %s", PATH_CONFIG, cmddup); - /* Do not process this command twice */ - *cmd = 0; - } - - /* - * Try to exec stage 3 boot loader. If interrupted by a keypress, - * or in case of failure, try to load a kernel directly instead. - */ - - if (!kname) { - kname = PATH_LOADER; - if (autoboot && !keyhit(3*SECOND)) { - load(); - kname = PATH_KERNEL; - } - } - - /* Present the user with the boot2 prompt. */ - - for (;;) { - if (!autoboot || !OPT_CHECK(RBX_QUIET)) - printf("\nFreeBSD/pc98 boot\n" - "Default: %u:%s(%u,%c)%s\n" - "boot: ", - dsk.unit, dev_nm[dsk.type], dsk.unit, - 'a' + dsk.part, kname); - if (DO_SIO) - sio_flush(); - if (!autoboot || keyhit(3*SECOND)) - getstr(); - else if (!autoboot || !OPT_CHECK(RBX_QUIET)) - putchar('\n'); - autoboot = 0; - if (parse()) - putchar('\a'); - else - load(); - } -} - -/* XXX - Needed for btxld to link the boot2 binary; do not remove. */ -void -exit(int x) -{ -} - -static void -load(void) -{ - union { - struct exec ex; - Elf32_Ehdr eh; - } hdr; - static Elf32_Phdr ep[2]; - static Elf32_Shdr es[2]; - caddr_t p; - ufs_ino_t ino; - uint32_t addr; - int k; - uint8_t i, j; - - if (!(ino = lookup(kname))) { - if (!ls) - printf("No %s\n", kname); - return; - } - if (xfsread(ino, &hdr, sizeof(hdr))) - return; - - if (N_GETMAGIC(hdr.ex) == ZMAGIC) { - addr = hdr.ex.a_entry & 0xffffff; - p = PTOV(addr); - fs_off = PAGE_SIZE; - if (xfsread(ino, p, hdr.ex.a_text)) - return; - p += roundup2(hdr.ex.a_text, PAGE_SIZE); - if (xfsread(ino, p, hdr.ex.a_data)) - return; - } else if (IS_ELF(hdr.eh)) { - fs_off = hdr.eh.e_phoff; - for (j = k = 0; k < hdr.eh.e_phnum && j < 2; k++) { - if (xfsread(ino, ep + j, sizeof(ep[0]))) - return; - if (ep[j].p_type == PT_LOAD) - j++; - } - for (i = 0; i < 2; i++) { - p = PTOV(ep[i].p_paddr & 0xffffff); - fs_off = ep[i].p_offset; - if (xfsread(ino, p, ep[i].p_filesz)) - return; - } - p += roundup2(ep[1].p_memsz, PAGE_SIZE); - bootinfo.bi_symtab = VTOP(p); - if (hdr.eh.e_shnum == hdr.eh.e_shstrndx + 3) { - fs_off = hdr.eh.e_shoff + sizeof(es[0]) * - (hdr.eh.e_shstrndx + 1); - if (xfsread(ino, &es, sizeof(es))) - return; - for (i = 0; i < 2; i++) { - *(Elf32_Word *)p = es[i].sh_size; - p += sizeof(es[i].sh_size); - fs_off = es[i].sh_offset; - if (xfsread(ino, p, es[i].sh_size)) - return; - p += es[i].sh_size; - } - } - addr = hdr.eh.e_entry & 0xffffff; - bootinfo.bi_esymtab = VTOP(p); - } else { - printf("Invalid %s\n", "format"); - return; - } - - bootinfo.bi_kernelname = VTOP(kname); - bootinfo.bi_bios_dev = dsk.daua; - __exec((caddr_t)addr, RB_BOOTINFO | (opts & RBX_MASK), - MAKEBOOTDEV(dev_maj[dsk.type], dsk.slice, dsk.unit, dsk.part), - 0, 0, 0, VTOP(&bootinfo)); -} - -static int -parse() -{ - char *arg = cmd; - char *ep, *p, *q; - const char *cp; - unsigned int drv; - int c, i, j; - size_t k; - - while ((c = *arg++)) { - if (c == ' ' || c == '\t' || c == '\n') - continue; - for (p = arg; *p && *p != '\n' && *p != ' ' && *p != '\t'; p++); - ep = p; - if (*p) - *p++ = 0; - if (c == '-') { - while ((c = *arg++)) { - if (c == 'P') { - if (*(uint8_t *)PTOV(0x481) & 0x48) { - cp = "yes"; - } else { - opts |= OPT_SET(RBX_DUAL) | OPT_SET(RBX_SERIAL); - cp = "no"; - } - printf("Keyboard: %s\n", cp); - continue; -#if SERIAL - } else if (c == 'S') { - j = 0; - while ((unsigned int)(i = *arg++ - '0') <= 9) - j = j * 10 + i; - if (j > 0 && i == -'0') { - comspeed = j; - break; - } - /* Fall through to error below ('S' not in optstr[]). */ -#endif - } - for (i = 0; c != optstr[i]; i++) - if (i == NOPT - 1) - return -1; - opts ^= OPT_SET(flags[i]); - } -#if SERIAL - ioctrl = OPT_CHECK(RBX_DUAL) ? (IO_SERIAL|IO_KEYBOARD) : - OPT_CHECK(RBX_SERIAL) ? IO_SERIAL : IO_KEYBOARD; - if (DO_SIO) { - if (sio_init(115200 / comspeed) != 0) - ioctrl &= ~IO_SERIAL; - } -#endif - } else { - for (q = arg--; *q && *q != '('; q++); - if (*q) { - drv = -1; - if (arg[1] == ':') { - drv = *arg - '0'; - if (drv > 9) - return (-1); - arg += 2; - } - if (q - arg != 2) - return -1; - for (i = 0; arg[0] != dev_nm[i][0] || - arg[1] != dev_nm[i][1]; i++) - if (i == NDEV - 1) - return -1; - dsk.type = i; - arg += 3; - dsk.unit = *arg - '0'; - if (arg[1] != ',' || dsk.unit > 9) - return -1; - arg += 2; - dsk.slice = WHOLE_DISK_SLICE; - if (arg[1] == ',') { - dsk.slice = *arg - '0' + 1; - if (dsk.slice > PC98_NPARTS + 1) - return -1; - arg += 2; - } - if (arg[1] != ')') - return -1; - dsk.part = *arg - 'a'; - if (dsk.part > 7) - return (-1); - arg += 2; - if (drv == -1) - drv = dsk.unit; - dsk.disk = dev_daua[dsk.type]; - dsk.daua = dsk.disk | dsk.unit; - dsk_meta = 0; - } - k = ep - arg; - if (k > 0) { - if (k >= sizeof(knamebuf)) - return -1; - memcpy(knamebuf, arg, k + 1); - kname = knamebuf; - } - } - arg = p; - } - return 0; -} - -static int -dskread(void *buf, unsigned lba, unsigned nblk) -{ - struct pc98_partition *dp; - struct disklabel *d; - char *sec; - unsigned i; - uint8_t sl; - u_char *p; - const char *reason; - - if (!dsk_meta) { - sec = dmadat->secbuf; - set_dsk(); - if (dsk.type == TYPE_FD) - goto unsliced; - if (drvread(sec, PC98_BBSECTOR)) - return -1; - dp = (void *)(sec + PC98_PARTOFF); - sl = dsk.slice; - if (sl < BASE_SLICE) { - for (i = 0; i < PC98_NPARTS; i++) - if (dp[i].dp_mid == DOSMID_386BSD) { - sl = BASE_SLICE + i; - break; - } - dsk.slice = sl; - } - if (sl != WHOLE_DISK_SLICE) { - dp += sl - BASE_SLICE; - if (dp->dp_mid != DOSMID_386BSD) { - reason = "slice"; - goto error; - } - dsk.start = dp->dp_scyl * dsk.head * dsk.sec + - dp->dp_shd * dsk.sec + dp->dp_ssect; - } - if (drvread(sec, dsk.start + LABELSECTOR)) - return -1; - d = (void *)(sec + LABELOFFSET); - if (d->d_magic != DISKMAGIC || d->d_magic2 != DISKMAGIC) { - if (dsk.part != RAW_PART) { - reason = "label"; - goto error; - } - } else { - if (dsk.part >= d->d_npartitions || - !d->d_partitions[dsk.part].p_size) { - reason = "partition"; - goto error; - } - dsk.start += d->d_partitions[dsk.part].p_offset; - dsk.start -= d->d_partitions[RAW_PART].p_offset; - } - unsliced: ; - } - for (p = buf; nblk; p += 512, lba++, nblk--) { - if ((i = drvread(p, dsk.start + lba))) - return i; - } - return 0; -error: - printf("Invalid %s\n", reason); - return -1; -} - -static void -printf(const char *fmt,...) -{ - va_list ap; - static char buf[10]; - char *s; - unsigned u; - int c; - - va_start(ap, fmt); - while ((c = *fmt++)) { - if (c == '%') { - c = *fmt++; - switch (c) { - case 'c': - putchar(va_arg(ap, int)); - continue; - case 's': - for (s = va_arg(ap, char *); *s; s++) - putchar(*s); - continue; - case 'u': - u = va_arg(ap, unsigned); - s = buf; - do - *s++ = '0' + u % 10U; - while (u /= 10U); - while (--s >= buf) - putchar(*s); - continue; - } - } - putchar(c); - } - va_end(ap); - return; -} - -static void -putchar(int c) -{ - if (c == '\n') - xputc('\r'); - xputc(c); -} - -static int -drvread(void *buf, unsigned lba) -{ - static unsigned c = 0x2d5c7c2f; - unsigned bpc, x, cyl, head, sec; - - bpc = dsk.sec * dsk.head; - cyl = lba / bpc; - x = lba % bpc; - head = x / dsk.sec; - sec = x % dsk.sec; - - if (!OPT_CHECK(RBX_QUIET)) { - xputc(c = c << 8 | c >> 24); - xputc('\b'); - } - v86.ctl = V86_ADDR | V86_CALLF | V86_FLAGS; - v86.addr = READORG; /* call to read in boot1 */ - v86.ecx = cyl; - v86.edx = (head << 8) | sec; - v86.edi = lba; - v86.ebx = 512; - v86.es = VTOPSEG(buf); - v86.ebp = VTOPOFF(buf); - v86int(); - v86.ctl = V86_FLAGS; - if (V86_CY(v86.efl)) { - printf("error %u c/h/s %u/%u/%u lba %u\n", v86.eax >> 8 & 0xff, - cyl, head, sec, lba); - return -1; - } - return 0; -} - -static inline void -delay(void) -{ - int i; - - i = 800; - do { - outb(0x5f, 0); /* about 600ns */ - } while (--i >= 0); -} - -static int -keyhit(unsigned sec) -{ - unsigned i; - - if (OPT_CHECK(RBX_NOINTR)) - return 0; - for (i = 0; i < sec * 1000; i++) { - if (xgetc(1)) - return 1; - delay(); - } - return 0; -} - -static int -xputc(int c) -{ - if (DO_KBD) - putc(c); - if (DO_SIO) - sio_putc(c); - return c; -} - -static int -getc(int fn) -{ - v86.addr = 0x18; - v86.eax = fn << 8; - v86int(); - if (fn) - return (v86.ebx >> 8) & 0x01; - else - return v86.eax & 0xff; -} - -static int -xgetc(int fn) -{ - if (OPT_CHECK(RBX_NOINTR)) - return 0; - for (;;) { - if (DO_KBD && getc(1)) - return fn ? 1 : getc(0); - if (DO_SIO && sio_ischar()) - return fn ? 1 : sio_getc(); - if (fn) - return 0; - } -} diff --git a/sys/boot/pc98/btx/Makefile b/sys/boot/pc98/btx/Makefile deleted file mode 100644 index 39f78ed639b9..000000000000 --- a/sys/boot/pc98/btx/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD$ - -SUBDIR= btx btxldr lib - -.include diff --git a/sys/boot/pc98/btx/Makefile.inc b/sys/boot/pc98/btx/Makefile.inc deleted file mode 100644 index 265f86d1ed55..000000000000 --- a/sys/boot/pc98/btx/Makefile.inc +++ /dev/null @@ -1,3 +0,0 @@ -# $FreeBSD$ - -.include "../Makefile.inc" diff --git a/sys/boot/pc98/btx/btx/Makefile b/sys/boot/pc98/btx/btx/Makefile deleted file mode 100644 index 275546068286..000000000000 --- a/sys/boot/pc98/btx/btx/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -# $FreeBSD$ - -PROG= btx -INTERNALPROG= -MAN= -SRCS= btx.S - -.if defined(BOOT_BTX_NOHANG) -BOOT_BTX_FLAGS=0x1 -.else -BOOT_BTX_FLAGS=0x0 -.endif - -CFLAGS+=-DBTX_FLAGS=${BOOT_BTX_FLAGS} -CFLAGS+=-I${.CURDIR}/../../../i386/common - -.if defined(BTX_SERIAL) -BOOT_COMCONSOLE_PORT?= 0x238 -BOOT_COMCONSOLE_SPEED?= 9600 -B2SIOFMT?= 0x3 - -CFLAGS+=-DBTX_SERIAL -DSIOPRT=${BOOT_COMCONSOLE_PORT} \ - -DSIOFMT=${B2SIOFMT} -DSIOSPD=${BOOT_COMCONSOLE_SPEED} -.endif - -ORG= 0x9000 - -LDFLAGS=${LDFLAGS_BIN} - -.include - -# XXX: clang integrated-as doesn't grok .codeNN directives yet -CFLAGS.btx.S= ${CLANG_NO_IAS} diff --git a/sys/boot/pc98/btx/btx/btx.S b/sys/boot/pc98/btx/btx/btx.S deleted file mode 100644 index e8710d38584a..000000000000 --- a/sys/boot/pc98/btx/btx/btx.S +++ /dev/null @@ -1,1104 +0,0 @@ -/* - * Copyright (c) 1998 Robert Nordier - * All rights reserved. - * - * Redistribution and use in source and binary forms are freely - * permitted provided that the above copyright notice and this - * paragraph and the following disclaimer are duplicated in all - * such forms. - * - * This software is provided "AS IS" and without any express or - * implied warranties, including, without limitation, the implied - * warranties of merchantability and fitness for a particular - * purpose. - * - * $FreeBSD$ - */ - -#include - -/* - * Memory layout. - */ - .set MEM_BTX,0x1000 # Start of BTX memory - .set MEM_ESP0,0x1800 # Supervisor stack - .set MEM_BUF,0x1800 # Scratch buffer - .set MEM_ESPR,0x5e00 # Real mode stack - .set MEM_IDT,0x5e00 # IDT - .set MEM_TSS,0x5f98 # TSS - .set MEM_MAP,0x6000 # I/O bit map - .set MEM_TSS_END,0x7fff # End of TSS - .set MEM_ORG,0x9000 # BTX code - .set MEM_USR,0xa000 # Start of user memory -/* - * Paging control. - */ - .set PAG_SIZ,0x1000 # Page size - .set PAG_CNT,0x1000 # Pages to map -/* - * Fields in %eflags. - */ - .set PSL_RESERVED_DEFAULT,0x00000002 - .set PSL_T,0x00000100 # Trap flag - .set PSL_I,0x00000200 # Interrupt enable flag - .set PSL_VM,0x00020000 # Virtual 8086 mode flag - .set PSL_AC,0x00040000 # Alignment check flag -/* - * Segment selectors. - */ - .set SEL_SCODE,0x8 # Supervisor code - .set SEL_SDATA,0x10 # Supervisor data - .set SEL_RCODE,0x18 # Real mode code - .set SEL_RDATA,0x20 # Real mode data - .set SEL_UCODE,0x28|3 # User code - .set SEL_UDATA,0x30|3 # User data - .set SEL_TSS,0x38 # TSS -/* - * Task state segment fields. - */ - .set TSS_ESP0,0x4 # PL 0 ESP - .set TSS_SS0,0x8 # PL 0 SS - .set TSS_MAP,0x66 # I/O bit map base -/* - * System calls. - */ - .set SYS_EXIT,0x0 # Exit - .set SYS_EXEC,0x1 # Exec -/* - * Fields in V86 interface structure. - */ - .set V86_CTL,0x0 # Control flags - .set V86_ADDR,0x4 # Int number/address - .set V86_ES,0x8 # V86 ES - .set V86_DS,0xc # V86 DS - .set V86_FS,0x10 # V86 FS - .set V86_GS,0x14 # V86 GS -/* - * V86 control flags. - */ - .set V86F_ADDR,0x10000 # Segment:offset address - .set V86F_CALLF,0x20000 # Emulate far call - .set V86F_FLAGS,0x40000 # Return flags -/* - * Dump format control bytes. - */ - .set DMP_X16,0x1 # Word - .set DMP_X32,0x2 # Long - .set DMP_MEM,0x4 # Memory - .set DMP_EOL,0x8 # End of line -/* - * Screen defaults and assumptions. - */ - .set SCR_MAT,0xe1 # Mode/attribute - .set SCR_COL,0x50 # Columns per row - .set SCR_ROW,0x19 # Rows per screen -/* - * BIOS Data Area locations. - */ - .set BDA_MEM,0x501 # Free memory - .set BDA_POS,0x53e # Cursor position -/* - * Derivations, for brevity. - */ - .set _ESP0H,MEM_ESP0>>0x8 # Byte 1 of ESP0 - .set _TSSIO,MEM_MAP-MEM_TSS # TSS I/O base - .set _TSSLM,MEM_TSS_END-MEM_TSS # TSS limit - .set _IDTLM,MEM_TSS-MEM_IDT-1 # IDT limit -/* - * Code segment. - */ - .globl start - .code16 -start: # Start of code -/* - * BTX header. - */ -btx_hdr: .byte 0xeb # Machine ID - .byte 0xe # Header size - .ascii "BTX" # Magic - .byte 0x1 # Major version - .byte 0x2 # Minor version - .byte BTX_FLAGS # Flags - .word PAG_CNT-MEM_ORG>>0xc # Paging control - .word break-start # Text size - .long 0x0 # Entry address -/* - * Initialization routine. - */ -init: cli # Disable interrupts - xor %ax,%ax # Zero/segment - mov %ax,%ss # Set up - mov $MEM_ESP0,%sp # stack - mov %ax,%es # Address - mov %ax,%ds # data - pushl $0x2 # Clear - popfl # flags -/* - * Initialize memory. - */ - mov $MEM_IDT,%di # Memory to initialize - mov $(MEM_ORG-MEM_IDT)/2,%cx # Words to zero - rep # Zero-fill - stosw # memory -/* - * Update real mode IDT for reflecting hardware interrupts. - */ - mov $intr20,%bx # Address first handler - mov $0x10,%cx # Number of handlers - mov $0x20*4,%di # First real mode IDT entry -init.0: mov %bx,(%di) # Store IP - inc %di # Address next - inc %di # entry - stosw # Store CS - add $4,%bx # Next handler - loop init.0 # Next IRQ -/* - * Create IDT. - */ - mov $MEM_IDT,%di - mov $idtctl,%si # Control string -init.1: lodsb # Get entry - cbw # count - xchg %ax,%cx # as word - jcxz init.4 # If done - lodsb # Get segment - xchg %ax,%dx # P:DPL:type - lodsw # Get control - xchg %ax,%bx # set - lodsw # Get handler offset - mov $SEL_SCODE,%dh # Segment selector -init.2: shr %bx # Handle this int? - jnc init.3 # No - mov %ax,(%di) # Set handler offset - mov %dh,0x2(%di) # and selector - mov %dl,0x5(%di) # Set P:DPL:type - add $0x4,%ax # Next handler -init.3: lea 0x8(%di),%di # Next entry - loop init.2 # Till set done - jmp init.1 # Continue -/* - * Initialize TSS. - */ -init.4: movb $_ESP0H,TSS_ESP0+1(%di) # Set ESP0 - movb $SEL_SDATA,TSS_SS0(%di) # Set SS0 - movb $_TSSIO,TSS_MAP(%di) # Set I/O bit map base -/* - * Bring up the system. - */ - mov $0x2820,%bx # Set protected mode - callw setpic # IRQ offsets - lidt idtdesc # Set IDT - lgdt gdtdesc # Set GDT - mov %cr0,%eax # Switch to protected - inc %ax # mode - mov %eax,%cr0 # - ljmp $SEL_SCODE,$init.8 # To 32-bit code - .code32 -init.8: xorl %ecx,%ecx # Zero - movb $SEL_SDATA,%cl # To 32-bit - movw %cx,%ss # stack -/* - * Launch user task. - */ - movb $SEL_TSS,%cl # Set task - ltr %cx # register - movl $MEM_USR,%edx # User base address - movzwl %ss:BDA_MEM,%eax # Get free memory - andl $0x7,%eax - incl %eax - shll $0x11,%eax # To bytes - subl $ARGSPACE,%eax # Less arg space - subl %edx,%eax # Less base - movb $SEL_UDATA,%cl # User data selector - pushl %ecx # Set SS - pushl %eax # Set ESP - push $0x202 # Set flags (IF set) - push $SEL_UCODE # Set CS - pushl btx_hdr+0xc # Set EIP - pushl %ecx # Set GS - pushl %ecx # Set FS - pushl %ecx # Set DS - pushl %ecx # Set ES - pushl %edx # Set EAX - movb $0x7,%cl # Set remaining -init.9: push $0x0 # general - loop init.9 # registers -#ifdef BTX_SERIAL - call sio_init # setup the serial console -#endif - popa # and initialize - popl %es # Initialize - popl %ds # user - popl %fs # segment - popl %gs # registers - iret # To user mode -/* - * Exit routine. - */ -exit: cli # Disable interrupts - movl $MEM_ESP0,%esp # Clear stack -/* - * Turn off paging. - */ - movl %cr0,%eax # Get CR0 - andl $~0x80000000,%eax # Disable - movl %eax,%cr0 # paging - xorl %ecx,%ecx # Zero - movl %ecx,%cr3 # Flush TLB -/* - * Restore the GDT in case we caught a kernel trap. - */ - lgdt %cs:gdtdesc # Set GDT -/* - * To 16 bits. - */ - ljmpw $SEL_RCODE,$exit.1 # Reload CS - .code16 -exit.1: mov $SEL_RDATA,%cl # 16-bit selector - mov %cx,%ss # Reload SS - mov %cx,%ds # Load - mov %cx,%es # remaining - mov %cx,%fs # segment - mov %cx,%gs # registers -/* - * To real-address mode. - */ - dec %ax # Switch to - mov %eax,%cr0 # real mode - ljmp $0x0,$exit.2 # Reload CS -exit.2: xor %ax,%ax # Real mode segment - mov %ax,%ss # Reload SS - mov %ax,%ds # Address data - mov $0x1008,%bx # Set real mode - callw setpic # IRQ offsets - lidt ivtdesc # Set IVT -/* - * Reboot or await reset. - */ - sti # Enable interrupts - testb $0x1,btx_hdr+0x7 # Reboot? -exit.3: jz exit.3 # No - movb $0xa0,%al - outb %al,$0x35 - movb $0x00,%al - outb %al,$0xf0 # reboot the machine -exit.4: jmp exit.4 -/* - * Set IRQ offsets by reprogramming 8259A PICs. - */ -setpic: in $0x02,%al # Save master - push %ax # IMR - in $0x0a,%al # Save slave - push %ax # IMR - movb $0x11,%al # ICW1 to - outb %al,$0x00 # master, - outb %al,$0x08 # slave - movb %bl,%al # ICW2 to - outb %al,$0x02 # master - movb %bh,%al # ICW2 to - outb %al,$0x0a # slave - movb $0x80,%al # ICW3 to - outb %al,$0x02 # master - movb $0x7,%al # ICW3 to - outb %al,$0x0a # slave - movb $0x1d,%al # ICW4 to - outb %al,$0x02 # master, - movb $0x9,%al # ICW4 to - outb %al,$0x0a # slave - pop %ax # Restore slave - outb %al,$0x0a # IMR - pop %ax # Restore master - outb %al,$0x02 # IMR - retw # To caller - .code32 -/* - * Exception jump table. - */ -intx00: push $0x0 # Int 0x0: #DE - jmp ex_noc # Divide error - push $0x1 # Int 0x1: #DB - jmp ex_noc # Debug - push $0x3 # Int 0x3: #BP - jmp ex_noc # Breakpoint - push $0x4 # Int 0x4: #OF - jmp ex_noc # Overflow - push $0x5 # Int 0x5: #BR - jmp ex_noc # BOUND range exceeded - push $0x6 # Int 0x6: #UD - jmp ex_noc # Invalid opcode - push $0x7 # Int 0x7: #NM - jmp ex_noc # Device not available - push $0x8 # Int 0x8: #DF - jmp except # Double fault - push $0xa # Int 0xa: #TS - jmp except # Invalid TSS - push $0xb # Int 0xb: #NP - jmp except # Segment not present - push $0xc # Int 0xc: #SS - jmp except # Stack segment fault - push $0xd # Int 0xd: #GP - jmp except # General protection - push $0xe # Int 0xe: #PF - jmp except # Page fault -intx10: push $0x10 # Int 0x10: #MF - jmp ex_noc # Floating-point error -/* - * Save a zero error code. - */ -ex_noc: pushl (%esp,1) # Duplicate int no - movb $0x0,0x4(%esp,1) # Fake error code -/* - * Handle exception. - */ -except: cld # String ops inc - pushl %ds # Save - pushl %es # most - pusha # registers - pushl %gs # Set GS - pushl %fs # Set FS - pushl %ds # Set DS - pushl %es # Set ES - cmpw $SEL_SCODE,0x44(%esp,1) # Supervisor mode? - jne except.1 # No - pushl %ss # Set SS - jmp except.2 # Join common code -except.1: pushl 0x50(%esp,1) # Set SS -except.2: pushl 0x50(%esp,1) # Set ESP - push $SEL_SDATA # Set up - popl %ds # to - pushl %ds # address - popl %es # data - movl %esp,%ebx # Stack frame - movl $dmpfmt,%esi # Dump format string - movl $MEM_BUF,%edi # Buffer - pushl %eax - pushl %edx -wait.1: inb $0x60,%al - testb $0x04,%al - jz wait.1 - movb $0xe0,%al - outb %al,$0x62 -wait.2: inb $0x60,%al - testb $0x01,%al - jz wait.2 - xorl %edx,%edx - inb $0x62,%al - movb %al,%dl - inb $0x62,%al - movb %al,%dh - inb $0x62,%al - inb $0x62,%al - inb $0x62,%al - movl %edx,%eax - shlw $1,%ax - movl $BDA_POS,%edx - movw %ax,(%edx) - popl %edx - popl %eax - pushl %edi # Dump to - call dump # buffer - popl %esi # and - call putstr # display - leal 0x18(%esp,1),%esp # Discard frame - popa # Restore - popl %es # registers - popl %ds # saved - cmpb $0x3,(%esp,1) # Breakpoint? - je except.3 # Yes - cmpb $0x1,(%esp,1) # Debug? - jne except.2a # No - testl $PSL_T,0x10(%esp,1) # Trap flag set? - jnz except.3 # Yes -except.2a: jmp exit # Exit -except.3: leal 0x8(%esp,1),%esp # Discard err, int no - iret # From interrupt - -/* - * Reboot the machine by setting the reboot flag and exiting - */ -reboot: orb $0x1,btx_hdr+0x7 # Set the reboot flag - jmp exit # Terminate BTX and reboot - -/* - * Protected Mode Hardware interrupt jump table. - */ -intx20: push $0x8 # Int 0x20: IRQ0 - jmp int_hw # V86 int 0x8 - push $0x9 # Int 0x21: IRQ1 - jmp int_hw # V86 int 0x9 - push $0xa # Int 0x22: IRQ2 - jmp int_hw # V86 int 0xa - push $0xb # Int 0x23: IRQ3 - jmp int_hw # V86 int 0xb - push $0xc # Int 0x24: IRQ4 - jmp int_hw # V86 int 0xc - push $0xd # Int 0x25: IRQ5 - jmp int_hw # V86 int 0xd - push $0xe # Int 0x26: IRQ6 - jmp int_hw # V86 int 0xe - push $0xf # Int 0x27: IRQ7 - jmp int_hw # V86 int 0xf - push $0x10 # Int 0x28: IRQ8 - jmp int_hw # V86 int 0x10 - push $0x11 # Int 0x29: IRQ9 - jmp int_hw # V86 int 0x11 - push $0x12 # Int 0x2a: IRQ10 - jmp int_hw # V86 int 0x12 - push $0x13 # Int 0x2b: IRQ11 - jmp int_hw # V86 int 0x13 - push $0x14 # Int 0x2c: IRQ12 - jmp int_hw # V86 int 0x14 - push $0x15 # Int 0x2d: IRQ13 - jmp int_hw # V86 int 0x15 - push $0x16 # Int 0x2e: IRQ14 - jmp int_hw # V86 int 0x16 - push $0x17 # Int 0x2f: IRQ15 - jmp int_hw # V86 int 0x17 - -/* - * Invoke real mode interrupt/function call from user mode with arguments. - */ -intx31: pushl $-1 # Dummy int no for btx_v86 -/* - * Invoke real mode interrupt/function call from protected mode. - * - * We place a trampoline on the user stack that will return to rret_tramp - * which will reenter protected mode and then finally return to the user - * client. - * - * Kernel frame %esi points to: Real mode stack frame at MEM_ESPR: - * - * -0x00 user %ss -0x04 kernel %esp (with full frame) - * -0x04 user %esp -0x08 btx_v86 pointer - * -0x08 user %eflags -0x0c flags (only used if interrupt) - * -0x0c user %cs -0x10 real mode CS:IP return trampoline - * -0x10 user %eip -0x12 real mode flags - * -0x14 int no -0x16 real mode CS:IP (target) - * -0x18 %eax - * -0x1c %ecx - * -0x20 %edx - * -0x24 %ebx - * -0x28 %esp - * -0x2c %ebp - * -0x30 %esi - * -0x34 %edi - * -0x38 %gs - * -0x3c %fs - * -0x40 %ds - * -0x44 %es - * -0x48 zero %eax (hardware int only) - * -0x4c zero %ecx (hardware int only) - * -0x50 zero %edx (hardware int only) - * -0x54 zero %ebx (hardware int only) - * -0x58 zero %esp (hardware int only) - * -0x5c zero %ebp (hardware int only) - * -0x60 zero %esi (hardware int only) - * -0x64 zero %edi (hardware int only) - * -0x68 zero %gs (hardware int only) - * -0x6c zero %fs (hardware int only) - * -0x70 zero %ds (hardware int only) - * -0x74 zero %es (hardware int only) - */ -int_hw: cld # String ops inc - pusha # Save gp regs - pushl %gs # Save - pushl %fs # seg - pushl %ds # regs - pushl %es - push $SEL_SDATA # Set up - popl %ds # to - pushl %ds # address - popl %es # data - leal 0x44(%esp,1),%esi # Base of frame - movl %esp,MEM_ESPR-0x04 # Save kernel stack pointer - movl -0x14(%esi),%eax # Get Int no - cmpl $-1,%eax # Hardware interrupt? - jne intusr.1 # Yes -/* - * v86 calls save the btx_v86 pointer on the real mode stack and read - * the address and flags from the btx_v86 structure. For interrupt - * handler invocations (VM86 INTx requests), disable interrupts, - * tracing, and alignment checking while the handler runs. - */ - movl $MEM_USR,%ebx # User base - movl %ebx,%edx # address - addl -0x4(%esi),%ebx # User ESP - movl (%ebx),%ebp # btx_v86 pointer - addl %ebp,%edx # Flatten btx_v86 ptr - movl %edx,MEM_ESPR-0x08 # Save btx_v86 ptr - movl V86_ADDR(%edx),%eax # Get int no/address - movl V86_CTL(%edx),%edx # Get control flags - movl -0x08(%esi),%ebx # Save user flags in %ebx - testl $V86F_ADDR,%edx # Segment:offset? - jnz intusr.4 # Yes - andl $~(PSL_I|PSL_T|PSL_AC),%ebx # Disable interrupts, tracing, - # and alignment checking for - # interrupt handler - jmp intusr.3 # Skip hardware interrupt -/* - * Hardware interrupts store a NULL btx_v86 pointer and use the - * address (interrupt number) from the stack with empty flags. Also, - * push a dummy frame of zeros onto the stack for all the general - * purpose and segment registers and clear %eflags. This gives the - * hardware interrupt handler a clean slate. - */ -intusr.1: xorl %edx,%edx # Control flags - movl %edx,MEM_ESPR-0x08 # NULL btx_v86 ptr - movl $12,%ecx # Frame is 12 dwords -intusr.2: pushl $0x0 # Fill frame - loop intusr.2 # with zeros - movl $PSL_RESERVED_DEFAULT,%ebx # Set clean %eflags -/* - * Look up real mode IDT entry for hardware interrupts and VM86 INTx - * requests. - */ -intusr.3: shll $0x2,%eax # Scale - movl (%eax),%eax # Load int vector - jmp intusr.5 # Skip CALLF test -/* - * Panic if V86F_CALLF isn't set with V86F_ADDR. - */ -intusr.4: testl $V86F_CALLF,%edx # Far call? - jnz intusr.5 # Ok - movl %edx,0x30(%esp,1) # Place VM86 flags in int no - movl $badvm86,%esi # Display bad - call putstr # VM86 call - popl %es # Restore - popl %ds # seg - popl %fs # regs - popl %gs - popal # Restore gp regs - jmp ex_noc # Panic -/* - * %eax now holds the segment:offset of the function. - * %ebx now holds the %eflags to pass to real mode. - * %edx now holds the V86F_* flags. - */ -intusr.5: movw %bx,MEM_ESPR-0x12 # Pass user flags to real mode - # target -/* - * If this is a v86 call, copy the seg regs out of the btx_v86 structure. - */ - movl MEM_ESPR-0x08,%ecx # Get btx_v86 ptr - jecxz intusr.6 # Skip for hardware ints - leal -0x44(%esi),%edi # %edi => kernel stack seg regs - pushl %esi # Save - leal V86_ES(%ecx),%esi # %esi => btx_v86 seg regs - movl $4,%ecx # Copy seg regs - rep # from btx_v86 - movsl # to kernel stack - popl %esi # Restore -intusr.6: movl -0x08(%esi),%ebx # Copy user flags to real - movl %ebx,MEM_ESPR-0x0c # mode return trampoline - movl $rret_tramp,%ebx # Set return trampoline - movl %ebx,MEM_ESPR-0x10 # CS:IP - movl %eax,MEM_ESPR-0x16 # Real mode target CS:IP - ljmpw $SEL_RCODE,$intusr.7 # Change to 16-bit segment - .code16 -intusr.7: movl %cr0,%eax # Leave - dec %al # protected - movl %eax,%cr0 # mode - ljmpw $0x0,$intusr.8 -intusr.8: xorw %ax,%ax # Reset %ds - movw %ax,%ds # and - movw %ax,%ss # %ss - lidt ivtdesc # Set IVT - popl %es # Restore - popl %ds # seg - popl %fs # regs - popl %gs - popal # Restore gp regs - movw $MEM_ESPR-0x16,%sp # Switch to real mode stack - iret # Call target routine -/* - * For the return to real mode we setup a stack frame like this on the real - * mode stack. Note that callf calls won't pop off the flags, but we just - * ignore that by repositioning %sp to be just above the btx_v86 pointer - * so it is aligned. The stack is relative to MEM_ESPR. - * - * -0x04 kernel %esp - * -0x08 btx_v86 - * -0x0c %eax - * -0x10 %ecx - * -0x14 %edx - * -0x18 %ebx - * -0x1c %esp - * -0x20 %ebp - * -0x24 %esi - * -0x28 %edi - * -0x2c %gs - * -0x30 %fs - * -0x34 %ds - * -0x38 %es - * -0x3c %eflags - */ -rret_tramp: movw $MEM_ESPR-0x08,%sp # Reset stack pointer - pushal # Save gp regs - pushl %gs # Save - pushl %fs # seg - pushl %ds # regs - pushl %es - pushfl # Save %eflags - cli # Disable interrupts - std # String ops dec - xorw %ax,%ax # Reset seg - movw %ax,%ds # regs - movw %ax,%es # (%ss is already 0) - lidt idtdesc # Set IDT - lgdt gdtdesc # Set GDT - mov %cr0,%eax # Switch to protected - inc %ax # mode - mov %eax,%cr0 # - ljmp $SEL_SCODE,$rret_tramp.1 # To 32-bit code - .code32 -rret_tramp.1: xorl %ecx,%ecx # Zero - movb $SEL_SDATA,%cl # Setup - movw %cx,%ss # 32-bit - movw %cx,%ds # seg - movw %cx,%es # regs - movl MEM_ESPR-0x04,%esp # Switch to kernel stack - leal 0x44(%esp,1),%esi # Base of frame - andb $~0x2,tss_desc+0x5 # Clear TSS busy - movb $SEL_TSS,%cl # Set task - ltr %cx # register -/* - * Now we are back in protected mode. The kernel stack frame set up - * before entering real mode is still intact. For hardware interrupts, - * leave the frame unchanged. - */ - cmpl $0,MEM_ESPR-0x08 # Leave saved regs unchanged - jz rret_tramp.3 # for hardware ints -/* - * For V86 calls, copy the registers off of the real mode stack onto - * the kernel stack as we want their updated values. Also, initialize - * the segment registers on the kernel stack. - * - * Note that the %esp in the kernel stack after this is garbage, but popa - * ignores it, so we don't have to fix it up. - */ - leal -0x18(%esi),%edi # Kernel stack GP regs - pushl %esi # Save - movl $MEM_ESPR-0x0c,%esi # Real mode stack GP regs - movl $8,%ecx # Copy GP regs from - rep # real mode stack - movsl # to kernel stack - movl $SEL_UDATA,%eax # Selector for data seg regs - movl $4,%ecx # Initialize %ds, - rep # %es, %fs, and - stosl # %gs -/* - * For V86 calls, copy the saved seg regs on the real mode stack back - * over to the btx_v86 structure. Also, conditionally update the - * saved eflags on the kernel stack based on the flags from the user. - */ - movl MEM_ESPR-0x08,%ecx # Get btx_v86 ptr - leal V86_GS(%ecx),%edi # %edi => btx_v86 seg regs - leal MEM_ESPR-0x2c,%esi # %esi => real mode seg regs - xchgl %ecx,%edx # Save btx_v86 ptr - movl $4,%ecx # Copy seg regs - rep # from real mode stack - movsl # to btx_v86 - popl %esi # Restore - movl V86_CTL(%edx),%edx # Read V86 control flags - testl $V86F_FLAGS,%edx # User wants flags? - jz rret_tramp.3 # No - movl MEM_ESPR-0x3c,%eax # Read real mode flags - movw %ax,-0x08(%esi) # Update user flags (low 16) -/* - * Return to the user task - */ -rret_tramp.3: popl %es # Restore - popl %ds # seg - popl %fs # regs - popl %gs - popal # Restore gp regs - addl $4,%esp # Discard int no - iret # Return to user mode - -/* - * System Call. - */ -intx30: cmpl $SYS_EXEC,%eax # Exec system call? - jne intx30.1 # No - pushl %ss # Set up - popl %es # all - pushl %es # segment - popl %ds # registers - pushl %ds # for the - popl %fs # program - pushl %fs # we're - popl %gs # invoking - movl $MEM_USR,%eax # User base address - addl 0xc(%esp,1),%eax # Change to user - leal 0x4(%eax),%esp # stack - popl %eax # Call - call *%eax # program -intx30.1: orb $0x1,%ss:btx_hdr+0x7 # Flag reboot - jmp exit # Exit -/* - * Dump structure [EBX] to [EDI], using format string [ESI]. - */ -dump.0: stosb # Save char -dump: lodsb # Load char - testb %al,%al # End of string? - jz dump.10 # Yes - testb $0x80,%al # Control? - jz dump.0 # No - movb %al,%ch # Save control - movb $'=',%al # Append - stosb # '=' - lodsb # Get offset - pushl %esi # Save - movsbl %al,%esi # To - addl %ebx,%esi # pointer - testb $DMP_X16,%ch # Dump word? - jz dump.1 # No - lodsw # Get and - call hex16 # dump it -dump.1: testb $DMP_X32,%ch # Dump long? - jz dump.2 # No - lodsl # Get and - call hex32 # dump it -dump.2: testb $DMP_MEM,%ch # Dump memory? - jz dump.8 # No - pushl %ds # Save - testl $PSL_VM,0x50(%ebx) # V86 mode? - jnz dump.3 # Yes - verr 0x4(%esi) # Readable selector? - jnz dump.3 # No - ldsl (%esi),%esi # Load pointer - jmp dump.4 # Join common code -dump.3: lodsl # Set offset - xchgl %eax,%edx # Save - lodsl # Get segment - shll $0x4,%eax # * 0x10 - addl %edx,%eax # + offset - xchgl %eax,%esi # Set pointer -dump.4: movb $2,%dl # Num lines -dump.4a: movb $0x10,%cl # Bytes to dump -dump.5: lodsb # Get byte and - call hex8 # dump it - decb %cl # Keep count - jz dump.6a # If done - movb $'-',%al # Separator - cmpb $0x8,%cl # Half way? - je dump.6 # Yes - movb $' ',%al # Use space -dump.6: stosb # Save separator - jmp dump.5 # Continue -dump.6a: decb %dl # Keep count - jz dump.7 # If done - movb $0xa,%al # Line feed - stosb # Save one - movb $7,%cl # Leading - movb $' ',%al # spaces -dump.6b: stosb # Dump - decb %cl # spaces - jnz dump.6b - jmp dump.4a # Next line -dump.7: popl %ds # Restore -dump.8: popl %esi # Restore - movb $0xa,%al # Line feed - testb $DMP_EOL,%ch # End of line? - jnz dump.9 # Yes - movb $' ',%al # Use spaces - stosb # Save one -dump.9: jmp dump.0 # Continue -dump.10: stosb # Terminate string - ret # To caller -/* - * Convert EAX, AX, or AL to hex, saving the result to [EDI]. - */ -hex32: pushl %eax # Save - shrl $0x10,%eax # Do upper - call hex16 # 16 - popl %eax # Restore -hex16: call hex16.1 # Do upper 8 -hex16.1: xchgb %ah,%al # Save/restore -hex8: pushl %eax # Save - shrb $0x4,%al # Do upper - call hex8.1 # 4 - popl %eax # Restore -hex8.1: andb $0xf,%al # Get lower 4 - cmpb $0xa,%al # Convert - sbbb $0x69,%al # to hex - das # digit - orb $0x20,%al # To lower case - stosb # Save char - ret # (Recursive) -/* - * Output zero-terminated string [ESI] to the console. - */ -putstr.0: call putchr # Output char -putstr: lodsb # Load char - testb %al,%al # End of string? - jnz putstr.0 # No - ret # To caller -#ifdef BTX_SERIAL - .set SIO_PRT,SIOPRT # Base port - .set SIO_FMT,SIOFMT # 8N1 - .set SIO_DIV,(115200/SIOSPD) # 115200 / SPD - -/* - * int sio_init(void) - */ -sio_init: movw $SIO_PRT+0x3,%dx # Data format reg - movb $SIO_FMT|0x80,%al # Set format - outb %al,(%dx) # and DLAB - pushl %edx # Save - subb $0x3,%dl # Divisor latch reg - movw $SIO_DIV,%ax # Set - outw %ax,(%dx) # BPS - popl %edx # Restore - movb $SIO_FMT,%al # Clear - outb %al,(%dx) # DLAB - incl %edx # Modem control reg - movb $0x3,%al # Set RTS, - outb %al,(%dx) # DTR - incl %edx # Line status reg - call sio_getc.1 # Get character - -/* - * int sio_flush(void) - */ -sio_flush: xorl %eax,%eax # Return value - xorl %ecx,%ecx # Timeout - movb $0x80,%ch # counter -sio_flush.1: call sio_ischar # Check for character - jz sio_flush.2 # Till none - loop sio_flush.1 # or counter is zero - movb $1, %al # Exhausted all tries -sio_flush.2: ret # To caller - -/* - * void sio_putc(int c) - */ -sio_putc: movw $SIO_PRT+0x5,%dx # Line status reg - xor %ecx,%ecx # Timeout - movb $0x40,%ch # counter -sio_putc.1: inb (%dx),%al # Transmitter - testb $0x20,%al # buffer empty? - loopz sio_putc.1 # No - jz sio_putc.2 # If timeout - movb 0x4(%esp,1),%al # Get character - subb $0x5,%dl # Transmitter hold reg - outb %al,(%dx) # Write character -sio_putc.2: ret $0x4 # To caller - -/* - * int sio_getc(void) - */ -sio_getc: call sio_ischar # Character available? - jz sio_getc # No -sio_getc.1: subb $0x5,%dl # Receiver buffer reg - inb (%dx),%al # Read character - ret # To caller - -/* - * int sio_ischar(void) - */ -sio_ischar: movw $SIO_PRT+0x5,%dx # Line status register - xorl %eax,%eax # Zero - inb (%dx),%al # Received data - andb $0x1,%al # ready? - ret # To caller - -/* - * Output character AL to the serial console. - */ -putchr: pusha # Save - cmpb $10, %al # is it a newline? - jne putchr.1 # no?, then leave - push $13 # output a carriage - call sio_putc # return first - movb $10, %al # restore %al -putchr.1: pushl %eax # Push the character - # onto the stack - call sio_putc # Output the character - popa # Restore - ret # To caller -#else -/* - * Output character AL to the console. - */ -putchr: pusha # Save - xorl %ecx,%ecx # Zero for loops - movb $SCR_MAT,%ah # Mode/attribute - movl $BDA_POS,%ebx # BDA pointer - movw (%ebx),%dx # Cursor position - movl $0xa0000,%edi -putchr.1: cmpb $0xa,%al # New line? - je putchr.2 # Yes - movw %dx,%cx - movb %al,(%edi,%ecx,1) # Write char - addl $0x2000,%ecx - movb %ah,(%edi,%ecx,1) # Write attr - addw $0x02,%dx - jmp putchr.3 -putchr.2: movw %dx,%ax - movb $SCR_COL*2,%dl - div %dl - incb %al - mul %dl - movw %ax,%dx -putchr.3: cmpw $SCR_ROW*SCR_COL*2,%dx - jb putchr.4 # No - leal 2*SCR_COL(%edi),%esi # New top line - movw $(SCR_ROW-1)*SCR_COL/2,%cx # Words to move - rep # Scroll - movsl # screen - movb $0x20,%al # Space - xorb %ah,%ah - movb $SCR_COL,%cl # Columns to clear - rep # Clear - stosw # line - movw $(SCR_ROW-1)*SCR_COL*2,%dx -putchr.4: movw %dx,(%ebx) # Update position - popa # Restore - ret # To caller -#endif - - .code16 -/* - * Real Mode Hardware interrupt jump table. - */ -intr20: push $0x8 # Int 0x20: IRQ0 - jmp int_hwr # V86 int 0x8 - push $0x9 # Int 0x21: IRQ1 - jmp int_hwr # V86 int 0x9 - push $0xa # Int 0x22: IRQ2 - jmp int_hwr # V86 int 0xa - push $0xb # Int 0x23: IRQ3 - jmp int_hwr # V86 int 0xb - push $0xc # Int 0x24: IRQ4 - jmp int_hwr # V86 int 0xc - push $0xd # Int 0x25: IRQ5 - jmp int_hwr # V86 int 0xd - push $0xe # Int 0x26: IRQ6 - jmp int_hwr # V86 int 0xe - push $0xf # Int 0x27: IRQ7 - jmp int_hwr # V86 int 0xf - push $0x10 # Int 0x28: IRQ8 - jmp int_hwr # V86 int 0x10 - push $0x11 # Int 0x29: IRQ9 - jmp int_hwr # V86 int 0x11 - push $0x12 # Int 0x2a: IRQ10 - jmp int_hwr # V86 int 0x12 - push $0x13 # Int 0x2b: IRQ11 - jmp int_hwr # V86 int 0x13 - push $0x14 # Int 0x2c: IRQ12 - jmp int_hwr # V86 int 0x14 - push $0x15 # Int 0x2d: IRQ13 - jmp int_hwr # V86 int 0x15 - push $0x16 # Int 0x2e: IRQ14 - jmp int_hwr # V86 int 0x16 - push $0x17 # Int 0x2f: IRQ15 - jmp int_hwr # V86 int 0x17 -/* - * Reflect hardware interrupts in real mode. - */ -int_hwr: push %ax # Save - push %ds # Save - push %bp # Save - mov %sp,%bp # Address stack frame - xchg %bx,6(%bp) # Swap BX, int no - xor %ax,%ax # Set %ds:%bx to - shl $2,%bx # point to - mov %ax,%ds # IDT entry - mov (%bx),%ax # Load IP - mov 2(%bx),%bx # Load CS - xchg %ax,4(%bp) # Swap saved %ax,%bx with - xchg %bx,6(%bp) # CS:IP of handler - pop %bp # Restore - pop %ds # Restore - lret # Jump to handler - - .p2align 4 -/* - * Global descriptor table. - */ -gdt: .word 0x0,0x0,0x0,0x0 # Null entry - .word 0xffff,0x0,0x9a00,0xcf # SEL_SCODE - .word 0xffff,0x0,0x9200,0xcf # SEL_SDATA - .word 0xffff,0x0,0x9a00,0x0 # SEL_RCODE - .word 0xffff,0x0,0x9200,0x0 # SEL_RDATA - .word 0xffff,MEM_USR,0xfa00,0xcf# SEL_UCODE - .word 0xffff,MEM_USR,0xf200,0xcf# SEL_UDATA -tss_desc: .word _TSSLM,MEM_TSS,0x8900,0x0 # SEL_TSS -gdt.1: -/* - * Pseudo-descriptors. - */ -gdtdesc: .word gdt.1-gdt-1,gdt,0x0 # GDT -idtdesc: .word _IDTLM,MEM_IDT,0x0 # IDT -ivtdesc: .word 0x400-0x0-1,0x0,0x0 # IVT -/* - * IDT construction control string. - */ -idtctl: .byte 0x10, 0x8e # Int 0x0-0xf - .word 0x7dfb,intx00 # (exceptions) - .byte 0x10, 0x8e # Int 0x10 - .word 0x1, intx10 # (exception) - .byte 0x10, 0x8e # Int 0x20-0x2f - .word 0xffff,intx20 # (hardware) - .byte 0x1, 0xee # int 0x30 - .word 0x1, intx30 # (system call) - .byte 0x2, 0xee # Int 0x31-0x32 - .word 0x1, intx31 # (V86, null) - .byte 0x0 # End of string -/* - * Dump format string. - */ -dmpfmt: .byte '\n' # "\n" - .ascii "int" # "int=" - .byte 0x80|DMP_X32, 0x40 # "00000000 " - .ascii "err" # "err=" - .byte 0x80|DMP_X32, 0x44 # "00000000 " - .ascii "efl" # "efl=" - .byte 0x80|DMP_X32, 0x50 # "00000000 " - .ascii "eip" # "eip=" - .byte 0x80|DMP_X32|DMP_EOL,0x48 # "00000000\n" - .ascii "eax" # "eax=" - .byte 0x80|DMP_X32, 0x34 # "00000000 " - .ascii "ebx" # "ebx=" - .byte 0x80|DMP_X32, 0x28 # "00000000 " - .ascii "ecx" # "ecx=" - .byte 0x80|DMP_X32, 0x30 # "00000000 " - .ascii "edx" # "edx=" - .byte 0x80|DMP_X32|DMP_EOL,0x2c # "00000000\n" - .ascii "esi" # "esi=" - .byte 0x80|DMP_X32, 0x1c # "00000000 " - .ascii "edi" # "edi=" - .byte 0x80|DMP_X32, 0x18 # "00000000 " - .ascii "ebp" # "ebp=" - .byte 0x80|DMP_X32, 0x20 # "00000000 " - .ascii "esp" # "esp=" - .byte 0x80|DMP_X32|DMP_EOL,0x0 # "00000000\n" - .ascii "cs" # "cs=" - .byte 0x80|DMP_X16, 0x4c # "0000 " - .ascii "ds" # "ds=" - .byte 0x80|DMP_X16, 0xc # "0000 " - .ascii "es" # "es=" - .byte 0x80|DMP_X16, 0x8 # "0000 " - .ascii " " # " " - .ascii "fs" # "fs=" - .byte 0x80|DMP_X16, 0x10 # "0000 " - .ascii "gs" # "gs=" - .byte 0x80|DMP_X16, 0x14 # "0000 " - .ascii "ss" # "ss=" - .byte 0x80|DMP_X16|DMP_EOL,0x4 # "0000\n" - .ascii "cs:eip" # "cs:eip=" - .byte 0x80|DMP_MEM|DMP_EOL,0x48 # "00 00 ... 00 00\n" - .ascii "ss:esp" # "ss:esp=" - .byte 0x80|DMP_MEM|DMP_EOL,0x0 # "00 00 ... 00 00\n" - .asciz "BTX halted\n" # End -/* - * Bad VM86 call panic - */ -badvm86: .asciz "Invalid VM86 Request\n" - -/* - * End of BTX memory. - */ - .p2align 4 -break: diff --git a/sys/boot/pc98/btx/btxldr/Makefile b/sys/boot/pc98/btx/btxldr/Makefile deleted file mode 100644 index 47e83a083056..000000000000 --- a/sys/boot/pc98/btx/btxldr/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# $FreeBSD$ - -PROG= btxldr -INTERNALPROG= -MAN= -SRCS= btxldr.S - -CFLAGS+=-DLOADER_ADDRESS=${LOADER_ADDRESS} -CFLAGS+=-I${.CURDIR}/../../../i386/common - -.if defined(BTXLDR_VERBOSE) -CFLAGS+=-DBTXLDR_VERBOSE -.endif - -ORG=${LOADER_ADDRESS} -LDFLAGS=${LDFLAGS_BIN} - -.include - -# XXX: clang integrated-as doesn't grok .codeNN directives yet -CFLAGS.btxldr.S= ${CLANG_NO_IAS} diff --git a/sys/boot/pc98/btx/btxldr/btxldr.S b/sys/boot/pc98/btx/btxldr/btxldr.S deleted file mode 100644 index 9a6483f72c3d..000000000000 --- a/sys/boot/pc98/btx/btxldr/btxldr.S +++ /dev/null @@ -1,430 +0,0 @@ -/* - * Copyright (c) 1998 Robert Nordier - * All rights reserved. - * - * Redistribution and use in source and binary forms are freely - * permitted provided that the above copyright notice and this - * paragraph and the following disclaimer are duplicated in all - * such forms. - * - * This software is provided "AS IS" and without any express or - * implied warranties, including, without limitation, the implied - * warranties of merchantability and fitness for a particular - * purpose. - * - * $FreeBSD$ - */ - -#include - -/* - * Prototype BTX loader program, written in a couple of hours. The - * real thing should probably be more flexible, and in C. - */ - -/* - * Memory locations. - */ - .set MEM_STUB,0x600 # Real mode stub - .set MEM_ESP,0x1000 # New stack pointer - .set MEM_TBL,0x5000 # BTX page tables - .set MEM_ENTRY,0x9010 # BTX entry point - .set MEM_DATA,start+0x1000 # Data segment -/* - * Segment selectors. - */ - .set SEL_SCODE,0x8 # 4GB code - .set SEL_SDATA,0x10 # 4GB data - .set SEL_RCODE,0x18 # 64K code - .set SEL_RDATA,0x20 # 64K data -/* - * Paging constants. - */ - .set PAG_SIZ,0x1000 # Page size - .set PAG_ENT,0x4 # Page entry size -/* - * Screen constants. - */ - .set SCR_MAT,0xe1 # Mode/attribute - .set SCR_COL,0x50 # Columns per row - .set SCR_ROW,0x19 # Rows per screen -/* - * BIOS Data Area locations. - */ - .set BDA_MEM,0xa1501 # Free memory - .set BDA_POS,0xa153e # Cursor position -/* - * Required by aout gas inadequacy. - */ - .set SIZ_STUB,0x1a # Size of stub -/* - * We expect to be loaded by boot2 at the origin defined in ./Makefile. - */ - .globl start -/* - * BTX program loader for ELF clients. - */ -start: cld # String ops inc - cli -gdcwait.1: inb $0x60,%al - testb $0x04,%al - jz gdcwait.1 - movb $0xe0,%al - outb %al,$0x62 - nop -gdcwait.2: inb $0x60,%al - testb $0x01,%al - jz gdcwait.2 - inb $0x62,%al - movb %al,%dl - inb $0x62,%al - movb %al,%dh - inb $0x62,%al - inb $0x62,%al - inb $0x62,%al - shlw $1,%dx - movl $BDA_POS,%ebx - movw %dx,(%ebx) - movl $m_logo,%esi # Identify - call putstr # ourselves - movzwl BDA_MEM,%eax # Get base memory - andl $0x7,%eax - incl %eax - shll $0x11,%eax # in bytes - movl %eax,%ebp # Base of user stack -#ifdef BTXLDR_VERBOSE - movl $m_mem,%esi # Display - call hexout # amount of - call putstr # base memory -#endif - lgdt gdtdesc # Load new GDT -/* - * Relocate caller's arguments. - */ -#ifdef BTXLDR_VERBOSE - movl $m_esp,%esi # Display - movl %esp,%eax # caller - call hexout # stack - call putstr # pointer - movl $m_args,%esi # Format string - leal 0x4(%esp),%ebx # First argument - movl $0x6,%ecx # Count -start.1: movl (%ebx),%eax # Get argument and - addl $0x4,%ebx # bump pointer - call hexout # Display it - loop start.1 # Till done - call putstr # End message -#endif - movl BA_BOOTINFO+4(%esp),%esi # Source: bootinfo - cmpl $0x0, %esi # If the bootinfo pointer - je start_null_bi # is null, don't copy it - movl BI_SIZE(%esi),%ecx # Allocate space - subl %ecx,%ebp # for bootinfo - movl %ebp,%edi # Destination - rep # Copy - movsb # it - movl %ebp,BA_BOOTINFO+4(%esp) # Update pointer - movl %edi,%ebp # Restore base pointer -#ifdef BTXLDR_VERBOSE - movl $m_rel_bi,%esi # Display - movl %ebp,%eax # bootinfo - call hexout # relocation - call putstr # message -#endif -start_null_bi: movl $BOOTARGS_SIZE,%ecx # Fixed size of arguments - testl $KARGS_FLAGS_EXTARG, BA_BOOTFLAGS+4(%esp) # Check for extra data - jz start_fixed # Skip if the flag is not set - addl BOOTARGS_SIZE+4(%esp),%ecx # Add size of variable args -start_fixed: subl $ARGOFF,%ebp # Place args at fixed offset - leal 0x4(%esp),%esi # Source - movl %ebp,%edi # Destination - rep # Copy - movsb # them -#ifdef BTXLDR_VERBOSE - movl $m_rel_args,%esi # Display - movl %ebp,%eax # argument - call hexout # relocation - call putstr # message -#endif -/* - * Set up BTX kernel. - */ - movl $MEM_ESP,%esp # Set up new stack - movl $MEM_DATA,%ebx # Data segment - movl $m_vers,%esi # Display BTX - call putstr # version message - movb 0x5(%ebx),%al # Get major version - addb $'0',%al # Display - call putchr # it - movb $'.',%al # And a - call putchr # dot - movb 0x6(%ebx),%al # Get minor - xorb %ah,%ah # version - movb $0xa,%dl # Divide - divb %dl,%al # by 10 - addb $'0',%al # Display - call putchr # tens - movb %ah,%al # Get units - addb $'0',%al # Display - call putchr # units - call putstr # End message - movl %ebx,%esi # BTX image - movzwl 0x8(%ebx),%edi # Compute - orl $PAG_SIZ/PAG_ENT-1,%edi # the - incl %edi # BTX - shll $0x2,%edi # load - addl $MEM_TBL,%edi # address - pushl %edi # Save load address - movzwl 0xa(%ebx),%ecx # Image size -#ifdef BTXLDR_VERBOSE - pushl %ecx # Save image size -#endif - rep # Relocate - movsb # BTX - movl %esi,%ebx # Keep place -#ifdef BTXLDR_VERBOSE - movl $m_rel_btx,%esi # Restore - popl %eax # parameters - call hexout # and -#endif - popl %ebp # display -#ifdef BTXLDR_VERBOSE - movl %ebp,%eax # the - call hexout # relocation - call putstr # message -#endif - addl $PAG_SIZ,%ebp # Display -#ifdef BTXLDR_VERBOSE - movl $m_base,%esi # the - movl %ebp,%eax # user - call hexout # base - call putstr # address -#endif -/* - * Set up ELF-format client program. - */ - cmpl $0x464c457f,(%ebx) # ELF magic number? - je start.3 # Yes - movl $e_fmt,%esi # Display error - call putstr # message -start.2: jmp start.2 # Hang -start.3: -#ifdef BTXLDR_VERBOSE - movl $m_elf,%esi # Display ELF - call putstr # message - movl $m_segs,%esi # Format string -#endif - movl $0x2,%edi # Segment count - movl 0x1c(%ebx),%edx # Get e_phoff - addl %ebx,%edx # To pointer - movzwl 0x2c(%ebx),%ecx # Get e_phnum -start.4: cmpl $0x1,(%edx) # Is p_type PT_LOAD? - jne start.6 # No -#ifdef BTXLDR_VERBOSE - movl 0x4(%edx),%eax # Display - call hexout # p_offset - movl 0x8(%edx),%eax # Display - call hexout # p_vaddr - movl 0x10(%edx),%eax # Display - call hexout # p_filesz - movl 0x14(%edx),%eax # Display - call hexout # p_memsz - call putstr # End message -#endif - pushl %esi # Save - pushl %edi # working - pushl %ecx # registers - movl 0x4(%edx),%esi # Get p_offset - addl %ebx,%esi # as pointer - movl 0x8(%edx),%edi # Get p_vaddr - addl %ebp,%edi # as pointer - movl 0x10(%edx),%ecx # Get p_filesz - rep # Set up - movsb # segment - movl 0x14(%edx),%ecx # Any bytes - subl 0x10(%edx),%ecx # to zero? - jz start.5 # No - xorb %al,%al # Then - rep # zero - stosb # them -start.5: popl %ecx # Restore - popl %edi # working - popl %esi # registers - decl %edi # Segments to do - je start.7 # If none -start.6: addl $0x20,%edx # To next entry - loop start.4 # Till done -start.7: -#ifdef BTXLDR_VERBOSE - movl $m_done,%esi # Display done - call putstr # message -#endif - movl $start.8,%esi # Real mode stub - movl $MEM_STUB,%edi # Destination - movl $start.9-start.8,%ecx # Size - rep # Relocate - movsb # it - ljmp $SEL_RCODE,$MEM_STUB # To 16-bit code - .code16 -start.8: xorw %ax,%ax # Data - movb $SEL_RDATA,%al # selector - movw %ax,%ss # Reload SS - movw %ax,%ds # Reset - movw %ax,%es # other - movw %ax,%fs # segment - movw %ax,%gs # limits - movl %cr0,%eax # Switch to - decw %ax # real - movl %eax,%cr0 # mode - ljmp $0,$MEM_ENTRY # Jump to BTX entry point -start.9: - .code32 -/* - * Output message [ESI] followed by EAX in hex. - */ -hexout: pushl %eax # Save - call putstr # Display message - popl %eax # Restore - pushl %esi # Save - pushl %edi # caller's - movl $buf,%edi # Buffer - pushl %edi # Save - call hex32 # To hex - xorb %al,%al # Terminate - stosb # string - popl %esi # Restore -hexout.1: lodsb # Get a char - cmpb $'0',%al # Leading zero? - je hexout.1 # Yes - testb %al,%al # End of string? - jne hexout.2 # No - decl %esi # Undo -hexout.2: decl %esi # Adjust for inc - call putstr # Display hex - popl %edi # Restore - popl %esi # caller's - ret # To caller -/* - * Output zero-terminated string [ESI] to the console. - */ -putstr.0: call putchr # Output char -putstr: lodsb # Load char - testb %al,%al # End of string? - jne putstr.0 # No - ret # To caller -/* - * Output character AL to the console. - */ -putchr: pusha # Save - xorl %ecx,%ecx # Zero for loops - movb $SCR_MAT,%ah # Mode/attribute - movl $BDA_POS,%ebx # BDA pointer - movw (%ebx),%dx # Cursor position - movl $0xa0000,%edi # Regen buffer (color) -putchr.1: cmpb $0xa,%al # New line? - je putchr.2 # Yes - movw %dx,%cx - movb %al,(%edi,%ecx,1) # Write char - addl $0x2000,%ecx - movb %ah,(%edi,%ecx,1) # Write attr - addw $0x2,%dx - jmp putchr.3 -putchr.2: movw %dx,%ax - movb $SCR_COL*2,%dl - div %dl - incb %al - mul %dl - movw %ax,%dx -putchr.3: cmpw $SCR_COL*SCR_ROW*2,%dx - jb putchr.4 # No - leal 2*SCR_COL(%edi),%esi # New top line - movw $(SCR_ROW-1)*SCR_COL/2,%cx # Words to move - rep # Scroll - movsl # screen - movb $' ',%al # Space - xorb %ah,%ah - movb $SCR_COL,%cl # Columns to clear - rep # Clear - stosw # line - movw $(SCR_ROW-1)*SCR_COL*2,%dx -putchr.4: movw %dx,(%ebx) # Update position - shrw $1,%dx -gdcwait.3: inb $0x60,%al - testb $0x04,%al - jz gdcwait.3 - movb $0x49,%al - outb %al,$0x62 - movb %dl,%al - outb %al,$0x60 - movb %dh,%al - outb %al,$0x60 - popa # Restore - ret # To caller -/* - * Convert EAX, AX, or AL to hex, saving the result to [EDI]. - */ -hex32: pushl %eax # Save - shrl $0x10,%eax # Do upper - call hex16 # 16 - popl %eax # Restore -hex16: call hex16.1 # Do upper 8 -hex16.1: xchgb %ah,%al # Save/restore -hex8: pushl %eax # Save - shrb $0x4,%al # Do upper - call hex8.1 # 4 - popl %eax # Restore -hex8.1: andb $0xf,%al # Get lower 4 - cmpb $0xa,%al # Convert - sbbb $0x69,%al # to hex - das # digit - orb $0x20,%al # To lower case - stosb # Save char - ret # (Recursive) - - .data - .p2align 4 -/* - * Global descriptor table. - */ -gdt: .word 0x0,0x0,0x0,0x0 # Null entry - .word 0xffff,0x0,0x9a00,0xcf # SEL_SCODE - .word 0xffff,0x0,0x9200,0xcf # SEL_SDATA - .word 0xffff,0x0,0x9a00,0x0 # SEL_RCODE - .word 0xffff,0x0,0x9200,0x0 # SEL_RDATA -gdt.1: -gdtdesc: .word gdt.1-gdt-1 # Limit - .long gdt # Base -/* - * Messages. - */ -m_logo: .asciz " \nBTX loader 1.00 " -m_vers: .asciz "BTX version is \0\n" -e_fmt: .asciz "Error: Client format not supported\n" -#ifdef BTXLDR_VERBOSE -m_mem: .asciz "Starting in protected mode (base mem=\0)\n" -m_esp: .asciz "Arguments passed (esp=\0):\n" -m_args: .asciz"\n" -m_rel_bi: .asciz "Relocated bootinfo (size=48) to \0\n" -m_rel_args: .asciz "Relocated arguments (size=18) to \0\n" -m_rel_btx: .asciz "Relocated kernel (size=\0) to \0\n" -m_base: .asciz "Client base address is \0\n" -m_elf: .asciz "Client format is ELF\n" -m_segs: .asciz "text segment: offset=" - .asciz " vaddr=" - .asciz " filesz=" - .asciz " memsz=\0\n" - .asciz "data segment: offset=" - .asciz " vaddr=" - .asciz " filesz=" - .asciz " memsz=\0\n" -m_done: .asciz "Loading complete\n" -#endif -/* - * Uninitialized data area. - */ -buf: # Scratch buffer diff --git a/sys/boot/pc98/btx/lib/Makefile b/sys/boot/pc98/btx/lib/Makefile deleted file mode 100644 index e5876bc1371d..000000000000 --- a/sys/boot/pc98/btx/lib/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# $FreeBSD$ - -PROG= crt0.o -INTERNALPROG= -MAN= -SRCS= btxcsu.S btxsys.s btxv86.s -CFLAGS+=-I${.CURDIR}/../../../i386/common -LDFLAGS=-Wl,-r - -.include diff --git a/sys/boot/pc98/btx/lib/btxcsu.S b/sys/boot/pc98/btx/lib/btxcsu.S deleted file mode 100644 index c46f8097dbe3..000000000000 --- a/sys/boot/pc98/btx/lib/btxcsu.S +++ /dev/null @@ -1,49 +0,0 @@ -# -# Copyright (c) 1998 Robert Nordier -# All rights reserved. -# -# Redistribution and use in source and binary forms are freely -# permitted provided that the above copyright notice and this -# paragraph and the following disclaimer are duplicated in all -# such forms. -# -# This software is provided "AS IS" and without any express or -# implied warranties, including, without limitation, the implied -# warranties of merchantability and fitness for a particular -# purpose. -# - -# $FreeBSD$ - -#include - -# -# BTX C startup code (ELF). -# - -# -# Globals. -# - .global _start -# -# Client entry point. -# -_start: cld - pushl %eax - movl $_edata,%edi - movl $_end,%ecx - subl %edi, %ecx - xorb %al, %al - rep - stosb - popl __base - movl %esp,%eax # Set - addl $ARGADJ,%eax # argument - movl %eax,__args # pointer - call main # Invoke client main() - call exit # Invoke client exit() -# -# Data. -# - .comm __base,4 # Client base address - .comm __args,4 # Client arguments diff --git a/sys/boot/pc98/btx/lib/btxsys.s b/sys/boot/pc98/btx/lib/btxsys.s deleted file mode 100644 index 9c77b4295e7c..000000000000 --- a/sys/boot/pc98/btx/lib/btxsys.s +++ /dev/null @@ -1,40 +0,0 @@ -# -# Copyright (c) 1998 Robert Nordier -# All rights reserved. -# -# Redistribution and use in source and binary forms are freely -# permitted provided that the above copyright notice and this -# paragraph and the following disclaimer are duplicated in all -# such forms. -# -# This software is provided "AS IS" and without any express or -# implied warranties, including, without limitation, the implied -# warranties of merchantability and fitness for a particular -# purpose. -# - -# $FreeBSD$ - -# -# BTX system calls. -# - -# -# Globals. -# - .global __exit - .global __exec -# -# Constants. -# - .set INT_SYS,0x30 # Interrupt number -# -# System call: exit -# -__exit: xorl %eax,%eax # BTX system - int $INT_SYS # call 0x0 -# -# System call: exec -# -__exec: movl $0x1,%eax # BTX system - int $INT_SYS # call 0x1 diff --git a/sys/boot/pc98/btx/lib/btxv86.h b/sys/boot/pc98/btx/lib/btxv86.h deleted file mode 100644 index 27f6b3404248..000000000000 --- a/sys/boot/pc98/btx/lib/btxv86.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 1998 Robert Nordier - * All rights reserved. - * - * Redistribution and use in source and binary forms are freely - * permitted provided that the above copyright notice and this - * paragraph and the following disclaimer are duplicated in all - * such forms. - * - * This software is provided "AS IS" and without any express or - * implied warranties, including, without limitation, the implied - * warranties of merchantability and fitness for a particular - * purpose. - */ - -/* - * $FreeBSD$ - */ - -#ifndef _BTXV86_H_ -#define _BTXV86_H_ - -#include -#include - -#define V86_ADDR 0x10000 /* Segment:offset address */ -#define V86_CALLF 0x20000 /* Emulate far call */ -#define V86_FLAGS 0x40000 /* Return flags */ - -struct __v86 { - uint32_t ctl; /* Control flags */ - uint32_t addr; /* Interrupt number or address */ - uint32_t es; /* V86 ES register */ - uint32_t ds; /* V86 DS register */ - uint32_t fs; /* V86 FS register */ - uint32_t gs; /* V86 GS register */ - uint32_t eax; /* V86 EAX register */ - uint32_t ecx; /* V86 ECX register */ - uint32_t edx; /* V86 EDX register */ - uint32_t ebx; /* V86 EBX register */ - uint32_t efl; /* V86 eflags register */ - uint32_t ebp; /* V86 EBP register */ - uint32_t esi; /* V86 ESI register */ - uint32_t edi; /* V86 EDI register */ -}; - -extern struct __v86 __v86; /* V86 interface structure */ -void __v86int(void); - -#define v86 __v86 -#define v86int __v86int - -extern u_int32_t __base; -extern u_int32_t __args; - -#define PTOV(pa) ((caddr_t)(pa) - __base) -#define VTOP(va) ((vm_offset_t)(va) + __base) -#define VTOPSEG(va) (u_int16_t)(VTOP((caddr_t)va) >> 4) -#define VTOPOFF(va) (u_int16_t)(VTOP((caddr_t)va) & 0xf) - -#define V86_CY(x) ((x) & PSL_C) -#define V86_ZR(x) ((x) & PSL_Z) - -void __exit(int) __attribute__((__noreturn__)); -void __exec(caddr_t, ...); - -#endif /* !_BTXV86_H_ */ diff --git a/sys/boot/pc98/btx/lib/btxv86.s b/sys/boot/pc98/btx/lib/btxv86.s deleted file mode 100644 index 0d7d1116322d..000000000000 --- a/sys/boot/pc98/btx/lib/btxv86.s +++ /dev/null @@ -1,85 +0,0 @@ -# -# Copyright (c) 1998 Robert Nordier -# All rights reserved. -# -# Redistribution and use in source and binary forms are freely -# permitted provided that the above copyright notice and this -# paragraph and the following disclaimer are duplicated in all -# such forms. -# -# This software is provided "AS IS" and without any express or -# implied warranties, including, without limitation, the implied -# warranties of merchantability and fitness for a particular -# purpose. -# - -# $FreeBSD$ - -# -# BTX V86 interface. -# - -# -# Globals. -# - .global __v86int -# -# Fields in V86 interface structure. -# - .set V86_CTL,0x0 # Control flags - .set V86_ADDR,0x4 # Int number/address - .set V86_ES,0x8 # V86 ES - .set V86_DS,0xc # V86 DS - .set V86_FS,0x10 # V86 FS - .set V86_GS,0x14 # V86 GS - .set V86_EAX,0x18 # V86 EAX - .set V86_ECX,0x1c # V86 ECX - .set V86_EDX,0x20 # V86 EDX - .set V86_EBX,0x24 # V86 EBX - .set V86_EFL,0x28 # V86 eflags - .set V86_EBP,0x2c # V86 EBP - .set V86_ESI,0x30 # V86 ESI - .set V86_EDI,0x34 # V86 EDI -# -# Other constants. -# - .set INT_V86,0x31 # Interrupt number - .set SIZ_V86,0x38 # Size of V86 structure -# -# V86 interface function. -# -__v86int: popl __v86ret # Save return address - pushl $__v86 # Push pointer - call __v86_swap # Load V86 registers - int $INT_V86 # To BTX - call __v86_swap # Load user registers - addl $0x4,%esp # Discard pointer - pushl __v86ret # Restore return address - ret # To user -# -# Swap V86 and user registers. -# -__v86_swap: xchgl %ebp,0x4(%esp,1) # Swap pointer, EBP - xchgl %eax,V86_EAX(%ebp) # Swap EAX - xchgl %ecx,V86_ECX(%ebp) # Swap ECX - xchgl %edx,V86_EDX(%ebp) # Swap EDX - xchgl %ebx,V86_EBX(%ebp) # Swap EBX - pushl %eax # Save - pushf # Put eflags - popl %eax # in EAX - xchgl %eax,V86_EFL(%ebp) # Swap - pushl %eax # Put EAX - popf # in eflags - movl 0x8(%esp,1),%eax # Load EBP - xchgl %eax,V86_EBP(%ebp) # Swap - movl %eax,0x8(%esp,1) # Save EBP - popl %eax # Restore - xchgl %esi,V86_ESI(%ebp) # Swap ESI - xchgl %edi,V86_EDI(%ebp) # Swap EDI - xchgl %ebp,0x4(%esp,1) # Swap pointer, EBP - ret # To caller -# -# V86 interface structure. -# - .comm __v86,SIZ_V86 - .comm __v86ret,4 diff --git a/sys/boot/pc98/cdboot/Makefile b/sys/boot/pc98/cdboot/Makefile deleted file mode 100644 index ba94111362c5..000000000000 --- a/sys/boot/pc98/cdboot/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -# $FreeBSD$ - -PROG= cdboot -STRIP= -BINMODE=${NOBINMODE} -MAN= -SRCS= ${PROG}.S - -CFLAGS+=-I${.CURDIR}/../../i386/common - -ORG= 0x0000 - -LDFLAGS=${LDFLAGS_BIN} - -.include - -# XXX: clang integrated-as doesn't grok .codeNN directives yet -CFLAGS.cdboot.S= ${CLANG_NO_IAS} diff --git a/sys/boot/pc98/cdboot/cdboot.S b/sys/boot/pc98/cdboot/cdboot.S deleted file mode 100644 index c97c02bea31b..000000000000 --- a/sys/boot/pc98/cdboot/cdboot.S +++ /dev/null @@ -1,805 +0,0 @@ -# -# Copyright (c) 2006 TAKAHASHI Yoshihiro -# Copyright (c) 2001 John Baldwin -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# - -# $FreeBSD$ - -# -# Basically, we first create a set of boot arguments to pass to the loaded -# binary. Then we attempt to load /boot/loader from the CD we were booted -# off of. -# - -#include - -# -# Memory locations. -# - .set STACK_OFF,0x6000 # Stack offset - .set LOAD_SEG,0x0700 # Load segment - .set LOAD_SIZE,2048 # Load size - .set DAUA,0x0584 # DA/UA - - .set MEM_PAGE_SIZE,0x1000 # memory page size, 4k - .set MEM_ARG,0x900 # Arguments at start - .set MEM_ARG_BTX,0xa100 # Where we move them to so the - # BTX client can see them - .set MEM_ARG_SIZE,0x18 # Size of the arguments - .set MEM_BTX_ADDRESS,0x9000 # where BTX lives - .set MEM_BTX_ENTRY,0x9010 # where BTX starts to execute - .set MEM_BTX_OFFSET,MEM_PAGE_SIZE # offset of BTX in the loader - .set MEM_BTX_CLIENT,0xa000 # where BTX clients live -# -# PC98 machine type from sys/pc98/pc98/pc98_machdep.h -# - .set MEM_SYS, 0xa100 # System common area segment - .set PC98_MACHINE_TYPE, 0x0620 # PC98 machine type - .set EPSON_ID, 0x0624 # EPSON machine id - - .set M_NEC_PC98, 0x0001 - .set M_EPSON_PC98, 0x0002 - .set M_NOT_H98, 0x0010 - .set M_H98, 0x0020 - .set M_NOTE, 0x0040 - .set M_NORMAL, 0x1000 - .set M_8M, 0x8000 -# -# Signature Constants -# - .set SIG1_OFF,0x1fe # Signature offset - .set SIG2_OFF,0x7fe # Signature offset -# -# a.out header fields -# - .set AOUT_TEXT,0x04 # text segment size - .set AOUT_DATA,0x08 # data segment size - .set AOUT_BSS,0x0c # zero'd BSS size - .set AOUT_SYMBOLS,0x10 # symbol table - .set AOUT_ENTRY,0x14 # entry point - .set AOUT_HEADER,MEM_PAGE_SIZE # size of the a.out header -# -# Segment selectors. -# - .set SEL_SDATA,0x8 # Supervisor data - .set SEL_RDATA,0x10 # Real mode data - .set SEL_SCODE,0x18 # PM-32 code - .set SEL_SCODE16,0x20 # PM-16 code -# -# BTX constants -# - .set INT_SYS,0x30 # BTX syscall interrupt -# -# Constants for reading from the CD. -# - .set ERROR_TIMEOUT,0x90 # BIOS timeout on read - .set NUM_RETRIES,3 # Num times to retry - .set SECTOR_SIZE,0x800 # size of a sector - .set SECTOR_SHIFT,11 # number of place to shift - .set BUFFER_LEN,0x100 # number of sectors in buffer - .set MAX_READ,0xf800 # max we can read at a time - .set MAX_READ_SEC,MAX_READ >> SECTOR_SHIFT - .set MEM_READ_BUFFER,0x9000 # buffer to read from CD - .set MEM_VOLDESC,MEM_READ_BUFFER # volume descriptor - .set MEM_DIR,MEM_VOLDESC+SECTOR_SIZE # Lookup buffer - .set VOLDESC_LBA,0x10 # LBA of vol descriptor - .set VD_PRIMARY,1 # Primary VD - .set VD_END,255 # VD Terminator - .set VD_ROOTDIR,156 # Offset of Root Dir Record - .set DIR_LEN,0 # Offset of Dir Record length - .set DIR_EA_LEN,1 # Offset of EA length - .set DIR_EXTENT,2 # Offset of 64-bit LBA - .set DIR_SIZE,10 # Offset of 64-bit length - .set DIR_NAMELEN,32 # Offset of 8-bit name len - .set DIR_NAME,33 # Offset of dir name - -# -# Program start. -# - .code16 - .globl start - -start: jmp main - - .org 4 - .ascii "IPL1 " - -main: cld - - /* Setup the stack */ - xor %ax,%ax - mov %ax,%ss - mov $STACK_OFF,%sp - - push %ecx - - /* Setup graphic screen */ - mov $0x42,%ah # 640x400 - mov $0xc0,%ch - int $0x18 - mov $0x40,%ah # graph on - int $0x18 - - /* Setup text screen */ - mov $0x0a00,%ax # 80x25 - int $0x18 - mov $0x0c,%ah # text on - int $0x18 - mov $0x13,%ah # cursor home - xor %dx,%dx - int $0x18 - mov $0x11,%ah # cursor on - int $0x18 - - /* Setup keyboard */ - mov $0x03,%ah - int $0x18 - - /* Transfer PC-9801 system common area */ - xor %ax,%ax - mov %ax,%si - mov %ax,%ds - mov %ax,%di - mov $MEM_SYS,%ax - mov %ax,%es - mov $0x0600,%cx - rep - movsb - - /* Transfer EPSON machine type */ - mov $0xfd00,%ax - mov %ax,%ds - mov (0x804),%eax - and $0x00ffffff,%eax - mov %eax,%es:(EPSON_ID) - - /* Set machine type to PC98_SYSTEM_PARAMETER */ - call machine_check - - /* Load cdboot */ - xor %ax,%ax - mov %ax,%ds - mov $0x06,%ah /* Read data */ - mov (DAUA),%al /* Read drive */ - pop %ecx /* cylinder */ - xor %dx,%dx /* head / sector */ - mov $LOAD_SEG,%bx /* Load address */ - mov %bx,%es - xor %bp,%bp - mov $LOAD_SIZE,%bx /* Load size */ - int $0x1b - mov $msg_readerr,%si - jc error - - /* Jump to cdboot */ - ljmp $LOAD_SEG,$cdboot - -# -# Set machine type to PC98_SYSTEM_PARAMETER. -# -machine_check: xor %edx,%edx - mov %dx,%ds - mov $MEM_SYS,%ax - mov %ax,%es - - /* Wait V-SYNC */ -vsync.1: inb $0x60,%al - test $0x20,%al - jnz vsync.1 -vsync.2: inb $0x60,%al - test $0x20,%al - jz vsync.2 - - /* ANK 'A' font */ - xor %al,%al - outb %al,$0xa1 - mov $0x41,%al - outb %al,$0xa3 - - /* Get 'A' font from CG window */ - push %ds - mov $0xa400,%ax - mov %ax,%ds - xor %eax,%eax - xor %bx,%bx - mov $4,%cx -font.1: add (%bx),%eax - add $4,%bx - loop font.1 - pop %ds - cmp $0x6efc58fc,%eax - jnz m_epson - -m_pc98: or $M_NEC_PC98,%edx - mov $0x0458,%bx - mov (%bx),%al - test $0x80,%al - jz m_not_h98 - or $M_H98,%edx - jmp 1f -m_epson: or $M_EPSON_PC98,%edx -m_not_h98: or $M_NOT_H98,%edx - -1: inb $0x42,%al - test $0x20,%al - jz 1f - or $M_8M,%edx - -1: mov $0x0400,%bx - mov (%bx),%al - test $0x80,%al - jz 1f - or $M_NOTE,%edx - -1: mov $PC98_MACHINE_TYPE,%bx - mov %edx,%es:(%bx) - ret - -# -# Print out the error message at [SI], wait for a keypress, and then -# reboot the machine. -# -error: call putstr - mov $msg_keypress,%si - call putstr - xor %ax,%ax # Get keypress - int $0x18 - xor %ax,%ax # CPU reset - outb %al,$0xf0 -halt: hlt - jmp halt # Spin - -# -# Display a null-terminated string at [SI]. -# -# Trashes: AX, BX, CX, DX, SI, DI -# -putstr: push %ds - push %es - mov %cs,%ax - mov %ax,%ds - mov $0xa000,%ax - mov %ax,%es - mov cursor,%di - mov $0x00e1,%bx # Attribute - mov $160,%cx -putstr.0: lodsb - testb %al,%al - jz putstr.done - cmp $0x0d,%al - jz putstr.cr - cmp $0x0a,%al - jz putstr.lf - mov %bl,%es:0x2000(%di) - stosb - inc %di - jmp putstr.move -putstr.cr: xor %dx,%dx - mov %di,%ax - div %cx - sub %dx,%di - jmp putstr.move -putstr.lf: add %cx,%di -putstr.move: mov %di,%dx - mov $0x13,%ah # Move cursor - int $0x18 - jmp putstr.0 -putstr.done: mov %di,cursor - pop %es - pop %ds - ret - -# -# Display a single char at [AL], but don't move a cursor. -# -putc: push %es - push %di - push %bx - mov $0xa000,%bx - mov %bx,%es - mov cursor,%di - mov $0xe1,%bl # Attribute - mov %bl,%es:0x2000(%di) - stosb - pop %bx - pop %di - pop %es - ret - -msg_readerr: .asciz "Read Error\r\n" -msg_keypress: .asciz "\r\nPress any key to reboot\r\n" - -/* Boot signature */ - - .org SIG1_OFF,0x90 - - .word 0xaa55 # Magic number - -# -# cdboot -# -cdboot: mov %cs,%ax - mov %ax,%ds - xor %ax,%ax - mov %ax,%es - mov %es:(DAUA),%al # Save BIOS boot device - mov %al,drive - mov %cx,cylinder # Save BIOS boot cylinder - - mov $msg_welcome,%si # %ds:(%si) -> welcome message - call putstr # display the welcome message -# -# Setup the arguments that the loader is expecting from boot[12] -# - mov $msg_bootinfo,%si # %ds:(%si) -> boot args message - call putstr # display the message - mov $MEM_ARG,%bx # %ds:(%bx) -> boot args - mov %bx,%di # %es:(%di) -> boot args - xor %eax,%eax # zero %eax - mov $(MEM_ARG_SIZE/4),%cx # Size of arguments in 32-bit - # dwords - rep # Clear the arguments - stosl # to zero - mov drive,%dl # Store BIOS boot device - mov %dl,%es:0x4(%bx) # in kargs->bootdev - or $KARGS_FLAGS_CD,%es:0x8(%bx) # kargs->bootflags |= - # KARGS_FLAGS_CD -# -# Load Volume Descriptor -# - mov $VOLDESC_LBA,%eax # Set LBA of first VD -load_vd: push %eax # Save %eax - mov $1,%dh # One sector - mov $MEM_VOLDESC,%ebx # Destination - call read # Read it in - cmpb $VD_PRIMARY,%es:(%bx) # Primary VD? - je have_vd # Yes - pop %eax # Prepare to - inc %eax # try next - cmpb $VD_END,%es:(%bx) # Last VD? - jne load_vd # No, read next - mov $msg_novd,%si # No VD - jmp error # Halt -have_vd: # Have Primary VD -# -# Try to look up the loader binary using the paths in the loader_paths -# array. -# - mov $loader_paths,%si # Point to start of array -lookup_path: push %si # Save file name pointer - call lookup # Try to find file - pop %di # Restore file name pointer - jnc lookup_found # Found this file - push %es - mov %cs,%ax - mov %ax,%es - xor %al,%al # Look for next - mov $0xffff,%cx # path name by - repnz # scanning for - scasb # nul char - pop %es - mov %di,%si # Point %si at next path - mov (%si),%al # Get first char of next path - or %al,%al # Is it double nul? - jnz lookup_path # No, try it. - mov $msg_failed,%si # Failed message - jmp error # Halt -lookup_found: # Found a loader file -# -# Load the binary into the buffer. Due to real mode addressing limitations -# we have to read it in 64k chunks. -# - mov %es:DIR_SIZE(%bx),%eax # Read file length - add $SECTOR_SIZE-1,%eax # Convert length to sectors - shr $SECTOR_SHIFT,%eax - cmp $BUFFER_LEN,%eax - jbe load_sizeok - mov $msg_load2big,%si # Error message - jmp error -load_sizeok: movzbw %al,%cx # Num sectors to read - mov %es:DIR_EXTENT(%bx),%eax # Load extent - xor %edx,%edx - mov %es:DIR_EA_LEN(%bx),%dl - add %edx,%eax # Skip extended - mov $MEM_READ_BUFFER,%ebx # Read into the buffer -load_loop: mov %cl,%dh - cmp $MAX_READ_SEC,%cl # Truncate to max read size - jbe load_notrunc - mov $MAX_READ_SEC,%dh -load_notrunc: sub %dh,%cl # Update count - push %eax # Save - call read # Read it in - pop %eax # Restore - add $MAX_READ_SEC,%eax # Update LBA - add $MAX_READ,%ebx # Update dest addr - jcxz load_done # Done? - jmp load_loop # Keep going -load_done: -# -# Turn on the A20 address line -# - xor %ax,%ax # Turn A20 on - outb %al,$0xf2 - mov $0x02,%al - outb %al,$0xf6 -# -# Relocate the loader and BTX using a very lazy protected mode -# - mov $msg_relocate,%si # Display the - call putstr # relocation message - mov %es:(MEM_READ_BUFFER+AOUT_ENTRY),%edi # %edi is the destination - mov $(MEM_READ_BUFFER+AOUT_HEADER),%esi # %esi is - # the start of the text - # segment - mov %es:(MEM_READ_BUFFER+AOUT_TEXT),%ecx # %ecx = length of the text - # segment - push %edi # Save entry point for later - lgdt gdtdesc # setup our own gdt - cli # turn off interrupts - mov %cr0,%eax # Turn on - or $0x1,%al # protected - mov %eax,%cr0 # mode - ljmp $SEL_SCODE,$pm_start # long jump to clear the - # instruction pre-fetch queue - .code32 -pm_start: mov $SEL_SDATA,%ax # Initialize - mov %ax,%ds # %ds and - mov %ax,%es # %es to a flat selector - rep # Relocate the - movsb # text segment - add $(MEM_PAGE_SIZE - 1),%edi # pad %edi out to a new page - and $~(MEM_PAGE_SIZE - 1),%edi # for the data segment - mov MEM_READ_BUFFER+AOUT_DATA,%ecx # size of the data segment - rep # Relocate the - movsb # data segment - mov MEM_READ_BUFFER+AOUT_BSS,%ecx # size of the bss - xor %eax,%eax # zero %eax - add $3,%cl # round %ecx up to - shr $2,%ecx # a multiple of 4 - rep # zero the - stosl # bss - mov MEM_READ_BUFFER+AOUT_ENTRY,%esi # %esi -> relocated loader - add $MEM_BTX_OFFSET,%esi # %esi -> BTX in the loader - mov $MEM_BTX_ADDRESS,%edi # %edi -> where BTX needs to go - movzwl 0xa(%esi),%ecx # %ecx -> length of BTX - rep # Relocate - movsb # BTX - ljmp $SEL_SCODE16,$pm_16 # Jump to 16-bit PM - .code16 -pm_16: mov $SEL_RDATA,%ax # Initialize - mov %ax,%ds # %ds and - mov %ax,%es # %es to a real mode selector - mov %cr0,%eax # Turn off - and $~0x1,%al # protected - mov %eax,%cr0 # mode - ljmp $LOAD_SEG,$pm_end # Long jump to clear the - # instruction pre-fetch queue -pm_end: sti # Turn interrupts back on now -# -# Copy the BTX client to MEM_BTX_CLIENT -# - mov %cs,%ax - mov %ax,%ds - xor %ax,%ax - mov %ax,%es - mov $MEM_BTX_CLIENT,%di # Prepare to relocate - mov $btx_client,%si # the simple btx client - mov $(btx_client_end-btx_client),%cx # length of btx client - rep # Relocate the - movsb # simple BTX client -# -# Copy the boot[12] args to where the BTX client can see them -# - xor %ax,%ax - mov %ax,%ds - mov $MEM_ARG,%si # where the args are at now - mov $MEM_ARG_BTX,%di # where the args are moving to - mov $(MEM_ARG_SIZE/4),%cx # size of the arguments in longs - rep # Relocate - movsl # the words -# -# Save the entry point so the client can get to it later on -# - pop %eax # Restore saved entry point - stosl # and add it to the end of - # the arguments -# -# Now we just start up BTX and let it do the rest -# - mov $msg_jump,%si # Display the - call putstr # jump message - ljmp $0,$MEM_BTX_ENTRY # Jump to the BTX entry point - -# -# Lookup the file in the path at [SI] from the root directory. -# -# Trashes: All but BX -# Returns: CF = 0 (success), BX = pointer to record -# CF = 1 (not found) -# -lookup: mov $VD_ROOTDIR+MEM_VOLDESC,%bx # Root directory record - push %bx - push %si - mov $msg_lookup,%si # Display lookup message - call putstr - pop %si - push %si - call putstr - mov $msg_lookup2,%si - call putstr - pop %si - pop %bx -lookup_dir: lodsb # Get first char of path - cmp $0,%al # Are we done? - je lookup_done # Yes - cmp $'/',%al # Skip path separator. - je lookup_dir - dec %si # Undo lodsb side effect - call find_file # Lookup first path item - jnc lookup_dir # Try next component - mov $msg_lookupfail,%si # Not found message - push %bx - call putstr - pop %bx - stc # Set carry - ret -lookup_done: mov $msg_lookupok,%si # Success message - push %bx - call putstr - pop %bx - clc # Clear carry - ret - -# -# Lookup file at [SI] in directory whose record is at [BX]. -# -# Trashes: All but returns -# Returns: CF = 0 (success), BX = pointer to record, SI = next path item -# CF = 1 (not found), SI = preserved -# -find_file: mov %es:DIR_EXTENT(%bx),%eax # Load extent - xor %edx,%edx - mov %es:DIR_EA_LEN(%bx),%dl - add %edx,%eax # Skip extended attributes - mov %eax,rec_lba # Save LBA - mov %es:DIR_SIZE(%bx),%eax # Save size - mov %eax,rec_size - xor %cl,%cl # Zero length - push %si # Save -ff.namelen: inc %cl # Update length - lodsb # Read char - cmp $0,%al # Nul? - je ff.namedone # Yes - cmp $'/',%al # Path separator? - jnz ff.namelen # No, keep going -ff.namedone: dec %cl # Adjust length and save - mov %cl,name_len - pop %si # Restore -ff.load: mov rec_lba,%eax # Load LBA - mov $MEM_DIR,%ebx # Address buffer - mov $1,%dh # One sector - call read # Read directory block - incl rec_lba # Update LBA to next block -ff.scan: mov %ebx,%edx # Check for EOF - sub $MEM_DIR,%edx - cmp %edx,rec_size - ja ff.scan.1 - stc # EOF reached - ret -ff.scan.1: cmpb $0,%es:DIR_LEN(%bx) # Last record in block? - je ff.nextblock - push %si # Save - movzbw %es:DIR_NAMELEN(%bx),%si # Find end of string -ff.checkver: cmpb $'0',%es:DIR_NAME-1(%bx,%si) # Less than '0'? - jb ff.checkver.1 - cmpb $'9',%es:DIR_NAME-1(%bx,%si) # Greater than '9'? - ja ff.checkver.1 - dec %si # Next char - jnz ff.checkver - jmp ff.checklen # All numbers in name, so - # no version -ff.checkver.1: movzbw %es:DIR_NAMELEN(%bx),%cx - cmp %cx,%si # Did we find any digits? - je ff.checkdot # No - cmpb $';',%es:DIR_NAME-1(%bx,%si) # Check for semicolon - jne ff.checkver.2 - dec %si # Skip semicolon - mov %si,%cx - mov %cl,%es:DIR_NAMELEN(%bx) # Adjust length - jmp ff.checkdot -ff.checkver.2: mov %cx,%si # Restore %si to end of string -ff.checkdot: cmpb $'.',%es:DIR_NAME-1(%bx,%si) # Trailing dot? - jne ff.checklen # No - decb %es:DIR_NAMELEN(%bx) # Adjust length -ff.checklen: pop %si # Restore - movzbw name_len,%cx # Load length of name - cmp %cl,%es:DIR_NAMELEN(%bx) # Does length match? - je ff.checkname # Yes, check name -ff.nextrec: add %es:DIR_LEN(%bx),%bl # Next record - adc $0,%bh - jmp ff.scan -ff.nextblock: subl $SECTOR_SIZE,rec_size # Adjust size - jnc ff.load # If subtract ok, keep going - ret # End of file, so not found -ff.checkname: lea DIR_NAME(%bx),%di # Address name in record - push %si # Save - repe cmpsb # Compare name - je ff.match # We have a winner! - pop %si # Restore - jmp ff.nextrec # Keep looking. -ff.match: add $2,%sp # Discard saved %si - clc # Clear carry - ret - -# -# Load DH sectors starting at LBA EAX into [EBX]. -# -# Trashes: EAX -# -read: push %es # Save - push %bp - push %dx - push %cx - push %ebx - mov %bx,%bp # Set destination address - and $0x000f,%bp - shr $4,%ebx - mov %bx,%es - xor %bx,%bx # Set read bytes - mov %dh,%bl - shl $SECTOR_SHIFT,%bx # 2048 bytes/sec - mov %ax,%cx # Set LBA - shr $16,%eax - mov %ax,%dx -read.retry: mov $0x06,%ah # BIOS device read - mov drive,%al - and $0x7f,%al - call twiddle # Entertain the user - int $0x1b # Call BIOS - jc read.fail # Worked? - pop %ebx # Restore - pop %cx - pop %dx - pop %bp - pop %es - ret # Return -read.fail: cmp $ERROR_TIMEOUT,%ah # Timeout? - je read.retry # Yes, Retry. -read.error: mov %ah,%al # Save error - mov $hex_error,%di # Format it - call hex8 # as hex - mov $msg_badread,%si # Display Read error message - jmp error - -# -# Output the "twiddle" -# -twiddle: push %ax # Save - push %bx # Save - mov twiddle_index,%al # Load index - mov $twiddle_chars,%bx # Address table - inc %al # Next - and $3,%al # char - mov %al,twiddle_index # Save index for next call - xlat # Get char - call putc # Output it - pop %bx # Restore - pop %ax # Restore - ret - -# -# Convert AL to hex, saving the result to [EDI]. -# -hex8: pushl %eax # Save - shrb $0x4,%al # Do upper - call hex8.1 # 4 - popl %eax # Restore -hex8.1: andb $0xf,%al # Get lower 4 - cmpb $0xa,%al # Convert - sbbb $0x69,%al # to hex - das # digit - orb $0x20,%al # To lower case - mov %al,(%di) # Save char - inc %di - ret # (Recursive) - -# -# BTX client to start btxldr -# - .code32 -btx_client: mov $(MEM_ARG_BTX-MEM_BTX_CLIENT+MEM_ARG_SIZE-4), %esi - # %ds:(%esi) -> end - # of boot[12] args - mov $(MEM_ARG_SIZE/4),%ecx # Number of words to push - std # Go backwards -push_arg: lodsl # Read argument - push %eax # Push it onto the stack - loop push_arg # Push all of the arguments - cld # In case anyone depends on this - pushl MEM_ARG_BTX-MEM_BTX_CLIENT+MEM_ARG_SIZE # Entry point of - # the loader - push %eax # Emulate a near call - mov $0x1,%eax # 'exec' system call - int $INT_SYS # BTX system call -btx_client_end: - .code16 - - .p2align 4 -# -# Global descriptor table. -# -gdt: .word 0x0,0x0,0x0,0x0 # Null entry - .word 0xffff,0x0000,0x9200,0x00cf # SEL_SDATA - .word 0xffff,0x0000,0x9200,0x0000 # SEL_RDATA - .word 0xffff,LOAD_SEG<<4,0x9a00,0x00cf # SEL_SCODE (32-bit) - .word 0xffff,LOAD_SEG<<4,0x9a00,0x008f # SEL_SCODE16 (16-bit) -gdt.1: -# -# Pseudo-descriptors. -# -gdtdesc: .word gdt.1-gdt-1 # Limit - .long LOAD_SEG<<4 + gdt # Base - -# -# BOOT device -# -drive: .byte 0 -cylinder: .word 0 - -# -# State for searching dir -# -rec_lba: .long 0x0 # LBA (adjusted for EA) -rec_size: .long 0x0 # File size -name_len: .byte 0x0 # Length of current name - -cursor: .word 0 -twiddle_index: .byte 0x0 - -msg_welcome: .asciz "CD Loader 1.2\r\n\n" -msg_bootinfo: .asciz "Building the boot loader arguments\r\n" -msg_relocate: .asciz "Relocating the loader and the BTX\r\n" -msg_jump: .asciz "Starting the BTX loader\r\n" -msg_badread: .ascii "Read Error: 0x" -hex_error: .asciz "00\r\n" -msg_novd: .asciz "Could not find Primary Volume Descriptor\r\n" -msg_lookup: .asciz "Looking up " -msg_lookup2: .asciz "... " -msg_lookupok: .asciz "Found\r\n" -msg_lookupfail: .asciz "File not found\r\n" -msg_load2big: .asciz "File too big\r\n" -msg_failed: .asciz "Boot failed\r\n" -twiddle_chars: .ascii "|/-\\" -loader_paths: .asciz "/BOOT.PC98/LOADER" - .asciz "/boot.pc98/loader" - .asciz "/BOOT/LOADER" - .asciz "/boot/loader" - .byte 0 - -/* Boot signature */ - - .org SIG2_OFF,0x90 - - .word 0xaa55 # Magic number diff --git a/sys/boot/pc98/kgzldr/Makefile b/sys/boot/pc98/kgzldr/Makefile deleted file mode 100644 index 0070d70204a5..000000000000 --- a/sys/boot/pc98/kgzldr/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# $FreeBSD$ - -PROG= kgzldr.o -STRIP= -BINMODE=${LIBMODE} -BINDIR= ${LIBDIR} -MAN= - -SRCS= start.s boot.c inflate.c lib.c crt.s sio.s -CFLAGS= -Os -CFLAGS+=-DKZIP -NO_SHARED= -LDFLAGS=-Wl,-r -.PATH: ${.CURDIR}/../../../kern -.PATH: ${.CURDIR}/../../i386/kgzldr - -BOOT_COMCONSOLE_PORT?= 0x238 -AFLAGS+=--defsym SIO_PRT=${BOOT_COMCONSOLE_PORT} - -.include diff --git a/sys/boot/pc98/kgzldr/crt.s b/sys/boot/pc98/kgzldr/crt.s deleted file mode 100644 index 35c1fc2dfe73..000000000000 --- a/sys/boot/pc98/kgzldr/crt.s +++ /dev/null @@ -1,89 +0,0 @@ -# -# Copyright (c) 1999 Global Technology Associates, Inc. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS -# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, -# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT -# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# From: btx.s 1.10 1999/02/25 16:27:41 rnordier -# $FreeBSD$ -# - -# Screen defaults and assumptions. - - .set SCR_MAT,0xe1 # Mode/attribute - .set SCR_COL,0x50 # Columns per row - .set SCR_ROW,0x19 # Rows per screen - -# BIOS Data Area locations. - - .set BDA_POS,0x53e # Cursor position - - .globl crt_putchr - -# void crt_putchr(int c) - -crt_putchr: movb 0x4(%esp,1),%al # Get character - pusha # Save - xorl %ecx,%ecx # Zero for loops - movb $SCR_MAT,%ah # Mode/attribute - movl $BDA_POS,%ebx # BDA pointer - movw (%ebx),%dx # Cursor position - movl $0xa0000,%edi -crt_putchr.1: cmpb $0xa,%al # New line? - je crt_putchr.2 # Yes - movw %dx,%cx - movb %al,(%edi,%ecx,1) # Write char - addl $0x2000,%ecx - movb %ah,(%edi,%ecx,1) # Write attr - addw $0x02,%dx - jmp crt_putchr.3 -crt_putchr.2: movw %dx,%ax - movb $SCR_COL*2,%dl - div %dl - incb %al - mul %dl - movw %ax,%dx -crt_putchr.3: cmpw $SCR_ROW*SCR_COL*2,%dx - jb crt_putchr.4 # No - leal 2*SCR_COL(%edi),%esi # New top line - movw $(SCR_ROW-1)*SCR_COL/2,%cx # Words to move - rep # Scroll - movsl # screen - movb $' ',%al # Space - xorb %ah,%ah - movb $SCR_COL,%cl # Columns to clear - rep # Clear - stosw # line - movw $(SCR_ROW-1)*SCR_COL*2,%dx -crt_putchr.4: movw %dx,(%ebx) # Update position - shrw $1,%dx -crt_putchr.5: inb $0x60,%al # Move cursor - testb $0x04,%al - jz crt_putchr.5 - movb $0x49,%al - outb %al,$0x62 - movb %dl,%al - outb %al,$0x60 - movb %dh,%al - outb %al,$0x60 - popa # Restore - ret # To caller diff --git a/sys/boot/pc98/libpc98/Makefile b/sys/boot/pc98/libpc98/Makefile deleted file mode 100644 index f3e27a4c679d..000000000000 --- a/sys/boot/pc98/libpc98/Makefile +++ /dev/null @@ -1,51 +0,0 @@ -# $FreeBSD$ -# -LIB= pc98 -INTERNALLIB= - -.PATH: ${.CURDIR}/../../i386/libi386 - -SRCS= bioscd.c biosdisk.c biosmem.c biospnp.c \ - biospci.c biossmap.c bootinfo.c bootinfo32.c \ - comconsole.c devicename.c elf32_freebsd.c \ - i386_copy.c i386_module.c nullconsole.c pc98_sys.c pxe.c pxetramp.s \ - time.c vidconsole.c -.PATH: ${.CURDIR}/../../zfs -SRCS+= devicename_stubs.c - -# Enable PXE TFTP or NFS support, not both. -.if defined(LOADER_TFTP_SUPPORT) -CFLAGS+= -DLOADER_TFTP_SUPPORT -.else -CFLAGS+= -DLOADER_NFS_SUPPORT -.endif - -BOOT_COMCONSOLE_PORT?= 0x238 -CFLAGS+= -DCOMPORT=${BOOT_COMCONSOLE_PORT} - -BOOT_COMCONSOLE_SPEED?= 9600 -CFLAGS+= -DCOMSPEED=${BOOT_COMCONSOLE_SPEED} - -.ifdef(BOOT_BIOSDISK_DEBUG) -# Make the disk code more talkative -CFLAGS+= -DDISK_DEBUG -.endif - -# Include simple terminal emulation (cons25-compatible) -CFLAGS+= -DTERM_EMU - -# XXX: make alloca() useable -CFLAGS+= -Dalloca=__builtin_alloca - -CFLAGS+= -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/i386 \ - -I${.CURDIR}/../../common \ - -I${.CURDIR}/../btx/lib \ - -I${.CURDIR}/../../i386/libi386 \ - -I${.CURDIR}/../../.. -I. -# the location of libstand -CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/ - -# Handle FreeBSD specific %b and %D printf format specifiers -CFLAGS+= ${FORMAT_EXTENSIONS} - -.include diff --git a/sys/boot/pc98/libpc98/bioscd.c b/sys/boot/pc98/libpc98/bioscd.c deleted file mode 100644 index f259701f91e0..000000000000 --- a/sys/boot/pc98/libpc98/bioscd.c +++ /dev/null @@ -1,420 +0,0 @@ -/*- - * Copyright (c) 1998 Michael Smith - * Copyright (c) 2001 John H. Baldwin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -/* - * BIOS CD device handling for CD's that have been booted off of via no - * emulation booting as defined in the El Torito standard. - * - * Ideas and algorithms from: - * - * - FreeBSD libi386/biosdisk.c - * - */ - -#include - -#include -#include - -#include - -#include -#include -#include "libi386.h" - -#define BIOSCD_SECSIZE 2048 -#define BUFSIZE (1 * BIOSCD_SECSIZE) -#define MAXBCDEV 1 - -/* Major numbers for devices we frontend for. */ -#define ACDMAJOR 117 -#define CDMAJOR 15 - -#ifdef DISK_DEBUG -# define DEBUG(fmt, args...) printf("%s: " fmt "\n" , __func__ , ## args) -#else -# define DEBUG(fmt, args...) -#endif - -struct specification_packet { - u_char sp_size; - u_char sp_bootmedia; - u_char sp_drive; - u_char sp_controller; - u_int sp_lba; - u_short sp_devicespec; - u_short sp_buffersegment; - u_short sp_loadsegment; - u_short sp_sectorcount; - u_short sp_cylsec; - u_char sp_head; -}; - -/* - * List of BIOS devices, translation from disk unit number to - * BIOS unit number. - */ -static struct bcinfo { - int bc_unit; /* BIOS unit number */ - struct specification_packet bc_sp; - int bc_open; /* reference counter */ - void *bc_bcache; /* buffer cache data */ -} bcinfo [MAXBCDEV]; -static int nbcinfo = 0; - -#define BC(dev) (bcinfo[(dev)->d_unit]) - -static int bc_read(int unit, daddr_t dblk, int blks, caddr_t dest); -static int bc_init(void); -static int bc_strategy(void *devdata, int flag, daddr_t dblk, - size_t size, char *buf, size_t *rsize); -static int bc_realstrategy(void *devdata, int flag, daddr_t dblk, - size_t size, char *buf, size_t *rsize); -static int bc_open(struct open_file *f, ...); -static int bc_close(struct open_file *f); -static int bc_print(int verbose); - -struct devsw bioscd = { - "cd", - DEVT_CD, - bc_init, - bc_strategy, - bc_open, - bc_close, - noioctl, - bc_print, - NULL -}; - -/* - * Translate between BIOS device numbers and our private unit numbers. - */ -int -bc_bios2unit(int biosdev) -{ - int i; - - DEBUG("looking for bios device 0x%x", biosdev); - for (i = 0; i < nbcinfo; i++) { - DEBUG("bc unit %d is BIOS device 0x%x", i, bcinfo[i].bc_unit); - if (bcinfo[i].bc_unit == biosdev) - return(i); - } - return(-1); -} - -int -bc_unit2bios(int unit) -{ - if ((unit >= 0) && (unit < nbcinfo)) - return(bcinfo[unit].bc_unit); - return(-1); -} - -/* - * We can't quiz, we have to be told what device to use, so this functoin - * doesn't do anything. Instead, the loader calls bc_add() with the BIOS - * device number to add. - */ -static int -bc_init(void) -{ - - return (0); -} - -int -bc_add(int biosdev) -{ - - if (nbcinfo >= MAXBCDEV) - return (-1); - bcinfo[nbcinfo].bc_unit = biosdev; - - /* SCSI CD-ROM only */ - if ((biosdev & 0xf0) != 0xa0) - return (-1); - if ((((uint32_t *)PTOV(0xA1460))[biosdev & 0x0f] & 0x1f) != 5) - return (-1); - - printf("BIOS CD is cd%d\n", nbcinfo); - nbcinfo++; - bcache_add_dev(nbcinfo); /* register cd device in bcache */ - return(0); -} - -/* - * Print information about disks - */ -static int -bc_print(int verbose) -{ - char line[80]; - int i, ret = 0; - - if (nbcinfo == 0) - return (0); - - printf("%s devices:", bioscd.dv_name); - if ((ret = pager_output("\n")) != 0) - return (ret); - - for (i = 0; i < nbcinfo; i++) { - sprintf(line, " cd%d: Device 0x%x\n", i, - bcinfo[i].bc_sp.sp_devicespec); - if ((ret = pager_output(line)) != 0) - break; - } - return (ret); -} - -/* - * Attempt to open the disk described by (dev) for use by (f). - */ -static int -bc_open(struct open_file *f, ...) -{ - va_list ap; - struct i386_devdesc *dev; - - va_start(ap, f); - dev = va_arg(ap, struct i386_devdesc *); - va_end(ap); - if (dev->d_unit >= nbcinfo) { - DEBUG("attempt to open nonexistent disk"); - return(ENXIO); - } - - BC(dev).bc_open++; - if (BC(dev).bc_bcache == NULL) - BC(dev).bc_bcache = bcache_allocate(); - return(0); -} - -static int -bc_close(struct open_file *f) -{ - struct i386_devdesc *dev; - - dev = (struct i386_devdesc *)f->f_devdata; - BC(dev).bc_open--; - if (BC(dev).bc_open == 0) { - bcache_free(BC(dev).bc_bcache); - BC(dev).bc_bcache = NULL; - } - return(0); -} - -static int -bc_strategy(void *devdata, int rw, daddr_t dblk, size_t size, - char *buf, size_t *rsize) -{ - struct bcache_devdata bcd; - struct i386_devdesc *dev; - - dev = (struct i386_devdesc *)devdata; - bcd.dv_strategy = bc_realstrategy; - bcd.dv_devdata = devdata; - bcd.dv_cache = BC(dev).bc_bcache; - - return (bcache_strategy(&bcd, rw, dblk, size, buf, rsize)); -} - -static int -bc_realstrategy(void *devdata, int rw, daddr_t dblk, size_t size, - char *buf, size_t *rsize) -{ - struct i386_devdesc *dev; - int unit; - int blks; -#ifdef BD_SUPPORT_FRAGS - char fragbuf[BIOSCD_SECSIZE]; - size_t fragsize; - - fragsize = size % BIOSCD_SECSIZE; -#else - if (size % BIOSCD_SECSIZE) - return (EINVAL); -#endif - - if (rw != F_READ) - return(EROFS); - dev = (struct i386_devdesc *)devdata; - unit = dev->d_unit; - blks = size / BIOSCD_SECSIZE; - if (dblk % (BIOSCD_SECSIZE / DEV_BSIZE) != 0) - return (EINVAL); - dblk /= (BIOSCD_SECSIZE / DEV_BSIZE); - DEBUG("read %d from %lld to %p", blks, dblk, buf); - - if (rsize) - *rsize = 0; - if (blks && bc_read(unit, dblk, blks, buf)) { - DEBUG("read error"); - return (EIO); - } -#ifdef BD_SUPPORT_FRAGS - DEBUG("frag read %d from %lld+%d to %p", - fragsize, dblk, blks, buf + (blks * BIOSCD_SECSIZE)); - if (fragsize && bc_read(unit, dblk + blks, 1, fragbuf)) { - DEBUG("frag read error"); - return(EIO); - } - bcopy(fragbuf, buf + (blks * BIOSCD_SECSIZE), fragsize); -#endif - if (rsize) - *rsize = size; - return (0); -} - -/* Max number of sectors to bounce-buffer at a time. */ -#define CD_BOUNCEBUF 8 - -static int -bc_read(int unit, daddr_t dblk, int blks, caddr_t dest) -{ - u_int maxfer, resid, result, retry, x; - caddr_t bbuf, p, xp; - int biosdev; -#ifdef DISK_DEBUG - int error; -#endif - - /* Just in case some idiot actually tries to read -1 blocks... */ - if (blks < 0) - return (-1); - - /* If nothing to do, just return succcess. */ - if (blks == 0) - return (0); - - /* Decide whether we have to bounce */ - if (VTOP(dest) >> 20 != 0) { - /* - * The destination buffer is above first 1MB of - * physical memory so we have to arrange a suitable - * bounce buffer. - */ - x = min(CD_BOUNCEBUF, (unsigned)blks); - bbuf = alloca(x * BIOSCD_SECSIZE); - maxfer = x; - } else { - bbuf = NULL; - maxfer = 0; - } - - biosdev = bc_unit2bios(unit); - resid = blks; - p = dest; - - while (resid > 0) { - if (bbuf) - xp = bbuf; - else - xp = p; - x = resid; - if (maxfer > 0) - x = min(x, maxfer); - - /* - * Loop retrying the operation a couple of times. The BIOS - * may also retry. - */ - for (retry = 0; retry < 3; retry++) { - /* If retrying, reset the drive */ - if (retry > 0) { - v86.ctl = V86_FLAGS; - v86.addr = 0x1b; - v86.eax = 0x0300 | biosdev; - v86int(); - } - - v86.ctl = V86_FLAGS; - v86.addr = 0x1b; - v86.eax = 0x0600 | (biosdev & 0x7f); - v86.ebx = x * BIOSCD_SECSIZE; - v86.ecx = dblk & 0xffff; - v86.edx = (dblk >> 16) & 0xffff; - v86.ebp = VTOPOFF(xp); - v86.es = VTOPSEG(xp); - v86int(); - result = V86_CY(v86.efl); - if (result == 0) - break; - } - -#ifdef DISK_DEBUG - error = (v86.eax >> 8) & 0xff; -#endif - DEBUG("%d sectors from %lld to %p (0x%x) %s", x, dblk, p, - VTOP(p), result ? "failed" : "ok"); - DEBUG("unit %d status 0x%x", unit, error); - if (bbuf != NULL) - bcopy(bbuf, p, x * BIOSCD_SECSIZE); - p += (x * BIOSCD_SECSIZE); - dblk += x; - resid -= x; - } - -/* hexdump(dest, (blks * BIOSCD_SECSIZE)); */ - return(0); -} - -/* - * Return a suitable dev_t value for (dev). - */ -int -bc_getdev(struct i386_devdesc *dev) -{ - int biosdev, unit, device; - int major; - int rootdev; - - unit = dev->d_unit; - biosdev = bc_unit2bios(unit); - DEBUG("unit %d BIOS device %d", unit, biosdev); - if (biosdev == -1) /* not a BIOS device */ - return(-1); - - device = biosdev & 0xf0; - if (device == 0x80) - major = ACDMAJOR; - else if (device == 0xa0) - major = CDMAJOR; - else - return (-1); - - unit = 0; /* XXX */ - - /* XXX: Assume partition 'a'. */ - rootdev = MAKEBOOTDEV(major, 0, unit, 0); - DEBUG("dev is 0x%x\n", rootdev); - return(rootdev); -} diff --git a/sys/boot/pc98/libpc98/biosdisk.c b/sys/boot/pc98/libpc98/biosdisk.c deleted file mode 100644 index 86a550deeac8..000000000000 --- a/sys/boot/pc98/libpc98/biosdisk.c +++ /dev/null @@ -1,1120 +0,0 @@ -/*- - * Copyright (c) 1998 Michael Smith - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -/* - * BIOS disk device handling. - * - * Ideas and algorithms from: - * - * - NetBSD libi386/biosdisk.c - * - FreeBSD biosboot/disk.c - * - */ - -#include - -#include -#include -#include - -#include - -#include -#include -#include "libi386.h" - -#define BIOS_NUMDRIVES 0x475 -#define BIOSDISK_SECSIZE 512 -#define BUFSIZE (1 * BIOSDISK_SECSIZE) - -#define DT_ATAPI 0x10 /* disk type for ATAPI floppies */ -#define WDMAJOR 0 /* major numbers for devices we frontend for */ -#define WFDMAJOR 1 -#define FDMAJOR 2 -#define DAMAJOR 4 - -#ifdef DISK_DEBUG -# define DEBUG(fmt, args...) printf("%s: " fmt "\n" , __func__ , ## args) -#else -# define DEBUG(fmt, args...) -#endif - -struct open_disk { - int od_dkunit; /* disk unit number */ - int od_unit; /* BIOS unit number */ - int od_cyl; /* BIOS geometry */ - int od_hds; - int od_sec; - int od_boff; /* block offset from beginning of BIOS disk */ - int od_flags; -#define BD_MODEINT13 0x0000 -#define BD_MODEEDD1 0x0001 -#define BD_MODEEDD3 0x0002 -#define BD_MODEMASK 0x0003 -#define BD_FLOPPY 0x0004 -#define BD_LABELOK 0x0008 -#define BD_PARTTABOK 0x0010 -#define BD_OPTICAL 0x0020 - struct disklabel od_disklabel; - int od_nslices; /* slice count */ - struct pc98_partition od_slicetab[PC98_NPARTS]; -}; - -/* - * List of BIOS devices, translation from disk unit number to - * BIOS unit number. - */ -static struct bdinfo -{ - int bd_unit; /* BIOS unit number */ - int bd_flags; - int bd_type; /* BIOS 'drive type' (floppy only) */ - int bd_da_unit; /* kernel unit number for da */ - int bd_open; /* reference counter */ - void *bd_bcache; /* buffer cache data */ -} bdinfo [MAXBDDEV]; -static int nbdinfo = 0; - -#define BD(dev) (bdinfo[(dev)->d_unit]) - -static int bd_getgeom(struct open_disk *od); -static int bd_read(struct open_disk *od, daddr_t dblk, int blks, - caddr_t dest); -static int bd_write(struct open_disk *od, daddr_t dblk, int blks, - caddr_t dest); - -static int bd_int13probe(struct bdinfo *bd); - -static int bd_printslice(struct open_disk *od, struct pc98_partition *dp, - char *prefix, int verbose); -static int bd_printbsdslice(struct open_disk *od, daddr_t offset, - char *prefix, int verbose); - -static int bd_init(void); -static int bd_strategy(void *devdata, int flag, daddr_t dblk, - size_t size, char *buf, size_t *rsize); -static int bd_realstrategy(void *devdata, int flag, daddr_t dblk, - size_t size, char *buf, size_t *rsize); -static int bd_open(struct open_file *f, ...); -static int bd_close(struct open_file *f); -static int bd_print(int verbose); - -struct devsw biosdisk = { - "disk", - DEVT_DISK, - bd_init, - bd_strategy, - bd_open, - bd_close, - noioctl, - bd_print, - NULL -}; - -static int bd_opendisk(struct open_disk **odp, struct i386_devdesc *dev); -static void bd_closedisk(struct open_disk *od); -static int bd_open_pc98(struct open_disk *od, struct i386_devdesc *dev); -static int bd_bestslice(struct open_disk *od); -static void bd_checkextended(struct open_disk *od, int slicenum); - -/* - * Translate between BIOS device numbers and our private unit numbers. - */ -int -bd_bios2unit(int biosdev) -{ - int i; - - DEBUG("looking for bios device 0x%x", biosdev); - for (i = 0; i < nbdinfo; i++) { - DEBUG("bd unit %d is BIOS device 0x%x", i, bdinfo[i].bd_unit); - if (bdinfo[i].bd_unit == biosdev) - return(i); - } - return(-1); -} - -int -bd_unit2bios(int unit) -{ - if ((unit >= 0) && (unit < nbdinfo)) - return(bdinfo[unit].bd_unit); - return(-1); -} - -/* - * Quiz the BIOS for disk devices, save a little info about them. - */ -static int -bd_init(void) -{ - int base, unit; - int da_drive=0, n=-0x10; - - /* sequence 0x90, 0x80, 0xa0 */ - for (base = 0x90; base <= 0xa0; base += n, n += 0x30) { - for (unit = base; (nbdinfo < MAXBDDEV) || ((unit & 0x0f) < 4); unit++) { - bdinfo[nbdinfo].bd_open = 0; - bdinfo[nbdinfo].bd_bcache = NULL; - bdinfo[nbdinfo].bd_unit = unit; - bdinfo[nbdinfo].bd_flags = (unit & 0xf0) == 0x90 ? BD_FLOPPY : 0; - - if (!bd_int13probe(&bdinfo[nbdinfo])){ - if (((unit & 0xf0) == 0x90 && (unit & 0x0f) < 4) || - ((unit & 0xf0) == 0xa0 && (unit & 0x0f) < 6)) - continue; /* Target IDs are not contiguous. */ - else - break; - } - - if (bdinfo[nbdinfo].bd_flags & BD_FLOPPY){ - /* available 1.44MB access? */ - if (*(u_char *)PTOV(0xA15AE) & (1<<(unit & 0xf))) { - /* boot media 1.2MB FD? */ - if ((*(u_char *)PTOV(0xA1584) & 0xf0) != 0x90) - bdinfo[nbdinfo].bd_unit = 0x30 + (unit & 0xf); - } - } - else { - if ((unit & 0xF0) == 0xA0) /* SCSI HD or MO */ - bdinfo[nbdinfo].bd_da_unit = da_drive++; - } - /* XXX we need "disk aliases" to make this simpler */ - printf("BIOS drive %c: is disk%d\n", - 'A' + nbdinfo, nbdinfo); - nbdinfo++; - } - } - bcache_add_dev(nbdinfo); - return(0); -} - -/* - * Try to detect a device supported by the legacy int13 BIOS - */ -static int -bd_int13probe(struct bdinfo *bd) -{ - int addr; - - if (bd->bd_flags & BD_FLOPPY) { - addr = 0xa155c; - } else { - if ((bd->bd_unit & 0xf0) == 0x80) - addr = 0xa155d; - else - addr = 0xa1482; - } - if ( *(u_char *)PTOV(addr) & (1<<(bd->bd_unit & 0x0f))) { - bd->bd_flags |= BD_MODEINT13; - return(1); - } - if ((bd->bd_unit & 0xF0) == 0xA0) { - int media = ((unsigned *)PTOV(0xA1460))[bd->bd_unit & 0x0F] & 0x1F; - - if (media == 7) { /* MO */ - bd->bd_flags |= BD_MODEINT13 | BD_OPTICAL; - return(1); - } - } - return(0); -} - -/* - * Print information about disks - */ -static int -bd_print(int verbose) -{ - int i, j, ret = 0; - char line[80]; - struct i386_devdesc dev; - struct open_disk *od; - struct pc98_partition *dptr; - - if (nbdinfo == 0) - return (0); - - printf("%s devices:", biosdisk.dv_name); - if ((ret = pager_output("\n")) != 0) - return (ret); - - for (i = 0; i < nbdinfo; i++) { - snprintf(line, sizeof(line), " disk%d: BIOS drive %c:\n", - i, 'A' + i); - if ((ret = pager_output(line)) != 0) - break; - - /* try to open the whole disk */ - dev.d_unit = i; - dev.d_kind.biosdisk.slice = -1; - dev.d_kind.biosdisk.partition = -1; - - if (!bd_opendisk(&od, &dev)) { - - /* Do we have a partition table? */ - if (od->od_flags & BD_PARTTABOK) { - dptr = &od->od_slicetab[0]; - - /* Check for a "dedicated" disk */ - for (j = 0; j < od->od_nslices; j++) { - snprintf(line, sizeof(line), " disk%ds%d", i, j + 1); - if ((ret = bd_printslice(od, &dptr[j], line, verbose)) != 0) - break; - } - } - bd_closedisk(od); - if (ret != 0) - break; - } - } - return (ret); -} - -/* Given a size in 512 byte sectors, convert it to a human-readable number. */ -static char * -display_size(uint64_t size) -{ - static char buf[80]; - char unit; - - size /= 2; - unit = 'K'; - if (size >= 10485760000LL) { - size /= 1073741824; - unit = 'T'; - } else if (size >= 10240000) { - size /= 1048576; - unit = 'G'; - } else if (size >= 10000) { - size /= 1024; - unit = 'M'; - } - sprintf(buf, "%6ld%cB", (long)size, unit); - return (buf); -} - -/* - * Print information about slices on a disk. For the size calculations we - * assume a 512 byte sector. - */ -static int -bd_printslice(struct open_disk *od, struct pc98_partition *dp, char *prefix, - int verbose) -{ - int cylsecs, start, size; - char stats[80]; - char line[80]; - - cylsecs = od->od_hds * od->od_sec; - start = dp->dp_scyl * cylsecs + dp->dp_shd * od->od_sec + dp->dp_ssect; - size = (dp->dp_ecyl - dp->dp_scyl + 1) * cylsecs; - - if (verbose) - sprintf(stats, " %s (%d - %d)", display_size(size), - start, start + size); - else - stats[0] = '\0'; - - switch(dp->dp_mid & PC98_MID_MASK) { - case PC98_MID_386BSD: - return (bd_printbsdslice(od, start, prefix, verbose)); - case 0x00: /* unused partition */ - return (0); - case 0x01: - sprintf(line, "%s: FAT-12%s\n", prefix, stats); - break; - case 0x11: - case 0x20: - case 0x21: - case 0x22: - case 0x23: - case 0x24: - sprintf(line, "%s: FAT-16%s\n", prefix, stats); - break; - default: - sprintf(line, "%s: Unknown fs: 0x%x %s\n", prefix, dp->dp_mid, - stats); - } - return (pager_output(line)); -} - -/* - * Print out each valid partition in the disklabel of a FreeBSD slice. - * For size calculations, we assume a 512 byte sector size. - */ -static int -bd_printbsdslice(struct open_disk *od, daddr_t offset, char *prefix, - int verbose) -{ - char line[80]; - char buf[BIOSDISK_SECSIZE]; - struct disklabel *lp; - int i; - - /* read disklabel */ - if (bd_read(od, offset + LABELSECTOR, 1, buf)) - return (0); - lp =(struct disklabel *)(&buf[0]); - if (lp->d_magic != DISKMAGIC) { - sprintf(line, "%s: FFS bad disklabel\n", prefix); - return (pager_output(line)); - } - - /* Print partitions */ - for (i = 0; i < lp->d_npartitions; i++) { - /* - * For each partition, make sure we know what type of fs it is. If - * not, then skip it. However, since floppies often have bogus - * fstypes, print the 'a' partition on a floppy even if it is marked - * unused. - */ - if ((lp->d_partitions[i].p_fstype == FS_BSDFFS) || - (lp->d_partitions[i].p_fstype == FS_SWAP) || - (lp->d_partitions[i].p_fstype == FS_VINUM) || - ((lp->d_partitions[i].p_fstype == FS_UNUSED) && - (od->od_flags & BD_FLOPPY) && (i == 0))) { - - /* Only print out statistics in verbose mode */ - if (verbose) - sprintf(line, " %s%c: %s %s (%d - %d)\n", prefix, 'a' + i, - (lp->d_partitions[i].p_fstype == FS_SWAP) ? "swap " : - (lp->d_partitions[i].p_fstype == FS_VINUM) ? "vinum" : - "FFS ", - display_size(lp->d_partitions[i].p_size), - lp->d_partitions[i].p_offset, - lp->d_partitions[i].p_offset + lp->d_partitions[i].p_size); - else - sprintf(line, " %s%c: %s\n", prefix, 'a' + i, - (lp->d_partitions[i].p_fstype == FS_SWAP) ? "swap" : - (lp->d_partitions[i].p_fstype == FS_VINUM) ? "vinum" : - "FFS"); - if (pager_output(line)) - return (1); - } - } - return (0); -} - - -/* - * Attempt to open the disk described by (dev) for use by (f). - * - * Note that the philosophy here is "give them exactly what - * they ask for". This is necessary because being too "smart" - * about what the user might want leads to complications. - * (eg. given no slice or partition value, with a disk that is - * sliced - are they after the first BSD slice, or the DOS - * slice before it?) - */ -static int -bd_open(struct open_file *f, ...) -{ - va_list ap; - struct i386_devdesc *dev; - struct open_disk *od; - int error; - - va_start(ap, f); - dev = va_arg(ap, struct i386_devdesc *); - va_end(ap); - if ((error = bd_opendisk(&od, dev))) - return(error); - - BD(dev).bd_open++; - if (BD(dev).bd_bcache == NULL) - BD(dev).bd_bcache = bcache_allocate(); - - /* - * Save our context - */ - ((struct i386_devdesc *)(f->f_devdata))->d_kind.biosdisk.data = od; - DEBUG("open_disk %p, partition at 0x%x", od, od->od_boff); - return(0); -} - -static int -bd_opendisk(struct open_disk **odp, struct i386_devdesc *dev) -{ - struct open_disk *od; - int error; - - if (dev->d_unit >= nbdinfo) { - DEBUG("attempt to open nonexistent disk"); - return(ENXIO); - } - - od = (struct open_disk *)malloc(sizeof(struct open_disk)); - if (!od) { - DEBUG("no memory"); - return (ENOMEM); - } - - /* Look up BIOS unit number, intialise open_disk structure */ - od->od_dkunit = dev->d_unit; - od->od_unit = bdinfo[od->od_dkunit].bd_unit; - od->od_flags = bdinfo[od->od_dkunit].bd_flags; - od->od_boff = 0; - error = 0; - DEBUG("open '%s', unit 0x%x slice %d partition %d", - i386_fmtdev(dev), dev->d_unit, - dev->d_kind.biosdisk.slice, dev->d_kind.biosdisk.partition); - - /* Get geometry for this open (removable device may have changed) */ - if (bd_getgeom(od)) { - DEBUG("can't get geometry"); - error = ENXIO; - goto out; - } - - /* Determine disk layout. */ - error = bd_open_pc98(od, dev); - - out: - if (error) { - free(od); - } else { - *odp = od; /* return the open disk */ - } - return(error); -} - -static int -bd_open_pc98(struct open_disk *od, struct i386_devdesc *dev) -{ - struct pc98_partition *dptr; - struct disklabel *lp; - int sector, slice, i; - char buf[BUFSIZE]; - - /* - * Following calculations attempt to determine the correct value - * for d->od_boff by looking for the slice and partition specified, - * or searching for reasonable defaults. - */ - - /* - * Find the slice in the DOS slice table. - */ - od->od_nslices = 0; - if (od->od_flags & BD_FLOPPY) { - sector = 0; - goto unsliced; - } - if (bd_read(od, 0, 1, buf)) { - DEBUG("error reading MBR"); - return (EIO); - } - - /* - * Check the slice table magic. - */ - if (((u_char)buf[0x1fe] != 0x55) || ((u_char)buf[0x1ff] != 0xaa)) { - /* If a slice number was explicitly supplied, this is an error */ - if (dev->d_kind.biosdisk.slice > 0) { - DEBUG("no slice table/MBR (no magic)"); - return (ENOENT); - } - sector = 0; - goto unsliced; /* may be a floppy */ - } - if (bd_read(od, 1, 1, buf)) { - DEBUG("error reading MBR"); - return (EIO); - } - - /* - * copy the partition table, then pick up any extended partitions. - */ - bcopy(buf + PC98_PARTOFF, &od->od_slicetab, - sizeof(struct pc98_partition) * PC98_NPARTS); - od->od_nslices = PC98_NPARTS; /* extended slices start here */ - od->od_flags |= BD_PARTTABOK; - dptr = &od->od_slicetab[0]; - - /* Is this a request for the whole disk? */ - if (dev->d_kind.biosdisk.slice == -1) { - sector = 0; - goto unsliced; - } - - /* - * if a slice number was supplied but not found, this is an error. - */ - if (dev->d_kind.biosdisk.slice > 0) { - slice = dev->d_kind.biosdisk.slice - 1; - if (slice >= od->od_nslices) { - DEBUG("slice %d not found", slice); - return (ENOENT); - } - } - - /* Try to auto-detect the best slice; this should always give a slice number */ - if (dev->d_kind.biosdisk.slice == 0) { - slice = bd_bestslice(od); - if (slice == -1) { - return (ENOENT); - } - dev->d_kind.biosdisk.slice = slice; - } - - dptr = &od->od_slicetab[0]; - /* - * Accept the supplied slice number unequivocally (we may be looking - * at a DOS partition). - */ - dptr += (dev->d_kind.biosdisk.slice - 1); /* we number 1-4, offsets are 0-3 */ - sector = dptr->dp_scyl * od->od_hds * od->od_sec + - dptr->dp_shd * od->od_sec + dptr->dp_ssect; - { - int end = dptr->dp_ecyl * od->od_hds * od->od_sec + - dptr->dp_ehd * od->od_sec + dptr->dp_esect; - DEBUG("slice entry %d at %d, %d sectors", - dev->d_kind.biosdisk.slice - 1, sector, end-sector); - } - - /* - * If we are looking at a BSD slice, and the partition is < 0, assume the 'a' partition - */ - if ((dptr->dp_mid == DOSMID_386BSD) && (dev->d_kind.biosdisk.partition < 0)) - dev->d_kind.biosdisk.partition = 0; - - unsliced: - /* - * Now we have the slice offset, look for the partition in the disklabel if we have - * a partition to start with. - * - * XXX we might want to check the label checksum. - */ - if (dev->d_kind.biosdisk.partition < 0) { - od->od_boff = sector; /* no partition, must be after the slice */ - DEBUG("opening raw slice"); - } else { - - if (bd_read(od, sector + LABELSECTOR, 1, buf)) { - DEBUG("error reading disklabel"); - return (EIO); - } - DEBUG("copy %d bytes of label from %p to %p", sizeof(struct disklabel), buf + LABELOFFSET, &od->od_disklabel); - bcopy(buf + LABELOFFSET, &od->od_disklabel, sizeof(struct disklabel)); - lp = &od->od_disklabel; - od->od_flags |= BD_LABELOK; - - if (lp->d_magic != DISKMAGIC) { - DEBUG("no disklabel"); - return (ENOENT); - } - if (dev->d_kind.biosdisk.partition >= lp->d_npartitions) { - DEBUG("partition '%c' exceeds partitions in table (a-'%c')", - 'a' + dev->d_kind.biosdisk.partition, 'a' + lp->d_npartitions); - return (EPART); - } - -#ifdef DISK_DEBUG - /* Complain if the partition is unused unless this is a floppy. */ - if ((lp->d_partitions[dev->d_kind.biosdisk.partition].p_fstype == FS_UNUSED) && - !(od->od_flags & BD_FLOPPY)) - DEBUG("warning, partition marked as unused"); -#endif - - od->od_boff = - lp->d_partitions[dev->d_kind.biosdisk.partition].p_offset - - lp->d_partitions[RAW_PART].p_offset + - sector; - } - return (0); -} - -/* - * Search for a slice with the following preferences: - * - * 1: Active FreeBSD slice - * 2: Non-active FreeBSD slice - * 3: Active Linux slice - * 4: non-active Linux slice - * 5: Active FAT/FAT32 slice - * 6: non-active FAT/FAT32 slice - */ -#define PREF_RAWDISK 0 -#define PREF_FBSD_ACT 1 -#define PREF_FBSD 2 -#define PREF_LINUX_ACT 3 -#define PREF_LINUX 4 -#define PREF_DOS_ACT 5 -#define PREF_DOS 6 -#define PREF_NONE 7 - -/* - * slicelimit is in the range 0 .. PC98_NPARTS - */ -static int -bd_bestslice(struct open_disk *od) -{ - struct pc98_partition *dp; - int pref, preflevel; - int i, prefslice; - - prefslice = 0; - preflevel = PREF_NONE; - - dp = &od->od_slicetab[0]; - for (i = 0; i < od->od_nslices; i++, dp++) { - switch(dp->dp_mid & PC98_MID_MASK) { - case PC98_MID_386BSD: /* FreeBSD */ - if ((dp->dp_mid & PC98_MID_BOOTABLE) && - (preflevel > PREF_FBSD_ACT)) { - pref = i; - preflevel = PREF_FBSD_ACT; - } else if (preflevel > PREF_FBSD) { - pref = i; - preflevel = PREF_FBSD; - } - break; - - case 0x11: /* DOS/Windows */ - case 0x20: - case 0x21: - case 0x22: - case 0x23: - case 0x63: - if ((dp->dp_mid & PC98_MID_BOOTABLE) && - (preflevel > PREF_DOS_ACT)) { - pref = i; - preflevel = PREF_DOS_ACT; - } else if (preflevel > PREF_DOS) { - pref = i; - preflevel = PREF_DOS; - } - break; - } - } - return (prefslice); -} - -static int -bd_close(struct open_file *f) -{ - struct i386_devdesc *dev = f->f_devdata; - struct open_disk *od = (struct open_disk *)(dev->d_kind.biosdisk.data); - - BD(dev).bd_open--; - if (BD(dev).bd_open == 0) { - bcache_free(BD(dev).bd_bcache); - BD(dev).bd_bcache = NULL; - } - - bd_closedisk(od); - return(0); -} - -static void -bd_closedisk(struct open_disk *od) -{ - DEBUG("open_disk %p", od); -#if 0 - /* XXX is this required? (especially if disk already open...) */ - if (od->od_flags & BD_FLOPPY) - delay(3000000); -#endif - free(od); -} - -static int -bd_strategy(void *devdata, int rw, daddr_t dblk, size_t size, - char *buf, size_t *rsize) -{ - struct bcache_devdata bcd; - struct i386_devdesc *dev = devdata; - struct open_disk *od = (struct open_disk *)(dev->d_kind.biosdisk.data); - - bcd.dv_strategy = bd_realstrategy; - bcd.dv_devdata = devdata; - bcd.dv_cache = BD(dev).bd_bcache; - return(bcache_strategy(&bcd, rw, dblk+od->od_boff, size, buf, rsize)); -} - -static int -bd_realstrategy(void *devdata, int rw, daddr_t dblk, - size_t size, char *buf, size_t *rsize) -{ - struct open_disk *od = (struct open_disk *)(((struct i386_devdesc *)devdata)->d_kind.biosdisk.data); - int blks; -#ifdef BD_SUPPORT_FRAGS - char fragbuf[BIOSDISK_SECSIZE]; - size_t fragsize; - - fragsize = size % BIOSDISK_SECSIZE; -#else - if (size % BIOSDISK_SECSIZE) - panic("bd_strategy: %d bytes I/O not multiple of block size", size); -#endif - - DEBUG("open_disk %p", od); - blks = size / BIOSDISK_SECSIZE; - if (rsize) - *rsize = 0; - - switch(rw){ - case F_READ: - DEBUG("read %d from %d to %p", blks, dblk, buf); - - if (blks && bd_read(od, dblk, blks, buf)) { - DEBUG("read error"); - return (EIO); - } -#ifdef BD_SUPPORT_FRAGS - DEBUG("bd_strategy: frag read %d from %d+%d to %p", - fragsize, dblk, blks, buf + (blks * BIOSDISK_SECSIZE)); - if (fragsize && bd_read(od, dblk + blks, 1, fragsize)) { - DEBUG("frag read error"); - return(EIO); - } - bcopy(fragbuf, buf + (blks * BIOSDISK_SECSIZE), fragsize); -#endif - break; - case F_WRITE : - DEBUG("write %d from %d to %p", blks, dblk, buf); - - if (blks && bd_write(od, dblk, blks, buf)) { - DEBUG("write error"); - return (EIO); - } -#ifdef BD_SUPPORT_FRAGS - if(fragsize) { - DEBUG("Attempted to write a frag"); - return (EIO); - } -#endif - break; - default: - /* DO NOTHING */ - return (EROFS); - } - - if (rsize) - *rsize = size; - return (0); -} - -/* Max number of sectors to bounce-buffer if the request crosses a 64k boundary */ -#define FLOPPY_BOUNCEBUF 18 - -static int -bd_chs_io(struct open_disk *od, daddr_t dblk, int blks, caddr_t dest, int write) -{ - u_int x, bpc, cyl, hd, sec; - - bpc = (od->od_sec * od->od_hds); /* blocks per cylinder */ - x = dblk; - cyl = x / bpc; /* block # / blocks per cylinder */ - x %= bpc; /* block offset into cylinder */ - hd = x / od->od_sec; /* offset / blocks per track */ - sec = x % od->od_sec; /* offset into track */ - - v86.ctl = V86_FLAGS; - v86.addr = 0x1b; - if (write) - v86.eax = 0x0500 | od->od_unit; - else - v86.eax = 0x0600 | od->od_unit; - if (od->od_flags & BD_FLOPPY) { - v86.eax |= 0xd000; - v86.ecx = 0x0200 | (cyl & 0xff); - v86.edx = (hd << 8) | (sec + 1); - } else if (od->od_flags & BD_OPTICAL) { - v86.eax &= 0xFF7F; - v86.ecx = dblk & 0xFFFF; - v86.edx = dblk >> 16; - } else { - v86.ecx = cyl; - v86.edx = (hd << 8) | sec; - } - v86.ebx = blks * BIOSDISK_SECSIZE; - v86.es = VTOPSEG(dest); - v86.ebp = VTOPOFF(dest); - v86int(); - return (V86_CY(v86.efl)); -} - -static int -bd_io(struct open_disk *od, daddr_t dblk, int blks, caddr_t dest, int write) -{ - u_int x, sec, result, resid, retry, maxfer; - caddr_t p, xp, bbuf, breg; - - /* Just in case some idiot actually tries to read/write -1 blocks... */ - if (blks < 0) - return (-1); - - resid = blks; - p = dest; - - /* Decide whether we have to bounce */ - if (VTOP(dest) >> 20 != 0 || - ((VTOP(dest) >> 16) != (VTOP(dest + blks * BIOSDISK_SECSIZE) >> 16))) { - - /* - * There is a 64k physical boundary somewhere in the - * destination buffer, or the destination buffer is above - * first 1MB of physical memory so we have to arrange a - * suitable bounce buffer. Allocate a buffer twice as large - * as we need to. Use the bottom half unless there is a break - * there, in which case we use the top half. - */ - x = min(od->od_sec, (unsigned)blks); - bbuf = alloca(x * 2 * BIOSDISK_SECSIZE); - if (((u_int32_t)VTOP(bbuf) & 0xffff0000) == - ((u_int32_t)VTOP(bbuf + x * BIOSDISK_SECSIZE) & 0xffff0000)) { - breg = bbuf; - } else { - breg = bbuf + x * BIOSDISK_SECSIZE; - } - maxfer = x; /* limit transfers to bounce region size */ - } else { - breg = bbuf = NULL; - maxfer = 0; - } - - while (resid > 0) { - /* - * Play it safe and don't cross track boundaries. - * (XXX this is probably unnecessary) - */ - sec = dblk % od->od_sec; /* offset into track */ - x = min(od->od_sec - sec, resid); - if (maxfer > 0) - x = min(x, maxfer); /* fit bounce buffer */ - - /* where do we transfer to? */ - xp = bbuf == NULL ? p : breg; - - /* - * Put your Data In, Put your Data out, - * Put your Data In, and shake it all about - */ - if (write && bbuf != NULL) - bcopy(p, breg, x * BIOSDISK_SECSIZE); - - /* - * Loop retrying the operation a couple of times. The BIOS - * may also retry. - */ - for (retry = 0; retry < 3; retry++) { - /* if retrying, reset the drive */ - if (retry > 0) { - v86.ctl = V86_FLAGS; - v86.addr = 0x1b; - v86.eax = 0x0300 | od->od_unit; - v86int(); - } - - result = bd_chs_io(od, dblk, x, xp, write); - if (result == 0) - break; - } - - if (write) - DEBUG("Write %d sector(s) from %p (0x%x) to %lld %s", x, - p, VTOP(p), dblk, result ? "failed" : "ok"); - else - DEBUG("Read %d sector(s) from %lld to %p (0x%x) %s", x, - dblk, p, VTOP(p), result ? "failed" : "ok"); - if (result) { - return(-1); - } - if (!write && bbuf != NULL) - bcopy(breg, p, x * BIOSDISK_SECSIZE); - p += (x * BIOSDISK_SECSIZE); - dblk += x; - resid -= x; - } - -/* hexdump(dest, (blks * BIOSDISK_SECSIZE)); */ - return(0); -} - -static int -bd_read(struct open_disk *od, daddr_t dblk, int blks, caddr_t dest) -{ - - return (bd_io(od, dblk, blks, dest, 0)); -} - -static int -bd_write(struct open_disk *od, daddr_t dblk, int blks, caddr_t dest) -{ - - return (bd_io(od, dblk, blks, dest, 1)); -} - -static int -bd_getgeom(struct open_disk *od) -{ - - if (od->od_flags & BD_FLOPPY) { - od->od_cyl = 79; - od->od_hds = 2; - od->od_sec = (od->od_unit & 0xf0) == 0x30 ? 18 : 15; - } else if (od->od_flags & BD_OPTICAL) { - od->od_cyl = 0xFFFE; - od->od_hds = 8; - od->od_sec = 32; - } else { - v86.ctl = V86_FLAGS; - v86.addr = 0x1b; - v86.eax = 0x8400 | od->od_unit; - v86int(); - - od->od_cyl = v86.ecx; - od->od_hds = (v86.edx >> 8) & 0xff; - od->od_sec = v86.edx & 0xff; - if (V86_CY(v86.efl)) - return(1); - } - - DEBUG("unit 0x%x geometry %d/%d/%d", od->od_unit, od->od_cyl, od->od_hds, od->od_sec); - return(0); -} - -/* - * Return the BIOS geometry of a given "fixed drive" in a format - * suitable for the legacy bootinfo structure. Since the kernel is - * expecting raw int 0x13/0x8 values for N_BIOS_GEOM drives, we - * prefer to get the information directly, rather than rely on being - * able to put it together from information already maintained for - * different purposes and for a probably different number of drives. - * - * For valid drives, the geometry is expected in the format (31..0) - * "000000cc cccccccc hhhhhhhh 00ssssss"; and invalid drives are - * indicated by returning the geometry of a "1.2M" PC-format floppy - * disk. And, incidentally, what is returned is not the geometry as - * such but the highest valid cylinder, head, and sector numbers. - */ -u_int32_t -bd_getbigeom(int bunit) -{ - int hds = 0; - int unit = 0x80; /* IDE HDD */ - u_int addr = 0xA155d; - - while (unit < 0xa7) { - if (*(u_char *)PTOV(addr) & (1 << (unit & 0x0f))) - if (hds++ == bunit) - break; - - if (unit >= 0xA0) { - int media = ((unsigned *)PTOV(0xA1460))[unit & 0x0F] & 0x1F; - - if (media == 7 && hds++ == bunit) /* SCSI MO */ - return(0xFFFE0820); /* C:65535 H:8 S:32 */ - } - if (++unit == 0x84) { - unit = 0xA0; /* SCSI HDD */ - addr = 0xA1482; - } - } - if (unit == 0xa7) - return 0x4F020F; /* 1200KB FD C:80 H:2 S:15 */ - v86.ctl = V86_FLAGS; - v86.addr = 0x1b; - v86.eax = 0x8400 | unit; - v86int(); - if (V86_CY(v86.efl)) - return 0x4F020F; /* 1200KB FD C:80 H:2 S:15 */ - return ((v86.ecx & 0xffff) << 16) | (v86.edx & 0xffff); -} - -/* - * Return a suitable dev_t value for (dev). - * - * In the case where it looks like (dev) is a SCSI disk, we allow the number of - * IDE disks to be specified in $num_ide_disks. There should be a Better Way. - */ -int -bd_getdev(struct i386_devdesc *dev) -{ - struct open_disk *od; - int biosdev; - int major; - int rootdev; - char *nip, *cp; - int unitofs = 0, i, unit; - - biosdev = bd_unit2bios(dev->d_unit); - DEBUG("unit %d BIOS device %d", dev->d_unit, biosdev); - if (biosdev == -1) /* not a BIOS device */ - return(-1); - if (bd_opendisk(&od, dev) != 0) /* oops, not a viable device */ - return(-1); - - if ((biosdev & 0xf0) == 0x90 || (biosdev & 0xf0) == 0x30) { - /* floppy (or emulated floppy) or ATAPI device */ - if (bdinfo[dev->d_unit].bd_type == DT_ATAPI) { - /* is an ATAPI disk */ - major = WFDMAJOR; - } else { - /* is a floppy disk */ - major = FDMAJOR; - } - } else { - /* harddisk */ - if ((od->od_flags & BD_LABELOK) && (od->od_disklabel.d_type == DTYPE_SCSI)) { - /* label OK, disk labelled as SCSI */ - major = DAMAJOR; - /* check for unit number correction hint, now deprecated */ - if ((nip = getenv("num_ide_disks")) != NULL) { - i = strtol(nip, &cp, 0); - /* check for parse error */ - if ((cp != nip) && (*cp == 0)) - unitofs = i; - } - } else { - /* assume an IDE disk */ - major = WDMAJOR; - } - } - /* default root disk unit number */ - if ((biosdev & 0xf0) == 0xa0) - unit = bdinfo[dev->d_unit].bd_da_unit; - else - unit = biosdev & 0xf; - - /* XXX a better kludge to set the root disk unit number */ - if ((nip = getenv("root_disk_unit")) != NULL) { - i = strtol(nip, &cp, 0); - /* check for parse error */ - if ((cp != nip) && (*cp == 0)) - unit = i; - } - - rootdev = MAKEBOOTDEV(major, dev->d_kind.biosdisk.slice + 1, unit, - dev->d_kind.biosdisk.partition); - DEBUG("dev is 0x%x\n", rootdev); - return(rootdev); -} diff --git a/sys/boot/pc98/libpc98/biosmem.c b/sys/boot/pc98/libpc98/biosmem.c deleted file mode 100644 index c5a9b302b02f..000000000000 --- a/sys/boot/pc98/libpc98/biosmem.c +++ /dev/null @@ -1,64 +0,0 @@ -/*- - * Copyright (c) 1998 Michael Smith - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -/* - * Obtain memory configuration information from the BIOS - */ -#include -#include "libi386.h" -#include "btxv86.h" - -vm_offset_t memtop, memtop_copyin, high_heap_base; -uint32_t bios_basemem, bios_extmem, high_heap_size; - -/* - * The minimum amount of memory to reserve in bios_extmem for the heap. - */ -#define HEAP_MIN (64 * 1024 * 1024) - -void -bios_getmem(void) -{ - - bios_basemem = ((*(u_char *)PTOV(0xA1501) & 0x07) + 1) * 128 * 1024; - bios_extmem = *(u_char *)PTOV(0xA1401) * 128 * 1024 + - *(u_int16_t *)PTOV(0xA1594) * 1024 * 1024; - - /* Set memtop to actual top of memory */ - memtop = memtop_copyin = 0x100000 + bios_extmem; - - /* - * If we have extended memory, use the last 3MB of 'extended' memory - * as a high heap candidate. - */ - if (bios_extmem >= HEAP_MIN) { - high_heap_size = HEAP_MIN; - high_heap_base = memtop - HEAP_MIN; - } -} diff --git a/sys/boot/pc98/libpc98/biossmap.c b/sys/boot/pc98/libpc98/biossmap.c deleted file mode 100644 index 5a7a89fd3efb..000000000000 --- a/sys/boot/pc98/libpc98/biossmap.c +++ /dev/null @@ -1,38 +0,0 @@ -/*- - * Copyright (c) 2006 TAKAHASHI Yoshihiro - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include "libi386.h" - -void -bios_addsmapdata(struct preloaded_file *kfp) -{ - -} diff --git a/sys/boot/pc98/libpc98/comconsole.c b/sys/boot/pc98/libpc98/comconsole.c deleted file mode 100644 index 1bf2d6a2ccb7..000000000000 --- a/sys/boot/pc98/libpc98/comconsole.c +++ /dev/null @@ -1,367 +0,0 @@ -/*- - * Copyright (c) 1998 Michael Smith (msmith@freebsd.org) - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include "libi386.h" - -#define COMC_FMT 0x3 /* 8N1 */ -#define COMC_TXWAIT 0x40000 /* transmit timeout */ -#define COMC_BPS(x) (115200 / (x)) /* speed to DLAB divisor */ -#define COMC_DIV2BPS(x) (115200 / (x)) /* DLAB divisor to speed */ - -#ifndef COMPORT -#define COMPORT 0x238 -#endif -#ifndef COMSPEED -#define COMSPEED 9600 -#endif - -static void comc_probe(struct console *cp); -static int comc_init(int arg); -static void comc_putchar(int c); -static int comc_getchar(void); -static int comc_getspeed(void); -static int comc_ischar(void); -static int comc_parseint(const char *string); -static uint32_t comc_parse_pcidev(const char *string); -static int comc_pcidev_set(struct env_var *ev, int flags, - const void *value); -static int comc_pcidev_handle(uint32_t locator); -static int comc_port_set(struct env_var *ev, int flags, - const void *value); -static void comc_setup(int speed, int port); -static int comc_speed_set(struct env_var *ev, int flags, - const void *value); - -static int comc_curspeed; -static int comc_port = COMPORT; -static uint32_t comc_locator; - -struct console comconsole = { - "comconsole", - "serial port", - 0, - comc_probe, - comc_init, - comc_putchar, - comc_getchar, - comc_ischar -}; - -static void -comc_probe(struct console *cp) -{ - char intbuf[16]; - char *cons, *env; - int speed, port; - uint32_t locator; - - if (comc_curspeed == 0) { - comc_curspeed = COMSPEED; - /* - * Assume that the speed was set by an earlier boot loader if - * comconsole is already the preferred console. - */ - cons = getenv("console"); - if ((cons != NULL && strcmp(cons, comconsole.c_name) == 0) || - getenv("boot_multicons") != NULL) { - comc_curspeed = comc_getspeed(); - } - - env = getenv("comconsole_speed"); - if (env != NULL) { - speed = comc_parseint(env); - if (speed > 0) - comc_curspeed = speed; - } - - sprintf(intbuf, "%d", comc_curspeed); - unsetenv("comconsole_speed"); - env_setenv("comconsole_speed", EV_VOLATILE, intbuf, comc_speed_set, - env_nounset); - - env = getenv("comconsole_port"); - if (env != NULL) { - port = comc_parseint(env); - if (port > 0) - comc_port = port; - } - - sprintf(intbuf, "%d", comc_port); - unsetenv("comconsole_port"); - env_setenv("comconsole_port", EV_VOLATILE, intbuf, comc_port_set, - env_nounset); - - env = getenv("comconsole_pcidev"); - if (env != NULL) { - locator = comc_parse_pcidev(env); - if (locator != 0) - comc_pcidev_handle(locator); - } - - unsetenv("comconsole_pcidev"); - env_setenv("comconsole_pcidev", EV_VOLATILE, env, comc_pcidev_set, - env_nounset); - } - comc_setup(comc_curspeed, comc_port); -} - -static int -comc_init(int arg) -{ - - comc_setup(comc_curspeed, comc_port); - - if ((comconsole.c_flags & (C_PRESENTIN | C_PRESENTOUT)) == - (C_PRESENTIN | C_PRESENTOUT)) - return (CMD_OK); - return (CMD_ERROR); -} - -static void -comc_putchar(int c) -{ - int wait; - - for (wait = COMC_TXWAIT; wait > 0; wait--) - if (inb(comc_port + com_lsr) & LSR_TXRDY) { - outb(comc_port + com_data, (u_char)c); - break; - } -} - -static int -comc_getchar(void) -{ - return (comc_ischar() ? inb(comc_port + com_data) : -1); -} - -static int -comc_ischar(void) -{ - return (inb(comc_port + com_lsr) & LSR_RXRDY); -} - -static int -comc_speed_set(struct env_var *ev, int flags, const void *value) -{ - int speed; - - if (value == NULL || (speed = comc_parseint(value)) <= 0) { - printf("Invalid speed\n"); - return (CMD_ERROR); - } - - if (comc_curspeed != speed) - comc_setup(speed, comc_port); - - env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); - - return (CMD_OK); -} - -static int -comc_port_set(struct env_var *ev, int flags, const void *value) -{ - int port; - - if (value == NULL || (port = comc_parseint(value)) <= 0) { - printf("Invalid port\n"); - return (CMD_ERROR); - } - - if (comc_port != port) - comc_setup(comc_curspeed, port); - - env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); - - return (CMD_OK); -} - -/* - * Input: bus:dev:func[:bar]. If bar is not specified, it is 0x10. - * Output: bar[24:16] bus[15:8] dev[7:3] func[2:0] - */ -static uint32_t -comc_parse_pcidev(const char *string) -{ - char *p, *p1; - uint8_t bus, dev, func, bar; - uint32_t locator; - int pres; - - pres = strtol(string, &p, 0); - if (p == string || *p != ':' || pres < 0 ) - return (0); - bus = pres; - p1 = ++p; - - pres = strtol(p1, &p, 0); - if (p == string || *p != ':' || pres < 0 ) - return (0); - dev = pres; - p1 = ++p; - - pres = strtol(p1, &p, 0); - if (p == string || (*p != ':' && *p != '\0') || pres < 0 ) - return (0); - func = pres; - - if (*p == ':') { - p1 = ++p; - pres = strtol(p1, &p, 0); - if (p == string || *p != '\0' || pres <= 0 ) - return (0); - bar = pres; - } else - bar = 0x10; - - locator = (bar << 16) | biospci_locator(bus, dev, func); - return (locator); -} - -static int -comc_pcidev_handle(uint32_t locator) -{ - char intbuf[64]; - uint32_t port; - - if (biospci_read_config(locator & 0xffff, - (locator & 0xff0000) >> 16, 2, &port) == -1) { - printf("Cannot read bar at 0x%x\n", locator); - return (CMD_ERROR); - } - if (!PCI_BAR_IO(port)) { - printf("Memory bar at 0x%x\n", locator); - return (CMD_ERROR); - } - port &= PCIM_BAR_IO_BASE; - - sprintf(intbuf, "%d", port); - unsetenv("comconsole_port"); - env_setenv("comconsole_port", EV_VOLATILE, intbuf, - comc_port_set, env_nounset); - - comc_setup(comc_curspeed, port); - comc_locator = locator; - - return (CMD_OK); -} - -static int -comc_pcidev_set(struct env_var *ev, int flags, const void *value) -{ - uint32_t locator; - int error; - - if (value == NULL || (locator = comc_parse_pcidev(value)) <= 0) { - printf("Invalid pcidev\n"); - return (CMD_ERROR); - } - if ((comconsole.c_flags & (C_ACTIVEIN | C_ACTIVEOUT)) != 0 && - comc_locator != locator) { - error = comc_pcidev_handle(locator); - if (error != CMD_OK) - return (error); - } - env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); - return (CMD_OK); -} - -static void -comc_setup(int speed, int port) -{ - static int TRY_COUNT = 1000000; - char intbuf[64]; - int tries; - - unsetenv("hw.uart.console"); - comc_curspeed = speed; - comc_port = port; - if ((comconsole.c_flags & (C_ACTIVEIN | C_ACTIVEOUT)) == 0) - return; - - outb(comc_port + com_cfcr, CFCR_DLAB | COMC_FMT); - outb(comc_port + com_dlbl, COMC_BPS(speed) & 0xff); - outb(comc_port + com_dlbh, COMC_BPS(speed) >> 8); - outb(comc_port + com_cfcr, COMC_FMT); - outb(comc_port + com_mcr, MCR_RTS | MCR_DTR); - - tries = 0; - do - inb(comc_port + com_data); - while (inb(comc_port + com_lsr) & LSR_RXRDY && ++tries < TRY_COUNT); - - if (tries < TRY_COUNT) { - comconsole.c_flags |= (C_PRESENTIN | C_PRESENTOUT); - sprintf(intbuf, "io:%d,br:%d", comc_port, comc_curspeed); - env_setenv("hw.uart.console", EV_VOLATILE, intbuf, NULL, NULL); - } else - comconsole.c_flags &= ~(C_PRESENTIN | C_PRESENTOUT); -} - -static int -comc_parseint(const char *speedstr) -{ - char *p; - int speed; - - speed = strtol(speedstr, &p, 0); - if (p == speedstr || *p != '\0' || speed <= 0) - return (-1); - - return (speed); -} - -static int -comc_getspeed(void) -{ - u_int divisor; - u_char dlbh; - u_char dlbl; - u_char cfcr; - - cfcr = inb(comc_port + com_cfcr); - outb(comc_port + com_cfcr, CFCR_DLAB | cfcr); - - dlbl = inb(comc_port + com_dlbl); - dlbh = inb(comc_port + com_dlbh); - - outb(comc_port + com_cfcr, cfcr); - - divisor = dlbh << 8 | dlbl; - - /* XXX there should be more sanity checking. */ - if (divisor == 0) - return (COMSPEED); - return (COMC_DIV2BPS(divisor)); -} diff --git a/sys/boot/pc98/libpc98/libpc98.h b/sys/boot/pc98/libpc98/libpc98.h deleted file mode 100644 index 78b07a10ffa3..000000000000 --- a/sys/boot/pc98/libpc98/libpc98.h +++ /dev/null @@ -1,29 +0,0 @@ -/*- - * Copyright (c) 2009 TAKAHASHI Yoshihiro - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -void set_machine_type(void); diff --git a/sys/boot/pc98/libpc98/pc98_sys.c b/sys/boot/pc98/libpc98/pc98_sys.c deleted file mode 100644 index 7f66d02c630f..000000000000 --- a/sys/boot/pc98/libpc98/pc98_sys.c +++ /dev/null @@ -1,78 +0,0 @@ -/*- - * Copyright (c) 2009 TAKAHASHI Yoshihiro - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#define _KERNEL -#include - -/* - * Set machine type to PC98_SYSTEM_PARAMETER. - */ -void -set_machine_type(void) -{ - int i; - u_long ret, data; - - /* PC98_SYSTEM_PARAMETER (0x501) */ - ret = ((*(u_char *)PTOV(0xA1501)) & 0x08) >> 3; - - /* Wait V-SYNC */ - while (inb(0x60) & 0x20) {} - while (!(inb(0x60) & 0x20)) {} - - /* ANK 'A' font */ - outb(0xa1, 0x00); - outb(0xa3, 0x41); - - /* M_NORMAL, use CG window (all NEC OK) */ - for (i = data = 0; i < 4; i++) - data += *((u_long *)PTOV(0xA4000) + i); /* 0xa4000 */ - if (data == 0x6efc58fc) /* DA data */ - ret |= M_NEC_PC98; - else - ret |= M_EPSON_PC98; - ret |= (inb(0x42) & 0x20) ? M_8M : 0; - - /* PC98_SYSTEM_PARAMETER(0x400) */ - if ((*(u_char *)PTOV(0xA1400)) & 0x80) - ret |= M_NOTE; - if (ret & M_NEC_PC98) { - /* PC98_SYSTEM_PARAMETER(0x458) */ - if ((*(u_char *)PTOV(0xA1458)) & 0x80) - ret |= M_H98; - else - ret |= M_NOT_H98; - } else - ret |= M_NOT_H98; - - (*(u_long *)PTOV(0xA1620)) = ret; -} diff --git a/sys/boot/pc98/libpc98/time.c b/sys/boot/pc98/libpc98/time.c deleted file mode 100644 index 5d832bb45b7e..000000000000 --- a/sys/boot/pc98/libpc98/time.c +++ /dev/null @@ -1,98 +0,0 @@ -/*- - * Copyright (c) 1998 Michael Smith - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include "bootstrap.h" -#include "libi386.h" - -static int bios_seconds(void); - -/* - * Return the BIOS time-of-day value. - * - * XXX uses undocumented BCD support from libstand. - */ -static int -bios_seconds(void) -{ - int hr, minute, sec; - unsigned char bios_time[6]; - - v86.ctl = 0; - v86.addr = 0x1c; /* int 0x1c, function 0 */ - v86.eax = 0x0000; - v86.es = VTOPSEG(bios_time); - v86.ebx = VTOPOFF(bios_time); - v86int(); - - hr = bcd2bin(bios_time[3]); - minute = bcd2bin(bios_time[4]); - sec = bcd2bin(bios_time[5]); - - return (hr * 3600 + minute * 60 + sec); -} - -/* - * Return the time in seconds since the beginning of the day. - */ -time_t -time(time_t *t) -{ - static time_t lasttime; - time_t now; - - now = bios_seconds(); - - if (now < lasttime) - now += 24 * 3600; - lasttime = now; - - if (t != NULL) - *t = now; - return(now); -} - -/* - * Use the BIOS Wait function to pause for (period) microseconds. - * - * Resolution of this function is variable, but typically around - * 1ms. - */ -void -delay(int period) -{ - int i; - - period = (period + 500) / 1000; - for( ; period != 0 ; period--) - for(i=800;i != 0; i--) - outb(0x5f,0); /* wait 600ns */ -} diff --git a/sys/boot/pc98/libpc98/vidconsole.c b/sys/boot/pc98/libpc98/vidconsole.c deleted file mode 100644 index 7cf81e81a371..000000000000 --- a/sys/boot/pc98/libpc98/vidconsole.c +++ /dev/null @@ -1,596 +0,0 @@ -/*- - * Copyright (c) 1998 Michael Smith (msmith@freebsd.org) - * Copyright (c) 1997 Kazutaka YOKOTA (yokota@zodiac.mech.utsunomiya-u.ac.jp) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Id: probe_keyboard.c,v 1.13 1997/06/09 05:10:55 bde Exp - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include "libi386.h" - -#if KEYBOARD_PROBE -#include - -static int probe_keyboard(void); -#endif -static void vidc_probe(struct console *cp); -static int vidc_init(int arg); -static void vidc_putchar(int c); -static int vidc_getchar(void); -static int vidc_ischar(void); - -static int vidc_started; - -#ifdef TERM_EMU -#define MAXARGS 8 -#define DEFAULT_FGCOLOR 7 -#define DEFAULT_BGCOLOR 0 - -void end_term(void); -void bail_out(int c); -void vidc_term_emu(int c); -void get_pos(void); -void curs_move(int x, int y); -void write_char(int c, int fg, int bg); -void scroll_up(int rows, int fg, int bg); -void CD(void); -void CM(void); -void HO(void); - -static int args[MAXARGS], argc; -static int fg_c, bg_c, curx, cury; -static int esc; -#endif - -static unsigned short *crtat, *Crtat; -static int row = 25, col = 80; -#ifdef TERM_EMU -static u_int8_t ibmpc_to_pc98[256] = { - 0x01, 0x21, 0x81, 0xa1, 0x41, 0x61, 0xc1, 0xe1, - 0x09, 0x29, 0x89, 0xa9, 0x49, 0x69, 0xc9, 0xe9, - 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, - 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, - 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, - 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, - 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, - 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, - 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, - 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, - 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, - 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, - 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, - 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, - 0xe5, 0xe5, 0xe5, 0xe5, 0xe5, 0xe5, 0xe5, 0xe5, - 0xe5, 0xe5, 0xe5, 0xe5, 0xe5, 0xe5, 0xe5, 0xe5, - - 0x03, 0x23, 0x83, 0xa3, 0x43, 0x63, 0xc3, 0xe3, - 0x0b, 0x2b, 0x8b, 0xab, 0x4b, 0x6b, 0xcb, 0xeb, - 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, - 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, - 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, - 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, - 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, - 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, - 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, - 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, - 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, - 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, - 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, - 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, - 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, - 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, -}; -#define at2pc98(fg_at, bg_at) ibmpc_to_pc98[((bg_at) << 4) | (fg_at)] -#endif /* TERM_EMU */ - -struct console vidconsole = { - "vidconsole", - "internal video/keyboard", - 0, - vidc_probe, - vidc_init, - vidc_putchar, - vidc_getchar, - vidc_ischar -}; - -static void -vidc_probe(struct console *cp) -{ - - /* look for a keyboard */ -#if KEYBOARD_PROBE - if (probe_keyboard()) -#endif - { - - cp->c_flags |= C_PRESENTIN; - } - - /* XXX for now, always assume we can do BIOS screen output */ - cp->c_flags |= C_PRESENTOUT; -} - -static int -vidc_init(int arg) -{ - int i, hw_cursor; - - if (vidc_started && arg == 0) - return (0); - vidc_started = 1; - Crtat = (unsigned short *)PTOV(0xA0000); - while ((inb(0x60) & 0x04) == 0) - ; - outb(0x62, 0xe0); - while ((inb(0x60) & 0x01) == 0) - ; - hw_cursor = inb(0x62); - hw_cursor |= (inb(0x62) << 8); - inb(0x62); - inb(0x62); - inb(0x62); - crtat = Crtat + hw_cursor; -#ifdef TERM_EMU - /* Init terminal emulator */ - end_term(); - get_pos(); - curs_move(curx, cury); - fg_c = DEFAULT_FGCOLOR; - bg_c = DEFAULT_BGCOLOR; -#endif - for (i = 0; i < 10 && vidc_ischar(); i++) - (void)vidc_getchar(); - return (0); /* XXX reinit? */ -} - -static void -beep(void) -{ - - outb(0x37, 6); - delay(40000); - outb(0x37, 7); -} - -#if 0 -static void -vidc_biosputchar(int c) -{ - unsigned short *cp; - int i, pos; - -#ifdef TERM_EMU - *crtat = (c == 0x5c ? 0xfc : c); - *(crtat + 0x1000) = at2pc98(fg, bg); -#else - switch(c) { - case '\b': - crtat--; - break; - case '\r': - crtat -= (crtat - Crtat) % col; - break; - case '\n': - crtat += col; - break; - default: - *crtat = (c == 0x5c ? 0xfc : c); - *(crtat++ + 0x1000) = 0xe1; - break; - } - - if (crtat >= Crtat + col * row) { - cp = Crtat; - for (i = 1; i < row; i++) { - bcopy((void *)(cp + col), (void *)cp, col * 2); - cp += col; - } - for (i = 0; i < col; i++) { - *cp++ = ' '; - } - crtat -= col; - } - pos = crtat - Crtat; - while ((inb(0x60) & 0x04) == 0) {} - outb(0x62, 0x49); - outb(0x60, pos & 0xff); - outb(0x60, pos >> 8); -#endif -} -#endif - -static void -vidc_rawputchar(int c) -{ - int i; - - if (c == '\t') - /* lame tab expansion */ - for (i = 0; i < 8; i++) - vidc_rawputchar(' '); - else { - /* Emulate AH=0eh (teletype output) */ - switch(c) { - case '\a': - beep(); - return; - case '\r': - curx = 0; - curs_move(curx, cury); - return; - case '\n': - cury++; - if (cury > 24) { - scroll_up(1, fg_c, bg_c); - cury--; - } else { - curs_move(curx, cury); - } - return; - case '\b': - if (curx > 0) { - curx--; - curs_move(curx, cury); - /* write_char(' ', fg_c, bg_c); XXX destructive(!) */ - return; - } - return; - default: - write_char(c, fg_c, bg_c); - curx++; - if (curx > 79) { - curx = 0; - cury++; - } - if (cury > 24) { - curx = 0; - scroll_up(1, fg_c, bg_c); - cury--; - } - } - curs_move(curx, cury); - } -} - -#ifdef TERM_EMU - -/* Get cursor position on the screen. Result is in edx. Sets - * curx and cury appropriately. - */ -void -get_pos(void) -{ - int pos = crtat - Crtat; - - curx = pos % col; - cury = pos / col; -} - -/* Move cursor to x rows and y cols (0-based). */ -void -curs_move(int x, int y) -{ - int pos; - - pos = x + y * col; - crtat = Crtat + pos; - pos = crtat - Crtat; - while((inb(0x60) & 0x04) == 0) {} - outb(0x62, 0x49); - outb(0x60, pos & 0xff); - outb(0x60, pos >> 8); - curx = x; - cury = y; -#define isvisible(c) (((c) >= 32) && ((c) < 255)) - if (!isvisible(*crtat & 0x00ff)) { - write_char(' ', fg_c, bg_c); - } -} - -/* Scroll up the whole window by a number of rows. If rows==0, - * clear the window. fg and bg are attributes for the new lines - * inserted in the window. - */ -void -scroll_up(int rows, int fgcol, int bgcol) -{ - unsigned short *cp; - int i; - - if (rows == 0) - rows = 25; - cp = Crtat; - for (i = rows; i < row; i++) { - bcopy((void *)(cp + col), (void *)cp, col * 2); - cp += col; - } - for (i = 0; i < col; i++) { - *(cp + 0x1000) = at2pc98(fgcol, bgcol); - *cp++ = ' '; - } -} - -/* Write character and attribute at cursor position. */ -void -write_char(int c, int fgcol, int bgcol) -{ - - *crtat = (c == 0x5c ? 0xfc : (c & 0xff)); - *(crtat + 0x1000) = at2pc98(fgcol, bgcol); -} - -/**************************************************************/ -/* - * Screen manipulation functions. They use accumulated data in - * args[] and argc variables. - * - */ - -/* Clear display from current position to end of screen */ -void -CD(void) -{ - int pos; - - get_pos(); - for (pos = 0; crtat + pos <= Crtat + col * row; pos++) { - *(crtat + pos) = ' '; - *(crtat + pos + 0x1000) = at2pc98(fg_c, bg_c); - } - end_term(); -} - -/* Absolute cursor move to args[0] rows and args[1] columns - * (the coordinates are 1-based). - */ -void -CM(void) -{ - - if (args[0] > 0) - args[0]--; - if (args[1] > 0) - args[1]--; - curs_move(args[1], args[0]); - end_term(); -} - -/* Home cursor (left top corner) */ -void -HO(void) -{ - - argc = 1; - args[0] = args[1] = 1; - CM(); -} - -/* Clear internal state of the terminal emulation code */ -void -end_term(void) -{ - - esc = 0; - argc = -1; -} - -/* Gracefully exit ESC-sequence processing in case of misunderstanding */ -void -bail_out(int c) -{ - char buf[16], *ch; - int i; - - if (esc) { - vidc_rawputchar('\033'); - if (esc != '\033') - vidc_rawputchar(esc); - for (i = 0; i <= argc; ++i) { - sprintf(buf, "%d", args[i]); - ch = buf; - while (*ch) - vidc_rawputchar(*ch++); - } - } - vidc_rawputchar(c); - end_term(); -} - -static void -get_arg(int c) -{ - - if (argc < 0) - argc = 0; - args[argc] *= 10; - args[argc] += c - '0'; -} - -/* Emulate basic capabilities of cons25 terminal */ -void -vidc_term_emu(int c) -{ - static int ansi_col[] = { - 0, 4, 2, 6, 1, 5, 3, 7, - }; - int t; - int i; - - switch (esc) { - case 0: - switch (c) { - case '\033': - esc = c; - break; - default: - vidc_rawputchar(c); - break; - } - break; - - case '\033': - switch (c) { - case '[': - esc = c; - args[0] = 0; - argc = -1; - break; - default: - bail_out(c); - break; - } - break; - - case '[': - switch (c) { - case ';': - if (argc < 0) /* XXX */ - argc = 0; - else if (argc + 1 >= MAXARGS) - bail_out(c); - else - args[++argc] = 0; - break; - case 'H': - if (argc < 0) - HO(); - else if (argc == 1) - CM(); - else - bail_out(c); - break; - case 'J': - if (argc < 0) - CD(); - else - bail_out(c); - break; - case 'm': - if (argc < 0) { - fg_c = DEFAULT_FGCOLOR; - bg_c = DEFAULT_BGCOLOR; - } - for (i = 0; i <= argc; ++i) { - switch (args[i]) { - case 0: /* back to normal */ - fg_c = DEFAULT_FGCOLOR; - bg_c = DEFAULT_BGCOLOR; - break; - case 1: /* bold */ - fg_c |= 0x8; - break; - case 4: /* underline */ - case 5: /* blink */ - bg_c |= 0x8; - break; - case 7: /* reverse */ - t = fg_c; - fg_c = bg_c; - bg_c = t; - break; - case 30: case 31: case 32: case 33: - case 34: case 35: case 36: case 37: - fg_c = ansi_col[args[i] - 30]; - break; - case 39: /* normal */ - fg_c = DEFAULT_FGCOLOR; - break; - case 40: case 41: case 42: case 43: - case 44: case 45: case 46: case 47: - bg_c = ansi_col[args[i] - 40]; - break; - case 49: /* normal */ - bg_c = DEFAULT_BGCOLOR; - break; - } - } - end_term(); - break; - default: - if (isdigit(c)) - get_arg(c); - else - bail_out(c); - break; - } - break; - - default: - bail_out(c); - break; - } -} -#endif - -static void -vidc_putchar(int c) -{ -#ifdef TERM_EMU - vidc_term_emu(c); -#else - vidc_rawputchar(c); -#endif -} - -static int -vidc_getchar(void) -{ - - if (vidc_ischar()) { - v86.ctl = 0; - v86.addr = 0x18; - v86.eax = 0x0; - v86int(); - return (v86.eax & 0xff); - } else { - return (-1); - } -} - -static int -vidc_ischar(void) -{ - - v86.ctl = 0; - v86.addr = 0x18; - v86.eax = 0x100; - v86int(); - return ((v86.ebx >> 8) & 0x1); -} - -#if KEYBOARD_PROBE -static int -probe_keyboard(void) -{ - return (*(u_char *)PTOV(0xA1481) & 0x48); -} -#endif /* KEYBOARD_PROBE */ diff --git a/sys/boot/pc98/loader/Makefile b/sys/boot/pc98/loader/Makefile deleted file mode 100644 index d75e8d04e284..000000000000 --- a/sys/boot/pc98/loader/Makefile +++ /dev/null @@ -1,99 +0,0 @@ -# $FreeBSD$ - -.include -MK_SSP= no -MAN= - -LOADER?= loader -PROG= ${LOADER}.sym -INTERNALPROG= -NEWVERSWHAT= "bootstrap loader" pc98 -VERSION_FILE= ${.CURDIR}/../../i386/loader/version - -# architecture-specific loader code -SRCS= main.c conf.c vers.c -.PATH: ${.CURDIR}/../../i386/loader - -# Enable PXE TFTP or NFS support, not both. -.if defined(LOADER_TFTP_SUPPORT) -CFLAGS+= -DLOADER_TFTP_SUPPORT -.else -CFLAGS+= -DLOADER_NFS_SUPPORT -.endif - -# Include bcache code. -HAVE_BCACHE= yes - -# Enable PnP and ISA-PnP code. -HAVE_PNP= yes -HAVE_ISABUS= yes - -.if ${MK_FORTH} != "no" -# Enable BootForth -BOOT_FORTH= yes -CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/i386 -LIBFICL= ${.OBJDIR}/../../ficl/libficl.a -.endif - -.if defined(LOADER_BZIP2_SUPPORT) -CFLAGS+= -DLOADER_BZIP2_SUPPORT -.endif -.if !defined(LOADER_NO_GZIP_SUPPORT) -CFLAGS+= -DLOADER_GZIP_SUPPORT -.endif - -# Always add MI sources -.PATH: ${.CURDIR}/../../common -.include "${.CURDIR}/../../common/Makefile.inc" -CFLAGS+= -I${.CURDIR}/../../common -CFLAGS+= -I${.CURDIR}/../../i386 -CFLAGS+= -I. - -CLEANFILES= ${LOADER} ${LOADER}.bin loader.help - -CFLAGS+= -Wall -LDFLAGS= -static -Ttext 0x0 - -# pc98 standalone support library -LIBPC98= ${.OBJDIR}/../libpc98/libpc98.a -CFLAGS+= -I${.CURDIR}/.. - -LIBSTAND= ${.OBJDIR}/../../libstand32/libstand.a - -# BTX components -CFLAGS+= -I${.CURDIR}/../btx/lib - -# Debug me! -#CFLAGS+= -g -#LDFLAGS+= -g - -# Pick up ../Makefile.inc early. -.include - -${LOADER}: ${LOADER}.bin ${BTXLDR} ${BTXKERN} - btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \ - -b ${BTXKERN} ${LOADER}.bin - -${LOADER}.bin: ${LOADER}.sym - cp ${.ALLSRC} ${.TARGET} - strip -R .comment -R .note ${.TARGET} - -loader.help: help.common help.pc98 - cat ${.ALLSRC} | awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET} - -FILES= ${LOADER} -# XXX INSTALLFLAGS_loader= -b -FILESMODE_${LOADER}= ${BINMODE} -b - -.PATH: ${.CURDIR}/../../forth -.include "${.CURDIR}/../../forth/Makefile.inc" - -FILES+= ${.CURDIR}/../../i386/loader/loader.rc menu.rc - -# XXX crt0.o needs to be first for pxeboot(8) to work -OBJS= ${BTXCRT} - -DPADD= ${LIBFICL} ${LIBPC98} ${LIBSTAND} -LDADD= ${LIBFICL} ${LIBPC98} ${LIBSTAND} - -.include diff --git a/sys/boot/pc98/loader/conf.c b/sys/boot/pc98/loader/conf.c deleted file mode 100644 index 695c2604c03a..000000000000 --- a/sys/boot/pc98/loader/conf.c +++ /dev/null @@ -1,116 +0,0 @@ -/*- - * Copyright (c) 1998 Michael Smith - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include "libi386/libi386.h" - -/* - * We could use linker sets for some or all of these, but - * then we would have to control what ended up linked into - * the bootstrap. So it's easier to conditionalise things - * here. - * - * XXX rename these arrays to be consistent and less namespace-hostile - * - * XXX as libi386 and biosboot merge, some of these can become linker sets. - */ - -/* Exported for libstand */ -struct devsw *devsw[] = { - &bioscd, - &biosdisk, -#if defined(LOADER_NFS_SUPPORT) || defined(LOADER_TFTP_SUPPORT) - &pxedisk, -#endif - NULL -}; - -struct fs_ops *file_system[] = { - &ufs_fsops, - &ext2fs_fsops, - &dosfs_fsops, - &cd9660_fsops, -#ifdef LOADER_NFS_SUPPORT - &nfs_fsops, -#endif -#ifdef LOADER_TFTP_SUPPORT - &tftp_fsops, -#endif -#ifdef LOADER_GZIP_SUPPORT - &gzipfs_fsops, -#endif -#ifdef LOADER_BZIP2_SUPPORT - &bzipfs_fsops, -#endif - &splitfs_fsops, - NULL -}; - -/* Exported for i386 only */ -/* - * Sort formats so that those that can detect based on arguments - * rather than reading the file go first. - */ -extern struct file_format i386_elf; -extern struct file_format i386_elf_obj; - -struct file_format *file_formats[] = { - &i386_elf, - &i386_elf_obj, - NULL -}; - -/* - * Consoles - * - * We don't prototype these in libi386.h because they require - * data structures from bootstrap.h as well. - */ -extern struct console vidconsole; -extern struct console comconsole; -extern struct console nullconsole; - -struct console *consoles[] = { - &vidconsole, - &comconsole, - &nullconsole, - NULL -}; - -extern struct pnphandler isapnphandler; -extern struct pnphandler biospnphandler; -extern struct pnphandler biospcihandler; - -struct pnphandler *pnphandlers[] = { - &biospnphandler, /* should go first, as it may set isapnp_readport */ - &isapnphandler, - &biospcihandler, - NULL -}; diff --git a/sys/boot/pc98/loader/help.pc98 b/sys/boot/pc98/loader/help.pc98 deleted file mode 100644 index 4b9197ce5074..000000000000 --- a/sys/boot/pc98/loader/help.pc98 +++ /dev/null @@ -1,38 +0,0 @@ -################################################################################ -# Treboot DReboot the system - - reboot - - Causes the system to immediately reboot. - -################################################################################ -# Theap DDisplay memory management statistics - - heap - - Requests debugging output from the heap manager. For debugging use - only. - -################################################################################ -# Tset Snum_ide_disks DSet the number of IDE disks - - NOTE: this variable is deprecated, use root_disk_unit instead. - - set num_ide_disks= - - When booting from a SCSI disk on a system with one or more IDE disks, - and where the IDE disks are the default boot device, it is necessary - to tell the kernel how many IDE disks there are in order to have it - correctly locate the SCSI disk you are booting from. - -################################################################################ -# Tset Sroot_disk_unit DForce the root disk unit number. - - set root_disk_unit= - - If the code which detects the disk unit number for the root disk is - confused, eg. by a mix of SCSI and IDE disks, or IDE disks with - gaps in the sequence (eg. no primary slave), the unit number can be - forced by setting this variable. - -################################################################################ diff --git a/sys/boot/pc98/loader/main.c b/sys/boot/pc98/loader/main.c deleted file mode 100644 index c31cc842a035..000000000000 --- a/sys/boot/pc98/loader/main.c +++ /dev/null @@ -1,322 +0,0 @@ -/*- - * Copyright (c) 1998 Michael Smith - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -/* - * MD bootstrap main() and assorted miscellaneous - * commands. - */ - -#include -#include -#include -#include -#include -#include -#include - -#include "bootstrap.h" -#include "common/bootargs.h" -#include "libi386/libi386.h" -#include "libpc98/libpc98.h" -#include "btxv86.h" - -CTASSERT(sizeof(struct bootargs) == BOOTARGS_SIZE); -CTASSERT(offsetof(struct bootargs, bootinfo) == BA_BOOTINFO); -CTASSERT(offsetof(struct bootargs, bootflags) == BA_BOOTFLAGS); -CTASSERT(offsetof(struct bootinfo, bi_size) == BI_SIZE); - -/* Arguments passed in from the boot1/boot2 loader */ -static struct bootargs *kargs; - -static u_int32_t initial_howto; -static u_int32_t initial_bootdev; -static struct bootinfo *initial_bootinfo; - -struct arch_switch archsw; /* MI/MD interface boundary */ - -static void extract_currdev(void); -static int isa_inb(int port); -static void isa_outb(int port, int value); -void exit(int code); - -/* from vers.c */ -extern char bootprog_info[]; - -/* XXX debugging */ -extern char end[]; - -static void *heap_top; -static void *heap_bottom; - -static uint64_t -pc98_loadaddr(u_int type, void *data, uint64_t addr) -{ - struct stat st; - - if (type == LOAD_ELF) - return (roundup(addr, PAGE_SIZE)); - - /* We cannot use 15M-16M area on pc98. */ - if (type == LOAD_RAW && addr < 0x1000000 && stat(data, &st) == 0 && - (st.st_size == -1 || addr + st.st_size > 0xf00000)) - addr = 0x1000000; - return (addr); -} - -int -main(void) -{ - int i; - - /* Set machine type to PC98_SYSTEM_PARAMETER. */ - set_machine_type(); - - /* Pick up arguments */ - kargs = (void *)__args; - initial_howto = kargs->howto; - initial_bootdev = kargs->bootdev; - initial_bootinfo = kargs->bootinfo ? (struct bootinfo *)PTOV(kargs->bootinfo) : NULL; - - /* Initialize the v86 register set to a known-good state. */ - bzero(&v86, sizeof(v86)); - v86.efl = PSL_RESERVED_DEFAULT | PSL_I; - - /* - * Initialise the heap as early as possible. Once this is done, malloc() is usable. - */ - bios_getmem(); - -#if defined(LOADER_BZIP2_SUPPORT) - if (high_heap_size > 0) { - heap_top = PTOV(high_heap_base + high_heap_size); - heap_bottom = PTOV(high_heap_base); - if (high_heap_base < memtop_copyin) - memtop_copyin = high_heap_base; - } else -#endif - { - heap_top = (void *)PTOV(bios_basemem); - heap_bottom = (void *)end; - } - setheap(heap_bottom, heap_top); - - /* - * XXX Chicken-and-egg problem; we want to have console output early, but some - * console attributes may depend on reading from eg. the boot device, which we - * can't do yet. - * - * We can use printf() etc. once this is done. - * If the previous boot stage has requested a serial console, prefer that. - */ - bi_setboothowto(initial_howto); - if (initial_howto & RB_MULTIPLE) { - if (initial_howto & RB_SERIAL) - setenv("console", "comconsole vidconsole", 1); - else - setenv("console", "vidconsole comconsole", 1); - } else if (initial_howto & RB_SERIAL) - setenv("console", "comconsole", 1); - else if (initial_howto & RB_MUTE) - setenv("console", "nullconsole", 1); - cons_probe(); - - /* - * Initialise the block cache. Set the upper limit. - */ - bcache_init(32768, 512); - - /* - * Special handling for PXE and CD booting. - */ - if (kargs->bootinfo == 0) { - /* - * We only want the PXE disk to try to init itself in the below - * walk through devsw if we actually booted off of PXE. - */ - if (kargs->bootflags & KARGS_FLAGS_PXE) - pxe_enable(kargs->pxeinfo ? PTOV(kargs->pxeinfo) : NULL); - else if (kargs->bootflags & KARGS_FLAGS_CD) - bc_add(initial_bootdev); - } - - archsw.arch_autoload = i386_autoload; - archsw.arch_getdev = i386_getdev; - archsw.arch_copyin = i386_copyin; - archsw.arch_copyout = i386_copyout; - archsw.arch_readin = i386_readin; - archsw.arch_isainb = isa_inb; - archsw.arch_isaoutb = isa_outb; - archsw.arch_loadaddr = pc98_loadaddr; - - /* - * March through the device switch probing for things. - */ - for (i = 0; devsw[i] != NULL; i++) - if (devsw[i]->dv_init != NULL) - (devsw[i]->dv_init)(); - printf("BIOS %dkB/%dkB available memory\n", bios_basemem / 1024, bios_extmem / 1024); - if (initial_bootinfo != NULL) { - initial_bootinfo->bi_basemem = bios_basemem / 1024; - initial_bootinfo->bi_extmem = bios_extmem / 1024; - } - - printf("\n%s", bootprog_info); - - extract_currdev(); /* set $currdev and $loaddev */ - setenv("LINES", "24", 1); /* optional */ - - interact(NULL); /* doesn't return */ - - /* if we ever get here, it is an error */ - return (1); -} - -/* - * Set the 'current device' by (if possible) recovering the boot device as - * supplied by the initial bootstrap. - * - * XXX should be extended for netbooting. - */ -static void -extract_currdev(void) -{ - struct i386_devdesc new_currdev; - int major; - int biosdev = -1; - - /* Assume we are booting from a BIOS disk by default */ - new_currdev.d_dev = &biosdisk; - - /* new-style boot loaders such as pxeldr and cdldr */ - if (kargs->bootinfo == 0) { - if ((kargs->bootflags & KARGS_FLAGS_CD) != 0) { - /* we are booting from a CD with cdboot */ - new_currdev.d_dev = &bioscd; - new_currdev.d_unit = bc_bios2unit(initial_bootdev); - } else if ((kargs->bootflags & KARGS_FLAGS_PXE) != 0) { - /* we are booting from pxeldr */ - new_currdev.d_dev = &pxedisk; - new_currdev.d_unit = 0; - } else { - /* we don't know what our boot device is */ - new_currdev.d_kind.biosdisk.slice = -1; - new_currdev.d_kind.biosdisk.partition = 0; - biosdev = -1; - } - } else if ((initial_bootdev & B_MAGICMASK) != B_DEVMAGIC) { - /* The passed-in boot device is bad */ - new_currdev.d_kind.biosdisk.slice = -1; - new_currdev.d_kind.biosdisk.partition = 0; - biosdev = -1; - } else { - new_currdev.d_kind.biosdisk.slice = B_SLICE(initial_bootdev) - 1; - new_currdev.d_kind.biosdisk.partition = B_PARTITION(initial_bootdev); - biosdev = initial_bootinfo->bi_bios_dev; - major = B_TYPE(initial_bootdev); - - /* - * If we are booted by an old bootstrap, we have to guess at the BIOS - * unit number. We will lose if there is more than one disk type - * and we are not booting from the lowest-numbered disk type - * (ie. SCSI when IDE also exists). - */ - if ((biosdev == 0) && (B_TYPE(initial_bootdev) != 2)) { /* biosdev doesn't match major */ - if (B_TYPE(initial_bootdev) == 6) - biosdev = 0x30 + B_UNIT(initial_bootdev); - else - biosdev = (major << 3) + 0x80 + B_UNIT(initial_bootdev); - } - } - new_currdev.d_type = new_currdev.d_dev->dv_type; - - /* - * If we are booting off of a BIOS disk and we didn't succeed in determining - * which one we booted off of, just use disk0: as a reasonable default. - */ - if ((new_currdev.d_type == biosdisk.dv_type) && - ((new_currdev.d_unit = bd_bios2unit(biosdev)) == -1)) { - printf("Can't work out which disk we are booting from.\n" - "Guessed BIOS device 0x%x not found by probes, defaulting to disk0:\n", biosdev); - new_currdev.d_unit = 0; - } - - env_setenv("currdev", EV_VOLATILE, i386_fmtdev(&new_currdev), - i386_setcurrdev, env_nounset); - env_setenv("loaddev", EV_VOLATILE, i386_fmtdev(&new_currdev), env_noset, - env_nounset); -} - -COMMAND_SET(reboot, "reboot", "reboot the system", command_reboot); - -static int -command_reboot(int argc, char *argv[]) -{ - int i; - - for (i = 0; devsw[i] != NULL; ++i) - if (devsw[i]->dv_cleanup != NULL) - (devsw[i]->dv_cleanup)(); - - printf("Rebooting...\n"); - delay(1000000); - __exit(0); -} - -/* provide this for panic, as it's not in the startup code */ -void -exit(int code) -{ - __exit(code); -} - -COMMAND_SET(heap, "heap", "show heap usage", command_heap); - -static int -command_heap(int argc, char *argv[]) -{ - mallocstats(); - printf("heap base at %p, top at %p, upper limit at %p\n", heap_bottom, - sbrk(0), heap_top); - return(CMD_OK); -} - -/* ISA bus access functions for PnP. */ -static int -isa_inb(int port) -{ - - return (inb(port)); -} - -static void -isa_outb(int port, int value) -{ - - outb(port, value); -} diff --git a/sys/boot/pc98/pc98boot/Makefile b/sys/boot/pc98/pc98boot/Makefile deleted file mode 100644 index f33b15f5db84..000000000000 --- a/sys/boot/pc98/pc98boot/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -# $FreeBSD$ - -FILES= ${BOOT} -CLEANFILES= ${BOOT} ${BOOT}.part - -BOOT= pc98boot - -.if exists(${.OBJDIR}/../boot0) -BOOT0= ${.OBJDIR}/../boot0/boot0 -.else -BOOT0= ${.CURDIR}/../boot0/boot0 -.endif -.if exists(${.OBJDIR}/../boot0.5) -BOOT05= ${.OBJDIR}/../boot0.5/boot0.5 -.else -BOOT05= ${.CURDIR}/../boot0.5/boot0.5 -.endif - -${BOOT}: ${BOOT0} ${BOOT05} ${BOOT}.part - cat ${BOOT0} ${BOOT}.part ${BOOT05} > ${.TARGET} - -${BOOT}.part: - ${DD} if=/dev/zero of=${.TARGET} bs=512 count=1 - -.include diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index f6cab5b81124..ff08560e6428 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -2585,15 +2585,8 @@ xpt_action_default(union ccb *start_ccb) start_ccb->ccb_h.status = CAM_REQ_CMP; break; } -#if defined(PC98) || defined(__sparc64__) +#if defined(__sparc64__) /* - * In a PC-98 system, geometry translation depens on - * the "real" device geometry obtained from mode page 4. - * SCSI geometry translation is performed in the - * initialization routine of the SCSI BIOS and the result - * stored in host memory. If the translation is available - * in host memory, use it. If not, rely on the default - * translation the device driver performs. * For sparc64, we may need adjust the geometry of large * disks in order to fit the limitations of the 16-bit * fields of the VTOC8 disk label. diff --git a/sys/conf/Makefile.pc98 b/sys/conf/Makefile.pc98 deleted file mode 100644 index 1bd5bae805f7..000000000000 --- a/sys/conf/Makefile.pc98 +++ /dev/null @@ -1,52 +0,0 @@ -# Makefile for FreeBSD(98) after: -# -# Makefile.i386 -- with config changes. -# Copyright 1990 W. Jolitz -# from: @(#)Makefile.i386 7.1 5/10/91 -# $FreeBSD$ -# -# Makefile for FreeBSD -# -# This makefile is constructed from a machine description: -# config machineid -# Most changes should be made in the machine description -# /sys/pc98/conf/``machineid'' -# after which you should do -# config machineid -# Generic makefile changes should be made in -# /sys/conf/Makefile.pc98 -# after which config should be rerun for all machines. -# - -# Which version of config(8) is required. -%VERSREQ= 600012 - -.if !defined(S) -.if exists(./@/.) -S= ./@ -.else -S= ../../.. -.endif -.endif - -LDSCRIPT_NAME?= ldscript.${MACHINE_ARCH} - -.include "$S/conf/kern.pre.mk" - -ASM_CFLAGS.mpboot.s= ${CLANG_NO_IAS34} - -%BEFORE_DEPEND - -%OBJS - -%FILES.c - -%FILES.s - -%FILES.m - -%CLEAN - -%RULES - -.include "$S/conf/kern.post.mk" diff --git a/sys/conf/NOTES b/sys/conf/NOTES index c8ac5de69ae5..ed8566acacea 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -169,9 +169,7 @@ options GEOM_PART_EBR_COMPAT # Backward compatible partition names options GEOM_PART_GPT # GPT partitioning options GEOM_PART_LDM # Logical Disk Manager options GEOM_PART_MBR # MBR partitioning -options GEOM_PART_PC98 # PC-9800 disk partitioning options GEOM_PART_VTOC8 # SMI VTOC8 disk label -options GEOM_PC98 # NEC PC9800 partitioning options GEOM_RAID # Soft RAID functionality. options GEOM_RAID3 # RAID3 functionality. options GEOM_SHSEC # Shared secret. @@ -1535,7 +1533,7 @@ options TERMINAL_KERN_ATTR=(FG_LIGHTRED|BG_BLACK) # ahc: Adaptec 274x/284x/2910/293x/294x/394x/3950x/3960x/398X/4944/ # 19160x/29160x, aic7770/aic78xx # ahd: Adaptec 29320/39320 Controllers. -# aic: Adaptec 6260/6360, APA-1460 (PC Card), NEC PC9801-100 (C-BUS) +# aic: Adaptec 6260/6360, APA-1460 (PC Card) # bt: Most Buslogic controllers: including BT-445, BT-54x, BT-64x, BT-74x, # BT-75x, BT-946, BT-948, BT-956, BT-958, SDC3211B, SDC3211F, SDC3222F # esp: Emulex ESP, NCR 53C9x and QLogic FAS families based controllers @@ -1759,7 +1757,6 @@ device ata # Modular ATA #device atacore # Core ATA functionality #device atacard # CARDBUS support -#device atabus # PC98 cbus support #device ataisa # ISA bus support #device atapci # PCI bus support; only generic chipset support @@ -2838,7 +2835,7 @@ options U3G_DEBUG # options for ukbd: options UKBD_DFLT_KEYMAP # specify the built-in keymap -makeoptions UKBD_DFLT_KEYMAP=jp.pc98 +makeoptions UKBD_DFLT_KEYMAP=jp # options for uplcom: options UPLCOM_INTR_INTERVAL=100 # interrupt pipe interval diff --git a/sys/conf/config.mk b/sys/conf/config.mk index 50294961ca12..c519980d088e 100644 --- a/sys/conf/config.mk +++ b/sys/conf/config.mk @@ -38,7 +38,6 @@ opt_wlan.h: echo "#define IEEE80211_AMPDU_AGE 1" >> ${.TARGET} echo "#define IEEE80211_SUPPORT_MESH 1" >> ${.TARGET} KERN_OPTS.i386=NEW_PCIB DEV_PCI -KERN_OPTS.pc98=NEW_PCIB DEV_PCI KERN_OPTS.amd64=NEW_PCIB DEV_PCI KERN_OPTS.powerpc=NEW_PCIB DEV_PCI KERN_OPTS=MROUTING NATM IEEE80211_DEBUG \ diff --git a/sys/conf/files b/sys/conf/files index 3f01e9d4eee6..a6eee9547178 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -789,7 +789,6 @@ dev/ata/ata-dma.c optional ata | atacore dev/ata/ata-lowlevel.c optional ata | atacore dev/ata/ata-sata.c optional ata | atacore dev/ata/ata-card.c optional ata pccard | atapccard -dev/ata/ata-cbus.c optional ata pc98 | atapc98 dev/ata/ata-isa.c optional ata isa | ataisa dev/ata/ata-pci.c optional ata pci | atapci dev/ata/chipsets/ata-acard.c optional ata pci | ataacard @@ -3458,8 +3457,6 @@ geom/geom_kern.c standard geom/geom_map.c optional geom_map geom/geom_mbr.c optional geom_mbr geom/geom_mbr_enc.c optional geom_mbr -geom/geom_pc98.c optional geom_pc98 -geom/geom_pc98_enc.c optional geom_pc98 geom/geom_redboot.c optional geom_redboot geom/geom_slice.c standard geom/geom_subr.c standard @@ -3493,7 +3490,6 @@ geom/part/g_part_ebr.c optional geom_part_ebr geom/part/g_part_gpt.c optional geom_part_gpt geom/part/g_part_ldm.c optional geom_part_ldm geom/part/g_part_mbr.c optional geom_part_mbr -geom/part/g_part_pc98.c optional geom_part_pc98 geom/part/g_part_vtoc8.c optional geom_part_vtoc8 geom/raid/g_raid.c optional geom_raid geom/raid/g_raid_ctl.c optional geom_raid diff --git a/sys/conf/files.amd64 b/sys/conf/files.amd64 index bb6d2db54e20..a2a68a19cb01 100644 --- a/sys/conf/files.amd64 +++ b/sys/conf/files.amd64 @@ -606,7 +606,7 @@ contrib/x86emu/x86emu.c optional x86bios | dpms | pci | vesa dev/bvm/bvm_console.c optional bvmconsole dev/bvm/bvm_dbg.c optional bvmdebug # -# x86 shared code between IA32, AMD64 and PC98 architectures +# x86 shared code between IA32 and AMD64 architectures # x86/acpica/OsdEnvironment.c optional acpi x86/acpica/acpi_apm.c optional acpi diff --git a/sys/conf/files.i386 b/sys/conf/files.i386 index 1add0b800871..c0b75d7e1894 100644 --- a/sys/conf/files.i386 +++ b/sys/conf/files.i386 @@ -578,7 +578,7 @@ compat/x86bios/x86bios.c optional x86bios | dpms | pci | vesa dev/bvm/bvm_console.c optional bvmconsole dev/bvm/bvm_dbg.c optional bvmdebug # -# x86 shared code between IA32, AMD64 and PC98 architectures +# x86 shared code between IA32 and AMD64 architectures # x86/acpica/OsdEnvironment.c optional acpi x86/acpica/acpi_apm.c optional acpi diff --git a/sys/conf/files.pc98 b/sys/conf/files.pc98 deleted file mode 100644 index 8a7dc98689e5..000000000000 --- a/sys/conf/files.pc98 +++ /dev/null @@ -1,279 +0,0 @@ -# This file tells config what files go into building a kernel, -# files marked standard are always included. -# -# modified for PC-9801/PC-9821 -# -# $FreeBSD$ -# -# The long compile-with and dependency lines are required because of -# limitations in config: backslash-newline doesn't work in strings, and -# dependency lines other than the first are silently ignored. -# -linux_genassym.o optional compat_linux \ - dependency "$S/i386/linux/linux_genassym.c" \ - compile-with "${CC} ${CFLAGS:N-fno-common} -c ${.IMPSRC}" \ - no-obj no-implicit-rule \ - clean "linux_genassym.o" -# -linux_assym.h optional compat_linux \ - dependency "$S/kern/genassym.sh linux_genassym.o" \ - compile-with "sh $S/kern/genassym.sh linux_genassym.o > ${.TARGET}" \ - no-obj no-implicit-rule before-depend \ - clean "linux_assym.h" -# -linux_locore.o optional compat_linux \ - dependency "linux_assym.h $S/i386/linux/linux_locore.s" \ - compile-with "${CC} -x assembler-with-cpp -DLOCORE -shared -s -pipe -I. -I$S -Werror -Wall -fno-common -nostdinc -nostdlib -Wl,-T$S/i386/linux/linux_vdso.lds.s -Wl,-soname=linux_vdso.so,--eh-frame-hdr,-fPIC,-warn-common ${.IMPSRC} -o ${.TARGET}" \ - no-obj no-implicit-rule \ - clean "linux_locore.o" -# -linux_vdso.so optional compat_linux \ - dependency "linux_locore.o" \ - compile-with "${OBJCOPY} --input-target binary --output-target elf32-i386-freebsd --binary-architecture i386 linux_locore.o ${.TARGET}" \ - no-implicit-rule \ - clean "linux_vdso.so" -# -svr4_genassym.o optional compat_svr4 \ - dependency "$S/i386/svr4/svr4_genassym.c" \ - compile-with "${CC} ${CFLAGS:N-fno-common} -c ${.IMPSRC}" \ - no-obj no-implicit-rule \ - clean "svr4_genassym.o" -# -svr4_assym.h optional compat_svr4 \ - dependency "$S/kern/genassym.sh svr4_genassym.o" \ - compile-with "sh $S/kern/genassym.sh svr4_genassym.o > ${.TARGET}" \ - no-obj no-implicit-rule before-depend \ - clean "svr4_assym.h" -# -ukbdmap.h optional ukbd_dflt_keymap \ - compile-with "kbdcontrol -P ${S:S/sys$/share/}/vt/keymaps -P ${S:S/sys$/share/}/syscons/keymaps -L ${UKBD_DFLT_KEYMAP} | sed -e 's/^static keymap_t.* = /static keymap_t key_map = /' -e 's/^static accentmap_t.* = /static accentmap_t accent_map = /' > ukbdmap.h" \ - no-obj no-implicit-rule before-depend \ - clean "ukbdmap.h" -# -cddl/contrib/opensolaris/common/atomic/i386/opensolaris_atomic.S optional zfs compile-with "${ZFS_S}" -compat/linprocfs/linprocfs.c optional linprocfs -compat/linsysfs/linsysfs.c optional linsysfs -compat/linux/linux_event.c optional compat_linux -compat/linux/linux_emul.c optional compat_linux -compat/linux/linux_file.c optional compat_linux -compat/linux/linux_fork.c optional compat_linux -compat/linux/linux_futex.c optional compat_linux -compat/linux/linux_getcwd.c optional compat_linux -compat/linux/linux_ioctl.c optional compat_linux -compat/linux/linux_ipc.c optional compat_linux -compat/linux/linux_mib.c optional compat_linux -compat/linux/linux_misc.c optional compat_linux -compat/linux/linux_mmap.c optional compat_linux -compat/linux/linux_signal.c optional compat_linux -compat/linux/linux_socket.c optional compat_linux -compat/linux/linux_stats.c optional compat_linux -compat/linux/linux_sysctl.c optional compat_linux -compat/linux/linux_time.c optional compat_linux -compat/linux/linux_timer.c optional compat_linux -compat/linux/linux_uid16.c optional compat_linux -compat/linux/linux_util.c optional compat_linux -compat/linux/linux_vdso.c optional compat_linux -compat/linux/linux.c optional compat_linux -compat/svr4/imgact_svr4.c optional compat_svr4 -compat/svr4/svr4_fcntl.c optional compat_svr4 -compat/svr4/svr4_filio.c optional compat_svr4 -compat/svr4/svr4_ioctl.c optional compat_svr4 -compat/svr4/svr4_ipc.c optional compat_svr4 -compat/svr4/svr4_misc.c optional compat_svr4 -compat/svr4/svr4_resource.c optional compat_svr4 -compat/svr4/svr4_signal.c optional compat_svr4 -compat/svr4/svr4_socket.c optional compat_svr4 -compat/svr4/svr4_sockio.c optional compat_svr4 -compat/svr4/svr4_stat.c optional compat_svr4 -compat/svr4/svr4_stream.c optional compat_svr4 -compat/svr4/svr4_syscallnames.c optional compat_svr4 -compat/svr4/svr4_sysent.c optional compat_svr4 -compat/svr4/svr4_sysvec.c optional compat_svr4 -compat/svr4/svr4_termios.c optional compat_svr4 -bf_enc.o optional crypto | ipsec \ - dependency "$S/crypto/blowfish/arch/i386/bf_enc.S $S/crypto/blowfish/arch/i386/bf_enc_586.S $S/crypto/blowfish/arch/i386/bf_enc_686.S" \ - compile-with "${CC} -c -I$S/crypto/blowfish/arch/i386 ${ASM_CFLAGS} ${WERROR} ${.IMPSRC}" \ - no-implicit-rule -crypto/des/arch/i386/des_enc.S optional crypto | ipsec | netsmb -dev/agp/agp_ali.c optional agp -dev/agp/agp_amd.c optional agp -dev/agp/agp_i810.c optional agp -dev/agp/agp_intel.c optional agp -dev/agp/agp_nvidia.c optional agp -dev/agp/agp_sis.c optional agp -dev/agp/agp_via.c optional agp -dev/aic/aic_cbus.c optional aic isa -dev/ce/ceddk.c optional ce -dev/ce/if_ce.c optional ce -dev/ce/tau32-ddk.c optional ce \ - compile-with "${NORMAL_C} ${NO_WCONSTANT_CONVERSION}" -dev/cp/cpddk.c optional cp -dev/cp/if_cp.c optional cp -dev/ct/bshw_machdep.c optional ct -dev/ct/ct.c optional ct -dev/ct/ct_isa.c optional ct isa -dev/ed/if_ed_cbus.c optional ed isa -dev/ed/if_ed_wd80x3.c optional ed isa -dev/fb/fb.c optional fb | gdc -dev/fdc/fdc.c optional fdc -dev/fdc/fdc_cbus.c optional fdc isa -dev/fe/if_fe_cbus.c optional fe isa -dev/hwpmc/hwpmc_amd.c optional hwpmc -dev/hwpmc/hwpmc_intel.c optional hwpmc -dev/hwpmc/hwpmc_core.c optional hwpmc -dev/hwpmc/hwpmc_uncore.c optional hwpmc -dev/hwpmc/hwpmc_pentium.c optional hwpmc -dev/hwpmc/hwpmc_piv.c optional hwpmc -dev/hwpmc/hwpmc_ppro.c optional hwpmc -dev/hwpmc/hwpmc_tsc.c optional hwpmc -dev/hwpmc/hwpmc_x86.c optional hwpmc -dev/io/iodev.c optional io -dev/le/if_le_cbus.c optional le isa -dev/mse/mse.c optional mse -dev/mse/mse_cbus.c optional mse isa -dev/sbni/if_sbni.c optional sbni -dev/sbni/if_sbni_pci.c optional sbni pci -dev/sio/sio_pccard.c optional sio pccard -dev/sio/sio_pci.c optional sio pci -dev/sio/sio_puc.c optional sio puc -dev/snc/dp83932.c optional snc -dev/snc/dp83932subr.c optional snc -dev/snc/if_snc.c optional snc -dev/snc/if_snc_cbus.c optional snc isa -dev/snc/if_snc_pccard.c optional snc pccard -dev/speaker/spkr.c optional speaker -dev/syscons/apm/apm_saver.c optional apm_saver apm -dev/uart/uart_cpu_pc98.c optional uart -i386/bios/apm.c optional apm -#i386/i386/apic_vector.s optional apic -i386/i386/atomic.c standard \ - compile-with "${CC} -c ${CFLAGS} ${DEFINED_PROF:S/^$/-fomit-frame-pointer/} ${.IMPSRC}" -i386/i386/bios.c standard -i386/i386/bioscall.s standard -i386/i386/bpf_jit_machdep.c optional bpf_jitter -i386/i386/db_disasm.c optional ddb -i386/i386/db_interface.c optional ddb -i386/i386/db_trace.c optional ddb -i386/i386/elf_machdep.c standard -i386/i386/exception.s standard -i386/i386/gdb_machdep.c optional gdb -i386/i386/i686_mem.c optional mem -i386/i386/in_cksum.c optional inet | inet6 -i386/i386/initcpu.c standard -i386/i386/io.c optional io -i386/i386/k6_mem.c optional mem -i386/i386/locore.s standard no-obj -i386/i386/machdep.c standard -i386/i386/mem.c optional mem -i386/i386/minidump_machdep.c standard -i386/i386/mp_clock.c optional smp -i386/i386/mp_machdep.c optional smp -i386/i386/mpboot.s optional smp -i386/i386/perfmon.c optional perfmon -i386/i386/pmap.c standard -i386/i386/ptrace_machdep.c standard -i386/i386/support.s standard -i386/i386/swtch.s standard -i386/i386/sys_machdep.c standard -i386/i386/trap.c standard -i386/i386/uio_machdep.c standard -i386/i386/vm86.c standard -i386/i386/vm_machdep.c standard -i386/ibcs2/ibcs2_errno.c optional ibcs2 -i386/ibcs2/ibcs2_fcntl.c optional ibcs2 -i386/ibcs2/ibcs2_ioctl.c optional ibcs2 -i386/ibcs2/ibcs2_ipc.c optional ibcs2 -i386/ibcs2/ibcs2_isc.c optional ibcs2 -i386/ibcs2/ibcs2_isc_sysent.c optional ibcs2 -i386/ibcs2/ibcs2_misc.c optional ibcs2 -i386/ibcs2/ibcs2_msg.c optional ibcs2 -i386/ibcs2/ibcs2_other.c optional ibcs2 -i386/ibcs2/ibcs2_signal.c optional ibcs2 -i386/ibcs2/ibcs2_socksys.c optional ibcs2 -i386/ibcs2/ibcs2_stat.c optional ibcs2 -i386/ibcs2/ibcs2_sysent.c optional ibcs2 -i386/ibcs2/ibcs2_sysi86.c optional ibcs2 -i386/ibcs2/ibcs2_sysvec.c optional ibcs2 -i386/ibcs2/ibcs2_util.c optional ibcs2 -i386/ibcs2/ibcs2_xenix.c optional ibcs2 -i386/ibcs2/ibcs2_xenix_sysent.c optional ibcs2 -i386/ibcs2/imgact_coff.c optional ibcs2 -i386/isa/elink.c optional ep | ie -i386/isa/npx.c optional npx -i386/isa/pmtimer.c optional pmtimer -i386/isa/prof_machdep.c optional profiling-routine -i386/linux/imgact_linux.c optional compat_linux -i386/linux/linux_dummy.c optional compat_linux -i386/linux/linux_machdep.c optional compat_linux -i386/linux/linux_ptrace.c optional compat_linux -i386/linux/linux_support.s optional compat_linux \ - dependency "linux_assym.h" -i386/linux/linux_sysent.c optional compat_linux -i386/linux/linux_sysvec.c optional compat_linux -i386/pci/pci_cfgreg.c optional pci -i386/pci/pci_pir.c optional pci -i386/svr4/svr4_locore.s optional compat_svr4 \ - dependency "svr4_assym.h" \ - warning "COMPAT_SVR4 is broken and should be avoided" -i386/svr4/svr4_machdep.c optional compat_svr4 -kern/kern_clocksource.c standard -kern/imgact_aout.c optional compat_aout -kern/imgact_gzip.c optional gzip -kern/subr_sfbuf.c standard -libkern/divdi3.c standard -libkern/ffsll.c standard -libkern/flsll.c standard -libkern/memmove.c standard -libkern/memset.c standard -libkern/moddi3.c standard -libkern/qdivrem.c standard -libkern/ucmpdi2.c standard -libkern/udivdi3.c standard -libkern/umoddi3.c standard -pc98/apm/apm_bioscall.S optional apm -pc98/cbus/cbus_dma.c optional isa -pc98/cbus/gdc.c optional gdc -pc98/cbus/nmi.c standard -pc98/cbus/olpt.c optional olpt -pc98/cbus/pckbd.c optional pckbd -pc98/cbus/pcrtc.c standard -pc98/cbus/pmc.c optional pmc -pc98/cbus/scgdcrndr.c optional sc gdc -pc98/cbus/scterm-sck.c optional sc -pc98/cbus/scvtb.c optional sc -pc98/cbus/sio.c optional sio -pc98/cbus/sio_cbus.c optional sio isa -pc98/cbus/syscons_cbus.c optional sc -pc98/pc98/busio.s standard -pc98/pc98/busiosubr.c standard -pc98/pc98/canbepm.c optional canbepm -pc98/pc98/canbus.c optional canbus -pc98/pc98/canbus_if.m optional canbus -pc98/pc98/pc98_machdep.c standard -# -# x86 shared code between IA32, AMD64 and PC98 architectures -# -x86/isa/atpic.c optional atpic -x86/isa/clock.c standard -x86/isa/isa.c optional isa -x86/pci/pci_bus.c optional pci -x86/x86/autoconf.c standard -x86/x86/busdma_bounce.c standard -x86/x86/busdma_machdep.c standard -x86/x86/cpu_machdep.c standard -x86/x86/dump_machdep.c standard -x86/x86/identcpu.c standard -x86/x86/intr_machdep.c standard -x86/x86/io_apic.c optional apic -x86/x86/legacy.c standard -x86/x86/local_apic.c optional apic -x86/x86/mca.c standard -x86/x86/mptable.c optional apic -x86/x86/mptable_pci.c optional apic pci -x86/x86/mp_x86.c optional smp -x86/x86/mp_watchdog.c optional mp_watchdog smp -x86/x86/msi.c optional apic pci -x86/x86/nexus.c standard -x86/x86/stack_machdep.c optional ddb | stack -x86/x86/tsc.c standard -x86/x86/delay.c standard diff --git a/sys/conf/options b/sys/conf/options index beea9bd507d3..e59f0c76a822 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -130,9 +130,7 @@ GEOM_PART_EBR_COMPAT opt_geom.h GEOM_PART_GPT opt_geom.h GEOM_PART_LDM opt_geom.h GEOM_PART_MBR opt_geom.h -GEOM_PART_PC98 opt_geom.h GEOM_PART_VTOC8 opt_geom.h -GEOM_PC98 opt_geom.h GEOM_RAID opt_geom.h GEOM_RAID3 opt_geom.h GEOM_SHSEC opt_geom.h diff --git a/sys/conf/options.pc98 b/sys/conf/options.pc98 deleted file mode 100644 index a19ebd11271b..000000000000 --- a/sys/conf/options.pc98 +++ /dev/null @@ -1,104 +0,0 @@ -# $FreeBSD$ -# Options specific to the pc98 platform kernels - -AUTO_EOI_1 opt_auto_eoi.h -BROKEN_KEYBOARD_RESET opt_reset.h -COUNT_XINVLTLB_HITS opt_smp.h -COUNT_IPIS opt_smp.h -DISABLE_PG_G opt_pmap.h -DISABLE_PSE opt_pmap.h -I586_PMC_GUPROF opt_i586_guprof.h -MAXMEM -MPTABLE_FORCE_HTT -MP_WATCHDOG -PERFMON -PMAP_SHPGPERPROC opt_pmap.h -POWERFAIL_NMI opt_trap.h - -# Options for emulators. These should only be used at config time, so -# they are handled like options for static filesystems -# (see src/sys/conf/options), except for broken debugging options. -COMPAT_AOUT opt_dontuse.h -IBCS2 opt_dontuse.h -COMPAT_LINUX opt_dontuse.h -COMPAT_SVR4 opt_dontuse.h -DEBUG_SVR4 opt_svr4.h -LINPROCFS opt_dontuse.h -LINSYSFS opt_dontuse.h - -# Change KVM size. Changes things all over the kernel. -KVA_PAGES opt_global.h - -TIMER_FREQ opt_clock.h - -CPU_BLUELIGHTNING_3X opt_cpu.h -CPU_BLUELIGHTNING_FPU_OP_CACHE opt_cpu.h -CPU_BTB_EN opt_cpu.h -CPU_CYRIX_NO_LOCK opt_cpu.h -CPU_DIRECT_MAPPED_CACHE opt_cpu.h -CPU_DISABLE_5X86_LSSER opt_cpu.h -CPU_DISABLE_CMPXCHG opt_global.h # XXX global, unlike other CPU_* -CPU_DISABLE_SSE opt_cpu.h -CPU_FASTER_5X86_FPU opt_cpu.h -CPU_GEODE opt_cpu.h -CPU_I486_ON_386 opt_cpu.h -CPU_IORT opt_cpu.h -CPU_L2_LATENCY opt_cpu.h -CPU_LOOP_EN opt_cpu.h -CPU_PPRO2CELERON opt_cpu.h -CPU_RSTK_EN opt_cpu.h -CPU_SOEKRIS opt_cpu.h -CPU_SUSP_HLT opt_cpu.h -CPU_UPGRADE_HW_CACHE opt_cpu.h -CPU_WT_ALLOC opt_cpu.h -CYRIX_CACHE_REALLY_WORKS opt_cpu.h -CYRIX_CACHE_WORKS opt_cpu.h -NO_F00F_HACK opt_cpu.h -NO_MEMORY_HOLE opt_cpu.h - -# The CPU type affects the endian conversion functions all over the kernel. -I486_CPU opt_global.h -I586_CPU opt_global.h -I686_CPU opt_global.h - -# options for serial support -COM_ESP opt_sio.h -COM_MULTIPORT opt_sio.h -CONSPEED opt_sio.h -GDBSPEED opt_sio.h - -GDC - -# AGP debugging support -AGP_DEBUG opt_agp.h - -# Video spigot -SPIGOT_UNSECURE opt_spigot.h - -# Enables NETGRAPH support for Cronyx adapters -NETGRAPH_CRONYX opt_ng_cronyx.h - -# ct driver options -CT_BUS_WEIGHT opt_ct.h -CT_USE_RELOCATE_OFFSET opt_ct.h - -# npx options -FPU_ERROR_BROKEN opt_npx.h - -# PC98 options -EPSON_BOUNCEDMA opt_pc98.h -EPSON_MEMWIN opt_pc98.h -LINE30 opt_syscons.h -PC98 opt_global.h - -# Device options -DEV_APIC opt_apic.h -DEV_ATPIC opt_atpic.h -DEV_MECIA opt_mecia.h -DEV_NPX opt_npx.h - -# Debugging -NPX_DEBUG opt_npx.h - -# BPF just-in-time compiler -BPF_JITTER opt_bpf.h diff --git a/sys/crypto/aesni/aesni.h b/sys/crypto/aesni/aesni.h index c3e113d12001..8b40e1ab0fec 100644 --- a/sys/crypto/aesni/aesni.h +++ b/sys/crypto/aesni/aesni.h @@ -35,7 +35,7 @@ #include -#if defined(__amd64__) || (defined(__i386__) && !defined(PC98)) +#if defined(__amd64__) || defined(__i386__) #include #include #include diff --git a/sys/crypto/via/padlock.c b/sys/crypto/via/padlock.c index 65a7b5dd9fb5..f6c6d77f6cb7 100644 --- a/sys/crypto/via/padlock.c +++ b/sys/crypto/via/padlock.c @@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#if defined(__amd64__) || (defined(__i386__) && !defined(PC98)) +#if defined(__amd64__) || defined(__i386__) #include #include #include @@ -85,7 +85,7 @@ padlock_probe(device_t dev) { char capp[256]; -#if defined(__amd64__) || (defined(__i386__) && !defined(PC98)) +#if defined(__amd64__) || defined(__i386__) /* If there is no AES support, we has nothing to do here. */ if (!(via_feature_xcrypt & VIA_HAS_AES)) { device_printf(dev, "No ACE support.\n"); diff --git a/sys/crypto/via/padlock_hash.c b/sys/crypto/via/padlock_hash.c index c952b63503ea..658043b4946a 100644 --- a/sys/crypto/via/padlock_hash.c +++ b/sys/crypto/via/padlock_hash.c @@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#if defined(__amd64__) || (defined(__i386__) && !defined(PC98)) +#if defined(__amd64__) || defined(__i386__) #include #include #include diff --git a/sys/dev/aic/aic_cbus.c b/sys/dev/aic/aic_cbus.c deleted file mode 100644 index 84e7f7bf4e9d..000000000000 --- a/sys/dev/aic/aic_cbus.c +++ /dev/null @@ -1,265 +0,0 @@ -/*- - * Copyright (c) 1999 Luoqi Chen. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -struct aic_isa_softc { - struct aic_softc sc_aic; - struct resource *sc_port; - struct resource *sc_irq; - struct resource *sc_drq; - void *sc_ih; -}; - -static int aic_isa_alloc_resources(device_t); -static void aic_isa_release_resources(device_t); -static int aic_isa_probe(device_t); -static int aic_isa_attach(device_t); - -static u_int aic_isa_ports[] = { 0x1840 }; - -#define AIC_ISA_NUMPORTS nitems(aic_isa_ports) -#define AIC_ISA_PORTSIZE 0x20 - -#define AIC98_GENERIC 0x00 -#define AIC98_NEC100 0x01 -#define AIC_TYPE98(x) (((x) >> 16) & 0x01) - -static bus_addr_t aicport_generic[AIC_ISA_PORTSIZE] = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, -}; -static bus_addr_t aicport_100[AIC_ISA_PORTSIZE] = { - 0x00, 0x02, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0e, - 0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e, - 0x20, 0x22, 0x24, 0x26, 0x28, 0x2a, 0x2c, 0x2e, - 0x30, 0x32, 0x34, 0x36, 0x38, 0x3a, 0x3c, 0x3e, -}; - -static struct isa_pnp_id aic_ids[] = { - { 0xa180a3b8, "NEC PC9801-100" }, - { 0 } -}; - -static int -aic_isa_alloc_resources(device_t dev) -{ - struct aic_isa_softc *sc = device_get_softc(dev); - int rid; - bus_addr_t *bs_iat; - - if ((isa_get_logicalid(dev) == 0xa180a3b8) || - (AIC_TYPE98(device_get_flags(dev)) == AIC98_NEC100)) - bs_iat = aicport_100; - else - bs_iat = aicport_generic; - - sc->sc_port = sc->sc_irq = sc->sc_drq = NULL; - - rid = 0; - sc->sc_port = isa_alloc_resourcev(dev, SYS_RES_IOPORT, &rid, - bs_iat, AIC_ISA_PORTSIZE, RF_ACTIVE); - if (!sc->sc_port) { - device_printf(dev, "I/O port allocation failed\n"); - return (ENOMEM); - } - isa_load_resourcev(sc->sc_port, bs_iat, AIC_ISA_PORTSIZE); - mtx_init(&sc->sc_aic.lock, "aic", NULL, MTX_DEF); - - if (isa_get_irq(dev) != -1) { - rid = 0; - sc->sc_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, - RF_ACTIVE); - if (!sc->sc_irq) { - device_printf(dev, "IRQ allocation failed\n"); - aic_isa_release_resources(dev); - return (ENOMEM); - } - } - - if (isa_get_drq(dev) != -1) { - rid = 0; - sc->sc_drq = bus_alloc_resource_any(dev, SYS_RES_DRQ, &rid, - RF_ACTIVE); - if (!sc->sc_drq) { - device_printf(dev, "DRQ allocation failed\n"); - aic_isa_release_resources(dev); - return (ENOMEM); - } - } - - sc->sc_aic.dev = dev; - sc->sc_aic.res = sc->sc_port; - return (0); -} - -static void -aic_isa_release_resources(device_t dev) -{ - struct aic_isa_softc *sc = device_get_softc(dev); - - if (sc->sc_port) - bus_release_resource(dev, SYS_RES_IOPORT, 0, sc->sc_port); - if (sc->sc_irq) - bus_release_resource(dev, SYS_RES_IRQ, 0, sc->sc_irq); - if (sc->sc_drq) - bus_release_resource(dev, SYS_RES_DRQ, 0, sc->sc_drq); - sc->sc_port = sc->sc_irq = sc->sc_drq = NULL; - mtx_destroy(&sc->sc_aic.lock); -} - -static int -aic_isa_probe(device_t dev) -{ - struct aic_isa_softc *sc = device_get_softc(dev); - struct aic_softc *aic = &sc->sc_aic; - int numports, i; - u_int port, *ports; - u_int8_t porta; - - if (ISA_PNP_PROBE(device_get_parent(dev), dev, aic_ids) == ENXIO) - return (ENXIO); - - port = isa_get_port(dev); - if (port != -1) { - ports = &port; - numports = 1; - } else { - ports = aic_isa_ports; - numports = AIC_ISA_NUMPORTS; - } - - for (i = 0; i < numports; i++) { - if (bus_set_resource(dev, SYS_RES_IOPORT, 0, ports[i], 1)) - continue; - if (aic_isa_alloc_resources(dev)) - continue; - if (aic_probe(aic) == 0) - break; - aic_isa_release_resources(dev); - } - - if (i == numports) - return (ENXIO); - - porta = aic_inb(aic, PORTA); - aic_isa_release_resources(dev); - if (isa_get_irq(dev) == -1) - bus_set_resource(dev, SYS_RES_IRQ, 0, PORTA_IRQ(porta), 1); - if ((aic->flags & AIC_DMA_ENABLE) && isa_get_drq(dev) == -1) - bus_set_resource(dev, SYS_RES_DRQ, 0, PORTA_DRQ(porta), 1); - device_set_desc(dev, "Adaptec 6260/6360 SCSI controller"); - return (0); -} - -static int -aic_isa_attach(device_t dev) -{ - struct aic_isa_softc *sc = device_get_softc(dev); - struct aic_softc *aic = &sc->sc_aic; - int error; - - error = aic_isa_alloc_resources(dev); - if (error) { - device_printf(dev, "resource allocation failed\n"); - return (error); - } - - error = aic_attach(aic); - if (error) { - device_printf(dev, "attach failed\n"); - aic_isa_release_resources(dev); - return (error); - } - - error = bus_setup_intr(dev, sc->sc_irq, INTR_TYPE_CAM | INTR_ENTROPY | - INTR_MPSAFE, NULL, aic_intr, aic, &sc->sc_ih); - if (error) { - device_printf(dev, "failed to register interrupt handler\n"); - aic_isa_release_resources(dev); - return (error); - } - return (0); -} - -static int -aic_isa_detach(device_t dev) -{ - struct aic_isa_softc *sc = device_get_softc(dev); - struct aic_softc *aic = &sc->sc_aic; - int error; - - error = aic_detach(aic); - if (error) { - device_printf(dev, "detach failed\n"); - return (error); - } - - error = bus_teardown_intr(dev, sc->sc_irq, sc->sc_ih); - if (error) { - device_printf(dev, "failed to unregister interrupt handler\n"); - } - - aic_isa_release_resources(dev); - return (0); -} - -static device_method_t aic_isa_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, aic_isa_probe), - DEVMETHOD(device_attach, aic_isa_attach), - DEVMETHOD(device_detach, aic_isa_detach), - { 0, 0 } -}; - -static driver_t aic_isa_driver = { - "aic", - aic_isa_methods, sizeof(struct aic_isa_softc), -}; - -extern devclass_t aic_devclass; - -MODULE_DEPEND(aic, cam, 1,1,1); -DRIVER_MODULE(aic, isa, aic_isa_driver, aic_devclass, 0, 0); diff --git a/sys/dev/ata/ata-all.h b/sys/dev/ata/ata-all.h index cf8ed784e7b8..8ef4191eca8c 100644 --- a/sys/dev/ata/ata-all.h +++ b/sys/dev/ata/ata-all.h @@ -83,7 +83,6 @@ #define ATA_CTLOFFSET 0x206 /* control register offset */ #define ATA_PCCARD_CTLOFFSET 0x0e /* do for PCCARD devices */ -#define ATA_PC98_CTLOFFSET 0x10c /* do for PC98 devices */ #define ATA_A_IDS 0x02 /* disable interrupts */ #define ATA_A_RESET 0x04 /* RESET controller */ #ifdef ATA_LEGACY_SUPPORT @@ -178,17 +177,12 @@ /* misc defines */ #define ATA_PRIMARY 0x1f0 #define ATA_SECONDARY 0x170 -#define ATA_PC98_BANK 0x432 #define ATA_IOSIZE 0x08 -#define ATA_PC98_IOSIZE 0x10 #define ATA_CTLIOSIZE 0x01 #define ATA_BMIOSIZE 0x08 -#define ATA_PC98_BANKIOSIZE 0x01 #define ATA_IOADDR_RID 0 #define ATA_CTLADDR_RID 1 #define ATA_BMADDR_RID 0x20 -#define ATA_PC98_CTLADDR_RID 8 -#define ATA_PC98_BANKADDR_RID 9 #define ATA_IRQ_RID 0 #define ATA_DEV(unit) ((unit > 0) ? 0x10 : 0) #define ATA_CFA_MAGIC1 0x844A diff --git a/sys/dev/ata/ata-cbus.c b/sys/dev/ata/ata-cbus.c deleted file mode 100644 index 4165ea6a947a..000000000000 --- a/sys/dev/ata/ata-cbus.c +++ /dev/null @@ -1,349 +0,0 @@ -/*- - * Copyright (c) 2002 - 2008 Søren Schmidt - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer, - * without modification, immediately at the beginning of the file. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* local vars */ -struct ata_cbus_controller { - struct resource *io; - struct resource *ctlio; - struct resource *bankio; - struct resource *irq; - void *ih; - int channels; - struct { - void (*function)(void *); - void *argument; - } interrupt[2]; -}; - -/* local prototypes */ -static void ata_cbus_intr(void *); - -static int -ata_cbus_probe(device_t dev) -{ - struct resource *io; - int rid; - rman_res_t tmp; - - /* dont probe PnP devices */ - if (isa_get_vendorid(dev)) - return (ENXIO); - - /* allocate the ioport range */ - rid = ATA_IOADDR_RID; - if (!(io = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, - ATA_PC98_IOSIZE, RF_ACTIVE))) - return ENOMEM; - - /* calculate & set the altport range */ - rid = ATA_PC98_CTLADDR_RID; - if (bus_get_resource(dev, SYS_RES_IOPORT, rid, &tmp, &tmp)) { - bus_set_resource(dev, SYS_RES_IOPORT, rid, - rman_get_start(io)+ATA_PC98_CTLOFFSET, ATA_CTLIOSIZE); - } - - /* calculate & set the bank range */ - rid = ATA_PC98_BANKADDR_RID; - if (bus_get_resource(dev, SYS_RES_IOPORT, rid, &tmp, &tmp)) { - bus_set_resource(dev, SYS_RES_IOPORT, rid, - ATA_PC98_BANK, ATA_PC98_BANKIOSIZE); - } - - bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, io); - return 0; -} - -static int -ata_cbus_attach(device_t dev) -{ - struct ata_cbus_controller *ctlr = device_get_softc(dev); - device_t child; - int rid, unit; - - /* allocate resources */ - rid = ATA_IOADDR_RID; - if (!(ctlr->io = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, - ATA_PC98_IOSIZE, RF_ACTIVE))) - return ENOMEM; - - rid = ATA_PC98_CTLADDR_RID; - if (!(ctlr->ctlio = - bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, - rman_get_start(ctlr->io) + ATA_PC98_CTLOFFSET, ~0, - ATA_CTLIOSIZE, RF_ACTIVE))) { - bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, ctlr->io); - return ENOMEM; - } - - rid = ATA_PC98_BANKADDR_RID; - if (!(ctlr->bankio = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, - ATA_PC98_BANK, ~0, - ATA_PC98_BANKIOSIZE, RF_ACTIVE))) { - bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, ctlr->io); - bus_release_resource(dev, SYS_RES_IOPORT, ATA_CTLADDR_RID, ctlr->ctlio); - return ENOMEM; - } - - rid = ATA_IRQ_RID; - if (!(ctlr->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, - RF_ACTIVE | RF_SHAREABLE))) { - device_printf(dev, "unable to alloc interrupt\n"); - bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, ctlr->io); - bus_release_resource(dev, SYS_RES_IOPORT, ATA_CTLADDR_RID, ctlr->ctlio); - bus_release_resource(dev, SYS_RES_IOPORT, - ATA_PC98_BANKADDR_RID, ctlr->bankio); - return ENXIO; - } - - if ((bus_setup_intr(dev, ctlr->irq, ATA_INTR_FLAGS, - NULL, ata_cbus_intr, ctlr, &ctlr->ih))) { - device_printf(dev, "unable to setup interrupt\n"); - bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, ctlr->io); - bus_release_resource(dev, SYS_RES_IOPORT, ATA_CTLADDR_RID, ctlr->ctlio); - bus_release_resource(dev, SYS_RES_IOPORT, - ATA_PC98_BANKADDR_RID, ctlr->bankio); - bus_release_resource(dev, SYS_RES_IOPORT, ATA_IRQ_RID, ctlr->irq); - return ENXIO; - } - - /* Work around the lack of channel serialization in ATA_CAM. */ - ctlr->channels = 1; - device_printf(dev, "second channel ignored\n"); - - for (unit = 0; unit < ctlr->channels; unit++) { - child = device_add_child(dev, "ata", unit); - if (child == NULL) - device_printf(dev, "failed to add ata child device\n"); - else - device_set_ivars(child, (void *)(intptr_t)unit); - } - - bus_generic_attach(dev); - return (0); -} - -static struct resource * -ata_cbus_alloc_resource(device_t dev, device_t child, int type, int *rid, - rman_res_t start, rman_res_t end, rman_res_t count, - u_int flags) -{ - struct ata_cbus_controller *ctlr = device_get_softc(dev); - - if (type == SYS_RES_IOPORT) { - switch (*rid) { - case ATA_IOADDR_RID: - return ctlr->io; - case ATA_CTLADDR_RID: - return ctlr->ctlio; - } - } - if (type == SYS_RES_IRQ) - return ctlr->irq; - return 0; -} - -static int -ata_cbus_setup_intr(device_t dev, device_t child, struct resource *irq, - int flags, driver_filter_t *filter, driver_intr_t *intr, - void *arg, void **cookiep) -{ - struct ata_cbus_controller *controller = device_get_softc(dev); - int unit = ((struct ata_channel *)device_get_softc(child))->unit; - - if (filter != NULL) { - printf("ata-cbus.c: we cannot use a filter here\n"); - return (EINVAL); - } - controller->interrupt[unit].function = intr; - controller->interrupt[unit].argument = arg; - *cookiep = controller; - - return 0; -} - -static int -ata_cbus_print_child(device_t dev, device_t child) -{ - struct ata_channel *ch = device_get_softc(child); - int retval = 0; - - retval += bus_print_child_header(dev, child); - retval += printf(" at bank %d", ch->unit); - retval += bus_print_child_footer(dev, child); - return retval; -} - -static void -ata_cbus_intr(void *data) -{ - struct ata_cbus_controller *ctlr = data; - struct ata_channel *ch; - int unit; - - for (unit = 0; unit < ctlr->channels; unit++) { - if (!(ch = ctlr->interrupt[unit].argument)) - continue; - ctlr->interrupt[unit].function(ch); - } -} - -static device_method_t ata_cbus_methods[] = { - /* device interface */ - DEVMETHOD(device_probe, ata_cbus_probe), - DEVMETHOD(device_attach, ata_cbus_attach), -// DEVMETHOD(device_detach, ata_cbus_detach), - - /* bus methods */ - DEVMETHOD(bus_alloc_resource, ata_cbus_alloc_resource), - DEVMETHOD(bus_setup_intr, ata_cbus_setup_intr), - DEVMETHOD(bus_print_child, ata_cbus_print_child), - - DEVMETHOD_END -}; - -static driver_t ata_cbus_driver = { - "atacbus", - ata_cbus_methods, - sizeof(struct ata_cbus_controller), -}; - -static devclass_t ata_cbus_devclass; - -DRIVER_MODULE(atacbus, isa, ata_cbus_driver, ata_cbus_devclass, NULL, NULL); - -static int -ata_cbuschannel_probe(device_t dev) -{ - char buffer[32]; - - sprintf(buffer, "ATA channel %d", (int)(intptr_t)device_get_ivars(dev)); - device_set_desc_copy(dev, buffer); - - return ata_probe(dev); -} - -static int -ata_cbuschannel_attach(device_t dev) -{ - struct ata_cbus_controller *ctlr = device_get_softc(device_get_parent(dev)); - struct ata_channel *ch = device_get_softc(dev); - int i; - - if (ch->attached) - return (0); - ch->attached = 1; - - ch->unit = (intptr_t)device_get_ivars(dev); - /* setup the resource vectors */ - for (i = ATA_DATA; i <= ATA_COMMAND; i ++) { - ch->r_io[i].res = ctlr->io; - ch->r_io[i].offset = i << 1; - } - ch->r_io[ATA_CONTROL].res = ctlr->ctlio; - ch->r_io[ATA_CONTROL].offset = 0; - ch->r_io[ATA_IDX_ADDR].res = ctlr->io; - ata_default_registers(dev); - - /* initialize softc for this channel */ - ch->flags |= ATA_USE_16BIT; - ata_generic_hw(dev); - - return ata_attach(dev); -} - -static int -ata_cbuschannel_detach(device_t dev) -{ - struct ata_channel *ch = device_get_softc(dev); - - if (!ch->attached) - return (0); - ch->attached = 0; - - return ata_detach(dev); -} - -static int -ata_cbuschannel_suspend(device_t dev) -{ - struct ata_channel *ch = device_get_softc(dev); - - if (!ch->attached) - return (0); - - return ata_suspend(dev); -} - -static int -ata_cbuschannel_resume(device_t dev) -{ - struct ata_channel *ch = device_get_softc(dev); - - if (!ch->attached) - return (0); - - return ata_resume(dev); -} - -static device_method_t ata_cbuschannel_methods[] = { - /* device interface */ - DEVMETHOD(device_probe, ata_cbuschannel_probe), - DEVMETHOD(device_attach, ata_cbuschannel_attach), - DEVMETHOD(device_detach, ata_cbuschannel_detach), - DEVMETHOD(device_suspend, ata_cbuschannel_suspend), - DEVMETHOD(device_resume, ata_cbuschannel_resume), - DEVMETHOD_END -}; - -static driver_t ata_cbuschannel_driver = { - "ata", - ata_cbuschannel_methods, - sizeof(struct ata_channel), -}; - -DRIVER_MODULE(ata, atacbus, ata_cbuschannel_driver, ata_devclass, NULL, NULL); -MODULE_DEPEND(ata, ata, 1, 1, 1); diff --git a/sys/dev/ct/bshw_machdep.c b/sys/dev/ct/bshw_machdep.c deleted file mode 100644 index 046aa7d9430c..000000000000 --- a/sys/dev/ct/bshw_machdep.c +++ /dev/null @@ -1,743 +0,0 @@ -/* $NecBSD: bshw_machdep.c,v 1.8.12.6 2001/06/29 06:28:05 honda Exp $ */ - -#include -__FBSDID("$FreeBSD$"); -/* $NetBSD$ */ - -/*- - * [NetBSD for NEC PC-98 series] - * Copyright (c) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 - * NetBSD/pc98 porting staff. All rights reserved. - * - * Copyright (c) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 - * Naofumi HONDA. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "opt_ddb.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -#include - -#include - -#include -#include -#include -#include - -#include - -#define BSHW_IO_CONTROL_FLAGS 0 - -u_int bshw_io_control = BSHW_IO_CONTROL_FLAGS; -int bshw_data_read_bytes = 4096; -int bshw_data_write_bytes = 4096; - -/********************************************************* - * OS dep part - *********************************************************/ -typedef unsigned long vaddr_t; - -/********************************************************* - * GENERIC MACHDEP FUNCTIONS - *********************************************************/ -void -bshw_synch_setup(struct ct_softc *ct, struct targ_info *ti) -{ - struct ct_bus_access_handle *chp = &ct->sc_ch; - struct ct_targ_info *cti = (void *) ti; - struct bshw_softc *bs = ct->ct_hw; - struct bshw *hw = bs->sc_hw; - - if (hw->hw_sregaddr == 0) - return; - - ct_cr_write_1(chp, hw->hw_sregaddr + ti->ti_id, cti->cti_syncreg); - if (hw->hw_flags & BSHW_DOUBLE_DMACHAN) - { - ct_cr_write_1(chp, hw->hw_sregaddr + ti->ti_id + 8, - cti->cti_syncreg); - } -} - -void -bshw_bus_reset(struct ct_softc *ct) -{ - struct scsi_low_softc *slp = &ct->sc_sclow; - struct ct_bus_access_handle *chp = &ct->sc_ch; - struct bshw_softc *bs = ct->ct_hw; - struct bshw *hw = bs->sc_hw; - bus_addr_t offs; - u_int8_t regv; - int i; - - /* open hardware busmaster mode */ - if (hw->hw_dma_init != NULL && ((*hw->hw_dma_init)(ct)) != 0) - { - device_printf(slp->sl_dev, - "change mode using external DMA (%x)\n", - (u_int)ct_cr_read_1(chp, 0x37)); - } - - /* clear hardware synch registers */ - offs = hw->hw_sregaddr; - if (offs != 0) - { - for (i = 0; i < 8; i ++, offs ++) - { - ct_cr_write_1(chp, offs, 0); - if ((hw->hw_flags & BSHW_DOUBLE_DMACHAN) != 0) - ct_cr_write_1(chp, offs + 8, 0); - } - } - - /* disable interrupt & assert reset */ - regv = ct_cr_read_1(chp, wd3s_mbank); - regv |= MBR_RST; - regv &= ~MBR_IEN; - ct_cr_write_1(chp, wd3s_mbank, regv); - - DELAY(500000); - - /* reset signal off */ - regv &= ~MBR_RST; - ct_cr_write_1(chp, wd3s_mbank, regv); - - /* interrupt enable */ - regv |= MBR_IEN; - ct_cr_write_1(chp, wd3s_mbank, regv); -} - -/* probe */ -int -bshw_read_settings(struct ct_bus_access_handle *chp, struct bshw_softc *bs) -{ - static int irq_tbl[] = { 3, 5, 6, 9, 12, 13 }; - - bs->sc_hostid = (ct_cr_read_1(chp, wd3s_auxc) & AUXCR_HIDM); - bs->sc_irq = irq_tbl[(ct_cr_read_1(chp, wd3s_auxc) >> 3) & 7]; - bs->sc_drq = ct_cmdp_read_1(chp) & 3; - return 0; -} - -/********************************************************* - * DMA PIO TRANSFER (SMIT) - *********************************************************/ -#define LC_SMIT_TIMEOUT 2 /* 2 sec: timeout for a fifo status ready */ -#define LC_SMIT_OFFSET 0x1000 -#define LC_FSZ DEV_BSIZE -#define LC_SFSZ 0x0c -#define LC_REST (LC_FSZ - LC_SFSZ) - -#define BSHW_LC_FSET 0x36 -#define BSHW_LC_FCTRL 0x44 -#define FCTRL_EN 0x01 -#define FCTRL_WRITE 0x02 - -#define SF_ABORT 0x08 -#define SF_RDY 0x10 - -static __inline void bshw_lc_smit_start(struct ct_softc *, int, u_int); -static __inline void bshw_lc_smit_stop(struct ct_softc *); -static int bshw_lc_smit_fstat(struct ct_softc *, int, int); - -static __inline void -bshw_lc_smit_stop(struct ct_softc *ct) -{ - struct ct_bus_access_handle *chp = &ct->sc_ch; - - ct_cr_write_1(chp, BSHW_LC_FCTRL, 0); - ct_cmdp_write_1(chp, CMDP_DMER); -} - -static __inline void -bshw_lc_smit_start(struct ct_softc *ct, int count, u_int direction) -{ - struct ct_bus_access_handle *chp = &ct->sc_ch; - u_int8_t pval, val; - - val = ct_cr_read_1(chp, BSHW_LC_FSET); - cthw_set_count(chp, count); - - pval = FCTRL_EN; - if (direction == SCSI_LOW_WRITE) - pval |= (val & 0xe0) | FCTRL_WRITE; - ct_cr_write_1(chp, BSHW_LC_FCTRL, pval); - ct_cr_write_1(chp, wd3s_cmd, WD3S_TFR_INFO); -} - -static int -bshw_lc_smit_fstat(struct ct_softc *ct, int wc, int read) -{ - struct ct_bus_access_handle *chp = &ct->sc_ch; - u_int8_t stat; - - while (wc -- > 0) - { - chp->ch_bus_weight(chp); - stat = ct_cmdp_read_1(chp); - if (read == SCSI_LOW_READ) - { - if ((stat & SF_RDY) != 0) - return 0; - if ((stat & SF_ABORT) != 0) - return EIO; - } - else - { - if ((stat & SF_ABORT) != 0) - return EIO; - if ((stat & SF_RDY) != 0) - return 0; - } - } - - device_printf(ct->sc_sclow.sl_dev, "SMIT fifo status timeout\n"); - return EIO; -} - -void -bshw_smit_xfer_stop(struct ct_softc *ct) -{ - struct scsi_low_softc *slp = &ct->sc_sclow; - struct bshw_softc *bs = ct->ct_hw; - struct targ_info *ti; - struct sc_p *sp = &slp->sl_scp; - u_int count; - - bshw_lc_smit_stop(ct); - - ti = slp->sl_Tnexus; - if (ti == NULL) - return; - - if (ti->ti_phase == PH_DATA) - { - count = cthw_get_count(&ct->sc_ch); - if (count < bs->sc_sdatalen) - { - if (sp->scp_direction == SCSI_LOW_READ && - count != bs->sc_edatalen) - goto bad; - - count = bs->sc_sdatalen - count; - if (count > (u_int) sp->scp_datalen) - goto bad; - - sp->scp_data += count; - sp->scp_datalen -= count; - } - else if (count > bs->sc_sdatalen) - { -bad: - device_printf(slp->sl_dev, - "smit_xfer_end: cnt error\n"); - slp->sl_error |= PDMAERR; - } - scsi_low_data_finish(slp); - } - else - { - device_printf(slp->sl_dev, "smit_xfer_end: phase miss\n"); - slp->sl_error |= PDMAERR; - } -} - -int -bshw_smit_xfer_start(struct ct_softc *ct) -{ - struct scsi_low_softc *slp = &ct->sc_sclow; - struct ct_bus_access_handle *chp = &ct->sc_ch; - struct bshw_softc *bs = ct->ct_hw; - struct sc_p *sp = &slp->sl_scp; - struct targ_info *ti = slp->sl_Tnexus; - struct ct_targ_info *cti = (void *) ti; - u_int datalen, count, io_control; - int wc; - u_int8_t *data; - - io_control = bs->sc_io_control | bshw_io_control; - if ((io_control & BSHW_SMIT_BLOCK) != 0) - return EINVAL; - - if ((slp->sl_scp.scp_datalen % DEV_BSIZE) != 0) - return EINVAL; - - datalen = sp->scp_datalen; - if (slp->sl_scp.scp_direction == SCSI_LOW_READ) - { - if ((io_control & BSHW_READ_INTERRUPT_DRIVEN) != 0 && - datalen > bshw_data_read_bytes) - datalen = bshw_data_read_bytes; - } - else - { - if ((io_control & BSHW_WRITE_INTERRUPT_DRIVEN) != 0 && - datalen > bshw_data_write_bytes) - datalen = bshw_data_write_bytes; - } - - bs->sc_sdatalen = datalen; - data = sp->scp_data; - wc = LC_SMIT_TIMEOUT * 1024 * 1024; - - ct_cr_write_1(chp, wd3s_ctrl, ct->sc_creg | CR_DMA); - bshw_lc_smit_start(ct, datalen, sp->scp_direction); - - if (sp->scp_direction == SCSI_LOW_READ) - { - do - { - if (bshw_lc_smit_fstat(ct, wc, SCSI_LOW_READ)) - break; - - count = (datalen > LC_FSZ ? LC_FSZ : datalen); - bus_read_region_4(chp->ch_mem, - LC_SMIT_OFFSET, (u_int32_t *) data, count >> 2); - data += count; - datalen -= count; - } - while (datalen > 0); - - bs->sc_edatalen = datalen; - } - else - { - do - { - if (bshw_lc_smit_fstat(ct, wc, SCSI_LOW_WRITE)) - break; - if (cti->cti_syncreg == 0) - { - /* XXX: - * If async transfer, reconfirm a scsi phase - * again. Unless C bus might hang up. - */ - if (bshw_lc_smit_fstat(ct, wc, SCSI_LOW_WRITE)) - break; - } - - count = (datalen > LC_SFSZ ? LC_SFSZ : datalen); - bus_write_region_4(chp->ch_mem, - LC_SMIT_OFFSET, (u_int32_t *) data, count >> 2); - data += count; - datalen -= count; - - if (bshw_lc_smit_fstat(ct, wc, SCSI_LOW_WRITE)) - break; - - count = (datalen > LC_REST ? LC_REST : datalen); - bus_write_region_4(chp->ch_mem, - LC_SMIT_OFFSET + LC_SFSZ, - (u_int32_t *) data, count >> 2); - data += count; - datalen -= count; - } - while (datalen > 0); - } - return 0; -} - -/********************************************************* - * DMA TRANSFER (BS) - *********************************************************/ -static __inline void bshw_dma_write_1 \ - (struct ct_bus_access_handle *, bus_addr_t, u_int8_t); -static void bshw_dmastart(struct ct_softc *); -static void bshw_dmadone(struct ct_softc *); - -int -bshw_dma_xfer_start(struct ct_softc *ct) -{ - struct scsi_low_softc *slp = &ct->sc_sclow; - struct sc_p *sp = &slp->sl_scp; - struct ct_bus_access_handle *chp = &ct->sc_ch; - struct bshw_softc *bs = ct->ct_hw; - vaddr_t va, endva, phys, nphys; - u_int io_control; - - io_control = bs->sc_io_control | bshw_io_control; - if ((io_control & BSHW_DMA_BLOCK) != 0 && sp->scp_datalen < 256) - return EINVAL; - - ct_cr_write_1(chp, wd3s_ctrl, ct->sc_creg | CR_DMA); - phys = vtophys((vaddr_t) sp->scp_data); - if (phys >= bs->sc_minphys) - { - /* setup segaddr */ - bs->sc_segaddr = bs->sc_bounce_phys; - /* setup seglen */ - bs->sc_seglen = sp->scp_datalen; - if (bs->sc_seglen > bs->sc_bounce_size) - bs->sc_seglen = bs->sc_bounce_size; - /* setup bufp */ - bs->sc_bufp = bs->sc_bounce_addr; - if (sp->scp_direction == SCSI_LOW_WRITE) - bcopy(sp->scp_data, bs->sc_bufp, bs->sc_seglen); - } - else - { - /* setup segaddr */ - bs->sc_segaddr = (u_int8_t *) phys; - /* setup seglen */ - endva = (vaddr_t) round_page((vaddr_t) sp->scp_data + sp->scp_datalen); - for (va = (vaddr_t) sp->scp_data; ; phys = nphys) - { - if ((va += PAGE_SIZE) >= endva) - { - bs->sc_seglen = sp->scp_datalen; - break; - } - - nphys = vtophys(va); - if (phys + PAGE_SIZE != nphys || nphys >= bs->sc_minphys) - { - bs->sc_seglen = - (u_int8_t *) trunc_page(va) - sp->scp_data; - break; - } - } - /* setup bufp */ - bs->sc_bufp = NULL; - } - - bshw_dmastart(ct); - cthw_set_count(chp, bs->sc_seglen); - ct_cr_write_1(chp, wd3s_cmd, WD3S_TFR_INFO); - return 0; -} - -void -bshw_dma_xfer_stop(struct ct_softc *ct) -{ - struct scsi_low_softc *slp = &ct->sc_sclow; - struct sc_p *sp = &slp->sl_scp; - struct bshw_softc *bs = ct->ct_hw; - struct targ_info *ti; - u_int count, transbytes; - - bshw_dmadone(ct); - - ti = slp->sl_Tnexus; - if (ti == NULL) - return; - - if (ti->ti_phase == PH_DATA) - { - count = cthw_get_count(&ct->sc_ch); - if (count < (u_int) bs->sc_seglen) - { - transbytes = bs->sc_seglen - count; - if (bs->sc_bufp != NULL && - sp->scp_direction == SCSI_LOW_READ) - bcopy(bs->sc_bufp, sp->scp_data, transbytes); - - sp->scp_data += transbytes; - sp->scp_datalen -= transbytes; - } - else if (count > (u_int) bs->sc_seglen) - { - device_printf(slp->sl_dev, - "port data %x != seglen %x\n", - count, bs->sc_seglen); - slp->sl_error |= PDMAERR; - } - - scsi_low_data_finish(slp); - } - else - { - device_printf(slp->sl_dev, "extra DMA interrupt\n"); - slp->sl_error |= PDMAERR; - } - - bs->sc_bufp = NULL; -} - -/* common dma settings */ -#undef DMA1_SMSK -#define DMA1_SMSK (0x15) -#undef DMA1_MODE -#define DMA1_MODE (0x17) -#undef DMA1_FFC -#define DMA1_FFC (0x19) -#undef DMA1_CHN -#define DMA1_CHN(c) (0x01 + ((c) << 2)) - -#define DMA37SM_SET 0x04 -#define DMA37MD_WRITE 0x04 -#define DMA37MD_READ 0x08 -#define DMA37MD_SINGLE 0x40 - -static bus_addr_t dmapageport[4] = { 0x27, 0x21, 0x23, 0x25 }; - -static __inline void -bshw_dma_write_1(struct ct_bus_access_handle *chp, bus_addr_t port, - u_int8_t val) -{ - - CT_BUS_WEIGHT(chp); - outb(port, val); -} - -static void -bshw_dmastart(struct ct_softc *ct) -{ - struct scsi_low_softc *slp = &ct->sc_sclow; - struct bshw_softc *bs = ct->ct_hw; - struct ct_bus_access_handle *chp = &ct->sc_ch; - int chan = bs->sc_drq; - bus_addr_t waport; - u_int8_t regv, *phys = bs->sc_segaddr; - u_int nbytes = bs->sc_seglen; - - /* flush cpu cache */ - (*bs->sc_dmasync_before) (ct); - - /* - * Program one of DMA channels 0..3. These are - * byte mode channels. - */ - /* set dma channel mode, and reset address ff */ - - if (slp->sl_scp.scp_direction == SCSI_LOW_READ) - regv = DMA37MD_WRITE | DMA37MD_SINGLE | chan; - else - regv = DMA37MD_READ | DMA37MD_SINGLE | chan; - - bshw_dma_write_1(chp, DMA1_MODE, regv); - bshw_dma_write_1(chp, DMA1_FFC, 0); - - /* send start address */ - waport = DMA1_CHN(chan); - bshw_dma_write_1(chp, waport, (u_int) phys); - bshw_dma_write_1(chp, waport, ((u_int) phys) >> 8); - bshw_dma_write_1(chp, dmapageport[chan], ((u_int) phys) >> 16); - - /* send count */ - bshw_dma_write_1(chp, waport + 2, --nbytes); - bshw_dma_write_1(chp, waport + 2, nbytes >> 8); - - /* vendor unique hook */ - if (bs->sc_hw->hw_dma_start) - (*bs->sc_hw->hw_dma_start)(ct); - - bshw_dma_write_1(chp, DMA1_SMSK, chan); - ct_cmdp_write_1(chp, CMDP_DMES); -} - -static void -bshw_dmadone(struct ct_softc *ct) -{ - struct bshw_softc *bs = ct->ct_hw; - struct ct_bus_access_handle *chp = &ct->sc_ch; - - bshw_dma_write_1(chp, DMA1_SMSK, (bs->sc_drq | DMA37SM_SET)); - ct_cmdp_write_1(chp, CMDP_DMER); - - /* vendor unique hook */ - if (bs->sc_hw->hw_dma_stop) - (*bs->sc_hw->hw_dma_stop) (ct); - - /* flush cpu cache */ - (*bs->sc_dmasync_after) (ct); -} - -/********************************************** - * VENDOR UNIQUE DMA FUNCS - **********************************************/ -static int bshw_dma_init_sc98(struct ct_softc *); -static void bshw_dma_start_sc98(struct ct_softc *); -static void bshw_dma_stop_sc98(struct ct_softc *); -static int bshw_dma_init_texa(struct ct_softc *); -static void bshw_dma_start_elecom(struct ct_softc *); -static void bshw_dma_stop_elecom(struct ct_softc *); - -static int -bshw_dma_init_texa(struct ct_softc *ct) -{ - struct ct_bus_access_handle *chp = &ct->sc_ch; - u_int8_t regval; - - if ((regval = ct_cr_read_1(chp, 0x37)) & 0x08) - return 0; - - ct_cr_write_1(chp, 0x37, regval | 0x08); - regval = ct_cr_read_1(chp, 0x3f); - ct_cr_write_1(chp, 0x3f, regval | 0x08); - return 1; -} - -static int -bshw_dma_init_sc98(struct ct_softc *ct) -{ - struct ct_bus_access_handle *chp = &ct->sc_ch; - - if (ct_cr_read_1(chp, 0x37) & 0x08) - return 0; - - /* If your card is SC98 with bios ver 1.01 or 1.02 under no PCI */ - ct_cr_write_1(chp, 0x37, 0x1a); - ct_cr_write_1(chp, 0x3f, 0x1a); -#if 0 - /* only valid for IO */ - ct_cr_write_1(chp, 0x40, 0xf4); - ct_cr_write_1(chp, 0x41, 0x9); - ct_cr_write_1(chp, 0x43, 0xff); - ct_cr_write_1(chp, 0x46, 0x4e); - - ct_cr_write_1(chp, 0x48, 0xf4); - ct_cr_write_1(chp, 0x49, 0x9); - ct_cr_write_1(chp, 0x4b, 0xff); - ct_cr_write_1(chp, 0x4e, 0x4e); -#endif - return 1; -} - -static void -bshw_dma_start_sc98(struct ct_softc *ct) -{ - struct ct_bus_access_handle *chp = &ct->sc_ch; - - ct_cr_write_1(chp, 0x73, 0x32); - ct_cr_write_1(chp, 0x74, 0x23); -} - -static void -bshw_dma_stop_sc98(struct ct_softc *ct) -{ - struct ct_bus_access_handle *chp = &ct->sc_ch; - - ct_cr_write_1(chp, 0x73, 0x43); - ct_cr_write_1(chp, 0x74, 0x34); -} - -static void -bshw_dma_start_elecom(struct ct_softc *ct) -{ - struct ct_bus_access_handle *chp = &ct->sc_ch; - u_int8_t tmp = ct_cr_read_1(chp, 0x4c); - - ct_cr_write_1(chp, 0x32, tmp & 0xdf); -} - -static void -bshw_dma_stop_elecom(struct ct_softc *ct) -{ - struct ct_bus_access_handle *chp = &ct->sc_ch; - u_int8_t tmp = ct_cr_read_1(chp, 0x4c); - - ct_cr_write_1(chp, 0x32, tmp | 0x20); -} - -static struct bshw bshw_generic = { - BSHW_SYNC_RELOAD, - - 0, - - NULL, - NULL, - NULL, -}; - -static struct bshw bshw_sc98 = { - BSHW_DOUBLE_DMACHAN, - - 0x60, - - bshw_dma_init_sc98, - bshw_dma_start_sc98, - bshw_dma_stop_sc98, -}; - -static struct bshw bshw_texa = { - BSHW_DOUBLE_DMACHAN, - - 0x60, - - bshw_dma_init_texa, - NULL, - NULL, -}; - -static struct bshw bshw_elecom = { - 0, - - 0x38, - - NULL, - bshw_dma_start_elecom, - bshw_dma_stop_elecom, -}; - -static struct bshw bshw_lc_smit = { - BSHW_SMFIFO | BSHW_DOUBLE_DMACHAN, - - 0x60, - - NULL, - NULL, - NULL, -}; - -static struct bshw bshw_lha20X = { - BSHW_DOUBLE_DMACHAN, - - 0x60, - - NULL, - NULL, - NULL, -}; - -/* hw tabs */ -static dvcfg_hw_t bshw_hwsel_array[] = { -/* 0x00 */ &bshw_generic, -/* 0x01 */ &bshw_sc98, -/* 0x02 */ &bshw_texa, -/* 0x03 */ &bshw_elecom, -/* 0x04 */ &bshw_lc_smit, -/* 0x05 */ &bshw_lha20X, -}; - -struct dvcfg_hwsel bshw_hwsel = { - DVCFG_HWSEL_SZ(bshw_hwsel_array), - bshw_hwsel_array -}; diff --git a/sys/dev/ct/bshwvar.h b/sys/dev/ct/bshwvar.h deleted file mode 100644 index ba42a7206979..000000000000 --- a/sys/dev/ct/bshwvar.h +++ /dev/null @@ -1,96 +0,0 @@ -/* $FreeBSD$ */ -/* $NecBSD: bshwvar.h,v 1.3.14.3 2001/06/21 04:07:37 honda Exp $ */ -/* $NetBSD$ */ - -/*- - * [NetBSD for NEC PC-98 series] - * Copyright (c) 1994, 1995, 1996, 1997, 1998 - * NetBSD/pc98 porting staff. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef _BSHWVAR_H_ -#define _BSHWVAR_H_ - -/* - * bshwvar.h - * NEC 55 compatible board specific definitions - */ - -#define BSHW_DEFAULT_CHIPCLK 20 /* 20MHz */ -#define BSHW_DEFAULT_HOSTID 7 - -struct bshw { -#define BSHW_SYNC_RELOAD 0x01 -#define BSHW_SMFIFO 0x02 -#define BSHW_DOUBLE_DMACHAN 0x04 - u_int hw_flags; - u_int hw_sregaddr; - - int ((*hw_dma_init)(struct ct_softc *)); - void ((*hw_dma_start)(struct ct_softc *)); - void ((*hw_dma_stop)(struct ct_softc *)); -}; - -struct bshw_softc { - int sc_hostid; - int sc_irq; /* irq */ - int sc_drq; /* drq */ - - /* dma transfer */ - u_int8_t *sc_segaddr; - u_int8_t *sc_bufp; - int sc_seglen; - u_int sc_sdatalen; /* SMIT */ - u_int sc_edatalen; /* SMIT */ - - /* private bounce */ - u_int8_t *sc_bounce_phys; - u_int8_t *sc_bounce_addr; - u_int sc_bounce_size; - bus_addr_t sc_minphys; - - /* io control */ -#define BSHW_READ_INTERRUPT_DRIVEN 0x0001 -#define BSHW_WRITE_INTERRUPT_DRIVEN 0x0002 -#define BSHW_DMA_BLOCK 0x0010 -#define BSHW_SMIT_BLOCK 0x0020 - u_int sc_io_control; - - /* hardware */ - struct bshw *sc_hw; - void ((*sc_dmasync_before))(struct ct_softc *); - void ((*sc_dmasync_after))(struct ct_softc *); -}; - -void bshw_synch_setup(struct ct_softc *, struct targ_info *); -void bshw_bus_reset(struct ct_softc *); -int bshw_read_settings(struct ct_bus_access_handle *, struct bshw_softc *); -int bshw_smit_xfer_start(struct ct_softc *); -void bshw_smit_xfer_stop(struct ct_softc *); -int bshw_dma_xfer_start(struct ct_softc *); -void bshw_dma_xfer_stop(struct ct_softc *); - -extern struct dvcfg_hwsel bshw_hwsel; -#endif /* !_BSHWVAR_H_ */ diff --git a/sys/dev/ct/ct.c b/sys/dev/ct/ct.c deleted file mode 100644 index 6a96c9c486e6..000000000000 --- a/sys/dev/ct/ct.c +++ /dev/null @@ -1,1242 +0,0 @@ -/* $NecBSD: ct.c,v 1.13.12.5 2001/06/26 07:31:53 honda Exp $ */ - -#include -__FBSDID("$FreeBSD$"); -/* $NetBSD$ */ - -#define CT_DEBUG -#define CT_IO_CONTROL_FLAGS (CT_USE_CCSEQ | CT_FAST_INTR) - -/*- - * [NetBSD for NEC PC-98 series] - * Copyright (c) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 - * NetBSD/pc98 porting staff. All rights reserved. - * - * Copyright (c) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 - * Naofumi HONDA. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -#include -#include -#include - -#define CT_NTARGETS 8 -#define CT_NLUNS 8 -#define CT_RESET_DEFAULT 2000 -#define CT_DELAY_MAX (2 * 1000 * 1000) -#define CT_DELAY_INTERVAL (1) - -/*************************************************** - * DEBUG - ***************************************************/ -#ifdef CT_DEBUG -int ct_debug; -#endif /* CT_DEBUG */ - -/*************************************************** - * IO control - ***************************************************/ -#define CT_USE_CCSEQ 0x0100 -#define CT_FAST_INTR 0x0200 - -u_int ct_io_control = CT_IO_CONTROL_FLAGS; - -/*************************************************** - * default data - ***************************************************/ -u_int8_t cthw_cmdlevel[256] = { -/* 0 1 2 3 4 5 6 7 8 9 A B C E D F */ -/*0*/0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,1 ,0 ,1 ,0 ,0 ,0 ,0 ,0 , -/*1*/0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , -/*2*/0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,1 ,0 ,1 ,0 ,0 ,0 ,0 ,0 , -/*3*/0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , -/*4*/0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , -/*5*/0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , -/*6*/0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , -/*7*/0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , -/*8*/0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , -/*9*/0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , -/*A*/0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , -/*B*/0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , -/*C*/0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , -/*D*/0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , -/*E*/0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , -/*F*/0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , -}; - -#if 0 -/* default synch data table */ -/* A 10 6.6 5.0 4.0 3.3 2.8 2.5 2.0 M/s */ -/* X 100 150 200 250 300 350 400 500 ns */ -static struct ct_synch_data ct_synch_data_FSCSI[] = { - {25, 0xa0}, {37, 0xb0}, {50, 0x20}, {62, 0xd0}, {75, 0x30}, - {87, 0xf0}, {100, 0x40}, {125, 0x50}, {0, 0} -}; - -static struct ct_synch_data ct_synch_data_SCSI[] = { - {50, 0x20}, {75, 0x30}, {100, 0x40}, {125, 0x50}, {0, 0} -}; -#endif -/*************************************************** - * DEVICE STRUCTURE - ***************************************************/ -extern struct cfdriver ct_cd; - -/***************************************************************** - * Interface functions - *****************************************************************/ -static int ct_xfer(struct ct_softc *, u_int8_t *, int, int, u_int *); -static void ct_io_xfer(struct ct_softc *); -static int ct_reselected(struct ct_softc *, u_int8_t); -static void ct_phase_error(struct ct_softc *, u_int8_t); -static int ct_start_selection(struct ct_softc *, struct slccb *); -static int ct_msg(struct ct_softc *, struct targ_info *, u_int); -static int ct_world_start(struct ct_softc *, int); -static __inline void cthw_phase_bypass(struct ct_softc *, u_int8_t); -static int cthw_chip_reset(struct ct_bus_access_handle *, int *, int, int); -static void cthw_bus_reset(struct ct_softc *); -static int ct_ccb_nexus_establish(struct ct_softc *); -static int ct_lun_nexus_establish(struct ct_softc *); -static int ct_target_nexus_establish(struct ct_softc *, int, int); -static void cthw_attention(struct ct_softc *); -static int ct_targ_init(struct ct_softc *, struct targ_info *, int); -static int ct_unbusy(struct ct_softc *); -static void ct_attention(struct ct_softc *); -static struct ct_synch_data *ct_make_synch_table(struct ct_softc *); -static int ct_catch_intr(struct ct_softc *); -static int ct_poll(void *); - -struct scsi_low_funcs ct_funcs = { - SC_LOW_INIT_T ct_world_start, - SC_LOW_BUSRST_T cthw_bus_reset, - SC_LOW_TARG_INIT_T ct_targ_init, - SC_LOW_LUN_INIT_T NULL, - - SC_LOW_SELECT_T ct_start_selection, - SC_LOW_NEXUS_T ct_lun_nexus_establish, - SC_LOW_NEXUS_T ct_ccb_nexus_establish, - - SC_LOW_ATTEN_T cthw_attention, - SC_LOW_MSG_T ct_msg, - - SC_LOW_TIMEOUT_T NULL, - SC_LOW_POLL_T ct_poll, - - NULL, /* SC_LOW_POWER_T cthw_power, */ -}; - -/************************************************** - * HW functions - **************************************************/ -static __inline void -cthw_phase_bypass(struct ct_softc *ct, u_int8_t ph) -{ - struct ct_bus_access_handle *chp = &ct->sc_ch; - - ct_cr_write_1(chp, wd3s_cph, ph); - ct_cr_write_1(chp, wd3s_cmd, WD3S_SELECT_ATN_TFR); -} - -static void -cthw_bus_reset(struct ct_softc *ct) -{ - - /* - * wd33c93 does not have bus reset function. - */ - if (ct->ct_bus_reset != NULL) - ((*ct->ct_bus_reset) (ct)); -} - -static int -cthw_chip_reset(struct ct_bus_access_handle *chp, int *chiprevp, int chipclk, - int hostid) -{ -#define CT_SELTIMEOUT_20MHz_REGV (0x80) - u_int8_t aux, regv; - u_int seltout; - int wc; - - /* issue abort cmd */ - ct_cr_write_1(chp, wd3s_cmd, WD3S_ABORT); - DELAY(1000); /* 1ms wait */ - (void) ct_stat_read_1(chp); - (void) ct_cr_read_1(chp, wd3s_stat); - - /* setup chip registers */ - regv = 0; - seltout = CT_SELTIMEOUT_20MHz_REGV; - switch (chipclk) - { - case 8: - case 10: - seltout = (seltout * chipclk) / 20; - regv = IDR_FS_8_10; - break; - - case 12: - case 15: - seltout = (seltout * chipclk) / 20; - regv = IDR_FS_12_15; - break; - - case 16: - case 20: - seltout = (seltout * chipclk) / 20; - regv = IDR_FS_16_20; - break; - - default: - panic("ct: illegal chip clk rate"); - break; - } - - regv |= IDR_EHP | hostid | IDR_RAF | IDR_EAF; - ct_cr_write_1(chp, wd3s_oid, regv); - - ct_cr_write_1(chp, wd3s_cmd, WD3S_RESET); - for (wc = CT_RESET_DEFAULT; wc > 0; wc --) - { - aux = ct_stat_read_1(chp); - if (aux != 0xff && (aux & STR_INT)) - { - regv = ct_cr_read_1(chp, wd3s_stat); - if (regv == BSR_RESET || regv == BSR_AFM_RESET) - break; - - ct_cr_write_1(chp, wd3s_cmd, WD3S_RESET); - } - DELAY(1); - } - if (wc == 0) - return ENXIO; - - ct_cr_write_1(chp, wd3s_tout, seltout); - ct_cr_write_1(chp, wd3s_sid, SIDR_RESEL); - ct_cr_write_1(chp, wd3s_ctrl, CR_DEFAULT); - ct_cr_write_1(chp, wd3s_synch, 0); - if (chiprevp != NULL) - { - *chiprevp = CT_WD33C93; - if (regv == BSR_RESET) - goto out; - - *chiprevp = CT_WD33C93_A; - ct_cr_write_1(chp, wd3s_qtag, 0xaa); - if (ct_cr_read_1(chp, wd3s_qtag) != 0xaa) - { - ct_cr_write_1(chp, wd3s_qtag, 0x0); - goto out; - } - ct_cr_write_1(chp, wd3s_qtag, 0x55); - if (ct_cr_read_1(chp, wd3s_qtag) != 0x55) - { - ct_cr_write_1(chp, wd3s_qtag, 0x0); - goto out; - } - ct_cr_write_1(chp, wd3s_qtag, 0x0); - *chiprevp = CT_WD33C93_B; - } - -out: - (void) ct_stat_read_1(chp); - (void) ct_cr_read_1(chp, wd3s_stat); - return 0; -} - -static struct ct_synch_data * -ct_make_synch_table(struct ct_softc *ct) -{ - struct ct_synch_data *sdtp, *sdp; - u_int base, i, period; - - sdtp = sdp = &ct->sc_default_sdt[0]; - - if ((ct->sc_chipclk % 5) == 0) - base = 1000 / (5 * 2); /* 5 MHz type */ - else - base = 1000 / (4 * 2); /* 4 MHz type */ - - if (ct->sc_chiprev >= CT_WD33C93_B) - { - /* fast scsi */ - for (i = 2; i < 8; i ++, sdp ++) - { - period = (base * i) / 2; - if (period >= 200) /* 5 MHz */ - break; - sdp->cs_period = period / 4; - sdp->cs_syncr = (i * 0x10) | 0x80; - } - } - - for (i = 2; i < 8; i ++, sdp ++) - { - period = (base * i); - if (period > 500) /* 2 MHz */ - break; - sdp->cs_period = period / 4; - sdp->cs_syncr = (i * 0x10); - } - - sdp->cs_period = 0; - sdp->cs_syncr = 0; - return sdtp; -} - -/************************************************** - * Attach & Probe - **************************************************/ -int -ctprobesubr(struct ct_bus_access_handle *chp, u_int dvcfg, int hsid, - u_int chipclk, int *chiprevp) -{ - -#if 0 - if ((ct_stat_read_1(chp) & STR_BSY) != 0) - return 0; -#endif - if (cthw_chip_reset(chp, chiprevp, chipclk, hsid) != 0) - return 0; - return 1; -} - -void -ctattachsubr(struct ct_softc *ct) -{ - struct scsi_low_softc *slp = &ct->sc_sclow; - - ct->sc_tmaxcnt = SCSI_LOW_MIN_TOUT * 1000 * 1000; /* default */ - slp->sl_funcs = &ct_funcs; - slp->sl_flags |= HW_READ_PADDING; - (void) scsi_low_attach(slp, 0, CT_NTARGETS, CT_NLUNS, - sizeof(struct ct_targ_info), 0); -} - -/************************************************** - * SCSI LOW interface functions - **************************************************/ -static void -cthw_attention(struct ct_softc *ct) -{ - struct ct_bus_access_handle *chp = &ct->sc_ch; - - ct->sc_atten = 1; - if ((ct_stat_read_1(chp) & (STR_BSY | STR_CIP)) != 0) - return; - - ct_cr_write_1(chp, wd3s_cmd, WD3S_ASSERT_ATN); - DELAY(10); - if ((ct_stat_read_1(chp) & STR_LCI) == 0) - ct->sc_atten = 0; - ct_unbusy(ct); - return; -} - -static void -ct_attention(struct ct_softc *ct) -{ - struct scsi_low_softc *slp = &ct->sc_sclow; - - if (slp->sl_atten == 0) - { - ct_unbusy(ct); - scsi_low_attention(slp); - } - else if (ct->sc_atten != 0) - { - ct_unbusy(ct); - cthw_attention(ct); - } -} - -static int -ct_targ_init(struct ct_softc *ct, struct targ_info *ti, int action) -{ - struct ct_targ_info *cti = (void *) ti; - - if (action == SCSI_LOW_INFO_ALLOC || action == SCSI_LOW_INFO_REVOKE) - { - if (ct->sc_sdp == NULL) - { - ct->sc_sdp = ct_make_synch_table(ct); - } - - switch (ct->sc_chiprev) - { - default: - ti->ti_maxsynch.offset = 5; - break; - - case CT_WD33C93_A: - case CT_AM33C93_A: - ti->ti_maxsynch.offset = 12; - break; - - case CT_WD33C93_B: - case CT_WD33C93_C: - ti->ti_maxsynch.offset = 12; - break; - } - - ti->ti_maxsynch.period = ct->sc_sdp[0].cs_period; - ti->ti_width = SCSI_LOW_BUS_WIDTH_8; - cti->cti_syncreg = 0; - } - - return 0; -} - -static int -ct_world_start(struct ct_softc *ct, int fdone) -{ - struct scsi_low_softc *slp = &ct->sc_sclow; - struct ct_bus_access_handle *chp = &ct->sc_ch; - - if (ct->sc_sdp == NULL) - { - ct->sc_sdp = ct_make_synch_table(ct); - } - - if (slp->sl_cfgflags & CFG_NOPARITY) - ct->sc_creg = CR_DEFAULT; - else - ct->sc_creg = CR_DEFAULT_HP; - - if (ct->sc_dma & CT_DMA_DMASTART) - (*ct->ct_dma_xfer_stop) (ct); - if (ct->sc_dma & CT_DMA_PIOSTART) - (*ct->ct_pio_xfer_stop) (ct); - ct->sc_dma = 0; - ct->sc_atten = 0; - - cthw_chip_reset(chp, NULL, ct->sc_chipclk, slp->sl_hostid); - scsi_low_bus_reset(slp); - cthw_chip_reset(chp, NULL, ct->sc_chipclk, slp->sl_hostid); - - return 0; -} - -static int -ct_start_selection(struct ct_softc *ct, struct slccb *cb) -{ - struct scsi_low_softc *slp = &ct->sc_sclow; - struct ct_bus_access_handle *chp = &ct->sc_ch; - - struct targ_info *ti = slp->sl_Tnexus; - struct lun_info *li = slp->sl_Lnexus; - int s, satok; - u_int8_t cmd; - - ct->sc_tmaxcnt = cb->ccb_tcmax * 1000 * 1000; - ct->sc_atten = 0; - satok = 0; - - if (scsi_low_is_disconnect_ok(cb) != 0) - { - if (ct->sc_chiprev >= CT_WD33C93_A) - satok = 1; - else if (cthw_cmdlevel[slp->sl_scp.scp_cmd[0]] != 0) - satok = 1; - } - - if (satok != 0 && - scsi_low_is_msgout_continue(ti, SCSI_LOW_MSG_IDENTIFY) == 0) - { - cmd = WD3S_SELECT_ATN_TFR; - ct->sc_satgo = CT_SAT_GOING; - } - else - { - cmd = WD3S_SELECT_ATN; - ct->sc_satgo = 0; - } - - if ((ct_stat_read_1(chp) & (STR_BSY | STR_INT | STR_CIP)) != 0) - return SCSI_LOW_START_FAIL; - - if ((ct->sc_satgo & CT_SAT_GOING) != 0) - { - (void) scsi_low_msgout(slp, ti, SCSI_LOW_MSGOUT_INIT); - scsi_low_cmd(slp, ti); - ct_cr_write_1(chp, wd3s_oid, slp->sl_scp.scp_cmdlen); - ct_write_cmds(chp, slp->sl_scp.scp_cmd, slp->sl_scp.scp_cmdlen); - } - else - { - /* anyway attention assert */ - SCSI_LOW_ASSERT_ATN(slp); - } - - ct_target_nexus_establish(ct, li->li_lun, slp->sl_scp.scp_direction); - - s = splhigh(); - if ((ct_stat_read_1(chp) & (STR_BSY | STR_INT | STR_CIP)) == 0) - { - /* XXX: - * Reload a lun again here. - */ - ct_cr_write_1(chp, wd3s_lun, li->li_lun); - ct_cr_write_1(chp, wd3s_cmd, cmd); - if ((ct_stat_read_1(chp) & STR_LCI) == 0) - { - splx(s); - SCSI_LOW_SETUP_PHASE(ti, PH_SELSTART); - return SCSI_LOW_START_OK; - } - } - splx(s); - return SCSI_LOW_START_FAIL; -} - -static int -ct_msg(struct ct_softc *ct, struct targ_info *ti, u_int msg) -{ - struct ct_bus_access_handle *chp = &ct->sc_ch; - struct ct_targ_info *cti = (void *) ti; - struct ct_synch_data *csp = ct->sc_sdp; - u_int offset, period; - int error; - - if ((msg & SCSI_LOW_MSG_WIDE) != 0) - { - if (ti->ti_width != SCSI_LOW_BUS_WIDTH_8) - { - ti->ti_width = SCSI_LOW_BUS_WIDTH_8; - return EINVAL; - } - return 0; - } - - if ((msg & SCSI_LOW_MSG_SYNCH) == 0) - return 0; - - offset = ti->ti_maxsynch.offset; - period = ti->ti_maxsynch.period; - for ( ; csp->cs_period != 0; csp ++) - { - if (period == csp->cs_period) - break; - } - - if (ti->ti_maxsynch.period != 0 && csp->cs_period == 0) - { - ti->ti_maxsynch.period = 0; - ti->ti_maxsynch.offset = 0; - cti->cti_syncreg = 0; - error = EINVAL; - } - else - { - cti->cti_syncreg = ((offset & 0x0f) | csp->cs_syncr); - error = 0; - } - - if (ct->ct_synch_setup != 0) - (*ct->ct_synch_setup) (ct, ti); - ct_cr_write_1(chp, wd3s_synch, cti->cti_syncreg); - return error; -} - -/************************************************* - * - *************************************************/ -static int -ct_xfer(struct ct_softc *ct, u_int8_t *data, int len, int direction, - u_int *statp) -{ - struct ct_bus_access_handle *chp = &ct->sc_ch; - int wc; - register u_int8_t aux; - - *statp = 0; - if (len == 1) - { - ct_cr_write_1(chp, wd3s_cmd, WD3S_SBT | WD3S_TFR_INFO); - } - else - { - cthw_set_count(chp, len); - ct_cr_write_1(chp, wd3s_cmd, WD3S_TFR_INFO); - } - - aux = ct_stat_read_1(chp); - if ((aux & STR_LCI) != 0) - { - cthw_set_count(chp, 0); - return len; - } - - for (wc = 0; wc < ct->sc_tmaxcnt; wc ++) - { - /* check data ready */ - if ((aux & (STR_BSY | STR_DBR)) == (STR_BSY | STR_DBR)) - { - if (direction == SCSI_LOW_READ) - { - *data = ct_cr_read_1(chp, wd3s_data); - if ((aux & STR_PE) != 0) - *statp |= SCSI_LOW_DATA_PE; - } - else - { - ct_cr_write_1(chp, wd3s_data, *data); - } - len --; - if (len <= 0) - break; - data ++; - } - else - { - DELAY(1); - } - - /* check phase miss */ - aux = ct_stat_read_1(chp); - if ((aux & STR_INT) != 0) - break; - } - return len; -} - -#define CT_PADDING_BUF_SIZE 32 - -static void -ct_io_xfer(struct ct_softc *ct) -{ - struct scsi_low_softc *slp = &ct->sc_sclow; - struct ct_bus_access_handle *chp = &ct->sc_ch; - struct sc_p *sp = &slp->sl_scp; - u_int stat; - int len; - u_int8_t pbuf[CT_PADDING_BUF_SIZE]; - - /* polling mode */ - ct_cr_write_1(chp, wd3s_ctrl, ct->sc_creg); - - if (sp->scp_datalen <= 0) - { - slp->sl_error |= PDMAERR; - - if (slp->sl_scp.scp_direction == SCSI_LOW_WRITE) - bzero(pbuf, CT_PADDING_BUF_SIZE); - ct_xfer(ct, pbuf, CT_PADDING_BUF_SIZE, - sp->scp_direction, &stat); - } - else - { - len = ct_xfer(ct, sp->scp_data, sp->scp_datalen, - sp->scp_direction, &stat); - sp->scp_data += (sp->scp_datalen - len); - sp->scp_datalen = len; - } -} - -/************************************************** - * - **************************************************/ -struct ct_err { - u_char *pe_msg; - u_int pe_err; - u_int pe_errmsg; - int pe_done; -}; - -struct ct_err ct_cmderr[] = { -/*0*/ { "illegal cmd", FATALIO, SCSI_LOW_MSG_ABORT, 1}, -/*1*/ { "unexpected bus free", FATALIO, 0, 1}, -/*2*/ { NULL, SELTIMEOUTIO, 0, 1}, -/*3*/ { "scsi bus parity error", PARITYERR, SCSI_LOW_MSG_ERROR, 0}, -/*4*/ { "scsi bus parity error", PARITYERR, SCSI_LOW_MSG_ERROR, 0}, -/*5*/ { "unknown" , FATALIO, SCSI_LOW_MSG_ABORT, 1}, -/*6*/ { "miss reselection (target mode)", FATALIO, SCSI_LOW_MSG_ABORT, 0}, -/*7*/ { "wrong status byte", PARITYERR, SCSI_LOW_MSG_ERROR, 0}, -}; - -static void -ct_phase_error(struct ct_softc *ct, u_int8_t scsi_status) -{ - struct scsi_low_softc *slp = &ct->sc_sclow; - struct targ_info *ti = slp->sl_Tnexus; - struct ct_err *pep; - u_int msg = 0; - - if ((scsi_status & BSR_CM) == BSR_CMDERR && - (scsi_status & BSR_PHVALID) == 0) - { - pep = &ct_cmderr[scsi_status & BSR_PM]; - slp->sl_error |= pep->pe_err; - if ((pep->pe_err & PARITYERR) != 0) - { - if (ti->ti_phase == PH_MSGIN) - msg = SCSI_LOW_MSG_PARITY; - else - msg = SCSI_LOW_MSG_ERROR; - } - else - msg = pep->pe_errmsg; - - if (msg != 0) - scsi_low_assert_msg(slp, slp->sl_Tnexus, msg, 1); - - if (pep->pe_msg != NULL) - { - device_printf(slp->sl_dev, "phase error: %s", - pep->pe_msg); - scsi_low_print(slp, slp->sl_Tnexus); - } - - if (pep->pe_done != 0) - scsi_low_disconnected(slp, ti); - } - else - { - slp->sl_error |= FATALIO; - scsi_low_restart(slp, SCSI_LOW_RESTART_HARD, "phase error"); - } -} - -/************************************************** - * ### SCSI PHASE SEQUENCER ### - **************************************************/ -static int -ct_reselected(struct ct_softc *ct, u_int8_t scsi_status) -{ - struct scsi_low_softc *slp = &ct->sc_sclow; - struct ct_bus_access_handle *chp = &ct->sc_ch; - struct targ_info *ti; - u_int sid; - u_int8_t regv; - - ct->sc_atten = 0; - ct->sc_satgo &= ~CT_SAT_GOING; - regv = ct_cr_read_1(chp, wd3s_sid); - if ((regv & SIDR_VALID) == 0) - return EJUSTRETURN; - - sid = regv & SIDR_IDM; - if ((ti = scsi_low_reselected(slp, sid)) == NULL) - return EJUSTRETURN; - - ct_target_nexus_establish(ct, 0, SCSI_LOW_READ); - if (scsi_status != BSR_AFM_RESEL) - return EJUSTRETURN; - - SCSI_LOW_SETUP_PHASE(ti, PH_MSGIN); - regv = ct_cr_read_1(chp, wd3s_data); - if (scsi_low_msgin(slp, ti, (u_int) regv) == 0) - { - if (scsi_low_is_msgout_continue(ti, 0) != 0) - { - /* XXX: scsi_low_attetion */ - scsi_low_attention(slp); - } - } - - if (ct->sc_atten != 0) - { - ct_attention(ct); - } - - ct_cr_write_1(chp, wd3s_cmd, WD3S_NEGATE_ACK); - return EJUSTRETURN; -} - -static int -ct_target_nexus_establish(struct ct_softc *ct, int lun, int dir) -{ - struct scsi_low_softc *slp = &ct->sc_sclow; - struct ct_bus_access_handle *chp = &ct->sc_ch; - struct targ_info *ti = slp->sl_Tnexus; - struct ct_targ_info *cti = (void *) ti; - - if (dir == SCSI_LOW_WRITE) - ct_cr_write_1(chp, wd3s_did, ti->ti_id); - else - ct_cr_write_1(chp, wd3s_did, ti->ti_id | DIDR_DPD); - ct_cr_write_1(chp, wd3s_lun, lun); - ct_cr_write_1(chp, wd3s_ctrl, ct->sc_creg | CR_DMA); - ct_cr_write_1(chp, wd3s_cph, 0); - ct_cr_write_1(chp, wd3s_synch, cti->cti_syncreg); - cthw_set_count(chp, 0); - return 0; -} - -static int -ct_lun_nexus_establish(struct ct_softc *ct) -{ - struct scsi_low_softc *slp = &ct->sc_sclow; - struct ct_bus_access_handle *chp = &ct->sc_ch; - struct lun_info *li = slp->sl_Lnexus; - - ct_cr_write_1(chp, wd3s_lun, li->li_lun); - return 0; -} - -static int -ct_ccb_nexus_establish(struct ct_softc *ct) -{ - struct scsi_low_softc *slp = &ct->sc_sclow; - struct ct_bus_access_handle *chp = &ct->sc_ch; - struct lun_info *li = slp->sl_Lnexus; - struct targ_info *ti = slp->sl_Tnexus; - struct ct_targ_info *cti = (void *) ti; - struct slccb *cb = slp->sl_Qnexus; - - ct->sc_tmaxcnt = cb->ccb_tcmax * 1000 * 1000; - - if ((ct->sc_satgo & CT_SAT_GOING) != 0) - { - ct_cr_write_1(chp, wd3s_oid, slp->sl_scp.scp_cmdlen); - ct_write_cmds(chp, slp->sl_scp.scp_cmd, slp->sl_scp.scp_cmdlen); - } - if (slp->sl_scp.scp_direction == SCSI_LOW_WRITE) - ct_cr_write_1(chp, wd3s_did, ti->ti_id); - else - ct_cr_write_1(chp, wd3s_did, ti->ti_id | DIDR_DPD); - ct_cr_write_1(chp, wd3s_lun, li->li_lun); - ct_cr_write_1(chp, wd3s_synch, cti->cti_syncreg); - return 0; -} - -static int -ct_unbusy(struct ct_softc *ct) -{ - struct scsi_low_softc *slp = &ct->sc_sclow; - struct ct_bus_access_handle *chp = &ct->sc_ch; - int wc; - register u_int8_t regv; - - for (wc = 0; wc < CT_DELAY_MAX / CT_DELAY_INTERVAL; wc ++) - { - regv = ct_stat_read_1(chp); - if ((regv & (STR_BSY | STR_CIP)) == 0) - return 0; - if (regv == (u_int8_t) -1) - return EIO; - - DELAY(CT_DELAY_INTERVAL); - } - - device_printf(slp->sl_dev, "unbusy timeout\n"); - return EBUSY; -} - -static int -ct_catch_intr(struct ct_softc *ct) -{ - struct ct_bus_access_handle *chp = &ct->sc_ch; - int wc; - register u_int8_t regv; - - for (wc = 0; wc < CT_DELAY_MAX / CT_DELAY_INTERVAL; wc ++) - { - regv = ct_stat_read_1(chp); - if ((regv & (STR_INT | STR_BSY | STR_CIP)) == STR_INT) - return 0; - - DELAY(CT_DELAY_INTERVAL); - } - return EJUSTRETURN; -} - -void -ctintr(void *arg) -{ - struct ct_softc *ct = arg; - struct scsi_low_softc *slp = &ct->sc_sclow; - - SCSI_LOW_LOCK(slp); - ct_poll(ct); - SCSI_LOW_UNLOCK(slp); -} - -static int -ct_poll(void *arg) -{ - struct ct_softc *ct = arg; - struct scsi_low_softc *slp = &ct->sc_sclow; - struct ct_bus_access_handle *chp = &ct->sc_ch; - struct targ_info *ti; - struct buf *bp; - u_int derror, flags; - int len, satgo, error; - u_int8_t scsi_status, regv; - -again: - if (slp->sl_flags & HW_INACTIVE) - return 0; - - /************************************************** - * Get status & bus phase - **************************************************/ - if ((ct_stat_read_1(chp) & STR_INT) == 0) - return 0; - - scsi_status = ct_cr_read_1(chp, wd3s_stat); - if (scsi_status == ((u_int8_t) -1)) - return 1; - - /************************************************** - * Check reselection, or nexus - **************************************************/ - if (scsi_status == BSR_RESEL || scsi_status == BSR_AFM_RESEL) - { - if (ct_reselected(ct, scsi_status) == EJUSTRETURN) - return 1; - } - - if ((ti = slp->sl_Tnexus) == NULL) - return 1; - - /************************************************** - * Debug section - **************************************************/ -#ifdef CT_DEBUG - if (ct_debug > 0) - { - scsi_low_print(slp, NULL); - device_printf(slp->sl_dev, "scsi_status 0x%x\n\n", - (u_int) scsi_status); -#ifdef KDB - if (ct_debug > 1) - kdb_enter(KDB_WHY_CAM, "ct"); -#endif /* KDB */ - } -#endif /* CT_DEBUG */ - - /************************************************** - * Internal scsi phase - **************************************************/ - satgo = ct->sc_satgo; - ct->sc_satgo &= ~CT_SAT_GOING; - - switch (ti->ti_phase) - { - case PH_SELSTART: - if ((satgo & CT_SAT_GOING) == 0) - { - if (scsi_status != BSR_SELECTED) - { - ct_phase_error(ct, scsi_status); - return 1; - } - scsi_low_arbit_win(slp); - SCSI_LOW_SETUP_PHASE(ti, PH_SELECTED); - return 1; - } - else - { - scsi_low_arbit_win(slp); - SCSI_LOW_SETUP_PHASE(ti, PH_MSGOUT); /* XXX */ - } - break; - - case PH_RESEL: - if ((scsi_status & BSR_PHVALID) == 0 || - (scsi_status & BSR_PM) != BSR_MSGIN) - { - scsi_low_restart(slp, SCSI_LOW_RESTART_HARD, - "phase miss after reselect"); - return 1; - } - break; - - default: - if (slp->sl_flags & HW_PDMASTART) - { - slp->sl_flags &= ~HW_PDMASTART; - if (ct->sc_dma & CT_DMA_DMASTART) - { - (*ct->ct_dma_xfer_stop) (ct); - ct->sc_dma &= ~CT_DMA_DMASTART; - } - else if (ct->sc_dma & CT_DMA_PIOSTART) - { - (*ct->ct_pio_xfer_stop) (ct); - ct->sc_dma &= ~CT_DMA_PIOSTART; - } - else - { - scsi_low_data_finish(slp); - } - } - break; - } - - /************************************************** - * parse scsi phase - **************************************************/ - if (scsi_status & BSR_PHVALID) - { - /************************************************** - * Normal SCSI phase. - **************************************************/ - if ((scsi_status & BSR_CM) == BSR_CMDABT) - { - ct_phase_error(ct, scsi_status); - return 1; - } - - switch (scsi_status & BSR_PM) - { - case BSR_DATAOUT: - SCSI_LOW_SETUP_PHASE(ti, PH_DATA); - if (scsi_low_data(slp, ti, &bp, SCSI_LOW_WRITE) != 0) - { - ct_attention(ct); - } - goto common_data_phase; - - case BSR_DATAIN: - SCSI_LOW_SETUP_PHASE(ti, PH_DATA); - if (scsi_low_data(slp, ti, &bp, SCSI_LOW_READ) != 0) - { - ct_attention(ct); - } - -common_data_phase: - if (slp->sl_scp.scp_datalen > 0) - { - slp->sl_flags |= HW_PDMASTART; - if ((ct->sc_xmode & CT_XMODE_PIO) != 0) - { - error = (*ct->ct_pio_xfer_start) (ct); - if (error == 0) - { - ct->sc_dma |= CT_DMA_PIOSTART; - return 1; - } - } - - if ((ct->sc_xmode & CT_XMODE_DMA) != 0) - { - error = (*ct->ct_dma_xfer_start) (ct); - if (error == 0) - { - ct->sc_dma |= CT_DMA_DMASTART; - return 1; - } - } - } - else - { - if (slp->sl_scp.scp_direction == SCSI_LOW_READ) - { - if (!(slp->sl_flags & HW_READ_PADDING)) - { - device_printf(slp->sl_dev, - "read padding required\n"); - return 1; - } - } - else - { - if (!(slp->sl_flags & HW_WRITE_PADDING)) - { - device_printf(slp->sl_dev, - "write padding required\n"); - return 1; - } - } - slp->sl_flags |= HW_PDMASTART; - } - - ct_io_xfer(ct); - return 1; - - case BSR_CMDOUT: - SCSI_LOW_SETUP_PHASE(ti, PH_CMD); - if (scsi_low_cmd(slp, ti) != 0) - { - ct_attention(ct); - } - - if (ct_xfer(ct, slp->sl_scp.scp_cmd, - slp->sl_scp.scp_cmdlen, - SCSI_LOW_WRITE, &derror) != 0) - { - device_printf(slp->sl_dev, - "scsi cmd xfer short\n"); - } - return 1; - - case BSR_STATIN: - SCSI_LOW_SETUP_PHASE(ti, PH_STAT); - if ((ct_io_control & CT_USE_CCSEQ) != 0) - { - if (scsi_low_is_msgout_continue(ti, 0) != 0 || - ct->sc_atten != 0) - { - ct_xfer(ct, ®v, 1, SCSI_LOW_READ, - &derror); - scsi_low_statusin(slp, ti, - regv | derror); - } - else - { - ct->sc_satgo |= CT_SAT_GOING; - cthw_set_count(chp, 0); - cthw_phase_bypass(ct, 0x41); - } - } - else - { - ct_xfer(ct, ®v, 1, SCSI_LOW_READ, &derror); - scsi_low_statusin(slp, ti, regv | derror); - } - return 1; - - case BSR_UNSPINFO0: - case BSR_UNSPINFO1: - device_printf(slp->sl_dev, "illegal bus phase (0x%x)\n", - (u_int) scsi_status); - scsi_low_print(slp, ti); - return 1; - - case BSR_MSGOUT: - SCSI_LOW_SETUP_PHASE(ti, PH_MSGOUT); - flags = SCSI_LOW_MSGOUT_UNIFY; - if (ti->ti_ophase != ti->ti_phase) - flags |= SCSI_LOW_MSGOUT_INIT; - len = scsi_low_msgout(slp, ti, flags); - - if (len > 1 && slp->sl_atten == 0) - { - ct_attention(ct); - } - - if (ct_xfer(ct, ti->ti_msgoutstr, len, - SCSI_LOW_WRITE, &derror) != 0) - { - device_printf(slp->sl_dev, - "scsi msgout xfer short\n"); - } - SCSI_LOW_DEASSERT_ATN(slp); - ct->sc_atten = 0; - return 1; - - case BSR_MSGIN:/* msg in */ - SCSI_LOW_SETUP_PHASE(ti, PH_MSGIN); - - ct_xfer(ct, ®v, 1, SCSI_LOW_READ, &derror); - if (scsi_low_msgin(slp, ti, regv | derror) == 0) - { - if (scsi_low_is_msgout_continue(ti, 0) != 0) - { - /* XXX: scsi_low_attetion */ - scsi_low_attention(slp); - } - } - - if ((ct_io_control & CT_FAST_INTR) != 0) - { - if (ct_catch_intr(ct) == 0) - goto again; - } - return 1; - } - } - else - { - /************************************************** - * Special SCSI phase - **************************************************/ - switch (scsi_status) - { - case BSR_SATSDP: /* SAT with save data pointer */ - SCSI_LOW_SETUP_PHASE(ti, PH_MSGIN); - ct->sc_satgo |= CT_SAT_GOING; - scsi_low_msgin(slp, ti, MSG_SAVESP); - cthw_phase_bypass(ct, 0x41); - return 1; - - case BSR_SATFIN: /* SAT COMPLETE */ - /* - * emulate statusin => msgin - */ - SCSI_LOW_SETUP_PHASE(ti, PH_STAT); - scsi_low_statusin(slp, ti, ct_cr_read_1(chp, wd3s_lun)); - - SCSI_LOW_SETUP_PHASE(ti, PH_MSGIN); - scsi_low_msgin(slp, ti, MSG_COMP); - - scsi_low_disconnected(slp, ti); - return 1; - - case BSR_ACKREQ: /* negate ACK */ - if (ct->sc_atten != 0) - { - ct_attention(ct); - } - - ct_cr_write_1(chp, wd3s_cmd, WD3S_NEGATE_ACK); - if ((ct_io_control & CT_FAST_INTR) != 0) - { - /* XXX: - * Should clear a pending interrupt and - * sync with a next interrupt! - */ - ct_catch_intr(ct); - } - return 1; - - case BSR_DISC: /* disconnect */ - if (slp->sl_msgphase == MSGPH_NULL && - (satgo & CT_SAT_GOING) != 0) - { - /* - * emulate disconnect msg - */ - SCSI_LOW_SETUP_PHASE(ti, PH_MSGIN); - scsi_low_msgin(slp, ti, MSG_DISCON); - } - scsi_low_disconnected(slp, ti); - return 1; - - default: - break; - } - } - - ct_phase_error(ct, scsi_status); - return 1; -} diff --git a/sys/dev/ct/ct_isa.c b/sys/dev/ct/ct_isa.c deleted file mode 100644 index 601f7fb06569..000000000000 --- a/sys/dev/ct/ct_isa.c +++ /dev/null @@ -1,382 +0,0 @@ -/* $NecBSD: ct_isa.c,v 1.6 1999/07/26 06:32:01 honda Exp $ */ - -#include -__FBSDID("$FreeBSD$"); -/* $NetBSD$ */ - -/*- - * [NetBSD for NEC PC-98 series] - * Copyright (c) 1995, 1996, 1997, 1998 - * NetBSD/pc98 porting staff. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#define SCSIBUS_RESCAN - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include - -#include -#include - -#include - -#include - -#include -#include -#include - -#define BSHW_IOSZ 0x08 -#define BSHW_IOBASE 0xcc0 -#define BSHW_MEMSZ (PAGE_SIZE * 2) - -static int ct_isa_match(device_t); -static int ct_isa_attach(device_t); -static int ct_space_map(device_t, struct bshw *, - struct resource **, struct resource **); -static void ct_space_unmap(device_t, struct ct_softc *); -static struct bshw *ct_find_hw(device_t); -static void ct_dmamap(void *, bus_dma_segment_t *, int, int); -static void ct_isa_bus_access_weight(struct ct_bus_access_handle *); -static void ct_isa_dmasync_before(struct ct_softc *); -static void ct_isa_dmasync_after(struct ct_softc *); - -struct ct_isa_softc { - struct ct_softc sc_ct; - struct bshw_softc sc_bshw; -}; - -static struct isa_pnp_id ct_pnp_ids[] = { - { 0x0100e7b1, "Logitec LHA-301" }, - { 0x110154dc, "I-O DATA SC-98III" }, - { 0x4120acb4, "MELCO IFC-NN" }, - { 0, NULL } -}; - -static device_method_t ct_isa_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, ct_isa_match), - DEVMETHOD(device_attach, ct_isa_attach), - { 0, 0 } -}; - -static driver_t ct_isa_driver = { - "ct", ct_isa_methods, sizeof(struct ct_isa_softc), -}; - -static devclass_t ct_devclass; - -DRIVER_MODULE(ct, isa, ct_isa_driver, ct_devclass, 0, 0); - -static int -ct_isa_match(device_t dev) -{ - struct bshw *hw; - struct resource *port_res, *mem_res; - struct ct_bus_access_handle ch; - int rv; - - if (ISA_PNP_PROBE(device_get_parent(dev), dev, ct_pnp_ids) == ENXIO) - return ENXIO; - - switch (isa_get_logicalid(dev)) { - case 0x0100e7b1: /* LHA-301 */ - case 0x110154dc: /* SC-98III */ - case 0x4120acb4: /* IFC-NN */ - /* XXX - force to SMIT mode */ - device_set_flags(dev, device_get_flags(dev) | 0x40000); - break; - } - - if (isa_get_port(dev) == -1) - bus_set_resource(dev, SYS_RES_IOPORT, 0, - BSHW_IOBASE, BSHW_IOSZ); - - if ((hw = ct_find_hw(dev)) == NULL) - return ENXIO; - if (ct_space_map(dev, hw, &port_res, &mem_res) != 0) - return ENXIO; - - bzero(&ch, sizeof(ch)); - ch.ch_io = port_res; - ch.ch_bus_weight = ct_isa_bus_access_weight; - - rv = ctprobesubr(&ch, 0, BSHW_DEFAULT_HOSTID, - BSHW_DEFAULT_CHIPCLK, NULL); - if (rv != 0) - { - struct bshw_softc bshw_tab; - struct bshw_softc *bs = &bshw_tab; - - memset(bs, 0, sizeof(*bs)); - bshw_read_settings(&ch, bs); - bus_set_resource(dev, SYS_RES_IRQ, 0, bs->sc_irq, 1); - bus_set_resource(dev, SYS_RES_DRQ, 0, bs->sc_drq, 1); - } - - bus_release_resource(dev, SYS_RES_IOPORT, 0, port_res); - if (mem_res != NULL) - bus_release_resource(dev, SYS_RES_MEMORY, 0, mem_res); - - if (rv != 0) - return (BUS_PROBE_DEFAULT); - return ENXIO; -} - -static int -ct_isa_attach(device_t dev) -{ - struct ct_isa_softc *pct = device_get_softc(dev); - struct ct_softc *ct = &pct->sc_ct; - struct ct_bus_access_handle *chp = &ct->sc_ch; - struct scsi_low_softc *slp = &ct->sc_sclow; - struct bshw_softc *bs = &pct->sc_bshw; - struct bshw *hw; - int irq_rid, drq_rid, chiprev; - u_int8_t *vaddr; - bus_addr_t addr; - - hw = ct_find_hw(dev); - if (ct_space_map(dev, hw, &ct->port_res, &ct->mem_res) != 0) { - device_printf(dev, "bus io mem map failed\n"); - return ENXIO; - } - - chp->ch_io = ct->port_res; - chp->ch_mem = ct->mem_res; - chp->ch_bus_weight = ct_isa_bus_access_weight; - - irq_rid = 0; - ct->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &irq_rid, - RF_ACTIVE); - drq_rid = 0; - ct->drq_res = bus_alloc_resource_any(dev, SYS_RES_DRQ, &drq_rid, - RF_ACTIVE); - if (ct->irq_res == NULL || ct->drq_res == NULL) { - ct_space_unmap(dev, ct); - return ENXIO; - } - - if (ctprobesubr(chp, 0, BSHW_DEFAULT_HOSTID, - BSHW_DEFAULT_CHIPCLK, &chiprev) == 0) - { - device_printf(dev, "hardware missing\n"); - ct_space_unmap(dev, ct); - return ENXIO; - } - - /* setup DMA map */ - if (bus_dma_tag_create(NULL, 1, 0, - BUS_SPACE_MAXADDR_24BIT, BUS_SPACE_MAXADDR, - NULL, NULL, DFLTPHYS, 1, - BUS_SPACE_MAXSIZE_32BIT, - BUS_DMA_ALLOCNOW, NULL, NULL, - &ct->sc_dmat) != 0) { - device_printf(dev, "can't set up ISA DMA map\n"); - ct_space_unmap(dev, ct); - return ENXIO; - } - - if (bus_dmamem_alloc(ct->sc_dmat, (void **)&vaddr, BUS_DMA_NOWAIT, - &ct->sc_dmamapt) != 0) { - device_printf(dev, "can't set up ISA DMA map\n"); - ct_space_unmap(dev, ct); - return ENXIO; - } - - bus_dmamap_load(ct->sc_dmat, ct->sc_dmamapt, vaddr, DFLTPHYS, - ct_dmamap, &addr, BUS_DMA_NOWAIT); - - /* setup machdep softc */ - bs->sc_hw = hw; - bs->sc_io_control = 0; - bs->sc_bounce_phys = (u_int8_t *)addr; - bs->sc_bounce_addr = vaddr; - bs->sc_bounce_size = DFLTPHYS; - bs->sc_minphys = (1 << 24); - bs->sc_dmasync_before = ct_isa_dmasync_before; - bs->sc_dmasync_after = ct_isa_dmasync_after; - bshw_read_settings(chp, bs); - - /* setup ct driver softc */ - ct->ct_hw = bs; - ct->ct_dma_xfer_start = bshw_dma_xfer_start; - ct->ct_pio_xfer_start = bshw_smit_xfer_start; - ct->ct_dma_xfer_stop = bshw_dma_xfer_stop; - ct->ct_pio_xfer_stop = bshw_smit_xfer_stop; - ct->ct_bus_reset = bshw_bus_reset; - ct->ct_synch_setup = bshw_synch_setup; - - ct->sc_xmode = CT_XMODE_DMA; - if (chp->ch_mem != NULL) - ct->sc_xmode |= CT_XMODE_PIO; - - ct->sc_chiprev = chiprev; - switch (chiprev) - { - case CT_WD33C93: - /* s = "WD33C93"; */ - ct->sc_chipclk = 8; - break; - case CT_WD33C93_A: - if (DVCFG_MAJOR(device_get_flags(dev)) > 0) - { - /* s = "AM33C93_A"; */ - ct->sc_chipclk = 20; - ct->sc_chiprev = CT_AM33C93_A; - } - else - { - /* s = "WD33C93_A"; */ - ct->sc_chipclk = 10; - } - break; - - case CT_AM33C93_A: - /* s = "AM33C93_A"; */ - ct->sc_chipclk = 20; - break; - - default: - case CT_WD33C93_B: - /* s = "WD33C93_B"; */ - ct->sc_chipclk = 20; - break; - } -#if 0 - printf("%s: chiprev %s chipclk %d MHz\n", - slp->sl_dev.dv_xname, s, ct->sc_chipclk); -#endif - - slp->sl_dev = dev; - slp->sl_hostid = bs->sc_hostid; - slp->sl_cfgflags = device_get_flags(dev); - mtx_init(&slp->sl_lock, "ct", NULL, MTX_DEF); - - ctattachsubr(ct); - - if (bus_setup_intr(dev, ct->irq_res, INTR_TYPE_CAM | INTR_MPSAFE, - NULL, ctintr, ct, &ct->sc_ih)) { - ct_space_unmap(dev, ct); - return ENXIO; - } - - return 0; -} - -static struct bshw * -ct_find_hw(device_t dev) -{ - return DVCFG_HW(&bshw_hwsel, DVCFG_MAJOR(device_get_flags(dev))); -} - -static int -ct_space_map(device_t dev, struct bshw *hw, - struct resource **iohp, struct resource **memhp) -{ - int port_rid, mem_rid; - - *memhp = NULL; - - port_rid = 0; - *iohp = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &port_rid, - BSHW_IOSZ, RF_ACTIVE); - if (*iohp == NULL) - return ENXIO; - - if ((hw->hw_flags & BSHW_SMFIFO) == 0 || isa_get_maddr(dev) == -1) - return 0; - - mem_rid = 0; - *memhp = bus_alloc_resource_anywhere(dev, SYS_RES_MEMORY, &mem_rid, - BSHW_MEMSZ, RF_ACTIVE); - if (*memhp == NULL) { - bus_release_resource(dev, SYS_RES_IOPORT, port_rid, *iohp); - return ENXIO; - } - - return 0; -} - -static void -ct_space_unmap(device_t dev, struct ct_softc *ct) -{ - if (ct->port_res != NULL) - bus_release_resource(dev, SYS_RES_IOPORT, 0, ct->port_res); - if (ct->mem_res != NULL) - bus_release_resource(dev, SYS_RES_MEMORY, 0, ct->mem_res); - if (ct->irq_res != NULL) - bus_release_resource(dev, SYS_RES_IRQ, 0, ct->irq_res); - if (ct->drq_res != NULL) - bus_release_resource(dev, SYS_RES_DRQ, 0, ct->drq_res); -} - -static void -ct_dmamap(void *arg, bus_dma_segment_t *seg, int nseg, int error) -{ - bus_addr_t *addr = (bus_addr_t *)arg; - - *addr = seg->ds_addr; -} - -static void -ct_isa_bus_access_weight(struct ct_bus_access_handle *chp) -{ - - outb(0x5f, 0); -} - -static void -ct_isa_dmasync_before(struct ct_softc *ct) -{ - - if (need_pre_dma_flush) - wbinvd(); -} - -static void -ct_isa_dmasync_after(struct ct_softc *ct) -{ - - if (need_post_dma_flush) - invd(); -} diff --git a/sys/dev/ct/ct_machdep.h b/sys/dev/ct/ct_machdep.h deleted file mode 100644 index 7d92526125eb..000000000000 --- a/sys/dev/ct/ct_machdep.h +++ /dev/null @@ -1,186 +0,0 @@ -/* $FreeBSD$ */ -/* $NecBSD: ct_machdep.h,v 1.4.12.2 2001/06/20 06:13:34 honda Exp $ */ -/* $NetBSD$ */ - -/*- - * [NetBSD for NEC PC-98 series] - * Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000, 2001 - * NetBSD/pc98 porting staff. All rights reserved. - * Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000, 2001 - * Naofumi HONDA. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _CT_MACHDEP_H_ -#define _CT_MACHDEP_H_ - -#include "opt_ct.h" - -/* - * Principal rules: - * 1) do not use bus_space_write/read_X directly in ct.c. - * 2) do not use port offset defs directly in ct.c. - */ - -/* special weight if requried */ -#ifdef CT_BUS_WEIGHT -#undef CT_BUS_WEIGHT -#define CT_BUS_WEIGHT(chp) \ -{ \ - if ((chp)->ch_bus_weight != NULL) \ - (chp)->ch_bus_weight((chp)); \ -} -#else /* !CT_BUS_WEIGHT */ -#define CT_BUS_WEIGHT(chp) -#endif /* !CT_BUS_WEIGHT */ - -/* port offset */ -#ifndef CT_USE_RELOCATE_OFFSET -#define addr_port 0 -#define stat_port 0 -#define ctrl_port 2 -#define cmd_port 4 -#else /* CT_USE_RELOCATE_OFFSET */ -#define addr_port ((chp)->ch_offset[0]) -#define stat_port ((chp)->ch_offset[1]) -#define ctrl_port ((chp)->ch_offset[2]) -#define cmd_port ((chp)->ch_offset[3]) -#endif /* CT_USE_RELOCATE_OFFSET */ - -/* - * All port accesses primitive methods - */ -static __inline u_int8_t ct_stat_read_1 - (struct ct_bus_access_handle *); -static __inline u_int8_t ct_cmdp_read_1 - (struct ct_bus_access_handle *); -static __inline void ct_cmdp_write_1 - (struct ct_bus_access_handle *, u_int8_t); -static __inline u_int8_t ct_cr_read_1 - (struct ct_bus_access_handle *, bus_addr_t); -static __inline void ct_cr_write_1 - (struct ct_bus_access_handle *, bus_addr_t, u_int8_t); -static __inline void ct_write_cmds - (struct ct_bus_access_handle *, u_int8_t *, int); -static __inline u_int cthw_get_count - (struct ct_bus_access_handle *); -static __inline void cthw_set_count - (struct ct_bus_access_handle *, u_int); - -static __inline u_int8_t -ct_stat_read_1(struct ct_bus_access_handle *chp) -{ - u_int8_t regv; - - regv = bus_read_1(chp->ch_io, stat_port); - CT_BUS_WEIGHT(chp) - return regv; -} - -static __inline void -cthw_set_count(struct ct_bus_access_handle *chp, u_int count) -{ - - bus_write_1(chp->ch_io, addr_port, wd3s_cnt); - CT_BUS_WEIGHT(chp) - bus_write_1(chp->ch_io, ctrl_port, count >> 16); - CT_BUS_WEIGHT(chp) - bus_write_1(chp->ch_io, ctrl_port, count >> 8); - CT_BUS_WEIGHT(chp) - bus_write_1(chp->ch_io, ctrl_port, count); - CT_BUS_WEIGHT(chp) -} - -static __inline u_int -cthw_get_count(struct ct_bus_access_handle *chp) -{ - u_int count; - - bus_write_1(chp->ch_io, addr_port, wd3s_cnt); - CT_BUS_WEIGHT(chp) - count = (((u_int) bus_read_1(chp->ch_io, ctrl_port)) << 16); - CT_BUS_WEIGHT(chp) - count += (((u_int) bus_read_1(chp->ch_io, ctrl_port)) << 8); - CT_BUS_WEIGHT(chp) - count += ((u_int) bus_read_1(chp->ch_io, ctrl_port)); - CT_BUS_WEIGHT(chp) - return count; -} - -static __inline void -ct_write_cmds(struct ct_bus_access_handle *chp, u_int8_t *cmd, int len) -{ - int i; - - bus_write_1(chp->ch_io, addr_port, wd3s_cdb); - CT_BUS_WEIGHT(chp) - for (i = 0; i < len; i ++) - { - bus_write_1(chp->ch_io, ctrl_port, cmd[i]); - CT_BUS_WEIGHT(chp) - } -} - -static __inline u_int8_t -ct_cr_read_1(struct ct_bus_access_handle *chp, bus_addr_t offs) -{ - u_int8_t regv; - - bus_write_1(chp->ch_io, addr_port, offs); - CT_BUS_WEIGHT(chp) - regv = bus_read_1(chp->ch_io, ctrl_port); - CT_BUS_WEIGHT(chp) - return regv; -} - -static __inline void -ct_cr_write_1(struct ct_bus_access_handle *chp, bus_addr_t offs, u_int8_t val) -{ - - bus_write_1(chp->ch_io, addr_port, offs); - CT_BUS_WEIGHT(chp) - bus_write_1(chp->ch_io, ctrl_port, val); - CT_BUS_WEIGHT(chp) -} - -static __inline u_int8_t -ct_cmdp_read_1(struct ct_bus_access_handle *chp) -{ - u_int8_t regv; - - regv = bus_read_1(chp->ch_io, cmd_port); - CT_BUS_WEIGHT(chp) - return regv; -} - -static __inline void -ct_cmdp_write_1(struct ct_bus_access_handle *chp, u_int8_t val) -{ - - bus_write_1(chp->ch_io, cmd_port, val); - CT_BUS_WEIGHT(chp) -} - -#endif /* !_CT_MACHDEP_H_ */ diff --git a/sys/dev/ct/ctvar.h b/sys/dev/ct/ctvar.h deleted file mode 100644 index 10ce2d891200..000000000000 --- a/sys/dev/ct/ctvar.h +++ /dev/null @@ -1,129 +0,0 @@ -/* $FreeBSD$ */ -/* $NecBSD: ctvar.h,v 1.4.14.3 2001/06/20 06:13:34 honda Exp $ */ -/* $NetBSD$ */ - -/*- - * [NetBSD for NEC PC-98 series] - * Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000, 2001 - * NetBSD/pc98 porting staff. All rights reserved. - * Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000, 2001 - * Naofumi HONDA. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _CTVAR_H_ -#define _CTVAR_H_ -/* - * ctvar.h - * Generic wd33c93 chip driver's definitions - */ - -/***************************************************************** - * Host adapter structure - *****************************************************************/ -struct ct_bus_access_handle { - struct resource *ch_io; /* core chip ctrl port */ - struct resource *ch_mem; /* data port (shm) */ - - void (*ch_bus_weight)(struct ct_bus_access_handle *); - -#ifdef CT_USE_RELOCATE_OFFSET - bus_addr_t ch_offset[4]; -#endif /* CT_USE_RELOCATE_OFFSET */ -}; - -struct ct_softc { - struct scsi_low_softc sc_sclow; /* generic data */ - - struct ct_bus_access_handle sc_ch; /* bus access handle */ - - struct resource *port_res; - struct resource *mem_res; - struct resource *irq_res; - struct resource *drq_res; - - bus_dma_tag_t sc_dmat; /* data DMA tag */ - bus_dmamap_t sc_dmamapt; /* data DMAMAP tag */ - - void *sc_ih; - - int sc_chiprev; /* chip version */ -#define CT_WD33C93 0x00000 -#define CT_WD33C93_A 0x10000 -#define CT_AM33C93_A 0x10001 -#define CT_WD33C93_B 0x20000 -#define CT_WD33C93_C 0x30000 - - int sc_xmode; -#define CT_XMODE_PIO 1 -#define CT_XMODE_DMA 2 - - int sc_dma; /* dma transfer start */ -#define CT_DMA_PIOSTART 1 -#define CT_DMA_DMASTART 2 - - int sc_satgo; /* combination cmd start */ -#define CT_SAT_GOING 1 - - int sc_tmaxcnt; - int sc_atten; /* attention */ - u_int8_t sc_creg; /* control register value */ - - int sc_chipclk; /* chipclk 0, 10, 15, 20 */ - struct ct_synch_data { - u_int cs_period; - u_int cs_syncr; - } *sc_sdp; /* synchronous data table pt */ - - struct ct_synch_data sc_default_sdt[16]; - - /* - * Machdep stuff. - */ - void *ct_hw; /* point to bshw_softc etc ... */ - int (*ct_dma_xfer_start)(struct ct_softc *); - int (*ct_pio_xfer_start)(struct ct_softc *); - void (*ct_dma_xfer_stop)(struct ct_softc *); - void (*ct_pio_xfer_stop)(struct ct_softc *); - void (*ct_bus_reset)(struct ct_softc *); - void (*ct_synch_setup)(struct ct_softc *, struct targ_info *); -}; - -/***************************************************************** - * Lun information - *****************************************************************/ -struct ct_targ_info { - struct targ_info cti_ti; - - u_int8_t cti_syncreg; -}; - -/***************************************************************** - * PROTO - *****************************************************************/ -int ctprobesubr(struct ct_bus_access_handle *, u_int, int, u_int, int *); -void ctattachsubr(struct ct_softc *); -void ctintr(void *); -#endif /* !_CTVAR_H_ */ diff --git a/sys/dev/ed/if_ed98.h b/sys/dev/ed/if_ed98.h deleted file mode 100644 index b16054960b31..000000000000 --- a/sys/dev/ed/if_ed98.h +++ /dev/null @@ -1,108 +0,0 @@ -/*- - * Copyright (c) KATO Takenori, 1996. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer as - * the first lines of this file unmodified. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -/* - * PC-9801 specific definitions for DP8390/SMC8216 NICs. - */ - -/* - * Vendor types - */ -#define ED_VENDOR_MISC 0xf0 /* others */ - -/* - * Card types. - * - * Type Card - * 0x00 Allied Telesis CenterCom LA-98-T / SMC EtherEZ98. - * 0x10 ** RESERVED ** - * 0x20 PLANET SMART COM 98 EN-2298 / ELECOM LANEED LD-BDN[123]A. - * 0x30 MELCO EGY-98 / Contec C-NET(98)E-A/L-A. - * 0x40 MELCO LGY-98, IND-SP, IND-SS / MACNICA NE2098(XXX). - * 0x50 ICM DT-ET-25, DT-ET-T5, IF-2766ET, IF-2771ET / - * D-Link DE-298P{T,CAT}, DE-298{T,TP,CAT}. - * 0x60 Allied Telesis SIC-98. - * 0x70 ** RESERVED ** - * 0x80 NEC PC-9801-108. - * 0x90 IO-DATA LA-98 / NEC PC-9801-77. - * 0xa0 Contec C-NET(98). - * 0xb0 Contec C-NET(98)E/L. - * 0xc0 ** RESERVED ** - * 0xd0 Networld EC/EP-98X. - * 0xe0 Soliton SB-9801 / Fujikura FN-9801 / Networld EC/EP-98S. - * 0xf0 NextCom NC5098. - */ -#define ED_TYPE98_BASE 0x80 - -#define ED_TYPE98_GENERIC 0x80 -#define ED_TYPE98_BDN 0x82 -#define ED_TYPE98_EGY 0x83 -#define ED_TYPE98_LGY 0x84 -#define ED_TYPE98_ICM 0x85 -#define ED_TYPE98_SIC 0x86 -#define ED_TYPE98_108 0x88 -#define ED_TYPE98_LA98 0x89 -#define ED_TYPE98_CNET98 0x8a -#define ED_TYPE98_CNET98EL 0x8b -#define ED_TYPE98_NW98X 0x8d -#define ED_TYPE98_SB98 0x8e -#define ED_TYPE98_NC5098 0x8f - -#define ED_TYPE98(x) (((x & 0xffff0000) >> 20) | ED_TYPE98_BASE) -#define ED_TYPE98SUB(x) ((x & 0xf0000) >> 16) - -/* - * Definitions for C-NET(98) serise - */ -/* - * Initial Register(on board JP1) - */ -#define ED_CNET98_INIT 0xaaed /* default */ -#define ED_CNET98_INIT2 0x55ed /* another setting */ - -#define ED_CNET98EL_PAGE_OFFSET 0x0000 /* Page offset for NIC access to mem */ - -/* - * Definitions for Soliton SB-9801 - */ -/* - * I/O port select register - */ -#define ED_SB98_IO_INHIBIT 0x0040 /* XXX - shares printer port! */ - -/* - * Definitions for SMC EtherEZ98(SMC8498BTA) - */ -#define ED_EZ98_NIC_OFFSET 0x100 /* I/O base offset to NIC */ -#define ED_EZ98_ASIC_OFFSET 0 /* I/O base offset to ASIC */ -/* - * XXX - The I/O address range is fragmented in the EtherEZ98; - * it occupies 16*2 I/O addresses, by the way. - */ -#define ED_EZ98_IO_PORTS 16 /* # of i/o addresses used */ diff --git a/sys/dev/ed/if_ed_cbus.c b/sys/dev/ed/if_ed_cbus.c deleted file mode 100644 index 7926fa8e2389..000000000000 --- a/sys/dev/ed/if_ed_cbus.c +++ /dev/null @@ -1,1629 +0,0 @@ -/*- - * Copyright (c) 1995, David Greenman - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice unmodified, this list of conditions, and the following - * disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -static int ed98_alloc_port(device_t, int); -static int ed98_alloc_memory(device_t, int); -static int ed_pio_testmem(struct ed_softc *, int, int, int); -static int ed_probe_CNET98(device_t, int, int); -static int ed_probe_CNET98EL(device_t, int, int); -static int ed_probe_EZ98(device_t, int, int); -static int ed_probe_NEC77(device_t, int, int); -static int ed_probe_NW98X(device_t, int, int); -static int ed_probe_SB98(device_t, int, int); -static int ed_probe_SIC98(device_t, int, int); -static int ed98_probe_Novell(device_t, int, int); -static int ed98_probe_generic8390(struct ed_softc *); -static void ed_reset_CNET98(struct ed_softc *, int); -static void ed_winsel_CNET98(struct ed_softc *, u_short); -static void ed_get_SB98(struct ed_softc *); - -static int ed_cbus_probe(device_t); -static int ed_cbus_attach(device_t); - -static struct isa_pnp_id ed_ids[] = { -/* TODO - list up PnP boards for PC-98 */ - { 0, NULL } -}; - -static int -ed_cbus_probe(device_t dev) -{ - struct ed_softc *sc = device_get_softc(dev); - int flags = device_get_flags(dev); - int error = 0; - - sc->type = ED_TYPE98(flags); -#ifdef ED_DEBUG - device_printf(dev, "ed_cbus_probe: sc->type=%x\n", sc->type); -#endif - - /* Check isapnp ids */ - error = ISA_PNP_PROBE(device_get_parent(dev), dev, ed_ids); -#ifdef ED_DEBUG - device_printf(dev, "ed_cbus_probe: ISA_PNP_PROBE returns %d\n", error); -#endif - - /* If the card had a PnP ID that didn't match any we know about */ - if (error == ENXIO) - goto end; - - /* If we had some other problem. */ - if (!(error == 0 || error == ENOENT)) - goto end; - - /* Heuristic probes */ -#ifdef ED_DEBUG - device_printf(dev, "ed_cbus_probe: Heuristic probes start\n"); -#endif - switch (sc->type) { - case ED_TYPE98_GENERIC: - /* - * CAUTION! - * sc->type of these boards are overwritten by PC/AT's value. - */ - - /* - * SMC EtherEZ98 - */ - error = ed_probe_EZ98(dev, 0, flags); - if (error == 0) - goto end; - - ed_release_resources(dev); - - /* - * Allied Telesis CenterCom LA-98-T - */ - error = ed_probe_Novell(dev, 0, flags); - if (error == 0) { - ed_Novell_read_mac(sc); - goto end; - } - break; - - /* - * NE2000-like boards probe routine - */ - case ED_TYPE98_BDN: - /* - * ELECOM LANEED LD-BDN - * PLANET SMART COM 98 EN-2298 - */ - case ED_TYPE98_LGY: - /* - * MELCO LGY-98, IND-SP, IND-SS - * MACNICA NE2098 - */ - case ED_TYPE98_ICM: - /* - * ICM DT-ET-25, DT-ET-T5, IF-2766ET, IF-2771ET - * D-Link DE-298P, DE-298 - */ - case ED_TYPE98_EGY: - /* - * MELCO EGY-98 - * Contec C-NET(98)E-A, C-NET(98)L-A - */ - case ED_TYPE98_108: - /* - * NEC PC-9801-107,108 - */ - case ED_TYPE98_NC5098: - /* - * NextCom NC5098 - */ - error = ed98_probe_Novell(dev, 0, flags); - break; - - /* - * other boards with special probe routine - */ - case ED_TYPE98_SIC: - /* - * Allied Telesis SIC-98 - */ - error = ed_probe_SIC98(dev, 0, flags); - break; - - case ED_TYPE98_CNET98EL: - /* - * Contec C-NET(98)E/L - */ - error = ed_probe_CNET98EL(dev, 0, flags); - break; - - case ED_TYPE98_CNET98: - /* - * Contec C-NET(98) - */ - error = ed_probe_CNET98(dev, 0, flags); - break; - - case ED_TYPE98_LA98: - /* - * IO-DATA LA/T-98 - * NEC PC-9801-77,78 - */ - error = ed_probe_NEC77(dev, 0, flags); - break; - - case ED_TYPE98_NW98X: - /* - * Networld EC/EP-98X - */ - error = ed_probe_NW98X(dev, 0, flags); - break; - - case ED_TYPE98_SB98: - /* - * Soliton SB-9801 - * Fujikura FN-9801 - */ - error = ed_probe_SB98(dev, 0, flags); - break; - } - -end: -#ifdef ED_DEBUG - device_printf(dev, "ed_cbus_probe: end, error=%d\n", error); -#endif - if (error == 0) - error = ed_alloc_irq(dev, 0, 0); - - ed_release_resources(dev); - return (error); -} - -static int -ed_cbus_attach(dev) - device_t dev; -{ - struct ed_softc *sc = device_get_softc(dev); - int flags = device_get_flags(dev); - int error; - - if (sc->port_used > 0) { - if (ED_TYPE98(flags) == ED_TYPE98_GENERIC) - ed_alloc_port(dev, 0, sc->port_used); - else - ed98_alloc_port(dev, 0); - } - if (sc->mem_used) - ed_alloc_memory(dev, 0, sc->mem_used); - - ed_alloc_irq(dev, 0, 0); - - if (sc->sc_media_ioctl == NULL) - ed_gen_ifmedia_init(sc); - error = ed_attach(dev); - if (error) { - ed_release_resources(dev); - return (error); - } - error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET | INTR_MPSAFE, - NULL, edintr, sc, &sc->irq_handle); - if (error) - ed_release_resources(dev); - return (error); -} - -/* - * Interrupt conversion table for EtherEZ98 - */ -static uint16_t ed_EZ98_intr_val[] = { - 0, - 3, - 5, - 6, - 0, - 9, - 12, - 13 -}; - -static int -ed_probe_EZ98(device_t dev, int port_rid, int flags) -{ - struct ed_softc *sc = device_get_softc(dev); - int error; - static unsigned short *intr_vals[] = {NULL, ed_EZ98_intr_val}; - - error = ed_alloc_port(dev, port_rid, ED_EZ98_IO_PORTS); - if (error) { - return (error); - } - - sc->asic_offset = ED_EZ98_ASIC_OFFSET; - sc->nic_offset = ED_EZ98_NIC_OFFSET; - - return ed_probe_WD80x3_generic(dev, flags, intr_vals); -} - -/* - * I/O conversion tables - */ - -/* LGY-98, ICM, C-NET(98)E/L */ -static bus_addr_t ed98_ioaddr_generic[] = { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 -}; - -/* - * Definitions for Contec C-NET(98)E/L - */ -#define ED_CNET98EL_ICR 2 /* Interrupt Configuration Register */ - -#define ED_CNET98EL_ICR_IRQ3 0x01 -#define ED_CNET98EL_ICR_IRQ5 0x02 -#define ED_CNET98EL_ICR_IRQ6 0x04 -#define ED_CNET98EL_ICR_IRQ12 0x20 - -#define ED_CNET98EL_IMR 4 /* Interrupt Mask Register */ -#define ED_CNET98EL_ISR 5 /* Interrupt Status Register */ - -/* EGY-98 */ -static bus_addr_t ed98_ioaddr_egy98[] = { - 0, 0x02, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0e, - 0x100, 0x102, 0x104, 0x106, 0x108, 0x10a, 0x10c, 0x10e -}; - -/* SIC-98 */ -static bus_addr_t ed98_ioaddr_sic98[] = { - 0x0000, 0x0200, 0x0400, 0x0600, 0x0800, 0x0a00, 0x0c00, 0x0e00, - 0x1000, 0x1200, 0x1400, 0x1600, 0x1800, 0x1a00, 0x1c00, 0x1e00 -}; - -/* LA/T-98, LD-BDN, PC-9801-77, SB-9801 */ -static bus_addr_t ed98_ioaddr_la98[] = { - 0x0000, 0x1000, 0x2000, 0x3000, 0x4000, 0x5000, 0x6000, 0x7000, - 0x8000, 0x9000, 0xa000, 0xb000, 0xc000, 0xd000, 0xe000, 0xf000, - 0x0100 /* for NEC 77(see below) */ -}; - -/* - * Definitions for NEC PC-9801-77 - */ -#define ED_NEC77_IRQ 16 /* Interrupt Configuration Register */ - -#define ED_NEC77_IRQ3 0x04 -#define ED_NEC77_IRQ5 0x06 -#define ED_NEC77_IRQ6 0x08 -#define ED_NEC77_IRQ12 0x0a -#define ED_NEC77_IRQ13 0x02 - -/* - * Definitions for Soliton SB-9801 - */ -#define ED_SB98_CFG 1 /* Board configuration */ - -#define ED_SB98_CFG_IRQ3 0x00 -#define ED_SB98_CFG_IRQ5 0x04 -#define ED_SB98_CFG_IRQ6 0x08 -#define ED_SB98_CFG_IRQ12 0x0c -#define ED_SB98_CFG_ALTPORT 0x40 /* use EXTERNAL media */ -#define ED_SB98_CFG_ENABLE 0xa0 /* enable configuration */ - -#define ED_SB98_EEPENA 2 /* EEPROM access enable */ - -#define ED_SB98_EEPENA_DISABLE 0x00 -#define ED_SB98_EEPENA_ENABLE 0x01 - -#define ED_SB98_EEP 3 /* EEPROM access */ - -#define ED_SB98_EEP_SDA 0x01 /* Serial Data */ -#define ED_SB98_EEP_SCL 0x02 /* Serial Clock */ -#define ED_SB98_EEP_READ 0x01 /* Read Command */ - -#define ED_SB98_EEP_DELAY 300 - -#define ED_SB98_ADDRESS 0x01 /* Station Address(1-6) */ - -#define ED_SB98_POLARITY 4 /* Polarity */ - -/* PC-9801-108 */ -static bus_addr_t ed98_ioaddr_nec108[] = { - 0x0000, 0x0002, 0x0004, 0x0006, 0x0008, 0x000a, 0x000c, 0x000e, - 0x1000, 0x1002, 0x1004, 0x1006, 0x1008, 0x100a, 0x100c, 0x100e -}; - -/* C-NET(98) */ -static bus_addr_t ed98_ioaddr_cnet98[] = { - 0x0000, 0x0002, 0x0004, 0x0006, 0x0008, 0x000a, 0x000c, 0x000e, - 0x0400, 0x0402, 0x0404, 0x0406, 0x0408, 0x040a, 0x040c, 0x040e -}; - -/* - * Definitions for Contec C-NET(98) - */ -#define ED_CNET98_MAP_REG0L 0 /* MAPPING register0 Low */ -#define ED_CNET98_MAP_REG1L 1 /* MAPPING register1 Low */ -#define ED_CNET98_MAP_REG2L 2 /* MAPPING register2 Low */ -#define ED_CNET98_MAP_REG3L 3 /* MAPPING register3 Low */ -#define ED_CNET98_MAP_REG0H 4 /* MAPPING register0 Hi */ -#define ED_CNET98_MAP_REG1H 5 /* MAPPING register1 Hi */ -#define ED_CNET98_MAP_REG2H 6 /* MAPPING register2 Hi */ -#define ED_CNET98_MAP_REG3H 7 /* MAPPING register3 Hi */ -#define ED_CNET98_WIN_REG 8 /* Window register */ -#define ED_CNET98_INT_LEV 9 /* Init level register */ - -#define ED_CNET98_INT_IRQ3 0x01 /* INT 0 */ -#define ED_CNET98_INT_IRQ5 0x02 /* INT 1 */ -#define ED_CNET98_INT_IRQ6 0x04 /* INT 2 */ -#define ED_CNET98_INT_IRQ9 0x08 /* INT 3 */ -#define ED_CNET98_INT_IRQ12 0x20 /* INT 5 */ -#define ED_CNET98_INT_IRQ13 0x40 /* INT 6 */ - -#define ED_CNET98_INT_REQ 10 /* Init request register */ -#define ED_CNET98_INT_MASK 11 /* Init mask register */ -#define ED_CNET98_INT_STAT 12 /* Init status register */ -#define ED_CNET98_INT_CLR 12 /* Init clear register */ -#define ED_CNET98_RESERVE1 13 -#define ED_CNET98_RESERVE2 14 -#define ED_CNET98_RESERVE3 15 - -/* EC/EP-98X, NC5098 */ -static bus_addr_t ed98_ioaddr_nw98x[] = { - 0x0000, 0x0100, 0x0200, 0x0300, 0x0400, 0x0500, 0x0600, 0x0700, - 0x0800, 0x0900, 0x0a00, 0x0b00, 0x0c00, 0x0d00, 0x0e00, 0x0f00, - 0x1000 /* for EC/EP-98X(see below) */ -}; - -/* - * Definitions for Networld EC/EP-98X - */ -#define ED_NW98X_IRQ 16 /* Interrupt Configuration Register */ - -#define ED_NW98X_IRQ3 0x04 -#define ED_NW98X_IRQ5 0x06 -#define ED_NW98X_IRQ6 0x08 -#define ED_NW98X_IRQ12 0x0a -#define ED_NW98X_IRQ13 0x02 - -/* NC5098 ASIC */ -static bus_addr_t ed98_asic_nc5098[] = { -/* DATA ENADDR RESET */ - 0x0000, 0x2000, 0x2100, 0x2200, 0x2300, 0x2400, 0x2500, 0x4000, - 0, 0, 0, 0, 0, 0, 0, 0 -}; - -/* - * Definitions for NextCom NC5098 - */ -#define ED_NC5098_ENADDR 1 /* Station Address(1-6) */ - -/* - * Allocate a port resource with the given resource id. - */ -static int -ed98_alloc_port(device_t dev, int rid) -{ - struct ed_softc *sc = device_get_softc(dev); - struct resource *res; - int error; - bus_addr_t *io_nic, *io_asic, adj; - static bus_addr_t io_res[ED_NOVELL_IO_PORTS + 1]; - int i, n; - int offset, reset, data; - - /* Set i/o table for resource manager */ - io_nic = io_asic = ed98_ioaddr_generic; - offset = ED_NOVELL_ASIC_OFFSET; - reset = ED_NOVELL_RESET; - data = ED_NOVELL_DATA; - n = ED_NOVELL_IO_PORTS; - - switch (sc->type) { - case ED_TYPE98_LGY: - io_asic = ed98_ioaddr_egy98; /* XXX - Yes, we use egy98 */ - offset = 0x0200; - reset = 8; - break; - - case ED_TYPE98_EGY: - io_nic = io_asic = ed98_ioaddr_egy98; - offset = 0x0200; - reset = 8; - break; - - case ED_TYPE98_ICM: - offset = 0x0100; - break; - - case ED_TYPE98_BDN: - io_nic = io_asic = ed98_ioaddr_la98; - offset = 0x0100; - reset = 0x0c; - break; - - case ED_TYPE98_SIC: - io_nic = io_asic = ed98_ioaddr_sic98; - offset = 0x2000; - n = 16+1; - break; - - case ED_TYPE98_108: - io_nic = io_asic = ed98_ioaddr_nec108; - offset = 0x0888; /* XXX - overwritten after */ - reset = 1; - n = 16; /* XXX - does not set ASIC i/o here */ - break; - - case ED_TYPE98_LA98: - io_nic = io_asic = ed98_ioaddr_la98; - offset = 0x0100; - break; - - case ED_TYPE98_CNET98EL: - offset = 0x0400; - data = 0x0e; - break; - - case ED_TYPE98_CNET98: - /* XXX - Yes, we use generic i/o here */ - offset = 0x0400; - break; - - case ED_TYPE98_NW98X: - io_nic = io_asic = ed98_ioaddr_nw98x; - offset = 0x1000; - break; - - case ED_TYPE98_SB98: - io_nic = io_asic = ed98_ioaddr_la98; - offset = 0x0400; - reset = 7; - break; - - case ED_TYPE98_NC5098: - io_nic = ed98_ioaddr_nw98x; - io_asic = ed98_asic_nc5098; - offset = 0x2000; - reset = 7; - n = 16+8; /* XXX */ - break; - } - - bcopy(io_nic, io_res, sizeof(io_nic[0]) * ED_NOVELL_ASIC_OFFSET); - for (i = ED_NOVELL_ASIC_OFFSET; i < ED_NOVELL_IO_PORTS; i++) - io_res[i] = io_asic[i - ED_NOVELL_ASIC_OFFSET] + offset; - - res = isa_alloc_resourcev(dev, SYS_RES_IOPORT, &rid, io_res, n, - RF_ACTIVE); - if (!res) - return (ENOENT); - - sc->port_res = res; - sc->port_used = n; - sc->port_bst = rman_get_bustag(res); - sc->port_bsh = rman_get_bushandle(res); - - /* Re-map i/o table if needed */ - switch (sc->type) { - case ED_TYPE98_LA98: - case ED_TYPE98_NW98X: - io_res[n] = io_asic[n - ED_NOVELL_ASIC_OFFSET] + offset; - n++; - break; - - case ED_TYPE98_108: - adj = (rman_get_start(res) & 0xf000) / 2; - offset = (offset | adj) - rman_get_start(res); - - for (n = ED_NOVELL_ASIC_OFFSET; n < ED_NOVELL_IO_PORTS; n++) - io_res[n] = io_asic[n - ED_NOVELL_ASIC_OFFSET] + offset; - break; - - case ED_TYPE98_CNET98: - io_nic = io_asic = ed98_ioaddr_cnet98; - offset = 1; - - bcopy(io_nic, io_res, sizeof(io_nic[0]) * ED_NOVELL_ASIC_OFFSET); - for (n = ED_NOVELL_ASIC_OFFSET; n < ED_NOVELL_IO_PORTS; n++) - io_res[n] = io_asic[n - ED_NOVELL_ASIC_OFFSET] + offset; - break; - - case ED_TYPE98_NC5098: - n = ED_NOVELL_IO_PORTS; - break; - } - - if (reset != ED_NOVELL_RESET) - io_res[ED_NOVELL_ASIC_OFFSET + ED_NOVELL_RESET] = - io_res[ED_NOVELL_ASIC_OFFSET + reset]; - if (data != ED_NOVELL_DATA) { - io_res[ED_NOVELL_ASIC_OFFSET + ED_NOVELL_DATA] = - io_res[ED_NOVELL_ASIC_OFFSET + data]; -#if 0 - io_res[ED_NOVELL_ASIC_OFFSET + ED_NOVELL_DATA + 1] = - io_res[ED_NOVELL_ASIC_OFFSET + data + 1]; -#endif - } - - error = isa_load_resourcev(res, io_res, n); - if (error != 0) - return (ENOENT); -#ifdef ED_DEBUG - device_printf(dev, "ed98_alloc_port: i/o ports = %d\n", n); - for (i = 0; i < n; i++) - printf("%x,", io_res[i]); - printf("\n"); -#endif - return (0); -} - -static int -ed98_alloc_memory(dev, rid) - device_t dev; - int rid; -{ - struct ed_softc *sc = device_get_softc(dev); - int error; - rman_res_t conf_maddr, conf_msize; - - error = bus_get_resource(dev, SYS_RES_MEMORY, 0, &conf_maddr, - &conf_msize); - if (error) - return (error); - - if ((conf_maddr == 0) || (conf_msize == 0)) - return (ENXIO); - - error = ed_alloc_memory(dev, rid, (int) conf_msize); - if (error) - return (error); - - sc->mem_start = 0; - sc->mem_size = conf_msize; - - return (0); -} - -/* - * Generic probe routine for testing for the existance of a DS8390. - * Must be called after the NIC has just been reset. This routine - * works by looking at certain register values that are guaranteed - * to be initialized a certain way after power-up or reset. Seems - * not to currently work on the 83C690. - * - * Specifically: - * - * Register reset bits set bits - * Command Register (CR) TXP, STA RD2, STP - * Interrupt Status (ISR) RST - * Interrupt Mask (IMR) All bits - * Data Control (DCR) LAS - * Transmit Config. (TCR) LB1, LB0 - * - * XXX - We only check the CR register. - * - * Return 1 if 8390 was found, 0 if not. - */ - -static int -ed98_probe_generic8390(struct ed_softc *sc) -{ - u_char tmp = ed_nic_inb(sc, ED_P0_CR); -#ifdef DIAGNOSTIC - printf("ed?: inb(ED_P0_CR)=%x\n", tmp); -#endif - if ((tmp & (ED_CR_RD2 | ED_CR_TXP | ED_CR_STA | ED_CR_STP)) != - (ED_CR_RD2 | ED_CR_STP)) - return (0); - - (void) ed_nic_inb(sc, ED_P0_ISR); - - return (1); -} - -static int -ed98_probe_Novell(device_t dev, int port_rid, int flags) -{ - struct ed_softc *sc = device_get_softc(dev); - int error; - int n; - u_char romdata[ETHER_ADDR_LEN * 2], tmp; - -#ifdef ED_DEBUG - device_printf(dev, "ed98_probe_Novell: start\n"); -#endif - error = ed98_alloc_port(dev, port_rid); - if (error) - return (error); - - sc->asic_offset = ED_NOVELL_ASIC_OFFSET; - sc->nic_offset = ED_NOVELL_NIC_OFFSET; - - /* Reset the board */ -#ifdef ED_DEBUG - device_printf(dev, "ed98_probe_Novell: reset\n"); -#endif - switch (sc->type) { -#if 1 /* XXX - I'm not sure this is really necessary... */ - case ED_TYPE98_BDN: - tmp = ed_asic_inb(sc, ED_NOVELL_RESET); - ed_asic_outb(sc, ED_NOVELL_RESET, (tmp & 0xf0) | 0x08); - ed_nic_outb(sc, 0x04, tmp); - (void) ed_asic_inb(sc, 0x08); - ed_asic_outb(sc, 0x08, tmp); - ed_asic_outb(sc, 0x08, tmp & 0x7f); - break; -#endif - case ED_TYPE98_NC5098: - ed_asic_outb(sc, ED_NOVELL_RESET, 0x00); - DELAY(5000); - ed_asic_outb(sc, ED_NOVELL_RESET, 0x01); - break; - - default: - tmp = ed_asic_inb(sc, ED_NOVELL_RESET); - - /* - * I don't know if this is necessary; probably cruft leftover from - * Clarkson packet driver code. Doesn't do a thing on the boards I've - * tested. -DG [note that an outb(0x84, 0) seems to work here, and is - * non-invasive...but some boards don't seem to reset and I don't have - * complete documentation on what the 'right' thing to do is...so we - * do the invasive thing for now. Yuck.] - */ - ed_asic_outb(sc, ED_NOVELL_RESET, tmp); - break; - } - DELAY(5000); - - /* - * This is needed because some NE clones apparently don't reset the - * NIC properly (or the NIC chip doesn't reset fully on power-up) XXX - * - this makes the probe invasive! ...Done against my better - * judgement. -DLG - */ - ed_nic_outb(sc, ED_P0_CR, ED_CR_RD2 | ED_CR_STP); - DELAY(5000); - - /* Make sure that we really have an 8390 based board */ - if (!ed98_probe_generic8390(sc)) - return (ENXIO); - - /* Test memory via PIO */ -#ifdef ED_DEBUG - device_printf(dev, "ed98_probe_Novell: test memory\n"); -#endif - sc->cr_proto = ED_CR_RD2; - if (!ed_pio_testmem(sc, 8192, 0, flags) && - !ed_pio_testmem(sc, 16384, 1, flags)) - return (ENXIO); - - /* Setup the board type */ -#ifdef ED_DEBUG - device_printf(dev, "ed98_probe_Novell: board type\n"); -#endif - switch (sc->type) { - case ED_TYPE98_BDN: - sc->type_str = "LD-BDN"; - break; - case ED_TYPE98_EGY: - sc->type_str = "EGY-98"; - break; - case ED_TYPE98_LGY: - sc->type_str = "LGY-98"; - break; - case ED_TYPE98_ICM: - sc->type_str = "ICM"; - break; - case ED_TYPE98_108: - sc->type_str = "PC-9801-108"; - break; - case ED_TYPE98_LA98: - sc->type_str = "LA-98"; - break; - case ED_TYPE98_NW98X: - sc->type_str = "NW98X"; - break; - case ED_TYPE98_NC5098: - sc->type_str = "NC5098"; - break; - default: - sc->type_str = NULL; - break; - } - - /* Get station address */ - switch (sc->type) { - case ED_TYPE98_NC5098: - for (n = 0; n < ETHER_ADDR_LEN; n++) - sc->enaddr[n] = ed_asic_inb(sc, ED_NC5098_ENADDR + n); - break; - - default: - ed_pio_readmem(sc, 0, romdata, sizeof(romdata)); - for (n = 0; n < ETHER_ADDR_LEN; n++) - sc->enaddr[n] = romdata[n * (sc->isa16bit + 1)]; - break; - } - - /* clear any pending interrupts that might have occurred above */ - ed_nic_outb(sc, ED_P0_ISR, 0xff); - - sc->sc_write_mbufs = ed_pio_write_mbufs; - return (0); -} - -/* - * Probe and vendor-specific initialization routine for SIC-98 boards - */ -static int -ed_probe_SIC98(device_t dev, int port_rid, int flags) -{ - struct ed_softc *sc = device_get_softc(dev); - int error; - int i; - u_char sum; - - /* - * Setup card RAM and I/O address - * Kernel Virtual to segment C0000-DFFFF???? - */ - error = ed98_alloc_port(dev, port_rid); - if (error) - return (error); - - sc->asic_offset = ED_SIC_ASIC_OFFSET; - sc->nic_offset = ED_SIC_NIC_OFFSET; - - error = ed98_alloc_memory(dev, 0); - if (error) - return (error); - - /* Reset card to force it into a known state. */ - ed_asic_outb(sc, 0, 0x00); - DELAY(100); - if (ED_TYPE98SUB(flags) == 0) { - /* SIC-98/SIU-98 */ - ed_asic_outb(sc, 0, 0x94); - DELAY(100); - ed_asic_outb(sc, 0, 0x94); - } else { - /* SIU-98-D */ - ed_asic_outb(sc, 0, 0x80); - DELAY(100); - ed_asic_outb(sc, 0, 0x94); - DELAY(100); - ed_asic_outb(sc, 0, 0x9e); - } - DELAY(100); - - /* - * Here we check the card ROM, if the checksum passes, and the - * type code and ethernet address check out, then we know we have - * an SIC card. - */ - sum = bus_space_read_1(sc->mem_bst, sc->mem_bsh, 6 * 2); - for (i = 0; i < ETHER_ADDR_LEN; i++) - sum ^= (sc->enaddr[i] = - bus_space_read_1(sc->mem_bst, sc->mem_bsh, i * 2)); -#ifdef ED_DEBUG - device_printf(dev, "ed_probe_sic98: got address %6D\n", - sc->enaddr, ":"); -#endif - if (sum != 0) - return (ENXIO); - if ((sc->enaddr[0] | sc->enaddr[1] | sc->enaddr[2]) == 0) - return (ENXIO); - - sc->vendor = ED_VENDOR_SIC; - sc->type_str = "SIC98"; - sc->isa16bit = 1; - sc->cr_proto = 0; - - /* - * SIC RAM page 0x0000-0x3fff(or 0x7fff) - */ - if (ED_TYPE98SUB(flags) == 0) - ed_asic_outb(sc, 0, 0x90); - else - ed_asic_outb(sc, 0, 0x8e); - DELAY(100); - - error = ed_clear_memory(dev); - if (error) - return (error); - - sc->mem_shared = 1; - sc->mem_end = sc->mem_start + sc->mem_size; - - /* - * allocate one xmit buffer if < 16k, two buffers otherwise - */ - if ((sc->mem_size < 16384) || (flags & ED_FLAGS_NO_MULTI_BUFFERING)) - sc->txb_cnt = 1; - else - sc->txb_cnt = 2; - sc->tx_page_start = 0; - - sc->rec_page_start = sc->tx_page_start + ED_TXBUF_SIZE * sc->txb_cnt; - sc->rec_page_stop = sc->tx_page_start + sc->mem_size / ED_PAGE_SIZE; - - sc->mem_ring = sc->mem_start + sc->txb_cnt * ED_PAGE_SIZE * ED_TXBUF_SIZE; - - sc->sc_write_mbufs = ed_shmem_write_mbufs; - return (0); -} - -/* - * Contec C-NET(98) series support routines - */ -static void -ed_reset_CNET98(struct ed_softc *sc, int flags) -{ - u_int init_addr = ED_CNET98_INIT; - u_char tmp; - - /* Choose initial register address */ - if (ED_TYPE98SUB(flags) != 0) { - init_addr = ED_CNET98_INIT2; - } -#ifdef ED_DEBUG - printf("ed?: initial register=%x\n", init_addr); -#endif - /* - * Reset the board to force it into a known state. - */ - outb(init_addr, 0x00); /* request */ - DELAY(5000); - outb(init_addr, 0x01); /* cancel */ - DELAY(5000); - - /* - * Set I/O address(A15-12) and cpu type - * - * AAAAIXXC(8bit) - * AAAA: A15-A12, I: I/O enable, XX: reserved, C: CPU type - * - * CPU type is 1:80286 or higher, 0:not. - * But FreeBSD runs under i386 or higher, thus it must be 1. - */ - tmp = (rman_get_start(sc->port_res) & 0xf000) >> 8; - tmp |= (0x08 | 0x01); -#ifdef ED_DEBUG - printf("ed?: outb(%x, %x)\n", init_addr + 2, tmp); -#endif - outb(init_addr + 2, tmp); - DELAY(5000); - - /* - * This is needed because some NE clones apparently don't reset the - * NIC properly (or the NIC chip doesn't reset fully on power-up) XXX - * - this makes the probe invasive! ...Done against my better - * judgement. -DLG - */ - ed_nic_outb(sc, ED_P0_CR, ED_CR_RD2 | ED_CR_STP); - DELAY(5000); -} - -static void -ed_winsel_CNET98(struct ed_softc *sc, u_short bank) -{ - u_char mem = (rman_get_start(sc->mem_res) >> 12) & 0xff; - - /* - * Disable window memory - * bit7 is 0:disable - */ - ed_asic_outb(sc, ED_CNET98_WIN_REG, mem & 0x7f); - DELAY(10); - - /* - * Select window address - * FreeBSD address 0xf00xxxxx - */ - ed_asic_outb(sc, ED_CNET98_MAP_REG0L, bank & 0xff); - DELAY(10); - ed_asic_outb(sc, ED_CNET98_MAP_REG0H, (bank >> 8) & 0xff); - DELAY(10); - ed_asic_outb(sc, ED_CNET98_MAP_REG1L, 0x00); - DELAY(10); - ed_asic_outb(sc, ED_CNET98_MAP_REG1H, 0x41); - DELAY(10); - ed_asic_outb(sc, ED_CNET98_MAP_REG2L, 0x00); - DELAY(10); - ed_asic_outb(sc, ED_CNET98_MAP_REG2H, 0x42); - DELAY(10); - ed_asic_outb(sc, ED_CNET98_MAP_REG3L, 0x00); - DELAY(10); - ed_asic_outb(sc, ED_CNET98_MAP_REG3H, 0x43); - DELAY(10); - - /* - * Enable window memory(16Kbyte) - * bit7 is 1:enable - */ -#ifdef ED_DEBUG - printf("ed?: window start address=%x\n", mem); -#endif - ed_asic_outb(sc, ED_CNET98_WIN_REG, mem); - DELAY(10); -} - -/* - * Probe and vendor-specific initialization routine for C-NET(98) boards - */ -static int -ed_probe_CNET98(device_t dev, int port_rid, int flags) -{ - struct ed_softc *sc = device_get_softc(dev); - int error; - u_char tmp; - rman_res_t conf_irq, junk; -#ifdef DIAGNOSTIC - u_char tmp_s; -#endif - - error = ed98_alloc_port(dev, port_rid); - if (error) - return (error); - - sc->asic_offset = ED_NOVELL_ASIC_OFFSET; - sc->nic_offset = ED_NOVELL_NIC_OFFSET; - - error = ed98_alloc_memory(dev, 0); - if (error) - return (error); - - /* Check I/O address. 0x[a-f]3d0 are allowed. */ - if (((rman_get_start(sc->port_res) & 0x0fff) != 0x03d0) - || ((rman_get_start(sc->port_res) & 0xf000) < (u_short) 0xa000)) { -#ifdef DIAGNOSTIC - device_printf(dev, "Invalid i/o port configuration (0x%jx) " - "must be %s for %s\n", rman_get_start(sc->port_res), - "0x[a-f]3d0", "CNET98"); -#endif - return (ENXIO); - } - -#ifdef DIAGNOSTIC - /* Check window area address */ - tmp_s = rman_get_start(sc->mem_res) >> 12; - if (tmp_s < 0x80) { - device_printf(dev, "Please change window address(0x%jx)\n", - rman_get_start(sc->mem_res)); - return (ENXIO); - } - - tmp_s &= 0x0f; - tmp = rman_get_start(sc->port_res) >> 12; - if ((tmp_s <= tmp) && (tmp < (tmp_s + 4))) { - device_printf(dev, "Please change iobase address(0x%jx) " - "or window address(0x%jx)\n", - rman_get_start(sc->port_res), - rman_get_start(sc->mem_res)); - return (ENXIO); - } -#endif - /* Reset the board */ - ed_reset_CNET98(sc, flags); - - /* - * This is needed because some NE clones apparently don't reset the - * NIC properly (or the NIC chip doesn't reset fully on power-up) XXX - * - this makes the probe invasive! ...Done against my better - * judgement. -DLG - */ - ed_nic_outb(sc, ED_P0_CR, ED_CR_RD2 | ED_CR_STP); - DELAY(5000); - - /* Make sure that we really have an 8390 based board */ - if (!ed98_probe_generic8390(sc)) - return (ENXIO); - - /* - * Set window ethernet address area - * board memory base 0x480000 data 256byte - */ - ed_winsel_CNET98(sc, 0x4800); - - /* - * Get station address from on-board ROM - */ - bus_space_read_region_1(sc->mem_bst, sc->mem_bsh, sc->mem_start, - sc->enaddr, ETHER_ADDR_LEN); - - sc->vendor = ED_VENDOR_MISC; - sc->type_str = "CNET98"; - sc->isa16bit = 0; - sc->cr_proto = ED_CR_RD2; - - /* - * Set window buffer memory area - * board memory base 0x400000 data 16kbyte - */ - ed_winsel_CNET98(sc, 0x4000); - - error = ed_clear_memory(dev); - if (error) - return (error); - - sc->mem_shared = 1; - sc->mem_end = sc->mem_start + sc->mem_size; - - sc->txb_cnt = 1; /* XXX */ - sc->tx_page_start = 0; - - sc->rec_page_start = sc->tx_page_start + ED_TXBUF_SIZE; - sc->rec_page_stop = sc->tx_page_start + sc->mem_size / ED_PAGE_SIZE; - - sc->mem_ring = sc->mem_start + ED_PAGE_SIZE * ED_TXBUF_SIZE; - - /* - * Set interrupt level - */ - error = bus_get_resource(dev, SYS_RES_IRQ, 0, &conf_irq, &junk); - if (error) - return (error); - - switch (conf_irq) { - case 3: - tmp = ED_CNET98_INT_IRQ3; - break; - case 5: - tmp = ED_CNET98_INT_IRQ5; - break; - case 6: - tmp = ED_CNET98_INT_IRQ6; - break; - case 9: - tmp = ED_CNET98_INT_IRQ9; - break; - case 12: - tmp = ED_CNET98_INT_IRQ12; - break; - case 13: - tmp = ED_CNET98_INT_IRQ13; - break; - default: - device_printf(dev, "Invalid irq configuration (%jd) must be " - "%s for %s\n", conf_irq, "3,5,6,9,12,13", "CNET98"); - return (ENXIO); - } - ed_asic_outb(sc, ED_CNET98_INT_LEV, tmp); - DELAY(1000); - /* - * Set interrupt mask. - * bit7:1 all interrupt mask - * bit1:1 timer interrupt mask - * bit0:0 NS controler interrupt enable - */ - ed_asic_outb(sc, ED_CNET98_INT_MASK, 0x7e); - DELAY(1000); - - sc->sc_write_mbufs = ed_shmem_write_mbufs; - return (0); -} - -/* - * Probe and vendor-specific initialization routine for C-NET(98)E/L boards - */ -static int -ed_probe_CNET98EL(device_t dev, int port_rid, int flags) -{ - struct ed_softc *sc = device_get_softc(dev); - int error; - int i; - u_char romdata[ETHER_ADDR_LEN * 2], tmp; - rman_res_t conf_irq, junk; - - error = ed98_alloc_port(dev, port_rid); - if (error) - return (error); - - sc->asic_offset = ED_NOVELL_ASIC_OFFSET; - sc->nic_offset = ED_NOVELL_NIC_OFFSET; - - /* Check I/O address. 0x[0-f]3d0 are allowed. */ - if ((rman_get_start(sc->port_res) & 0x0fff) != 0x03d0) { -#ifdef DIAGNOSTIC - device_printf(dev, "Invalid i/o port configuration (0x%jx) " - "must be %s for %s\n", rman_get_start(sc->port_res), - "0x?3d0", "CNET98E/L"); -#endif - return (ENXIO); - } - - /* Reset the board */ - ed_reset_CNET98(sc, flags); - - /* - * This is needed because some NE clones apparently don't reset the - * NIC properly (or the NIC chip doesn't reset fully on power-up) XXX - * - this makes the probe invasive! ...Done against my better - * judgement. -DLG - */ - ed_nic_outb(sc, ED_P0_CR, ED_CR_RD2 | ED_CR_STP); - DELAY(5000); - - /* Make sure that we really have an 8390 based board */ - if (!ed98_probe_generic8390(sc)) - return (ENXIO); - - /* Test memory via PIO */ - sc->cr_proto = ED_CR_RD2; - if (!ed_pio_testmem(sc, ED_CNET98EL_PAGE_OFFSET, 1, flags)) - return (ENXIO); - - /* This looks like a C-NET(98)E/L board. */ - sc->type_str = "CNET98E/L"; - - /* - * Set IRQ. C-NET(98)E/L only allows a choice of irq 3,5,6. - */ - error = bus_get_resource(dev, SYS_RES_IRQ, 0, &conf_irq, &junk); - if (error) - return (error); - - switch (conf_irq) { - case 3: - tmp = ED_CNET98EL_ICR_IRQ3; - break; - case 5: - tmp = ED_CNET98EL_ICR_IRQ5; - break; - case 6: - tmp = ED_CNET98EL_ICR_IRQ6; - break; -#if 0 - case 12: - tmp = ED_CNET98EL_ICR_IRQ12; - break; -#endif - default: - device_printf(dev, "Invalid irq configuration (%jd) must be " - "%s for %s\n", conf_irq, "3,5,6", "CNET98E/L"); - return (ENXIO); - } - ed_asic_outb(sc, ED_CNET98EL_ICR, tmp); - ed_asic_outb(sc, ED_CNET98EL_IMR, 0x7e); - - /* Get station address from on-board ROM */ - ed_pio_readmem(sc, 16384, romdata, sizeof(romdata)); - for (i = 0; i < ETHER_ADDR_LEN; i++) - sc->enaddr[i] = romdata[i * 2]; - - /* clear any pending interrupts that might have occurred above */ - ed_nic_outb(sc, ED_P0_ISR, 0xff); - - sc->sc_write_mbufs = ed_pio_write_mbufs; - return (0); -} - -/* - * Probe and vendor-specific initialization routine for PC-9801-77 boards - */ -static int -ed_probe_NEC77(device_t dev, int port_rid, int flags) -{ - struct ed_softc *sc = device_get_softc(dev); - int error; - u_char tmp; - rman_res_t conf_irq, junk; - - error = ed98_probe_Novell(dev, port_rid, flags); - if (error) - return (error); - - /* LA/T-98 does not need IRQ setting. */ - if (ED_TYPE98SUB(flags) == 0) - return (0); - - /* - * Set IRQ. PC-9801-77 only allows a choice of irq 3,5,6,12,13. - */ - error = bus_get_resource(dev, SYS_RES_IRQ, 0, &conf_irq, &junk); - if (error) - return (error); - - switch (conf_irq) { - case 3: - tmp = ED_NEC77_IRQ3; - break; - case 5: - tmp = ED_NEC77_IRQ5; - break; - case 6: - tmp = ED_NEC77_IRQ6; - break; - case 12: - tmp = ED_NEC77_IRQ12; - break; - case 13: - tmp = ED_NEC77_IRQ13; - break; - default: - device_printf(dev, "Invalid irq configuration (%jd) must be " - "%s for %s\n", conf_irq, "3,5,6,12,13", "PC-9801-77"); - return (ENXIO); - } - ed_asic_outb(sc, ED_NEC77_IRQ, tmp); - - return (0); -} - -/* - * Probe and vendor-specific initialization routine for EC/EP-98X boards - */ -static int -ed_probe_NW98X(device_t dev, int port_rid, int flags) -{ - struct ed_softc *sc = device_get_softc(dev); - int error; - u_char tmp; - rman_res_t conf_irq, junk; - - error = ed98_probe_Novell(dev, port_rid, flags); - if (error) - return (error); - - /* Networld 98X3 does not need IRQ setting. */ - if (ED_TYPE98SUB(flags) == 0) - return (0); - - /* - * Set IRQ. EC/EP-98X only allows a choice of irq 3,5,6,12,13. - */ - error = bus_get_resource(dev, SYS_RES_IRQ, 0, &conf_irq, &junk); - if (error) - return (error); - - switch (conf_irq) { - case 3: - tmp = ED_NW98X_IRQ3; - break; - case 5: - tmp = ED_NW98X_IRQ5; - break; - case 6: - tmp = ED_NW98X_IRQ6; - break; - case 12: - tmp = ED_NW98X_IRQ12; - break; - case 13: - tmp = ED_NW98X_IRQ13; - break; - default: - device_printf(dev, "Invalid irq configuration (%jd) must be " - "%s for %s\n", conf_irq, "3,5,6,12,13", "EC/EP-98X"); - return (ENXIO); - } - ed_asic_outb(sc, ED_NW98X_IRQ, tmp); - - return (0); -} - -/* - * Read SB-9801 station address from Serial Two-Wire EEPROM - */ -static void -ed_get_SB98(struct ed_softc *sc) -{ - int i, j; - u_char mask, val; - - /* enable EEPROM acceess */ - ed_asic_outb(sc, ED_SB98_EEPENA, ED_SB98_EEPENA_ENABLE); - - /* output start command */ - ed_asic_outb(sc, ED_SB98_EEP, ED_SB98_EEP_SDA | ED_SB98_EEP_SCL); - DELAY(ED_SB98_EEP_DELAY); - ed_asic_outb(sc, ED_SB98_EEP, ED_SB98_EEP_SCL); - DELAY(ED_SB98_EEP_DELAY); - - /* output address (7bit) */ - for (mask = 0x40; mask != 0; mask >>= 1) { - val = 0; - if (ED_SB98_ADDRESS & mask) - val = ED_SB98_EEP_SDA; - ed_asic_outb(sc, ED_SB98_EEP, val); - DELAY(ED_SB98_EEP_DELAY); - ed_asic_outb(sc, ED_SB98_EEP, val | ED_SB98_EEP_SCL); - DELAY(ED_SB98_EEP_DELAY); - } - - /* output READ command */ - ed_asic_outb(sc, ED_SB98_EEP, ED_SB98_EEP_READ); - DELAY(ED_SB98_EEP_DELAY); - ed_asic_outb(sc, ED_SB98_EEP, ED_SB98_EEP_READ | ED_SB98_EEP_SCL); - DELAY(ED_SB98_EEP_DELAY); - - /* read station address */ - for (i = 0; i < ETHER_ADDR_LEN; i++) { - /* output ACK */ - ed_asic_outb(sc, ED_SB98_EEP, 0); - DELAY(ED_SB98_EEP_DELAY); - ed_asic_outb(sc, ED_SB98_EEP, ED_SB98_EEP_SCL); - DELAY(ED_SB98_EEP_DELAY); - - val = 0; - for (j = 0; j < 8; j++) { - ed_asic_outb(sc, ED_SB98_EEP, ED_SB98_EEP_SDA); - DELAY(ED_SB98_EEP_DELAY); - ed_asic_outb(sc, ED_SB98_EEP, ED_SB98_EEP_SDA | ED_SB98_EEP_SCL); - DELAY(ED_SB98_EEP_DELAY); - val <<= 1; - val |= (ed_asic_inb(sc, ED_SB98_EEP) & ED_SB98_EEP_SDA); - DELAY(ED_SB98_EEP_DELAY); - } - sc->enaddr[i] = val; - } - - /* output Last ACK */ - ed_asic_outb(sc, ED_SB98_EEP, ED_SB98_EEP_SDA); - DELAY(ED_SB98_EEP_DELAY); - ed_asic_outb(sc, ED_SB98_EEP, ED_SB98_EEP_SDA | ED_SB98_EEP_SCL); - DELAY(ED_SB98_EEP_DELAY); - - /* output stop command */ - ed_asic_outb(sc, ED_SB98_EEP, ED_SB98_EEP_SCL); - DELAY(ED_SB98_EEP_DELAY); - ed_asic_outb(sc, ED_SB98_EEP, ED_SB98_EEP_SDA | ED_SB98_EEP_SCL); - DELAY(ED_SB98_EEP_DELAY); - - /* disable EEPROM access */ - ed_asic_outb(sc, ED_SB98_EEPENA, ED_SB98_EEPENA_DISABLE); -} - -/* - * Probe and vendor-specific initialization routine for SB-9801 boards - */ -static int -ed_probe_SB98(device_t dev, int port_rid, int flags) -{ - struct ed_softc *sc = device_get_softc(dev); - int error; - u_char tmp; - rman_res_t conf_irq, junk; - - error = ed98_alloc_port(dev, port_rid); - if (error) - return (error); - - sc->asic_offset = ED_NOVELL_ASIC_OFFSET; - sc->nic_offset = ED_NOVELL_NIC_OFFSET; - - /* Check I/O address. 00d[02468ace] are allowed. */ - if ((rman_get_start(sc->port_res) & ~0x000e) != 0x00d0) { -#ifdef DIAGNOSTIC - device_printf(dev, "Invalid i/o port configuration (0x%jx) " - "must be %s for %s\n", rman_get_start(sc->port_res), - "0xd?", "SB9801"); -#endif - return (ENXIO); - } - - /* Write I/O port address and read 4 times */ - outb(ED_SB98_IO_INHIBIT, rman_get_start(sc->port_res) & 0xff); - (void) inb(ED_SB98_IO_INHIBIT); DELAY(300); - (void) inb(ED_SB98_IO_INHIBIT); DELAY(300); - (void) inb(ED_SB98_IO_INHIBIT); DELAY(300); - (void) inb(ED_SB98_IO_INHIBIT); DELAY(300); - - /* - * Check IRQ. Soliton SB-9801 only allows a choice of - * irq 3,5,6,12 - */ - error = bus_get_resource(dev, SYS_RES_IRQ, 0, &conf_irq, &junk); - if (error) - return (error); - - switch (conf_irq) { - case 3: - tmp = ED_SB98_CFG_IRQ3; - break; - case 5: - tmp = ED_SB98_CFG_IRQ5; - break; - case 6: - tmp = ED_SB98_CFG_IRQ6; - break; - case 12: - tmp = ED_SB98_CFG_IRQ12; - break; - default: - device_printf(dev, "Invalid irq configuration (%jd) must be " - "%s for %s\n", conf_irq, "3,5,6,12", "SB9801"); - return (ENXIO); - } - - if (flags & ED_FLAGS_DISABLE_TRANCEIVER) - tmp |= ED_SB98_CFG_ALTPORT; - ed_asic_outb(sc, ED_SB98_CFG, ED_SB98_CFG_ENABLE | tmp); - ed_asic_outb(sc, ED_SB98_POLARITY, 0x01); - - /* Reset the board. */ - ed_asic_outb(sc, ED_NOVELL_RESET, 0x7a); - DELAY(300); - ed_asic_outb(sc, ED_NOVELL_RESET, 0x79); - DELAY(300); - - /* - * This is needed because some NE clones apparently don't reset the - * NIC properly (or the NIC chip doesn't reset fully on power-up) XXX - * - this makes the probe invasive! ...Done against my better - * judgement. -DLG - */ - ed_nic_outb(sc, ED_P0_CR, ED_CR_RD2 | ED_CR_STP); - DELAY(5000); - - /* Make sure that we really have an 8390 based board */ - if (!ed98_probe_generic8390(sc)) - return (ENXIO); - - /* Test memory via PIO */ - sc->cr_proto = ED_CR_RD2; - if (!ed_pio_testmem(sc, 16384, 1, flags)) - return (ENXIO); - - /* This looks like an SB9801 board. */ - sc->type_str = "SB9801"; - - /* Get station address */ - ed_get_SB98(sc); - - /* clear any pending interrupts that might have occurred above */ - ed_nic_outb(sc, ED_P0_ISR, 0xff); - - sc->sc_write_mbufs = ed_pio_write_mbufs; - return (0); -} - -/* - * Test the ability to read and write to the NIC memory. - */ -static int -ed_pio_testmem(struct ed_softc *sc, int page_offset, int isa16bit, int flags) -{ - u_long memsize; - static char test_pattern[32] = "THIS is A memory TEST pattern"; - char test_buffer[32]; -#ifdef DIAGNOSTIC - int page_end; -#endif - - sc->vendor = ED_VENDOR_NOVELL; - sc->mem_shared = 0; - sc->isa16bit = isa16bit; - - /* 8k of memory plus an additional 8k if 16bit */ - memsize = (isa16bit ? 16384 : 8192); - - /* - * This prevents packets from being stored in the NIC memory when the - * readmem routine turns on the start bit in the CR. - */ - ed_nic_outb(sc, ED_P0_RCR, ED_RCR_MON); - - /* Initialize DCR for byte/word operations */ - if (isa16bit) - ed_nic_outb(sc, ED_P0_DCR, ED_DCR_WTS | ED_DCR_FT1 | ED_DCR_LS); - else - ed_nic_outb(sc, ED_P0_DCR, ED_DCR_FT1 | ED_DCR_LS); - ed_nic_outb(sc, ED_P0_PSTART, page_offset / ED_PAGE_SIZE); - ed_nic_outb(sc, ED_P0_PSTOP, (page_offset + memsize) / ED_PAGE_SIZE); -#ifdef ED_DEBUG - printf("ed?: ed_pio_testmem: page start=%x, end=%lx", - page_offset, page_offset + memsize); -#endif - - /* - * Write a test pattern. If this fails, then we don't know - * what this board is. - */ - ed_pio_writemem(sc, test_pattern, page_offset, sizeof(test_pattern)); - ed_pio_readmem(sc, page_offset, test_buffer, sizeof(test_pattern)); - - if (bcmp(test_pattern, test_buffer, sizeof(test_pattern))) { -#ifdef ED_DEBUG - printf("ed?: ed_pio_testmem: bcmp(page %x) NG", page_offset); -#endif - return (0); - } - -#ifdef DIAGNOSTIC - /* Check the bottom. */ - page_end = page_offset + memsize - ED_PAGE_SIZE; - ed_pio_writemem(sc, test_pattern, page_end, sizeof(test_pattern)); - ed_pio_readmem(sc, page_end, test_buffer, sizeof(test_pattern)); - - if (bcmp(test_pattern, test_buffer, sizeof(test_pattern))) { -#ifdef ED_DEBUG - printf("ed?: ed_pio_testmem: bcmp(page %x) NG", page_end); -#endif - return (0); - } -#endif - sc->mem_size = memsize; - sc->mem_start = page_offset; - sc->mem_end = sc->mem_start + memsize; - sc->tx_page_start = page_offset / ED_PAGE_SIZE; - - /* - * Use one xmit buffer if < 16k, two buffers otherwise (if not told - * otherwise). - */ - if ((memsize < 16384) || (flags & ED_FLAGS_NO_MULTI_BUFFERING)) - sc->txb_cnt = 1; - else - sc->txb_cnt = 2; - - sc->rec_page_start = sc->tx_page_start + sc->txb_cnt * ED_TXBUF_SIZE; - sc->rec_page_stop = sc->tx_page_start + memsize / ED_PAGE_SIZE; - - sc->mem_ring = sc->mem_start + sc->txb_cnt * ED_PAGE_SIZE * ED_TXBUF_SIZE; - - return (1); -} - -static device_method_t ed_cbus_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, ed_cbus_probe), - DEVMETHOD(device_attach, ed_cbus_attach), - DEVMETHOD(device_detach, ed_detach), - - { 0, 0 } -}; - -static driver_t ed_cbus_driver = { - "ed", - ed_cbus_methods, - sizeof(struct ed_softc) -}; - -DRIVER_MODULE(ed, isa, ed_cbus_driver, ed_devclass, 0, 0); -MODULE_DEPEND(ed, isa, 1, 1, 1); -MODULE_DEPEND(ed, ether, 1, 1, 1); diff --git a/sys/dev/ep/if_ep_isa.c b/sys/dev/ep/if_ep_isa.c index e125daf101fd..7bcb3d410057 100644 --- a/sys/dev/ep/if_ep_isa.c +++ b/sys/dev/ep/if_ep_isa.c @@ -76,10 +76,6 @@ const char *ep_isa_match_id(uint32_t, struct isa_ident *); #define ISA_ID_3C509_COMBO 0x506d5094 #define ISA_ID_3C509_TPO 0x506d5095 #define ISA_ID_3C509_TPC 0x506d5098 -#ifdef PC98 -#define ISA_ID_3C569B_COMBO 0x506d5694 -#define ISA_ID_3C569B_TPO 0x506d5695 -#endif #ifdef __i386__ static struct isa_ident ep_isa_devs[] = { @@ -88,10 +84,6 @@ static struct isa_ident ep_isa_devs[] = { {ISA_ID_3C509_COMBO, "3Com 3C509-Combo EtherLink III"}, {ISA_ID_3C509_TPO, "3Com 3C509-TPO EtherLink III"}, {ISA_ID_3C509_TPC, "3Com 3C509-TPC EtherLink III"}, -#ifdef PC98 - {ISA_ID_3C569B_COMBO, "3Com 3C569B-J-Combo EtherLink III"}, - {ISA_ID_3C569B_TPO, "3Com 3C569B-J-TPO EtherLink III"}, -#endif {0, NULL}, }; #endif @@ -224,11 +216,7 @@ ep_isa_identify(driver_t * driver, device_t parent) /* Retreive IOPORT */ data = get_eeprom_data(ELINK_ID_PORT, EEPROM_ADDR_CFG); -#ifdef PC98 - ioport = (((data & ADDR_CFG_MASK) * 0x100) + 0x40d0); -#else ioport = (((data & ADDR_CFG_MASK) << 4) + 0x200); -#endif if ((data & ADDR_CFG_MASK) == ADDR_CFG_EISA) { device_printf(parent, diff --git a/sys/dev/exca/excareg.h b/sys/dev/exca/excareg.h index c445efe60583..ecde55a4a1de 100644 --- a/sys/dev/exca/excareg.h +++ b/sys/dev/exca/excareg.h @@ -417,10 +417,6 @@ #define EXCA_PNP_82365_CARDBUS 0x030ED041 /* PNP0E03 */ #define EXCA_PNP_SCM_SWAPBOX 0x69046d4c /* SMC0469 */ -/* C-Bus PnP Definitions */ -#define EXCA_NEC_PC9801_102 0x9180a3b8 /* NEC8091 PC-9801-102 */ -#define EXCA_NEC_PC9821RA_E01 0x2181a3b8 /* NEC8121 PC-9821RA-E01 */ - /* * Mask of allowable interrupts. * @@ -433,20 +429,7 @@ * NT had a special device that would probe for conflicts early in the * boot process and formulate a mapping table. Maybe we should do * something similar. - * - * For NEC PC-98 machines, irq 3, 5, 6, 9, 10, 11, 12, 13 are allowed. - * These correspond to the C-BUS signals INT 0, 1, 2, 3, 41, 42, 5, 6 - * respectively. - * - * Hiroshi TSUKADA-san writes in FreeBSD98-testers that CBUS INT 2 - * (mapped to IRQ 6) is routed to the IRQ 7 pin of the pcic in pc98 - * cbus add-in cards. He has confirmed this routing with a visual - * inspection of his card or a VOM. */ -#ifdef PC98 -#define EXCA_INT_MASK_ALLOWED 0x3E68 /* PC98 */ -#else #define EXCA_INT_MASK_ALLOWED 0xDEB8 /* AT */ -#endif #endif /* !_SYS_DEV_EXCA_EXCAREG_H */ diff --git a/sys/dev/fb/fb.c b/sys/dev/fb/fb.c index 183abdc3bfcb..169dacc77360 100644 --- a/sys/dev/fb/fb.c +++ b/sys/dev/fb/fb.c @@ -530,7 +530,6 @@ static char { KD_CGA, "CGA" }, { KD_EGA, "EGA" }, { KD_VGA, "VGA" }, - { KD_PC98, "PC-98x1" }, { KD_TGA, "TGA" }, { -1, "Unknown" }, }; @@ -605,7 +604,6 @@ fb_type(int adp_type) { FBTYPE_CGA, KD_CGA }, { FBTYPE_EGA, KD_EGA }, { FBTYPE_VGA, KD_VGA }, - { FBTYPE_PC98, KD_PC98 }, { FBTYPE_TGA, KD_TGA }, }; int i; diff --git a/sys/dev/fb/splash_bmp.c b/sys/dev/fb/splash_bmp.c index 517a3efd73f3..719725ee0fe6 100644 --- a/sys/dev/fb/splash_bmp.c +++ b/sys/dev/fb/splash_bmp.c @@ -36,11 +36,9 @@ #include #include -#ifndef PC98 #include #include -#endif #define FADE_TIMEOUT 15 /* sec */ #define FADE_LEVELS 10 @@ -65,15 +63,6 @@ bmp_start(video_adapter_t *adp) { /* currently only 256-color modes are supported XXX */ static int modes[] = { -#ifdef PC98 - /* - * As 640x400 doesn't generally look great, - * it's least preferred here. - */ - M_PC98_PEGC640x400, - M_PC98_PEGC640x480, - M_PC98_EGC640x400, -#else M_VESA_CG640x480, M_VESA_CG800x600, M_VESA_CG1024x768, @@ -83,7 +72,6 @@ bmp_start(video_adapter_t *adp) * it's least preferred here. */ M_VGA_CG320, -#endif -1, }; video_info_t info; @@ -239,9 +227,6 @@ typedef struct u_char *vidmem; /* video memory allocated for drawing */ video_adapter_t *adp; int bank; -#ifdef PC98 - u_char prev_val; -#endif } BMP_INFO; static BMP_INFO bmp_info; @@ -273,25 +258,6 @@ bmp_SetPix(BMP_INFO *info, int x, int y, u_char val) x += (info->swidth - info->width) / 2; switch(info->sdepth) { -#ifdef PC98 - case 4: - sofs += (x >> 3); - bofs = x & 0x7; /* offset within byte */ - - outb(0x7c, 0x80 | 0x40); /* GRCG on & RMW mode */ - if (val != info->prev_val) { - outb(0x7e, (val & 1) ? 0xff : 0); /* tile B */ - outb(0x7e, (val & 2) ? 0xff : 0); /* tile R */ - outb(0x7e, (val & 4) ? 0xff : 0); /* tile G */ - outb(0x7e, (val & 8) ? 0xff : 0); /* tile I */ - - info->prev_val = val; - } - - *(info->vidmem+sofs) = (0x80 >> bofs); /* write new bit */ - outb(0x7c, 0); /* GRCG off */ - break; -#else case 4: case 1: /* EGA/VGA planar modes */ @@ -307,7 +273,6 @@ bmp_SetPix(BMP_INFO *info, int x, int y, u_char val) outw(GDCIDX, (val << 8) | 0x00); /* set/reset */ *(info->vidmem + sofs) ^= 0xff; /* read-modify-write */ break; -#endif case 8: sofs += x; @@ -589,9 +554,7 @@ bmp_Draw(video_adapter_t *adp) { int line; #if 0 -#ifndef PC98 int i; -#endif #endif if (bmp_info.data == NULL) { /* init failed, do nothing */ @@ -607,15 +570,11 @@ bmp_Draw(video_adapter_t *adp) /* initialise the info structure for drawing */ bmp_info.index = bmp_info.data; -#ifdef PC98 - bmp_info.prev_val = 255; -#endif /* set the palette for our image */ vidd_load_palette(adp, (u_char *)&bmp_info.palette); #if 0 -#ifndef PC98 /* XXX: this is ugly, but necessary for EGA/VGA 1bpp/4bpp modes */ if ((adp->va_type == KD_EGA) || (adp->va_type == KD_VGA)) { inb(adp->va_crtc_addr + 6); /* reset flip-flop */ @@ -633,7 +592,6 @@ bmp_Draw(video_adapter_t *adp) if (bmp_info.sdepth == 1) outw(TSIDX, 0x0102); /* unmask plane #0 */ } -#endif #endif for (line = 0; (line < bmp_info.height) && bmp_info.index; line++) { diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c index 699ccbb2ca64..bb322aa318d2 100644 --- a/sys/dev/fdc/fdc.c +++ b/sys/dev/fdc/fdc.c @@ -82,12 +82,8 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef PC98 -#include -#else #include #include -#endif #include #include @@ -140,57 +136,34 @@ __FBSDID("$FreeBSD$"); */ static struct fd_type fd_searchlist_360k[] = { -#ifndef PC98 { FDF_5_360 }, -#endif { 0 } }; static struct fd_type fd_searchlist_12m[] = { -#ifdef PC98 - { FDF_5_1200 | FL_AUTO }, - { FDF_5_720 | FL_AUTO }, - { FDF_5_360 | FL_AUTO }, - { FDF_5_640 | FL_AUTO }, - { FDF_5_1230 | FL_AUTO }, -#else { FDF_5_1200 | FL_AUTO }, { FDF_5_400 | FL_AUTO }, { FDF_5_360 | FL_2STEP | FL_AUTO}, -#endif { 0 } }; static struct fd_type fd_searchlist_720k[] = { -#ifndef PC98 { FDF_3_720 }, -#endif { 0 } }; static struct fd_type fd_searchlist_144m[] = { -#ifdef PC98 - { FDF_3_1440 | FL_AUTO}, - { FDF_3_1200 | FL_AUTO}, - { FDF_3_720 | FL_AUTO}, - { FDF_3_360 | FL_AUTO}, - { FDF_3_640 | FL_AUTO}, - { FDF_3_1230 | FL_AUTO}, -#else { FDF_3_1440 | FL_AUTO}, { FDF_3_720 | FL_AUTO}, -#endif { 0 } }; static struct fd_type fd_searchlist_288m[] = { -#ifndef PC98 { FDF_3_1440 | FL_AUTO }, #if 0 { FDF_3_2880 | FL_AUTO }, /* XXX: probably doesn't work */ #endif { FDF_3_720 | FL_AUTO}, -#endif { 0 } }; @@ -211,26 +184,6 @@ static struct fd_type *fd_native_types[] = { * Internals start here */ -#ifdef PC98 -/* registers */ -#define FDSTS 0 /* NEC 765 Main Status Register (R) */ -#define FDDATA 1 /* NEC 765 Data Register (R/W) */ -#define FDCTL 2 /* FD Control Register */ -#define FDC_RST 0x80 /* FDC RESET */ -#define FDC_RDY 0x40 /* force READY */ -#define FDC_DD 0x20 /* FDD Mode Exchange 0:1M 1:640K */ -#define FDC_DMAE 0x10 /* enable floppy DMA */ -#define FDC_MTON 0x08 /* MOTOR ON (when EMTON=1)*/ -#define FDC_TMSK 0x04 /* TIMER MASK */ -#define FDC_TTRG 0x01 /* TIMER TRIGER */ - -#define FDP 3 -#define FDP_EMTON 0x04 /* enable MTON */ -#define FDP_FDDEXC 0x02 /* FDD Mode Exchange 1:1M 0:640K */ -#define FDP_PORTEXC 0x01 /* PORT Exchane 1:1M 0:640K */ - -#define FDEM 4 -#else /* registers */ #define FDOUT 2 /* Digital Output Register (W) */ #define FDO_FDSEL 0x03 /* floppy device select */ @@ -245,7 +198,6 @@ static struct fd_type *fd_native_types[] = { #define FDDSR 4 /* Data Rate Select Register (W) */ #define FDDATA 5 /* NEC 765 Data Register (R/W) */ #define FDCTL 7 /* Control Register (W) */ -#endif /* PC98 */ /* * The YE-DATA PC Card floppies use PIO to read in the data rather @@ -268,11 +220,9 @@ static struct fd_type *fd_native_types[] = { #define FDBCDR 0 /* And 1 */ #define FD_YE_DATAPORT 6 /* Drive Data port */ -#ifndef PC98 #define FDI_DCHG 0x80 /* diskette has been changed */ /* requires drive and motor being selected */ /* is cleared by any step pulse to drive */ -#endif /* * We have three private BIO commands. @@ -309,9 +259,6 @@ struct fd_data { struct g_provider *fd_provider; device_t dev; struct bio_queue_head fd_bq; -#ifdef PC98 - int pc98_trans; -#endif }; #define FD_NOT_VALID -2 @@ -335,19 +282,11 @@ static int retries = 10; SYSCTL_INT(_debug_fdc, OID_AUTO, retries, CTLFLAG_RW, &retries, 0, "Number of retries to attempt"); -#ifdef PC98 -static int spec1 = NE7_SPEC_1(4, 240); -#else static int spec1 = NE7_SPEC_1(6, 240); -#endif SYSCTL_INT(_debug_fdc, OID_AUTO, spec1, CTLFLAG_RW, &spec1, 0, "Specification byte one (step-rate + head unload)"); -#ifdef PC98 -static int spec2 = NE7_SPEC_2(2, 0); -#else static int spec2 = NE7_SPEC_2(16, 0); -#endif SYSCTL_INT(_debug_fdc, OID_AUTO, spec2, CTLFLAG_RW, &spec2, 0, "Specification byte two (head load time + no-dma)"); @@ -397,14 +336,12 @@ fdctl_wr(struct fdc_data *fdc, u_int8_t v) fdregwr(fdc, FDCTL, v); } -#ifndef PC98 static void fdout_wr(struct fdc_data *fdc, u_int8_t v) { fdregwr(fdc, FDOUT, v); } -#endif static u_int8_t fdsts_rd(struct fdc_data *fdc) @@ -413,14 +350,12 @@ fdsts_rd(struct fdc_data *fdc) return fdregrd(fdc, FDSTS); } -#ifndef PC98 static void fddsr_wr(struct fdc_data *fdc, u_int8_t v) { fdregwr(fdc, FDDSR, v); } -#endif static void fddata_wr(struct fdc_data *fdc, u_int8_t v) @@ -436,14 +371,12 @@ fddata_rd(struct fdc_data *fdc) return fdregrd(fdc, FDDATA); } -#ifndef PC98 static u_int8_t fdin_rd(struct fdc_data *fdc) { return fdregrd(fdc, FDCTL); } -#endif /* * Magic pseudo-DMA initialization for YE FDC. Sets count and @@ -570,90 +503,11 @@ fdc_cmd(struct fdc_data *fdc, int n_out, ...) return (0); } -#ifdef PC98 -static void fd_motor(struct fd_data *fd, int turnon); - -static int pc98_trans = 0; /* 0 : HD , 1 : DD , 2 : 1.44 */ -static int pc98_trans_prev = -1; - -static void -set_density(struct fdc_data *fdc) -{ - /* always motor on */ - fdregwr(fdc, FDP, (pc98_trans != 1 ? FDP_FDDEXC : 0) | FDP_PORTEXC); - DELAY(100); - fdctl_wr(fdc, FDC_RST | FDC_DMAE); - /* in the case of note W, always inhibit 100ms timer */ -} - -static int -pc98_fd_check_ready(struct fd_data *fd) -{ - struct fdc_data *fdc = fd->fdc; - int retry = 0, status; - int fdu = device_get_unit(fd->dev); - - while (retry++ < 30000) { - fd_motor(fd, 1); - fdc_out(fdc, NE7CMD_SENSED); /* Sense Drive Status */ - DELAY(100); - fdc_out(fdc, fdu); /* Drive number */ - DELAY(100); - if ((fdc_in(fdc, &status) == 0) && (status & NE7_ST3_RD)) { - fdctl_wr(fdc, FDC_DMAE | FDC_MTON); - DELAY(10); - return (0); - } - } - return (-1); -} - -static void -pc98_fd_check_type(struct fd_data *fd, int unit) -{ - struct fdc_data *fdc; - - if (fd->type != FDT_NONE || unit < 0 || unit > 3) - return; - - fdc = fd->fdc; - - /* Look up what the BIOS thinks we have. */ - if (!((PC98_SYSTEM_PARAMETER(0x55c) >> unit) & 0x01)) { - fd->type = FDT_NONE; - return; - } - if ((PC98_SYSTEM_PARAMETER(0x5ae) >> unit) & 0x01) { - /* Check 3mode I/F */ - fd->pc98_trans = 0; - fdregwr(fdc, FDEM, (unit << 5) | 0x10); - if (!(fdregrd(fdc, FDEM) & 0x01)) { - fd->type = FDT_144M; - return; - } - device_printf(fd->dev, - "Warning: can't control 3mode I/F, fallback to 2mode.\n"); - } - - fd->type = FDT_12M; -} -#endif /* PC98 */ - static void fdc_reset(struct fdc_data *fdc) { int i, r[10]; -#ifdef PC98 - set_density(fdc); - if (pc98_machine_type & M_EPSON_PC98) - fdctl_wr(fdc, FDC_RST | FDC_RDY | FDC_DD | FDC_MTON); - else - fdctl_wr(fdc, FDC_RST | FDC_RDY | FDC_DMAE | FDC_MTON); - DELAY(200); - fdctl_wr(fdc, FDC_DMAE | FDC_MTON); - DELAY(10); -#else if (fdc->fdct == FDC_ENHANCED) { /* Try a software reset, default precomp, and 500 kb/s */ fddsr_wr(fdc, I8207X_DSR_SR); @@ -666,7 +520,6 @@ fdc_reset(struct fdc_data *fdc) } DELAY(100); fdout_wr(fdc, fdc->fdout); -#endif /* XXX after a reset, silently believe the FDC will accept commands */ if (fdc_cmd(fdc, 3, NE7CMD_SPECIFY, spec1, spec2, 0)) @@ -760,7 +613,6 @@ fdc_read_status(struct fdc_data *fdc) return ret; } -#ifndef PC98 /* * Select this drive */ @@ -798,7 +650,6 @@ fd_turnon(void *arg) if (once) wakeup(&fd->fdc->head); } -#endif static void fd_motor(struct fd_data *fd, int turnon) @@ -809,11 +660,6 @@ fd_motor(struct fd_data *fd, int turnon) /* mtx_assert(&fdc->fdc_mtx, MA_OWNED); */ -#ifdef PC98 - fdregwr(fdc, FDP, (pc98_trans != 1 ? FDP_FDDEXC : 0) | FDP_PORTEXC); - DELAY(10); - fdctl_wr(fdc, FDC_DMAE | FDC_MTON); -#else if (turnon) { fd->flags |= FD_MOTORWAIT; fdc->fdout |= (FDO_MOEN0 << fd->fdsu); @@ -824,7 +670,6 @@ fd_motor(struct fd_data *fd, int turnon) fdc->fdout &= ~(FDO_MOEN0 << fd->fdsu); } fdout_wr(fdc, fdc->fdout); -#endif } static void @@ -995,41 +840,15 @@ fdc_worker(struct fdc_data *fdc) } /* Select drive, setup params */ -#ifdef PC98 - pc98_trans = fd->ft->trans; - if (pc98_trans_prev != pc98_trans) { - int i; - - set_density(fdc); - for (i = 0; i < 10; i++) { - outb(0x5f, 0); - outb(0x5f, 0); - } - pc98_trans_prev = pc98_trans; - } - if (pc98_trans != fd->pc98_trans) { - if (fd->type == FDT_144M) { - fdregwr(fdc, FDEM, - (device_get_unit(fd->dev) << 5) | 0x10 | - (pc98_trans >> 1)); - outb(0x5f, 0); - outb(0x5f, 0); - } - fd->pc98_trans = pc98_trans; - } -#else fd_select(fd); if (fdc->fdct == FDC_ENHANCED) fddsr_wr(fdc, fd->ft->trans); else fdctl_wr(fdc, fd->ft->trans); -#endif if (bp->bio_cmd == BIO_PROBE) { if ((!(device_get_flags(fd->dev) & FD_NO_CHLINE) && -#ifndef PC98 !(fdin_rd(fdc) & FDI_DCHG) && -#endif !(fd->flags & FD_EMPTY)) || fd_probe_disk(fd, &need_recal) == 0) return (fdc_biodone(fdc, 0)); @@ -1042,7 +861,6 @@ fdc_worker(struct fdc_data *fdc) if (fd->flags & FD_EMPTY) return (fdc_biodone(fdc, ENXIO)); -#ifndef PC98 /* Check if we lost our media */ if (fdin_rd(fdc) & FDI_DCHG) { if (debugflags & 0x40) @@ -1060,7 +878,6 @@ fdc_worker(struct fdc_data *fdc) g_topology_unlock(); return (fdc_biodone(fdc, ENXIO)); } -#endif /* Check if the floppy is write-protected */ if (bp->bio_cmd == BIO_FMT || bp->bio_cmd == BIO_WRITE) { @@ -1095,9 +912,6 @@ fdc_worker(struct fdc_data *fdc) if ((need_recal & (1 << fd->fdsu)) || (cylinder == 0 && fd->track != 0) || fdc->retry > 2) { -#ifdef PC98 - pc98_fd_check_ready(fd); -#endif retry_line = __LINE__; if (fdc_cmd(fdc, 2, NE7CMD_RECAL, fd->fdsu, 0)) return (1); @@ -1119,9 +933,6 @@ fdc_worker(struct fdc_data *fdc) * SEEK to where we want to be */ if (cylinder != fd->track) { -#ifdef PC98 - pc98_fd_check_ready(fd); -#endif retry_line = __LINE__; if (fdc_cmd(fdc, 3, NE7CMD_SEEK, fd->fdsu, descyl, 0)) return (1); @@ -1429,7 +1240,6 @@ fd_probe_disk(struct fd_data *fd, int *recal) if (fdc_sense_int(fdc, &st0, &cyl) == FD_NOT_VALID) goto done; /* XXX */ *recal |= (1 << fd->fdsu); -#ifndef PC98 if (fdin_rd(fdc) & FDI_DCHG) { if (debugflags & 0x40) printf("Empty in probe\n"); @@ -1437,9 +1247,6 @@ fd_probe_disk(struct fd_data *fd, int *recal) fd->flags |= FD_EMPTY; mtx_unlock(&fdc->fdc_mtx); } else { -#else - { -#endif if (fdc_sense_drive(fdc, &st3) != 0) goto done; if (debugflags & 0x40) @@ -1576,11 +1383,7 @@ fdautoselect(struct fd_data *fd) if (debugflags & 0x40) { device_printf(fd->dev, "autoselected %d KB medium\n", -#ifdef PC98 - (128 << (fd->ft->secsize)) * fd->ft->size / 1024); -#else fd->ft->size / 2); -#endif fdprinttype(fd->ft); } return (0); @@ -1633,10 +1436,6 @@ fd_access(struct g_provider *pp, int r, int w, int e) busy = 0; if (pp->acr == 0 && pp->acw == 0 && pp->ace == 0) { -#ifdef PC98 - if (pc98_fd_check_ready(fd) == -1) - return (ENXIO); -#endif if (fdmisccmd(fd, BIO_PROBE, NULL)) return (ENXIO); if (fd->flags & FD_EMPTY) @@ -1706,10 +1505,6 @@ fd_ioctl(struct g_provider *pp, u_long cmd, void *data, int fflag, struct thread fd = pp->geom->softc; -#ifdef PC98 - pc98_fd_check_ready(fd); -#endif - switch (cmd) { case FD_GTYPE: /* get drive type */ *(struct fd_type *)data = *fd->ft; @@ -1877,12 +1672,6 @@ fdc_initial_reset(device_t dev, struct fdc_data *fdc) { int ic_type, part_id; -#ifdef PC98 - /* See if it can handle a command. */ - if (fdc_cmd(fdc, 3, NE7CMD_SPECIFY, NE7_SPEC_1(4, 240), - NE7_SPEC_2(2, 0), 0)) - return (ENXIO); -#else /* * A status value of 0xff is very unlikely, but not theoretically * impossible, but it is far more likely to indicate an empty bus. @@ -1911,7 +1700,6 @@ fdc_initial_reset(device_t dev, struct fdc_data *fdc) if (fdc_cmd(fdc, 3, NE7CMD_SPECIFY, NE7_SPEC_1(6, 240), NE7_SPEC_2(31, 0), 0)) return (ENXIO); -#endif /* * Try to identify the chip. @@ -1973,11 +1761,7 @@ fdc_detach(device_t dev) mtx_unlock(&fdc->fdc_mtx); /* reset controller, turn motor off */ -#ifdef PC98 - fdc_reset(fdc); -#else fdout_wr(fdc, 0); -#endif if (!(fdc->flags & FDC_NODMA)) isa_dma_release(fdc->dmachan); @@ -2051,11 +1835,7 @@ fdc_attach(device_t dev) mtx_init(&fdc->fdc_mtx, "fdc lock", NULL, MTX_DEF); /* reset controller, turn motor off, clear fdout mirror reg */ -#ifdef PC98 - fdc_reset(fdc); -#else fdout_wr(fdc, fdc->fdout = 0); -#endif bioq_init(&fdc->head); settle = hz / 8; @@ -2117,10 +1897,8 @@ static int fd_probe(device_t dev) { int unit; -#ifndef PC98 int i; u_int st0, st3; -#endif struct fd_data *fd; struct fdc_data *fdc; int fdsu; @@ -2147,9 +1925,7 @@ fd_probe(device_t dev) fd->type = type; } -#ifdef PC98 - pc98_fd_check_type(fd, unit); -#elif defined(__i386__) || defined(__amd64__) +#if defined(__i386__) || defined(__amd64__) if (fd->type == FDT_NONE && (unit == 0 || unit == 1)) { /* Look up what the BIOS thinks we have. */ if (unit == 0) @@ -2164,7 +1940,6 @@ fd_probe(device_t dev) if (fd->type == FDT_NONE) return (ENXIO); -#ifndef PC98 mtx_lock(&fdc->fdc_mtx); /* select it */ @@ -2214,19 +1989,10 @@ fd_probe(device_t dev) if ((flags & FD_NO_PROBE) == 0 && (st0 & NE7_ST0_EC) != 0) /* no track 0 -> no drive present */ return (ENXIO); -#endif /* PC98 */ done: switch (fd->type) { -#ifdef PC98 - case FDT_144M: - device_set_desc(dev, "1.44M FDD"); - break; - case FDT_12M: - device_set_desc(dev, "1M/640K FDD"); - break; -#else case FDT_12M: device_set_desc(dev, "1200-KB 5.25\" drive"); break; @@ -2242,7 +2008,6 @@ fd_probe(device_t dev) case FDT_720K: device_set_desc(dev, "720-KB 3.5\" drive"); break; -#endif default: return (ENXIO); } @@ -2250,9 +2015,6 @@ fd_probe(device_t dev) fd->fdc = fdc; fd->fdsu = fdsu; fd->options = 0; -#ifdef PC98 - fd->pc98_trans = 0; -#endif callout_init_mtx(&fd->toffhandle, &fd->fdc->fdc_mtx, 0); /* initialize densities for subdevices */ diff --git a/sys/dev/fdc/fdc_cbus.c b/sys/dev/fdc/fdc_cbus.c deleted file mode 100644 index b03b370375d8..000000000000 --- a/sys/dev/fdc/fdc_cbus.c +++ /dev/null @@ -1,184 +0,0 @@ -/*- - * Copyright (c) 2004 TAKAHASHI Yoshihiro - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification, immediately at the beginning of the file. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -#include - -static bus_addr_t fdc_iat[] = {0, 2, 4}; - -static int -fdc_cbus_alloc_resources(device_t dev, struct fdc_data *fdc) -{ - struct resource *res; - int i, rid; - - fdc->fdc_dev = dev; - rid = 0; - res = isa_alloc_resourcev(dev, SYS_RES_IOPORT, &rid, fdc_iat, 3, - RF_ACTIVE); - if (res == NULL) { - device_printf(dev, "cannot reserve I/O port range\n"); - return (ENXIO); - } - isa_load_resourcev(res, fdc_iat, 3); - for (i = 0; i < 3; i++) { - fdc->resio[i] = res; - fdc->ridio[i] = rid; - fdc->ioff[i] = i; - fdc->ioh[i] = rman_get_bushandle(res); - } - fdc->iot = rman_get_bustag(res); - - rid = 3; - bus_set_resource(dev, SYS_RES_IOPORT, rid, IO_FDPORT, 1); - res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, RF_ACTIVE); - if (res == NULL) { - device_printf(dev, "cannot reserve I/O port range\n"); - return (ENXIO); - } - fdc->resio[3] = res; - fdc->ridio[3] = rid; - fdc->ioff[3] = 0; - fdc->ioh[3] = rman_get_bushandle(res); - /* XXX: Reuses fdc->iot */ - - rid = 4; - bus_set_resource(dev, SYS_RES_IOPORT, rid, 0x4be, 1); - res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, RF_ACTIVE); - if (res == NULL) { - device_printf(dev, "cannot reserve I/O port range\n"); - return (ENXIO); - } - fdc->resio[4] = res; - fdc->ridio[4] = rid; - fdc->ioff[4] = 0; - fdc->ioh[4] = rman_get_bushandle(res); - /* XXX: Reuses fdc->iot */ - - fdc->res_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &fdc->rid_irq, - RF_ACTIVE); - if (fdc->res_irq == NULL) { - device_printf(dev, "cannot reserve interrupt line\n"); - return (ENXIO); - } - - if ((fdc->flags & FDC_NODMA) == 0) { - fdc->res_drq = bus_alloc_resource_any(dev, SYS_RES_DRQ, - &fdc->rid_drq, RF_ACTIVE); - if (fdc->res_drq == NULL) { - device_printf(dev, "cannot reserve DMA request line\n"); - return (ENXIO); - } - fdc->dmachan = rman_get_start(fdc->res_drq); - } - - return (0); -} - -static int -fdc_cbus_probe(device_t dev) -{ - int error; - struct fdc_data *fdc; - - fdc = device_get_softc(dev); - - /* Check pnp ids */ - if (isa_get_vendorid(dev)) - return (ENXIO); - - /* Attempt to allocate our resources for the duration of the probe */ - error = fdc_cbus_alloc_resources(dev, fdc); - if (error == 0) - error = fdc_initial_reset(dev, fdc); - - fdc_release_resources(fdc); - return (error); -} - -static int -fdc_cbus_attach(device_t dev) -{ - struct fdc_data *fdc; - int error; - - fdc = device_get_softc(dev); - error = fdc_cbus_alloc_resources(dev, fdc); - if (error == 0) - error = fdc_attach(dev); - if (error == 0) - error = fdc_hints_probe(dev); - if (error == 0) - fdc_start_worker(dev); - else - fdc_release_resources(fdc); - return (error); -} - -static device_method_t fdc_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, fdc_cbus_probe), - DEVMETHOD(device_attach, fdc_cbus_attach), - DEVMETHOD(device_detach, fdc_detach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - DEVMETHOD(device_suspend, bus_generic_suspend), - DEVMETHOD(device_resume, bus_generic_resume), - - /* Bus interface */ - DEVMETHOD(bus_print_child, fdc_print_child), - DEVMETHOD(bus_read_ivar, fdc_read_ivar), - DEVMETHOD(bus_write_ivar, fdc_write_ivar), - /* Our children never use any other bus interface methods. */ - - { 0, 0 } -}; - -static driver_t fdc_driver = { - "fdc", - fdc_methods, - sizeof(struct fdc_data) -}; - -DRIVER_MODULE(fdc, isa, fdc_driver, fdc_devclass, 0, 0); diff --git a/sys/dev/fdc/fdcvar.h b/sys/dev/fdc/fdcvar.h index edaef7959de2..082990115135 100644 --- a/sys/dev/fdc/fdcvar.h +++ b/sys/dev/fdc/fdcvar.h @@ -49,9 +49,7 @@ struct fdc_data { #define FDC_KTHREAD_ALIVE 0x2000 /* worker thread is alive */ struct fd_data *fd; /* The active drive */ int retry; -#ifndef PC98 int fdout; /* mirror of the w/o digital output reg */ -#endif u_int status[7]; /* copy of the registers */ enum fdc_type fdct; /* chip version of FDC */ int fdc_errs; /* number of logged errors */ diff --git a/sys/dev/fe/if_fe.c b/sys/dev/fe/if_fe.c index 28841b783777..e4a46011a9a3 100644 --- a/sys/dev/fe/if_fe.c +++ b/sys/dev/fe/if_fe.c @@ -37,14 +37,6 @@ __FBSDID("$FreeBSD$"); * other types of Ethernet cards, but the author is not sure whether * they are useful. * - * This version also includes some alignments to support RE1000, - * C-NET(98)P2 and so on. These cards are not for AT-compatibles, - * but for NEC PC-98 bus -- a proprietary bus architecture available - * only in Japan. Confusingly, it is different from the Microsoft's - * PC98 architecture. :-{ - * Further work for PC-98 version will be available as a part of - * FreeBSD(98) project. - * * This software is a derivative work of if_ed.c version 1.56 by David * Greenman available as a part of FreeBSD 2.0 RELEASE source distribution. * @@ -61,7 +53,6 @@ __FBSDID("$FreeBSD$"); /* * TODO: * o To support ISA PnP auto configuration for FMV-183/184. - * o To support REX-9886/87(PC-98 only). * o To reconsider mbuf usage. * o To reconsider transmission buffer usage, including * transmission buffer size (currently 4KB x 2) and pros-and- diff --git a/sys/dev/fe/if_fe_cbus.c b/sys/dev/fe/if_fe_cbus.c deleted file mode 100644 index c083cdda87a1..000000000000 --- a/sys/dev/fe/if_fe_cbus.c +++ /dev/null @@ -1,1020 +0,0 @@ -/*- - * All Rights Reserved, Copyright (C) Fujitsu Limited 1995 - * - * This software may be used, modified, copied, distributed, and sold, in - * both source and binary form provided that the above copyright, these - * terms and the following disclaimer are retained. The name of the author - * and/or the contributor may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND THE CONTRIBUTOR ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR THE CONTRIBUTOR BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION. - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include - -/* - * Cbus specific code. - */ -static int fe_isa_probe(device_t); -static int fe_isa_attach(device_t); - -static struct isa_pnp_id fe_ids[] = { - { 0x101ee0d, NULL }, /* CON0101 - Contec C-NET(98)P2-T */ - { 0, NULL } -}; - -static device_method_t fe_isa_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, fe_isa_probe), - DEVMETHOD(device_attach, fe_isa_attach), - - { 0, 0 } -}; - -static driver_t fe_isa_driver = { - "fe", - fe_isa_methods, - sizeof (struct fe_softc) -}; - -DRIVER_MODULE(fe, isa, fe_isa_driver, fe_devclass, 0, 0); - - -static int fe98_alloc_port(device_t, int); - -static int fe_probe_re1000(device_t); -static int fe_probe_cnet9ne(device_t); -static int fe_probe_rex(device_t); -static int fe_probe_ssi(device_t); -static int fe_probe_jli(device_t); -static int fe_probe_lnx(device_t); -static int fe_probe_gwy(device_t); -static int fe_probe_ubn(device_t); - -/* - * Determine if the device is present at a specified I/O address. The - * main entry to the driver. - */ -static int -fe_isa_probe(device_t dev) -{ - struct fe_softc *sc; - int error; - - /* Prepare for the softc struct. */ - sc = device_get_softc(dev); - sc->sc_unit = device_get_unit(dev); - - /* Check isapnp ids */ - error = ISA_PNP_PROBE(device_get_parent(dev), dev, fe_ids); - - /* If the card had a PnP ID that didn't match any we know about */ - if (error == ENXIO) - goto end; - - /* If we had some other problem. */ - if (!(error == 0 || error == ENOENT)) - goto end; - - /* Probe for supported boards. */ - if ((error = fe_probe_re1000(dev)) == 0) - goto end; - fe_release_resource(dev); - - if ((error = fe_probe_cnet9ne(dev)) == 0) - goto end; - fe_release_resource(dev); - - if ((error = fe_probe_rex(dev)) == 0) - goto end; - fe_release_resource(dev); - - if ((error = fe_probe_ssi(dev)) == 0) - goto end; - fe_release_resource(dev); - - if ((error = fe_probe_jli(dev)) == 0) - goto end; - fe_release_resource(dev); - - if ((error = fe_probe_lnx(dev)) == 0) - goto end; - fe_release_resource(dev); - - if ((error = fe_probe_ubn(dev)) == 0) - goto end; - fe_release_resource(dev); - - if ((error = fe_probe_gwy(dev)) == 0) - goto end; - fe_release_resource(dev); - -end: - if (error == 0) - error = fe_alloc_irq(dev, 0); - - fe_release_resource(dev); - return (error); -} - -static int -fe_isa_attach(device_t dev) -{ - struct fe_softc *sc = device_get_softc(dev); - int error = 0; - - /* - * Note: these routines aren't expected to fail since we also call - * them in the probe routine. But coverity complains, so we'll honor - * that complaint since the intention here was never to ignore them.. - */ - if (sc->port_used) { - error = fe98_alloc_port(dev, sc->type); - if (error != 0) - return (error); - } - error = fe_alloc_irq(dev, 0); - if (error != 0) - return (error); - - return fe_attach(dev); -} - - -/* Generic I/O address table */ -static bus_addr_t ioaddr_generic[MAXREGISTERS] = { - 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, - 0x008, 0x009, 0x00a, 0x00b, 0x00c, 0x00d, 0x00e, 0x00f, - 0x010, 0x011, 0x012, 0x013, 0x014, 0x015, 0x016, 0x017, - 0x018, 0x019, 0x01a, 0x01b, 0x01c, 0x01d, 0x01e, 0x01f, -}; - -/* I/O address table for RE1000/1000Plus */ -static bus_addr_t ioaddr_re1000[MAXREGISTERS] = { - 0x0000, 0x0001, 0x0200, 0x0201, 0x0400, 0x0401, 0x0600, 0x0601, - 0x0800, 0x0801, 0x0a00, 0x0a01, 0x0c00, 0x0c01, 0x0e00, 0x0e01, - 0x1000, 0x1200, 0x1400, 0x1600, 0x1800, 0x1a00, 0x1c00, 0x1e00, - 0x1001, 0x1201, 0x1401, 0x1601, 0x1801, 0x1a01, 0x1c01, 0x1e01, -}; - -/* I/O address table for CNET9NE */ -static bus_addr_t ioaddr_cnet9ne[MAXREGISTERS] = { - 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, - 0x008, 0x009, 0x00a, 0x00b, 0x00c, 0x00d, 0x00e, 0x00f, - 0x400, 0x402, 0x404, 0x406, 0x408, 0x40a, 0x40c, 0x40e, - 0x401, 0x403, 0x405, 0x407, 0x409, 0x40b, 0x40d, 0x40f, -}; - -/* I/O address table for LAC-98 */ -static bus_addr_t ioaddr_lnx[MAXREGISTERS] = { - 0x000, 0x002, 0x004, 0x006, 0x008, 0x00a, 0x00c, 0x00e, - 0x100, 0x102, 0x104, 0x106, 0x108, 0x10a, 0x10c, 0x10e, - 0x200, 0x202, 0x204, 0x206, 0x208, 0x20a, 0x20c, 0x20e, - 0x300, 0x302, 0x304, 0x306, 0x308, 0x30a, 0x30c, 0x30e, -}; - -/* I/O address table for Access/PC N98C+ */ -static bus_addr_t ioaddr_ubn[MAXREGISTERS] = { - 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, - 0x008, 0x009, 0x00a, 0x00b, 0x00c, 0x00d, 0x00e, 0x00f, - 0x200, 0x201, 0x202, 0x203, 0x204, 0x205, 0x206, 0x207, - 0x208, 0x209, 0x20a, 0x20b, 0x20c, 0x20d, 0x20e, 0x20f, -}; - -/* I/O address table for REX-9880 */ -static bus_addr_t ioaddr_rex[MAXREGISTERS] = { - 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, - 0x008, 0x009, 0x00a, 0x00b, 0x00c, 0x00d, 0x00e, 0x00f, - 0x100, 0x101, 0x102, 0x103, 0x104, 0x105, 0x106, 0x107, - 0x108, 0x109, 0x10a, 0x10b, 0x10c, 0x10d, 0x10e, 0x10f, -}; - -static int -fe98_alloc_port(device_t dev, int type) -{ - struct fe_softc *sc = device_get_softc(dev); - struct resource *res; - bus_addr_t *iat; - int size, rid; - - switch (type) { - case FE_TYPE_RE1000: - iat = ioaddr_re1000; - size = MAXREGISTERS; - break; - case FE_TYPE_CNET9NE: - iat = ioaddr_cnet9ne; - size = MAXREGISTERS; - break; - case FE_TYPE_SSI: - iat = ioaddr_generic; - size = MAXREGISTERS; - break; - case FE_TYPE_LNX: - iat = ioaddr_lnx; - size = MAXREGISTERS; - break; - case FE_TYPE_GWY: - iat = ioaddr_generic; - size = MAXREGISTERS; - break; - case FE_TYPE_UBN: - iat = ioaddr_ubn; - size = MAXREGISTERS; - break; - case FE_TYPE_REX: - iat = ioaddr_rex; - size = MAXREGISTERS; - break; - default: - iat = ioaddr_generic; - size = MAXREGISTERS; - break; - } - - rid = 0; - res = isa_alloc_resourcev(dev, SYS_RES_IOPORT, &rid, - iat, size, RF_ACTIVE); - if (res == NULL) - return ENOENT; - - isa_load_resourcev(res, iat, size); - - sc->type = type; - sc->port_used = size; - sc->port_res = res; - return (0); -} - - -/* - * Probe and initialization for Allied-Telesis RE1000 series. - */ -static void -fe_init_re1000(struct fe_softc *sc) -{ - /* Setup IRQ control register on the ASIC. */ - fe_outb(sc, FE_RE1000_IRQCONF, sc->priv_info); -} - -static int -fe_probe_re1000(device_t dev) -{ - struct fe_softc *sc = device_get_softc(dev); - int i, n; - rman_res_t iobase, irq; - u_char sum; - - static struct fe_simple_probe_struct probe_table [] = { - { FE_DLCR2, 0x58, 0x00 }, - { FE_DLCR4, 0x08, 0x00 }, - { 0 } - }; - - /* See if the specified I/O address is possible for RE1000. */ - /* [01]D[02468ACE] are allowed. */ - if (bus_get_resource(dev, SYS_RES_IOPORT, 0, &iobase, NULL) != 0) - return ENXIO; - if ((iobase & ~0x10E) != 0xD0) - return ENXIO; - - if (fe98_alloc_port(dev, FE_TYPE_RE1000)) - return ENXIO; - - /* Fill the softc struct with default values. */ - fe_softc_defaults(sc); - - /* See if the card is on its address. */ - if (!fe_simple_probe(sc, probe_table)) - return ENXIO; - - /* Get our station address from EEPROM. */ - fe_inblk(sc, 0x18, sc->enaddr, ETHER_ADDR_LEN); - - /* Make sure it is Allied-Telesis's. */ - if (!fe_valid_Ether_p(sc->enaddr, 0x0000F4)) - return ENXIO; -#if 1 - /* Calculate checksum. */ - sum = fe_inb(sc, 0x1e); - for (i = 0; i < ETHER_ADDR_LEN; i++) - sum ^= sc->enaddr[i]; - if (sum != 0) - return ENXIO; -#endif - /* Setup the board type. */ - sc->typestr = "RE1000"; - - /* This looks like an RE1000 board. It requires an - explicit IRQ setting in config. Make sure we have one, - determining an appropriate value for the IRQ control - register. */ - irq = 0; - bus_get_resource(dev, SYS_RES_IRQ, 0, &irq, NULL); - switch (irq) { - case 3: n = 0x10; break; - case 5: n = 0x20; break; - case 6: n = 0x40; break; - case 12: n = 0x80; break; - default: - fe_irq_failure(sc->typestr, sc->sc_unit, irq, "3/5/6/12"); - return ENXIO; - } - sc->priv_info = (fe_inb(sc, FE_RE1000_IRQCONF) & 0x0f) | n; - - /* Setup hooks. We need a special initialization procedure. */ - sc->init = fe_init_re1000; - - return 0; -} - -/* JLI sub-probe for Allied-Telesis RE1000Plus/ME1500 series. */ -static u_short const * -fe_probe_jli_re1000p(struct fe_softc * sc, u_char const * eeprom) -{ - int i; - static u_short const irqmaps_re1000p [4] = { 3, 5, 6, 12 }; - - /* Make sure the EEPROM contains Allied-Telesis bit pattern. */ - if (eeprom[1] != 0xFF) return NULL; - for (i = 2; i < 8; i++) if (eeprom[i] != 0xFF) return NULL; - for (i = 14; i < 24; i++) if (eeprom[i] != 0xFF) return NULL; - - /* Get our station address from EEPROM, and make sure the - EEPROM contains Allied-Telesis's address. */ - bcopy(eeprom + 8, sc->enaddr, ETHER_ADDR_LEN); - if (!fe_valid_Ether_p(sc->enaddr, 0x0000F4)) - return NULL; - - /* I don't know any sub-model identification. */ - sc->typestr = "RE1000Plus/ME1500"; - - /* Returns the IRQ table for the RE1000Plus. */ - return irqmaps_re1000p; -} - - -/* - * Probe for Allied-Telesis RE1000Plus/ME1500 series. - */ -static int -fe_probe_jli(device_t dev) -{ - struct fe_softc *sc = device_get_softc(dev); - int i, n, xirq, error; - rman_res_t iobase, irq; - u_char eeprom [JLI_EEPROM_SIZE]; - u_short const * irqmap; - - static u_short const baseaddr [8] = - { 0x1D6, 0x1D8, 0x1DA, 0x1D4, 0x0D4, 0x0D2, 0x0D8, 0x0D0 }; - static struct fe_simple_probe_struct const probe_table [] = { - /* { FE_DLCR1, 0x20, 0x00 }, Doesn't work. */ - { FE_DLCR2, 0x50, 0x00 }, - { FE_DLCR4, 0x08, 0x00 }, - /* { FE_DLCR5, 0x80, 0x00 }, Doesn't work. */ -#if 0 - { FE_BMPR16, 0x1B, 0x00 }, - { FE_BMPR17, 0x7F, 0x00 }, -#endif - { 0 } - }; - - /* - * See if the specified address is possible for MB86965A JLI mode. - */ - if (bus_get_resource(dev, SYS_RES_IOPORT, 0, &iobase, NULL) != 0) - return ENXIO; - for (i = 0; i < 8; i++) { - if (baseaddr[i] == iobase) - break; - } - if (i == 8) - return ENXIO; - - if (fe98_alloc_port(dev, FE_TYPE_RE1000)) - return ENXIO; - - /* Fill the softc struct with default values. */ - fe_softc_defaults(sc); - - /* - * We should test if MB86965A is on the base address now. - * Unfortunately, it is very hard to probe it reliably, since - * we have no way to reset the chip under software control. - * On cold boot, we could check the "signature" bit patterns - * described in the Fujitsu document. On warm boot, however, - * we can predict almost nothing about register values. - */ - if (!fe_simple_probe(sc, probe_table)) - return ENXIO; - - /* Check if our I/O address matches config info on 86965. */ - n = (fe_inb(sc, FE_BMPR19) & FE_B19_ADDR) >> FE_B19_ADDR_SHIFT; - if (baseaddr[n] != iobase) - return ENXIO; - - /* - * We are now almost sure we have an MB86965 at the given - * address. So, read EEPROM through it. We have to write - * into LSI registers to read from EEPROM. I want to avoid it - * at this stage, but I cannot test the presence of the chip - * any further without reading EEPROM. FIXME. - */ - fe_read_eeprom_jli(sc, eeprom); - - /* Make sure that config info in EEPROM and 86965 agree. */ - if (eeprom[FE_EEPROM_CONF] != fe_inb(sc, FE_BMPR19)) - return ENXIO; - - /* Use 86965 media selection scheme, unless othewise - specified. It is "AUTO always" and "select with BMPR13". - This behaviour covers most of the 86965 based board (as - minimum requirements.) It is backward compatible with - previous versions, also. */ - sc->mbitmap = MB_HA; - sc->defmedia = MB_HA; - sc->msel = fe_msel_965; - - /* Perform board-specific probe. */ - if ((irqmap = fe_probe_jli_re1000p(sc, eeprom)) == NULL) - return ENXIO; - - /* Find the IRQ read from EEPROM. */ - n = (fe_inb(sc, FE_BMPR19) & FE_B19_IRQ) >> FE_B19_IRQ_SHIFT; - xirq = irqmap[n]; - - /* Try to determine IRQ setting. */ - error = bus_get_resource(dev, SYS_RES_IRQ, 0, &irq, NULL); - if (error && xirq == NO_IRQ) { - /* The device must be configured with an explicit IRQ. */ - device_printf(dev, "IRQ auto-detection does not work\n"); - return ENXIO; - } else if (error && xirq != NO_IRQ) { - /* Just use the probed IRQ value. */ - bus_set_resource(dev, SYS_RES_IRQ, 0, xirq, 1); - } else if (!error && xirq == NO_IRQ) { - /* No problem. Go ahead. */ - } else if (irq == xirq) { - /* Good. Go ahead. */ - } else { - /* User must be warned in this case. */ - sc->stability |= UNSTABLE_IRQ; - } - - /* Setup a hook, which resets te 86965 when the driver is being - initialized. This may solve a nasty bug. FIXME. */ - sc->init = fe_init_jli; - - return 0; -} - - -/* - * Probe and initialization for Contec C-NET(9N)E series. - */ - -/* TODO: Should be in "if_fereg.h" */ -#define FE_CNET9NE_INTR 0x10 /* Interrupt Mask? */ - -static void -fe_init_cnet9ne(struct fe_softc *sc) -{ - /* Enable interrupt? FIXME. */ - fe_outb(sc, FE_CNET9NE_INTR, 0x10); -} - -static int -fe_probe_cnet9ne (device_t dev) -{ - struct fe_softc *sc = device_get_softc(dev); - rman_res_t iobase, irq; - - static struct fe_simple_probe_struct probe_table [] = { - { FE_DLCR2, 0x58, 0x00 }, - { FE_DLCR4, 0x08, 0x00 }, - { 0 } - }; - - /* See if the specified I/O address is possible for C-NET(9N)E. */ - if (bus_get_resource(dev, SYS_RES_IOPORT, 0, &iobase, NULL) != 0) - return ENXIO; - if (iobase != 0x73D0) - return ENXIO; - - if (fe98_alloc_port(dev, FE_TYPE_CNET9NE)) - return ENXIO; - - /* Fill the softc struct with default values. */ - fe_softc_defaults(sc); - - /* See if the card is on its address. */ - if (!fe_simple_probe(sc, probe_table)) - return ENXIO; - - /* Get our station address from EEPROM. */ - fe_inblk(sc, 0x18, sc->enaddr, ETHER_ADDR_LEN); - - /* Make sure it is Contec's. */ - if (!fe_valid_Ether_p(sc->enaddr, 0x00804C)) - return ENXIO; - - /* Determine the card type. */ - if (sc->enaddr[3] == 0x06) { - sc->typestr = "C-NET(9N)C"; - - /* We seems to need our own IDENT bits... FIXME. */ - sc->proto_dlcr7 = FE_D7_BYTSWP_LH | FE_D7_IDENT_NICE; - - /* C-NET(9N)C requires an explicit IRQ to work. */ - if (bus_get_resource(dev, SYS_RES_IRQ, 0, &irq, NULL) != 0) { - fe_irq_failure(sc->typestr, sc->sc_unit, NO_IRQ, NULL); - return ENXIO; - } - } else { - sc->typestr = "C-NET(9N)E"; - - /* C-NET(9N)E works only IRQ5. */ - if (bus_get_resource(dev, SYS_RES_IRQ, 0, &irq, NULL) != 0) - return ENXIO; - if (irq != 5) { - fe_irq_failure(sc->typestr, sc->sc_unit, irq, "5"); - return ENXIO; - } - - /* We need an init hook to initialize ASIC before we start. */ - sc->init = fe_init_cnet9ne; - } - - /* C-NET(9N)E has 64KB SRAM. */ - sc->proto_dlcr6 = FE_D6_BUFSIZ_64KB | FE_D6_TXBSIZ_2x4KB - | FE_D6_BBW_WORD | FE_D6_SBW_WORD | FE_D6_SRAM; - - return 0; -} - - -/* - * Probe for Contec C-NET(98)P2 series. - * (Logitec LAN-98TP/LAN-98T25P - parhaps) - */ -static int -fe_probe_ssi(device_t dev) -{ - struct fe_softc *sc = device_get_softc(dev); - rman_res_t iobase, irq; - - u_char eeprom [SSI_EEPROM_SIZE]; - static struct fe_simple_probe_struct probe_table [] = { - { FE_DLCR2, 0x08, 0x00 }, - { FE_DLCR4, 0x08, 0x00 }, - { 0 } - }; - static u_short const irqmap[] = { - /* INT0 INT1 INT2 */ - NO_IRQ, NO_IRQ, NO_IRQ, 3, NO_IRQ, 5, 6, NO_IRQ, - NO_IRQ, 9, 10, NO_IRQ, 12, 13, NO_IRQ, NO_IRQ, - /* INT3 INT41 INT5 INT6 */ - }; - - /* See if the specified I/O address is possible for 78Q8377A. */ - /* [0-D]3D0 are allowed. */ - if (bus_get_resource(dev, SYS_RES_IOPORT, 0, &iobase, NULL) != 0) - return ENXIO; - if ((iobase & 0xFFF) != 0x3D0) - return ENXIO; - - if (fe98_alloc_port(dev, FE_TYPE_SSI)) - return ENXIO; - - /* Fill the softc struct with default values. */ - fe_softc_defaults(sc); - - /* See if the card is on its address. */ - if (!fe_simple_probe(sc, probe_table)) - return ENXIO; - - /* We now have to read the config EEPROM. We should be very - careful, since doing so destroys a register. (Remember, we - are not yet sure we have a C-NET(98)P2 board here.) Don't - remember to select BMPRs bofore reading EEPROM, since other - register bank may be selected before the probe() is called. */ - fe_read_eeprom_ssi(sc, eeprom); - - /* Make sure the Ethernet (MAC) station address is of Contec's. */ - if (!fe_valid_Ether_p(eeprom + FE_SSI_EEP_ADDR, 0x00804C)) - return ENXIO; - bcopy(eeprom + FE_SSI_EEP_ADDR, sc->enaddr, ETHER_ADDR_LEN); - - /* Setup the board type. */ - sc->typestr = "C-NET(98)P2"; - - /* Non-PnP mode, set static resource from eeprom. */ - if (!isa_get_vendorid(dev)) { - /* Get IRQ configuration from EEPROM. */ - irq = irqmap[eeprom[FE_SSI_EEP_IRQ]]; - if (irq == NO_IRQ) { - fe_irq_failure(sc->typestr, sc->sc_unit, irq, - "3/5/6/9/10/12/13"); - return ENXIO; - } - bus_set_resource(dev, SYS_RES_IRQ, 0, irq, 1); - } - - /* Get Duplex-mode configuration from EEPROM. */ - sc->proto_dlcr4 |= (eeprom[FE_SSI_EEP_DUPLEX] & FE_D4_DSC); - - /* Fill softc struct accordingly. */ - sc->mbitmap = MB_HT; - sc->defmedia = MB_HT; - - return 0; -} - - -/* - * Probe for TDK LAC-98012/013/025/9N011 - parhaps. - */ -static int -fe_probe_lnx(device_t dev) -{ - struct fe_softc *sc = device_get_softc(dev); - - rman_res_t iobase, irq; - u_char eeprom [LNX_EEPROM_SIZE]; - - static struct fe_simple_probe_struct probe_table [] = { - { FE_DLCR2, 0x58, 0x00 }, - { FE_DLCR4, 0x08, 0x00 }, - { 0 } - }; - - /* See if the specified I/O address is possible for TDK/LANX boards. */ - /* 0D0, 4D0, 8D0, and CD0 are allowed. */ - if (bus_get_resource(dev, SYS_RES_IOPORT, 0, &iobase, NULL) != 0) - return ENXIO; - if ((iobase & ~0xC00) != 0xD0) - return ENXIO; - - if (fe98_alloc_port(dev, FE_TYPE_LNX)) - return ENXIO; - - /* Fill the softc struct with default values. */ - fe_softc_defaults(sc); - - /* See if the card is on its address. */ - if (!fe_simple_probe(sc, probe_table)) - return ENXIO; - - /* We now have to read the config EEPROM. We should be very - careful, since doing so destroys a register. (Remember, we - are not yet sure we have a LAC-98012/98013 board here.) */ - fe_read_eeprom_lnx(sc, eeprom); - - /* Make sure the Ethernet (MAC) station address is of TDK/LANX's. */ - if (!fe_valid_Ether_p(eeprom, 0x008098)) - return ENXIO; - bcopy(eeprom, sc->enaddr, ETHER_ADDR_LEN); - - /* Setup the board type. */ - sc->typestr = "LAC-98012/98013"; - - /* This looks like a TDK/LANX board. It requires an - explicit IRQ setting in config. Make sure we have one, - determining an appropriate value for the IRQ control - register. */ - irq = 0; - if (bus_get_resource(dev, SYS_RES_IRQ, 0, &irq, NULL) != 0) - return ENXIO; - switch (irq) { - case 3 : sc->priv_info = 0x10 | LNX_CLK_LO | LNX_SDA_HI; break; - case 5 : sc->priv_info = 0x20 | LNX_CLK_LO | LNX_SDA_HI; break; - case 6 : sc->priv_info = 0x40 | LNX_CLK_LO | LNX_SDA_HI; break; - case 12: sc->priv_info = 0x80 | LNX_CLK_LO | LNX_SDA_HI; break; - default: - fe_irq_failure(sc->typestr, sc->sc_unit, irq, "3/5/6/12"); - return ENXIO; - } - - /* LAC-98's system bus width is 8-bit. */ - sc->proto_dlcr6 = FE_D6_BUFSIZ_32KB | FE_D6_TXBSIZ_2x2KB - | FE_D6_BBW_BYTE | FE_D6_SBW_BYTE | FE_D6_SRAM_150ns; - - /* Setup hooks. We need a special initialization procedure. */ - sc->init = fe_init_lnx; - - return 0; -} - - -/* - * Probe for Gateway Communications' old cards. - * (both as Generic MB86960 probe routine) - */ -static int -fe_probe_gwy(device_t dev) -{ - struct fe_softc *sc = device_get_softc(dev); - - static struct fe_simple_probe_struct probe_table [] = { - /* { FE_DLCR2, 0x70, 0x00 }, */ - { FE_DLCR2, 0x58, 0x00 }, - { FE_DLCR4, 0x08, 0x00 }, - { 0 } - }; - - /* - * XXX - * I'm not sure which address is possible, so accepts any. - */ - - if (fe98_alloc_port(dev, FE_TYPE_GWY)) - return ENXIO; - - /* Fill the softc struct with default values. */ - fe_softc_defaults(sc); - - /* See if the card is on its address. */ - if (!fe_simple_probe(sc, probe_table)) - return ENXIO; - - /* Get our station address from EEPROM. */ - fe_inblk(sc, 0x18, sc->enaddr, ETHER_ADDR_LEN); - if (!fe_valid_Ether_p(sc->enaddr, 0x000000)) - return ENXIO; - - /* Determine the card type. */ - sc->typestr = "Generic MB86960 Ethernet"; - if (fe_valid_Ether_p(sc->enaddr, 0x000061)) - sc->typestr = "Gateway Ethernet (Fujitsu chipset)"; - - /* Gateway's board requires an explicit IRQ to work, since it - is not possible to probe the setting of jumpers. */ - if (bus_get_resource(dev, SYS_RES_IRQ, 0, NULL, NULL) != 0) { - fe_irq_failure(sc->typestr, sc->sc_unit, NO_IRQ, NULL); - return ENXIO; - } - - return 0; -} - - -/* - * Probe for Ungermann-Bass Access/PC N98C+(Model 85152). - */ -static int -fe_probe_ubn(device_t dev) -{ - struct fe_softc *sc = device_get_softc(dev); - - u_char sum, save7; - rman_res_t iobase, irq; - int i; - static struct fe_simple_probe_struct const probe_table [] = { - { FE_DLCR2, 0x58, 0x00 }, - { FE_DLCR4, 0x08, 0x00 }, - { 0 } - }; - - /* See if the specified I/O address is possible for Access/PC. */ - /* [01][048C]D0 are allowed. */ - if (bus_get_resource(dev, SYS_RES_IOPORT, 0, &iobase, NULL) != 0) - return ENXIO; - if ((iobase & ~0x1C00) != 0xD0) - return ENXIO; - - if (fe98_alloc_port(dev, FE_TYPE_UBN)) - return ENXIO; - - /* Fill the softc struct with default values. */ - fe_softc_defaults(sc); - - /* Simple probe. */ - if (!fe_simple_probe(sc, probe_table)) - return ENXIO; - - /* NOTE: Access/NOTE N98 sometimes freeze when reading station - address. In case of using it togather with C-NET(9N)C, - this problem usually happens. - Writing DLCR7 prevents freezing, but I don't know why. FIXME. */ - - /* Save the current value for the DLCR7 register we are about - to destroy. */ - save7 = fe_inb(sc, FE_DLCR7); - fe_outb(sc, FE_DLCR7, - sc->proto_dlcr7 | FE_D7_RBS_BMPR | FE_D7_POWER_UP); - - /* Get our station address form ID ROM and make sure it is UBN's. */ - fe_inblk(sc, 0x18, sc->enaddr, ETHER_ADDR_LEN); - if (!fe_valid_Ether_p(sc->enaddr, 0x00DD01)) - goto fail_ubn; -#if 1 - /* Calculate checksum. */ - sum = fe_inb(sc, 0x1e); - for (i = 0; i < ETHER_ADDR_LEN; i++) - sum ^= sc->enaddr[i]; - if (sum != 0) - goto fail_ubn; -#endif - - /* Setup the board type. */ - sc->typestr = "Access/PC"; - - /* This looks like an AccessPC/N98C+ board. It requires an - explicit IRQ setting in config. Make sure we have one, - determining an appropriate value for the IRQ control - register. */ - irq = 0; - bus_get_resource(dev, SYS_RES_IRQ, 0, &irq, NULL); - switch (irq) { - case 3: sc->priv_info = 0x01; break; - case 5: sc->priv_info = 0x02; break; - case 6: sc->priv_info = 0x04; break; - case 12: sc->priv_info = 0x08; break; - default: - fe_irq_failure(sc->typestr, sc->sc_unit, irq, "3/5/6/12"); - goto fail_ubn; - } - - /* Setup hooks. We need a special initialization procedure. */ - sc->init = fe_init_ubn; - - return 0; - -fail_ubn: - fe_outb(sc, FE_DLCR7, save7); - return ENXIO; -} - - -/* - * REX boards(non-JLI type) support routine. - */ - -#define REX_EEPROM_SIZE 32 -#define REX_DAT 0x01 - -static void -fe_read_eeprom_rex(struct fe_softc *sc, u_char *data) -{ - int i; - u_char bit, val; - u_char save16; - - save16 = fe_inb(sc, 0x10); - - /* Issue a start condition. */ - val = fe_inb(sc, 0x10) & 0xf0; - fe_outb(sc, 0x10, val); - - (void) fe_inb(sc, 0x10); - (void) fe_inb(sc, 0x10); - (void) fe_inb(sc, 0x10); - (void) fe_inb(sc, 0x10); - - /* Read bytes from EEPROM. */ - for (i = 0; i < REX_EEPROM_SIZE; i++) { - /* Read a byte and store it into the buffer. */ - val = 0x00; - for (bit = 0x01; bit != 0x00; bit <<= 1) - if (fe_inb(sc, 0x10) & REX_DAT) - val |= bit; - *data++ = val; - } - - fe_outb(sc, 0x10, save16); - -#if 1 - /* Report what we got. */ - if (bootverbose) { - data -= REX_EEPROM_SIZE; - for (i = 0; i < REX_EEPROM_SIZE; i += 16) { - printf("fe%d: EEPROM(REX):%3x: %16D\n", - sc->sc_unit, i, data + i, " "); - } - } -#endif -} - - -static void -fe_init_rex(struct fe_softc *sc) -{ - /* Setup IRQ control register on the ASIC. */ - fe_outb(sc, 0x10, sc->priv_info); -} - -/* - * Probe for RATOC REX-9880/81/82/83 series. - */ -static int -fe_probe_rex(device_t dev) -{ - struct fe_softc *sc = device_get_softc(dev); - - int i; - rman_res_t iobase, irq; - u_char eeprom [REX_EEPROM_SIZE]; - - static struct fe_simple_probe_struct probe_table [] = { - { FE_DLCR2, 0x58, 0x00 }, - { FE_DLCR4, 0x08, 0x00 }, - { 0 } - }; - - /* See if the specified I/O address is possible for REX-9880. */ - /* 6[46CE]D0 are allowed. */ - if (bus_get_resource(dev, SYS_RES_IOPORT, 0, &iobase, NULL) != 0) - return ENXIO; - if ((iobase & ~0xA00) != 0x64D0) - return ENXIO; - - if (fe98_alloc_port(dev, FE_TYPE_REX)) - return ENXIO; - - /* Fill the softc struct with default values. */ - fe_softc_defaults(sc); - - /* See if the card is on its address. */ - if (!fe_simple_probe(sc, probe_table)) - return ENXIO; - - /* We now have to read the config EEPROM. We should be very - careful, since doing so destroys a register. (Remember, we - are not yet sure we have a REX-9880 board here.) */ - fe_read_eeprom_rex(sc, eeprom); - for (i = 0; i < ETHER_ADDR_LEN; i++) - sc->enaddr[i] = eeprom[7 - i]; - - /* Make sure it is RATOC's. */ - if (!fe_valid_Ether_p(sc->enaddr, 0x00C0D0) && - !fe_valid_Ether_p(sc->enaddr, 0x00803D)) - return 0; - - /* Setup the board type. */ - sc->typestr = "REX-9880/9883"; - - /* This looks like a REX-9880 board. It requires an - explicit IRQ setting in config. Make sure we have one, - determining an appropriate value for the IRQ control - register. */ - irq = 0; - bus_get_resource(dev, SYS_RES_IRQ, 0, &irq, NULL); - switch (irq) { - case 3: sc->priv_info = 0x10; break; - case 5: sc->priv_info = 0x20; break; - case 6: sc->priv_info = 0x40; break; - case 12: sc->priv_info = 0x80; break; - default: - fe_irq_failure(sc->typestr, sc->sc_unit, irq, "3/5/6/12"); - return ENXIO; - } - - /* Setup hooks. We need a special initialization procedure. */ - sc->init = fe_init_rex; - - /* REX-9880 has 64KB SRAM. */ - sc->proto_dlcr6 = FE_D6_BUFSIZ_64KB | FE_D6_TXBSIZ_2x4KB - | FE_D6_BBW_WORD | FE_D6_SBW_WORD | FE_D6_SRAM; -#if 1 - sc->proto_dlcr7 |= FE_D7_EOPPOL; /* XXX */ -#endif - - return 0; -} diff --git a/sys/dev/fe/if_fereg.h b/sys/dev/fe/if_fereg.h index afc9c5704c58..a349f77044b1 100644 --- a/sys/dev/fe/if_fereg.h +++ b/sys/dev/fe/if_fereg.h @@ -113,14 +113,6 @@ #define FE_MBH0_INTR_DISABLE 0x00 /* Disable interrupts. */ -/* - * Registers on RE1000. (*NOT* on RE1000 Plus.) - */ - -/* IRQ configuration. */ -#define FE_RE1000_IRQCONF 0x10 - - /* * Fujitsu MB86965 JLI mode support routines. */ diff --git a/sys/dev/ic/i8251.h b/sys/dev/ic/i8251.h deleted file mode 100644 index 162ab29e9ac9..000000000000 --- a/sys/dev/ic/i8251.h +++ /dev/null @@ -1,111 +0,0 @@ -/*- - * Copyright (c) 1991 The Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -/* - * modified for PC9801 by M.Ishii - * Kyoto University Microcomputer Club (KMC) - * - * modified for 8251(FIFO) by Seigo TANIMURA - */ - -/* i8251 mode register */ -#define MOD8251_5BITS 0x00 -#define MOD8251_6BITS 0x04 -#define MOD8251_7BITS 0x08 -#define MOD8251_8BITS 0x0c -#define MOD8251_PENAB 0x10 /* parity enable */ -#define MOD8251_PEVEN 0x20 /* parity even */ -#define MOD8251_STOP1 0x40 /* 1 stop bit */ -#define MOD8251_STOP15 0x80 /* 1.5 stop bit */ -#define MOD8251_STOP2 0xc0 /* 2 stop bit */ -#define MOD8251_CLKx1 0x01 /* x1 */ -#define MOD8251_CLKx16 0x02 /* x16 */ -#define MOD8251_CLKx64 0x03 /* x64 */ - -/* i8251 command register */ -#define CMD8251_TxEN 0x01 /* transmit enable */ -#define CMD8251_DTR 0x02 /* assert DTR */ -#define CMD8251_RxEN 0x04 /* receive enable */ -#define CMD8251_SBRK 0x08 /* send break */ -#define CMD8251_ER 0x10 /* error reset */ -#define CMD8251_RTS 0x20 /* assert RTS */ -#define CMD8251_RESET 0x40 /* internal reset */ -#define CMD8251_EH 0x80 /* enter hunt mode */ - -/* i8251 status register */ -#define STS8251_TxRDY 0x01 /* transmit READY */ -#define STS8251_RxRDY 0x02 /* data exists in receive buffer */ -#define STS8251_TxEMP 0x04 /* transmit buffer EMPTY */ -#define STS8251_PE 0x08 /* perity error */ -#define STS8251_OE 0x10 /* overrun error */ -#define STS8251_FE 0x20 /* framing error */ -#define STS8251_BI 0x40 /* break detect */ -#define STS8251_DSR 0x80 /* DSR is asserted */ - -/* i8251F line status register */ -#define FLSR_TxEMP 0x01 /* transmit buffer EMPTY */ -#define FLSR_TxRDY 0x02 /* transmit READY */ -#define FLSR_RxRDY 0x04 /* data exists in receive buffer */ -#define FLSR_OE 0x10 /* overrun error */ -#define FLSR_PE 0x20 /* perity error */ -#define FLSR_BI 0x80 /* break detect */ - -/* i8251F modem status register */ -#define MSR_DCD 0x80 /* Current Data Carrier Detect */ -#define MSR_RI 0x40 /* Current Ring Indicator */ -#define MSR_DSR 0x20 /* Current Data Set Ready */ -#define MSR_CTS 0x10 /* Current Clear to Send */ -#define MSR_DDCD 0x08 /* DCD has changed state */ -#define MSR_TERI 0x04 /* RI has toggled low to high */ -#define MSR_DDSR 0x02 /* DSR has changed state */ -#define MSR_DCTS 0x01 /* CTS has changed state */ - -/* i8251F interrupt identification register */ -#define IIR_FIFO_CK1 0x40 -#define IIR_FIFO_CK2 0x20 -#define IIR_IMASK 0x0f -#define IIR_RXTOUT 0x0c /* Receiver timeout */ -#define IIR_RLS 0x06 /* Line status change */ -#define IIR_RXRDY 0x04 /* Receiver ready */ -#define IIR_TXRDY 0x02 /* Transmitter ready */ -#define IIR_NOPEND 0x01 /* Transmitter ready */ -#define IIR_MLSC 0x00 /* Modem status */ - -/* i8251F fifo control register */ -#define FIFO_ENABLE 0x01 /* Turn the FIFO on */ -#define FIFO_RCV_RST 0x02 /* Reset RX FIFO */ -#define FIFO_XMT_RST 0x04 /* Reset TX FIFO */ -#define FIFO_LSR_EN 0x08 -#define FIFO_MSR_EN 0x10 -#define FIFO_TRIGGER_1 0x00 /* Trigger RXRDY intr on 1 character */ -#define FIFO_TRIGGER_4 0x40 /* ibid 4 */ -#define FIFO_TRIGGER_8 0x80 /* ibid 8 */ -#define FIFO_TRIGGER_14 0xc0 /* ibid 14 */ diff --git a/sys/dev/ic/wd33c93reg.h b/sys/dev/ic/wd33c93reg.h deleted file mode 100644 index 8e536cd1d32d..000000000000 --- a/sys/dev/ic/wd33c93reg.h +++ /dev/null @@ -1,165 +0,0 @@ -/* $FreeBSD$ */ -/* $NecBSD: wd33c93reg.h,v 1.21.24.1 2001/06/13 05:52:05 honda Exp $ */ -/* $NetBSD$ */ -/*- - * [NetBSD for NEC PC-98 series] - * Copyright (c) 1996, 1997, 1998 - * NetBSD/pc98 porting staff. All rights reserved. - * Copyright (c) 1996, 1997, 1998 - * Naofumi Honda. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _WD33C93REG_H_ -#define _WD33C93REG_H_ - -/* wd33c93 register */ -#define wd3s_oid 0x00 -#define IDR_FS_16_20 0x80 -#define IDR_FS_12_15 0x40 -#define IDR_FS_8_10 0x00 -#define IDR_RAF 0x20 -#define IDR_EHP 0x10 -#define IDR_EAF 0x08 -#define IDR_IDM 0x07 - -#define wd3s_ctrl 0x01 -#define CR_DMA 0x80 -#define CR_DMAD 0x40 -#define CR_HLT_HOST_PARITY 0x10 -#define CR_DIS_INT 0x08 -#define CR_IDIS_INT 0x04 -#define CR_HLT_ATN 0x02 -#define CR_HLT_BUS_PARITY 0x01 -#define CR_DEFAULT (CR_DIS_INT | CR_IDIS_INT) -#define CR_DEFAULT_HP (CR_DEFAULT | CR_HLT_BUS_PARITY) - -#define wd3s_tout 0x02 -#define wd3s_cdb 0x03 -#define wd3s_lun 0x0f -#define wd3s_cph 0x10 -#define wd3s_synch 0x11 -#define wd3s_cnt 0x12 -#define wd3s_did 0x15 -#define DIDR_SCC 0x80 -#define DIDR_DPD 0x40 - -#define wd3s_sid 0x16 -#define SIDR_RESEL 0x80 -#define SIDR_SEL 0x40 -#define SIDR_VALID 0x08 -#define SIDR_IDM 0x07 - -#define wd3s_stat 0x17 - -#define BSR_CM 0xf0 -#define BSR_CMDCPL 0x10 -#define BSR_CMDABT 0x20 -#define BSR_CMDERR 0x40 -#define BSR_CMDREQ 0x80 - -#define BSR_SM 0x0f -#define BSR_PM 0x07 -#define BSR_PHVALID 0x08 -#define BSR_IOR 0x01 -#define BSR_DATAOUT 0x00 -#define BSR_DATAIN 0x01 -#define BSR_CMDOUT 0x02 -#define BSR_STATIN 0x03 -#define BSR_UNSPINFO0 0x04 -#define BSR_UNSPINFO1 0x05 -#define BSR_MSGOUT 0x06 -#define BSR_MSGIN 0x07 - -#define BSR_RESET 0x00 -#define BSR_AFM_RESET 0x01 -#define BSR_SELECTED 0x11 -#define BSR_SATFIN 0x16 -#define BSR_ACKREQ 0x20 -#define BSR_SATSDP 0x21 -#define BSR_RESEL 0x80 -#define BSR_AFM_RESEL 0x81 -#define BSR_DISC 0x85 - -#define wd3s_cmd 0x18 -#define wd3s_data 0x19 -#define wd3s_qtag 0x1a - -#define wd3s_mbank 0x30 -#define MBR_RST 0x02 -#define MBR_IEN 0x04 - -#define wd3s_mwin 0x31 -#define wd3s_auxc 0x33 -#define AUXCR_HIDM 0x07 -#define AUXCR_INTM 0x38 -#define AUXCR_RRST 0x80 - -/* status port */ -#define STR_INT 0x80 -#define STR_LCI 0x40 -#define STR_BSY 0x20 -#define STR_CIP 0x10 -#define STR_PE 0x02 -#define STR_DBR 0x01 -#define STR_BUSY 0xf0 - -/* cmd port */ -#define CMDP_DMES 0x01 -#define CMDP_DMER 0x02 -#define CMDP_TCMS 0x04 -#define CMDP_TCMR 0x08 -#define CMDP_TCIR 0x10 - -/* wd33c93 chip cmds */ -#define WD3S_SBT 0x80 -#define WD3S_RESET 0x00 -#define WD3S_ABORT 0x01 -#define WD3S_ASSERT_ATN 0x02 -#define WD3S_NEGATE_ACK 0x03 -#define WD3S_DISCONNECT 0x04 -#define WD3S_RESELECT 0x05 -#define WD3S_SELECT_ATN 0x06 -#define WD3S_SELECT_NO_ATN 0x07 -#define WD3S_SELECT_ATN_TFR 0x08 -#define WD3S_SELECT_NO_ATN_TFR 0x09 -#define WD3S_RESELECT_RCV_DATA 0x0a -#define WD3S_RESELECT_SEND_DATA 0x0b -#define WD3S_WAIT_SELECT_RCV 0x0c -#define WD3S_CMD_COMPSEQ 0x0d -#define WD3S_SEND_DISC_MSG 0x0e -#define WD3S_SET_IDI 0x0f -#define WD3S_RCV_CMD 0x10 -#define WD3S_RCV_DATA 0x11 -#define WD3S_RCV_MSG_OUT 0x12 -#define WD3S_RCV_UNSP_INFO_OUT 0x13 -#define WD3S_SEND_STATUS 0x14 -#define WD3S_SEND_DATA 0x15 -#define WD3S_SEND_MSG_IN 0x16 -#define WD3S_SEND_UNSP_INFO_IN 0x17 -#define WD3S_TRANSLATE_ADDRESS 0x18 -#define WD3S_TFR_INFO 0x20 - -#endif /* !_WD33C93REG_H_ */ diff --git a/sys/dev/kbd/kbd.c b/sys/dev/kbd/kbd.c index 24dc9bbe48ea..2452507002ae 100644 --- a/sys/dev/kbd/kbd.c +++ b/sys/dev/kbd/kbd.c @@ -1327,13 +1327,7 @@ genkbd_keyaction(keyboard_t *kbd, int keycode, int up, int *shiftstate, state &= ~NLKDOWN; break; case CLK: -#ifndef PC98 state &= ~CLKDOWN; -#else - state &= ~CLKED; - i = state & LOCK_MASK; - (void)kbdd_ioctl(kbd, KDSETLED, (caddr_t)&i); -#endif break; case SLK: state &= ~SLKDOWN; @@ -1363,13 +1357,7 @@ genkbd_keyaction(keyboard_t *kbd, int keycode, int up, int *shiftstate, set_lockkey_state(kbd, state, NLK); break; case CLK: -#ifndef PC98 set_lockkey_state(kbd, state, CLK); -#else - state |= CLKED; - i = state & LOCK_MASK; - (void)kbdd_ioctl(kbd, KDSETLED, (caddr_t)&i); -#endif break; case SLK: set_lockkey_state(kbd, state, SLK); diff --git a/sys/dev/le/am79900.c b/sys/dev/le/am79900.c index 5ea82284535c..74f9e5c802f3 100644 --- a/sys/dev/le/am79900.c +++ b/sys/dev/le/am79900.c @@ -254,7 +254,7 @@ am79900_rint(struct lance_softc *sc) struct lermd rmd; uint32_t rmd1; int bix, rp; -#if defined(__i386__) && !defined(PC98) +#if defined(__i386__) struct ether_header *eh; #endif @@ -315,7 +315,7 @@ am79900_rint(struct lance_softc *sc) if (m != NULL) { if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); -#if defined(__i386__) && !defined(PC98) +#if defined(__i386__) /* * The VMware LANCE does not present IFF_SIMPLEX * behavior on multicast packets. Thus drop the diff --git a/sys/dev/le/if_le_cbus.c b/sys/dev/le/if_le_cbus.c deleted file mode 100644 index 7b493f9f798d..000000000000 --- a/sys/dev/le/if_le_cbus.c +++ /dev/null @@ -1,443 +0,0 @@ -/*- - * Copyright (c) 1994-2000 - * Paul Richards. All rights reserved. - * - * PC-98 port by Chiharu Shibata & FreeBSD(98) porting team. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer, - * verbatim and that no modifications are made prior to this - * point in the file. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name Paul Richards may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY PAUL RICHARDS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL PAUL RICHARDS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: FreeBSD: src/sys/dev/lnc/if_lnc_cbus.c,v 1.12 2005/11/12 19:14:21 - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include - -#include -#include -#include - -#define LE_CBUS_MEMSIZE (16*1024) -#define CNET98S_IOSIZE 32 -#define CNET98S_RDP 0x10 -#define CNET98S_RAP 0x12 -#define CNET98S_RESET 0x14 -#define CNET98S_BDP 0x16 - -struct le_cbus_softc { - struct am7990_softc sc_am7990; /* glue to MI code */ - - struct resource *sc_rres; - - struct resource *sc_ires; - void *sc_ih; - - bus_dma_tag_t sc_pdmat; - bus_dma_tag_t sc_dmat; - bus_dmamap_t sc_dmam; -}; - -static device_probe_t le_cbus_probe; -static device_attach_t le_cbus_attach; -static device_detach_t le_cbus_detach; -static device_resume_t le_cbus_resume; -static device_suspend_t le_cbus_suspend; - -static device_method_t le_cbus_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, le_cbus_probe), - DEVMETHOD(device_attach, le_cbus_attach), - DEVMETHOD(device_detach, le_cbus_detach), - /* We can just use the suspend method here. */ - DEVMETHOD(device_shutdown, le_cbus_suspend), - DEVMETHOD(device_suspend, le_cbus_suspend), - DEVMETHOD(device_resume, le_cbus_resume), - - { 0, 0 } -}; - -DEFINE_CLASS_0(le, le_cbus_driver, le_cbus_methods, sizeof(struct le_cbus_softc)); -DRIVER_MODULE(le, isa, le_cbus_driver, le_devclass, 0, 0); -MODULE_DEPEND(le, ether, 1, 1, 1); - -static bus_addr_t le_ioaddr_cnet98s[CNET98S_IOSIZE] = { - 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, - 0x008, 0x009, 0x00a, 0x00b, 0x00c, 0x00d, 0x00e, 0x00f, - 0x400, 0x401, 0x402, 0x403, 0x404, 0x405, 0x406, 0x407, - 0x408, 0x409, 0x40a, 0x40b, 0x40c, 0x40d, 0x40e, 0x40f, -}; - -static void le_cbus_wrbcr(struct lance_softc *, uint16_t, uint16_t); -#ifdef LEDEBUG -static uint16_t le_cbus_rdbcr(struct lance_softc *, uint16_t); -#endif -static void le_cbus_wrcsr(struct lance_softc *, uint16_t, uint16_t); -static uint16_t le_cbus_rdcsr(struct lance_softc *, uint16_t); -static void le_cbus_hwreset(struct lance_softc *); -static bus_dmamap_callback_t le_cbus_dma_callback; - -static void -le_cbus_wrbcr(struct lance_softc *sc, uint16_t port, uint16_t val) -{ - struct le_cbus_softc *lesc = (struct le_cbus_softc *)sc; - - bus_write_2(lesc->sc_rres, CNET98S_RAP, port); - bus_barrier(lesc->sc_rres, CNET98S_RAP, 2, BUS_SPACE_BARRIER_WRITE); - bus_write_2(lesc->sc_rres, CNET98S_BDP, val); -} - -#ifdef LEDEBUG -static uint16_t -le_cbus_rdbcr(struct lance_softc *sc, uint16_t port) -{ - struct le_cbus_softc *lesc = (struct le_cbus_softc *)sc; - - bus_write_2(lesc->sc_rres, CNET98S_RAP, port); - bus_barrier(lesc->sc_rres, CNET98S_RAP, 2, BUS_SPACE_BARRIER_WRITE); - return (bus_read_2(lesc->sc_rres, CNET98S_BDP)); -} -#endif - -static void -le_cbus_wrcsr(struct lance_softc *sc, uint16_t port, uint16_t val) -{ - struct le_cbus_softc *lesc = (struct le_cbus_softc *)sc; - - bus_write_2(lesc->sc_rres, CNET98S_RAP, port); - bus_barrier(lesc->sc_rres, CNET98S_RAP, 2, BUS_SPACE_BARRIER_WRITE); - bus_write_2(lesc->sc_rres, CNET98S_RDP, val); -} - -static uint16_t -le_cbus_rdcsr(struct lance_softc *sc, uint16_t port) -{ - struct le_cbus_softc *lesc = (struct le_cbus_softc *)sc; - - bus_write_2(lesc->sc_rres, CNET98S_RAP, port); - bus_barrier(lesc->sc_rres, CNET98S_RAP, 2, BUS_SPACE_BARRIER_WRITE); - return (bus_read_2(lesc->sc_rres, CNET98S_RDP)); -} - -static void -le_cbus_hwreset(struct lance_softc *sc) -{ - struct le_cbus_softc *lesc = (struct le_cbus_softc *)sc; - - /* - * NB: These are Contec C-NET(98)S only. - */ - - /* Reset the chip. */ - bus_write_2(lesc->sc_rres, CNET98S_RESET, - bus_read_2(lesc->sc_rres, CNET98S_RESET)); - DELAY(500); - - /* ISA bus configuration */ - /* ISACSR0 - set Master Mode Read Active time to 300ns. */ - le_cbus_wrbcr(sc, LE_BCR0, 0x0006); - /* ISACSR1 - set Master Mode Write Active time to 300ns. */ - le_cbus_wrbcr(sc, LE_BCR1, 0x0006); -#ifdef LEDEBUG - device_printf(dev, "ISACSR2=0x%x\n", le_cbus_rdbcr(sc, LE_BCR2)); -#endif - /* ISACSR5 - LED1 */ - le_cbus_wrbcr(sc, LE_BCR5, LE_B4_PSE | LE_B4_XMTE); - /* ISACSR6 - LED2 */ - le_cbus_wrbcr(sc, LE_BCR6, LE_B4_PSE | LE_B4_RCVE); - /* ISACSR7 - LED3 */ - le_cbus_wrbcr(sc, LE_BCR7, LE_B4_PSE | LE_B4_COLE); -} - -static void -le_cbus_dma_callback(void *xsc, bus_dma_segment_t *segs, int nsegs, int error) -{ - struct lance_softc *sc = (struct lance_softc *)xsc; - - if (error != 0) - return; - KASSERT(nsegs == 1, ("%s: bad DMA segment count", __func__)); - sc->sc_addr = segs[0].ds_addr; -} - -static int -le_cbus_probe(device_t dev) -{ - struct le_cbus_softc *lesc; - struct lance_softc *sc; - int error, i; - - /* - * Skip PnP devices as some wedge when trying to probe them as - * C-NET(98)S. - */ - if (isa_get_vendorid(dev)) - return (ENXIO); - - lesc = device_get_softc(dev); - sc = &lesc->sc_am7990.lsc; - - i = 0; - lesc->sc_rres = isa_alloc_resourcev(dev, SYS_RES_IOPORT, &i, - le_ioaddr_cnet98s, CNET98S_IOSIZE, RF_ACTIVE); - if (lesc->sc_rres == NULL) - return (ENXIO); - isa_load_resourcev(lesc->sc_rres, le_ioaddr_cnet98s, CNET98S_IOSIZE); - - /* Reset the chip. */ - bus_write_2(lesc->sc_rres, CNET98S_RESET, - bus_read_2(lesc->sc_rres, CNET98S_RESET)); - DELAY(500); - - /* Stop the chip and put it in a known state. */ - le_cbus_wrcsr(sc, LE_CSR0, LE_C0_STOP); - DELAY(100); - if (le_cbus_rdcsr(sc, LE_CSR0) != LE_C0_STOP) { - error = ENXIO; - goto fail; - } - le_cbus_wrcsr(sc, LE_CSR3, 0); - device_set_desc(dev, "C-NET(98)S"); - error = BUS_PROBE_DEFAULT; - - fail: - bus_release_resource(dev, SYS_RES_IOPORT, - rman_get_rid(lesc->sc_rres), lesc->sc_rres); - return (error); -} - -static int -le_cbus_attach(device_t dev) -{ - struct le_cbus_softc *lesc; - struct lance_softc *sc; - int error, i; - - lesc = device_get_softc(dev); - sc = &lesc->sc_am7990.lsc; - - LE_LOCK_INIT(sc, device_get_nameunit(dev)); - - i = 0; - lesc->sc_rres = isa_alloc_resourcev(dev, SYS_RES_IOPORT, &i, - le_ioaddr_cnet98s, CNET98S_IOSIZE, RF_ACTIVE); - if (lesc->sc_rres == NULL) { - device_printf(dev, "cannot allocate registers\n"); - error = ENXIO; - goto fail_mtx; - } - isa_load_resourcev(lesc->sc_rres, le_ioaddr_cnet98s, CNET98S_IOSIZE); - - i = 0; - if ((lesc->sc_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ, - &i, RF_SHAREABLE | RF_ACTIVE)) == NULL) { - device_printf(dev, "cannot allocate interrupt\n"); - error = ENXIO; - goto fail_rres; - } - - error = bus_dma_tag_create( - bus_get_dma_tag(dev), /* parent */ - 1, 0, /* alignment, boundary */ - BUS_SPACE_MAXADDR_24BIT, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - BUS_SPACE_MAXSIZE_32BIT, /* maxsize */ - 0, /* nsegments */ - BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */ - 0, /* flags */ - NULL, NULL, /* lockfunc, lockarg */ - &lesc->sc_pdmat); - if (error != 0) { - device_printf(dev, "cannot allocate parent DMA tag\n"); - goto fail_ires; - } - - sc->sc_memsize = LE_CBUS_MEMSIZE; - /* - * For Am79C90, Am79C961 and Am79C961A the init block must be 2-byte - * aligned and the ring descriptors must be 8-byte aligned. - */ - error = bus_dma_tag_create( - lesc->sc_pdmat, /* parent */ - 8, 0, /* alignment, boundary */ - BUS_SPACE_MAXADDR_24BIT, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - sc->sc_memsize, /* maxsize */ - 1, /* nsegments */ - sc->sc_memsize, /* maxsegsize */ - 0, /* flags */ - NULL, NULL, /* lockfunc, lockarg */ - &lesc->sc_dmat); - if (error != 0) { - device_printf(dev, "cannot allocate buffer DMA tag\n"); - goto fail_pdtag; - } - - error = bus_dmamem_alloc(lesc->sc_dmat, (void **)&sc->sc_mem, - BUS_DMA_WAITOK | BUS_DMA_COHERENT, &lesc->sc_dmam); - if (error != 0) { - device_printf(dev, "cannot allocate DMA buffer memory\n"); - goto fail_dtag; - } - - sc->sc_addr = 0; - error = bus_dmamap_load(lesc->sc_dmat, lesc->sc_dmam, sc->sc_mem, - sc->sc_memsize, le_cbus_dma_callback, sc, 0); - if (error != 0 || sc->sc_addr == 0) { - device_printf(dev, "cannot load DMA buffer map\n"); - goto fail_dmem; - } - - sc->sc_flags = 0; - sc->sc_conf3 = 0; - - /* - * Extract the physical MAC address from the ROM. - */ - for (i = 0; i < sizeof(sc->sc_enaddr); i++) - sc->sc_enaddr[i] = bus_read_1(lesc->sc_rres, i * 2); - - sc->sc_copytodesc = lance_copytobuf_contig; - sc->sc_copyfromdesc = lance_copyfrombuf_contig; - sc->sc_copytobuf = lance_copytobuf_contig; - sc->sc_copyfrombuf = lance_copyfrombuf_contig; - sc->sc_zerobuf = lance_zerobuf_contig; - - sc->sc_rdcsr = le_cbus_rdcsr; - sc->sc_wrcsr = le_cbus_wrcsr; - sc->sc_hwreset = le_cbus_hwreset; - sc->sc_hwinit = NULL; - sc->sc_hwintr = NULL; - sc->sc_nocarrier = NULL; - sc->sc_mediachange = NULL; - sc->sc_mediastatus = NULL; - sc->sc_supmedia = NULL; - - error = am7990_config(&lesc->sc_am7990, device_get_name(dev), - device_get_unit(dev)); - if (error != 0) { - device_printf(dev, "cannot attach Am7990\n"); - goto fail_dmap; - } - - error = bus_setup_intr(dev, lesc->sc_ires, INTR_TYPE_NET | INTR_MPSAFE, - NULL, am7990_intr, sc, &lesc->sc_ih); - if (error != 0) { - device_printf(dev, "cannot set up interrupt\n"); - goto fail_am7990; - } - - return (0); - - fail_am7990: - am7990_detach(&lesc->sc_am7990); - fail_dmap: - bus_dmamap_unload(lesc->sc_dmat, lesc->sc_dmam); - fail_dmem: - bus_dmamem_free(lesc->sc_dmat, sc->sc_mem, lesc->sc_dmam); - fail_dtag: - bus_dma_tag_destroy(lesc->sc_dmat); - fail_pdtag: - bus_dma_tag_destroy(lesc->sc_pdmat); - fail_ires: - bus_release_resource(dev, SYS_RES_IRQ, - rman_get_rid(lesc->sc_ires), lesc->sc_ires); - fail_rres: - bus_release_resource(dev, SYS_RES_IOPORT, - rman_get_rid(lesc->sc_rres), lesc->sc_rres); - fail_mtx: - LE_LOCK_DESTROY(sc); - return (error); -} - -static int -le_cbus_detach(device_t dev) -{ - struct le_cbus_softc *lesc; - struct lance_softc *sc; - - lesc = device_get_softc(dev); - sc = &lesc->sc_am7990.lsc; - - bus_teardown_intr(dev, lesc->sc_ires, lesc->sc_ih); - am7990_detach(&lesc->sc_am7990); - bus_dmamap_unload(lesc->sc_dmat, lesc->sc_dmam); - bus_dmamem_free(lesc->sc_dmat, sc->sc_mem, lesc->sc_dmam); - bus_dma_tag_destroy(lesc->sc_dmat); - bus_dma_tag_destroy(lesc->sc_pdmat); - bus_release_resource(dev, SYS_RES_IRQ, - rman_get_rid(lesc->sc_ires), lesc->sc_ires); - bus_release_resource(dev, SYS_RES_IOPORT, - rman_get_rid(lesc->sc_rres), lesc->sc_rres); - LE_LOCK_DESTROY(sc); - - return (0); -} - -static int -le_cbus_suspend(device_t dev) -{ - struct le_cbus_softc *lesc; - - lesc = device_get_softc(dev); - - lance_suspend(&lesc->sc_am7990.lsc); - - return (0); -} - -static int -le_cbus_resume(device_t dev) -{ - struct le_cbus_softc *lesc; - - lesc = device_get_softc(dev); - - lance_resume(&lesc->sc_am7990.lsc); - - return (0); -} diff --git a/sys/dev/mse/mse_cbus.c b/sys/dev/mse/mse_cbus.c deleted file mode 100644 index 21924b60b9ee..000000000000 --- a/sys/dev/mse/mse_cbus.c +++ /dev/null @@ -1,301 +0,0 @@ -/*- - * Copyright (c) 2004 M. Warner Losh - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -/*- - * Copyright 1992 by the University of Guelph - * - * Permission to use, copy and modify this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting - * documentation. - * University of Guelph makes no representations about the suitability of - * this software for any purpose. It is provided "as is" - * without express or implied warranty. - */ -/* - * Driver for the Logitech and ATI Inport Bus mice for use with 386bsd and - * the X386 port, courtesy of - * Rick Macklem, rick@snowhite.cis.uoguelph.ca - * Caveats: The driver currently uses spltty(), but doesn't use any - * generic tty code. It could use splmse() (that only masks off the - * bus mouse interrupt, but that would require hacking in i386/isa/icu.s. - * (This may be worth the effort, since the Logitech generates 30/60 - * interrupts/sec continuously while it is open.) - * NB: The ATI has NOT been tested yet! - */ - -/* - * Modification history: - * Sep 6, 1994 -- Lars Fredriksen(fredriks@mcs.com) - * improved probe based on input from Logitech. - * - * Oct 19, 1992 -- E. Stark (stark@cs.sunysb.edu) - * fixes to make it work with Microsoft InPort busmouse - * - * Jan, 1993 -- E. Stark (stark@cs.sunysb.edu) - * added patches for new "select" interface - * - * May 4, 1993 -- E. Stark (stark@cs.sunysb.edu) - * changed position of some spl()'s in mseread - * - * October 8, 1993 -- E. Stark (stark@cs.sunysb.edu) - * limit maximum negative x/y value to -127 to work around XFree problem - * that causes spurious button pushes. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include - -static int mse_cbus_probe(device_t dev); -static int mse_cbus_attach(device_t dev); - -static device_method_t mse_methods[] = { - DEVMETHOD(device_probe, mse_cbus_probe), - DEVMETHOD(device_attach, mse_cbus_attach), - DEVMETHOD(device_detach, mse_detach), - { 0, 0 } -}; - -static driver_t mse_driver = { - "mse", - mse_methods, - sizeof(mse_softc_t), -}; - -DRIVER_MODULE(mse, isa, mse_driver, mse_devclass, 0, 0); - -static struct isa_pnp_id mse_ids[] = { -#if 0 - { 0x001fa3b8, "PC-98 bus mouse" }, /* NEC1F00 */ -#endif - { 0 } -}; - -/* - * PC-9801 Bus mouse definitions - */ - -#define MODE MSE_PORTD -#define HC MSE_PORTD -#define INT MSE_PORTD - -#define XL 0x00 -#define XH 0x20 -#define YL 0x40 -#define YH 0x60 - -#define INT_ENABLE 0x8 -#define INT_DISABLE 0x9 -#define HC_NO_CLEAR 0xe -#define HC_CLEAR 0xf - -static bus_addr_t mse_port[] = {0, 2, 4, 6}; - -static int mse_probe98m(device_t dev, mse_softc_t *sc); -static void mse_disable98m(struct resource *port); -static void mse_get98m(struct resource *port, - int *dx, int *dy, int *but); -static void mse_enable98m(struct resource *port); - -static struct mse_types mse_types[] = { - { MSE_98BUSMOUSE, - mse_probe98m, mse_enable98m, mse_disable98m, mse_get98m, - { 2, MOUSE_IF_BUS, MOUSE_MOUSE, MOUSE_MODEL_GENERIC, 0, }, - { MOUSE_PROTO_BUS, -1, -1, 0, 0, MOUSE_MSC_PACKETSIZE, - { MOUSE_MSC_SYNCMASK, MOUSE_MSC_SYNC, }, }, }, - { 0, }, -}; - -static int -mse_cbus_probe(device_t dev) -{ - mse_softc_t *sc; - int error; - int rid; - int i; - - /* check PnP IDs */ - error = ISA_PNP_PROBE(device_get_parent(dev), dev, mse_ids); - if (error == ENXIO) - return error; - - sc = device_get_softc(dev); - rid = 0; - sc->sc_port = isa_alloc_resourcev(dev, SYS_RES_IOPORT, &rid, mse_port, - MSE_IOSIZE, RF_ACTIVE); - if (sc->sc_port == NULL) - return ENXIO; - if (isa_load_resourcev(sc->sc_port, mse_port, MSE_IOSIZE)) { - bus_release_resource(dev, SYS_RES_IOPORT, rid, sc->sc_port); - return ENXIO; - } - - /* - * Check for each mouse type in the table. - */ - i = 0; - while (mse_types[i].m_type) { - if ((*mse_types[i].m_probe)(dev, sc)) { - sc->sc_mousetype = mse_types[i].m_type; - sc->sc_enablemouse = mse_types[i].m_enable; - sc->sc_disablemouse = mse_types[i].m_disable; - sc->sc_getmouse = mse_types[i].m_get; - sc->hw = mse_types[i].m_hw; - sc->mode = mse_types[i].m_mode; - bus_release_resource(dev, SYS_RES_IOPORT, rid, - sc->sc_port); - device_set_desc(dev, "Bus/InPort Mouse"); - return 0; - } - i++; - } - bus_release_resource(dev, SYS_RES_IOPORT, rid, sc->sc_port); - return ENXIO; -} - -static int -mse_cbus_attach(device_t dev) -{ - mse_softc_t *sc; - int rid; - - sc = device_get_softc(dev); - - rid = 0; - sc->sc_port = isa_alloc_resourcev(dev, SYS_RES_IOPORT, &rid, mse_port, - MSE_IOSIZE, RF_ACTIVE); - if (sc->sc_port == NULL) - return ENXIO; - if (isa_load_resourcev(sc->sc_port, mse_port, MSE_IOSIZE)) { - bus_release_resource(dev, SYS_RES_IOPORT, rid, sc->sc_port); - return ENXIO; - } - - return (mse_common_attach(dev)); -} - -/* - * Routines for the PC98 bus mouse. - */ - -/* - * Test for a PC98 bus mouse and return 1 if it is. - * (do not enable interrupts) - */ -static int -mse_probe98m(device_t dev, mse_softc_t *sc) -{ - /* mode set */ - bus_write_1(sc->sc_port, MODE, 0x93); - - /* initialize */ - /* INT disable */ - bus_write_1(sc->sc_port, INT, INT_DISABLE); - /* HC = 0 */ - bus_write_1(sc->sc_port, HC, HC_NO_CLEAR); - /* HC = 1 */ - bus_write_1(sc->sc_port, HC, HC_CLEAR); - - return (1); -} - -/* - * Initialize PC98 bus mouse and enable interrupts. - */ -static void -mse_enable98m(struct resource *port) -{ - bus_write_1(port, INT, INT_ENABLE); /* INT enable */ - bus_write_1(port, HC, HC_NO_CLEAR); /* HC = 0 */ - bus_write_1(port, HC, HC_CLEAR); /* HC = 1 */ -} - -/* - * Disable interrupts for PC98 Bus mouse. - */ -static void -mse_disable98m(struct resource *port) -{ - bus_write_1(port, INT, INT_DISABLE); /* INT disable */ - bus_write_1(port, HC, HC_NO_CLEAR); /* HC = 0 */ - bus_write_1(port, HC, HC_CLEAR); /* HC = 1 */ -} - -/* - * Get current dx, dy and up/down button state. - */ -static void -mse_get98m(struct resource *port, int *dx, int *dy, int *but) -{ - register char x, y; - - bus_write_1(port, INT, INT_DISABLE); /* INT disable */ - - bus_write_1(port, HC, HC_CLEAR); /* HC = 1 */ - - /* X low */ - bus_write_1(port, MSE_PORTC, 0x90 | XL); - x = bus_read_1(port, MSE_PORTA) & 0x0f; - /* X high */ - bus_write_1(port, MSE_PORTC, 0x90 | XH); - x |= ((bus_read_1(port, MSE_PORTA) & 0x0f) << 4); - - /* Y low */ - bus_write_1(port, MSE_PORTC, 0x90 | YL); - y = (bus_read_1(port, MSE_PORTA) & 0x0f); - /* Y high */ - bus_write_1(port, MSE_PORTC, 0x90 | YH); - y |= ((bus_read_1(port, MSE_PORTA) & 0x0f) << 4); - - *but = (bus_read_1(port, MSE_PORTA) >> 5) & 7; - - *dx = x; - *dy = y; - - bus_write_1(port, HC, HC_NO_CLEAR); /* HC = 0 */ - - bus_write_1(port, INT, INT_ENABLE); /* INT enable */ -} diff --git a/sys/dev/mse/msevar.h b/sys/dev/mse/msevar.h index 74a393f0ef0a..19b069ea27d5 100644 --- a/sys/dev/mse/msevar.h +++ b/sys/dev/mse/msevar.h @@ -87,9 +87,6 @@ typedef struct mse_softc { /* and Mouse Types */ #define MSE_NONE 0 /* don't move this! */ -/* pc98 bus mouse types */ -#define MSE_98BUSMOUSE 0x1 - /* isa bus mouse types */ #define MSE_LOGITECH 0x1 #define MSE_ATIINPORT 0x2 diff --git a/sys/dev/pccbb/pccbb_isa.c b/sys/dev/pccbb/pccbb_isa.c index 6ef441f35e94..d2a0d03fc933 100644 --- a/sys/dev/pccbb/pccbb_isa.c +++ b/sys/dev/pccbb/pccbb_isa.c @@ -113,8 +113,6 @@ static struct isa_pnp_id pcic_ids[] = { {EXCA_PNP_VLSI_82C146, NULL}, /* PNP0E02 */ {EXCA_PNP_82365_CARDBUS, NULL}, /* PNP0E03 */ {EXCA_PNP_SCM_SWAPBOX, NULL}, /* SCM0469 */ - {EXCA_NEC_PC9801_102, NULL}, /* NEC8091 */ - {EXCA_NEC_PC9821RA_E01, NULL}, /* NEC8121 */ {0} }; diff --git a/sys/dev/pci/vga_pci.c b/sys/dev/pci/vga_pci.c index 3cc6ac343e9c..3e7c7447a8f0 100644 --- a/sys/dev/pci/vga_pci.c +++ b/sys/dev/pci/vga_pci.c @@ -207,7 +207,7 @@ vga_pci_unmap_bios(device_t dev, void *bios) int vga_pci_repost(device_t dev) { -#if defined(__amd64__) || (defined(__i386__) && !defined(PC98)) +#if defined(__amd64__) || defined(__i386__) x86regs_t regs; if (!vga_pci_is_boot_display(dev)) diff --git a/sys/dev/ppc/ppc.c b/sys/dev/ppc/ppc.c index 4c6761fb279c..9515039036d9 100644 --- a/sys/dev/ppc/ppc.c +++ b/sys/dev/ppc/ppc.c @@ -67,11 +67,6 @@ static void ppcintr(void *arg); #define LOG_PPC(function, ppc, string) \ if (bootverbose) printf("%s: %s\n", function, string) -#if defined(__i386__) && defined(PC98) -#define PC98_IEEE_1284_DISABLE 0x100 -#define PC98_IEEE_1284_PORT 0x140 -#endif - #define DEVTOSOFTC(dev) ((struct ppc_data *)device_get_softc(dev)) /* @@ -1667,10 +1662,6 @@ ppc_probe(device_t dev, int rid) { #ifdef __i386__ static short next_bios_ppc = 0; -#ifdef PC98 - unsigned int pc98_ieee_mode = 0x00; - unsigned int tmp; -#endif #endif struct ppc_data *ppc; int error; @@ -1692,16 +1683,6 @@ ppc_probe(device_t dev, int rid) * If port not specified, use bios list. */ if (error) { -#ifdef PC98 - if (next_bios_ppc == 0) { - /* Use default IEEE-1284 port of NEC PC-98x1 */ - port = PC98_IEEE_1284_PORT; - next_bios_ppc += 1; - if (bootverbose) - device_printf(dev, - "parallel port found at 0x%jx\n", port); - } -#else if ((next_bios_ppc < BIOS_MAX_PPC) && (*(BIOS_PORTS + next_bios_ppc) != 0)) { port = *(BIOS_PORTS + next_bios_ppc++); @@ -1712,7 +1693,6 @@ ppc_probe(device_t dev, int rid) device_printf(dev, "parallel port not found.\n"); return (ENXIO); } -#endif /* PC98 */ bus_set_resource(dev, SYS_RES_IOPORT, rid, port, IO_LPTSIZE_EXTENDED); } @@ -1771,30 +1751,6 @@ ppc_probe(device_t dev, int rid) ppc->ppc_type = PPC_TYPE_GENERIC; -#if defined(__i386__) && defined(PC98) - /* - * IEEE STD 1284 Function Check and Enable - * for default IEEE-1284 port of NEC PC-98x1 - */ - if (ppc->ppc_base == PC98_IEEE_1284_PORT && - !(ppc->ppc_flags & PC98_IEEE_1284_DISABLE)) { - tmp = inb(ppc->ppc_base + PPC_1284_ENABLE); - pc98_ieee_mode = tmp; - if ((tmp & 0x10) == 0x10) { - outb(ppc->ppc_base + PPC_1284_ENABLE, tmp & ~0x10); - tmp = inb(ppc->ppc_base + PPC_1284_ENABLE); - if ((tmp & 0x10) == 0x10) - goto error; - } else { - outb(ppc->ppc_base + PPC_1284_ENABLE, tmp | 0x10); - tmp = inb(ppc->ppc_base + PPC_1284_ENABLE); - if ((tmp & 0x10) != 0x10) - goto error; - } - outb(ppc->ppc_base + PPC_1284_ENABLE, pc98_ieee_mode | 0x10); - } -#endif - /* * Try to detect the chipset and its mode. */ @@ -1804,12 +1760,6 @@ ppc_probe(device_t dev, int rid) return (0); error: -#if defined(__i386__) && defined(PC98) - if (ppc->ppc_base == PC98_IEEE_1284_PORT && - !(ppc->ppc_flags & PC98_IEEE_1284_DISABLE)) { - outb(ppc->ppc_base + PPC_1284_ENABLE, pc98_ieee_mode); - } -#endif if (ppc->res_irq != 0) { bus_release_resource(dev, SYS_RES_IRQ, ppc->rid_irq, ppc->res_irq); diff --git a/sys/dev/ppc/ppcreg.h b/sys/dev/ppc/ppcreg.h index a7295033d731..fa1f165d6daa 100644 --- a/sys/dev/ppc/ppcreg.h +++ b/sys/dev/ppc/ppcreg.h @@ -130,18 +130,10 @@ struct ppc_data { #define PPC_SPP_CTR 2 /* SPP control register */ #define PPC_EPP_ADDR 3 /* EPP address register (8 bit) */ #define PPC_EPP_DATA 4 /* EPP data register (8, 16 or 32 bit) */ -#if defined(__i386__) && defined(PC98) -#define PPC_1284_ENABLE 0x09 /* IEEE STD 1284 Enable register */ -#define PPC_ECP_D_FIFO 0x0c /* ECP Data fifo register */ -#define PPC_ECP_CNFGA 0x0c /* Configuration register A */ -#define PPC_ECP_CNFGB 0x0d /* Configuration register B */ -#define PPC_ECP_ECR 0x0e /* ECP extended control register */ -#else #define PPC_ECP_D_FIFO 0x400 /* ECP Data fifo register */ #define PPC_ECP_CNFGA 0x400 /* Configuration register A */ #define PPC_ECP_CNFGB 0x401 /* Configuration register B */ #define PPC_ECP_ECR 0x402 /* ECP extended control register */ -#endif #define PPC_FIFO_EMPTY 0x1 /* ecr register - bit 0 */ #define PPC_FIFO_FULL 0x2 /* ecr register - bit 1 */ diff --git a/sys/dev/sio/sio_pccard.c b/sys/dev/sio/sio_pccard.c index 7bdb755d8051..93757c73870c 100644 --- a/sys/dev/sio/sio_pccard.c +++ b/sys/dev/sio/sio_pccard.c @@ -87,9 +87,6 @@ sio_pccard_attach(device_t dev) { int err; -#ifdef PC98 - SET_FLAG(dev, SET_IFTYPE(COM_IF_MODEM_CARD)); -#endif /* Do not probe IRQ - pccard doesn't turn on the interrupt line */ /* until bus_setup_intr */ if ((err = sioprobe(dev, 0, 0UL, 1)) > 0) diff --git a/sys/dev/sio/sio_pci.c b/sys/dev/sio/sio_pci.c index a693536d33cd..34010acada1e 100644 --- a/sys/dev/sio/sio_pci.c +++ b/sys/dev/sio/sio_pci.c @@ -118,9 +118,7 @@ sio_pci_probe(dev) if (id->desc == NULL) return (ENXIO); device_set_desc(dev, id->desc); -#ifdef PC98 - SET_FLAG(dev, SET_IFTYPE(COM_IF_NS16550)); -#endif + return (sioprobe(dev, id->rid, 0UL, 0)); } diff --git a/sys/dev/sio/sio_puc.c b/sys/dev/sio/sio_puc.c index 0ae0e7d6424d..199254b08201 100644 --- a/sys/dev/sio/sio_puc.c +++ b/sys/dev/sio/sio_puc.c @@ -89,9 +89,7 @@ sio_puc_probe(device_t dev) if (BUS_READ_IVAR(parent, dev, PUC_IVAR_CLOCK, &rclk)) rclk = DEFAULT_RCLK; -#ifdef PC98 - SET_FLAG(dev, SET_IFTYPE(COM_IF_NS16550)); -#endif + error = sioprobe(dev, 0, rclk, 1); return ((error > 0) ? error : BUS_PROBE_LOW_PRIORITY); } diff --git a/sys/dev/sio/siovar.h b/sys/dev/sio/siovar.h index 22a6019d8e62..1a0abddf7a09 100644 --- a/sys/dev/sio/siovar.h +++ b/sys/dev/sio/siovar.h @@ -29,36 +29,6 @@ * $FreeBSD$ */ -#ifdef PC98 -#define COM_IF_INTERNAL 0x00 -#define COM_IF_PC9861K_1 0x01 -#define COM_IF_PC9861K_2 0x02 -#define COM_IF_IND_SS_1 0x03 -#define COM_IF_IND_SS_2 0x04 -#define COM_IF_PIO9032B_1 0x05 -#define COM_IF_PIO9032B_2 0x06 -#define COM_IF_B98_01_1 0x07 -#define COM_IF_B98_01_2 0x08 -#define COM_IF_END1 COM_IF_B98_01_2 -#define COM_IF_RSA98 0x10 /* same as COM_IF_NS16550 */ -#define COM_IF_NS16550 0x11 -#define COM_IF_SECOND_CCU 0x12 /* same as COM_IF_NS16550 */ -#define COM_IF_MC16550II 0x13 -#define COM_IF_MCRS98 0x14 /* same as COM_IF_MC16550II */ -#define COM_IF_RSB3000 0x15 -#define COM_IF_RSB384 0x16 -#define COM_IF_MODEM_CARD 0x17 -#define COM_IF_RSA98III 0x18 -#define COM_IF_ESP98 0x19 -#define COM_IF_END2 COM_IF_ESP98 - -#define GET_IFTYPE(type) (((type) >> 24) & 0x1f) -#define SET_IFTYPE(type) ((type) << 24) - -#define SET_FLAG(dev, bit) device_set_flags(dev, device_get_flags(dev) | (bit)) -#define CLR_FLAG(dev, bit) device_set_flags(dev, device_get_flags(dev) & ~(bit)) -#endif /* PC98 */ - int sioattach(device_t dev, int xrid, u_long rclk); int siodetach(device_t dev); int sioprobe(device_t dev, int xrid, u_long rclk, int noprobe); diff --git a/sys/dev/snc/dp83932.c b/sys/dev/snc/dp83932.c deleted file mode 100644 index acda11c2c00f..000000000000 --- a/sys/dev/snc/dp83932.c +++ /dev/null @@ -1,1198 +0,0 @@ -/* $FreeBSD$ */ -/* $NecBSD: dp83932.c,v 1.5 1999/07/29 05:08:44 kmatsuda Exp $ */ -/* $NetBSD: if_snc.c,v 1.18 1998/04/25 21:27:40 scottr Exp $ */ - -/*- - * Copyright (c) 1997, 1998, 1999 - * Kouichi Matsuda. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Kouichi Matsuda for - * NetBSD/pc98. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Modified for FreeBSD(98) 4.0 from NetBSD/pc98 1.4.2 by Motomichi Matsuzaki. - */ - -/* - * Modified for NetBSD/pc98 1.2G from NetBSD/mac68k 1.2G by Kouichi Matsuda. - * Make adapted for NEC PC-9801-83, 84, PC-9801-103, 104, PC-9801N-25 and - * PC-9801N-J02, J02R, which uses National Semiconductor DP83934AVQB as - * Ethernet Controller and National Semiconductor NS46C46 as - * (64 * 16 bits) Microwire Serial EEPROM. - */ - -/*- - * National Semiconductor DP8393X SONIC Driver - * Copyright (c) 1991 Algorithmics Ltd (http://www.algor.co.uk) - * You may use, copy, and modify this program so long as you retain the - * copyright line. - * - * This driver has been substantially modified since Algorithmics donated - * it. - * - * Denton Gentry - * and also - * Yanagisawa Takeshi - * did the work to get this running on the Macintosh. - */ - -#include "opt_inet.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include - -static void sncwatchdog(void *); -static void sncinit(void *); -static void sncinit_locked(struct snc_softc *); -static int sncstop(struct snc_softc *sc); -static int sncioctl(struct ifnet *ifp, u_long cmd, caddr_t data); -static void sncstart(struct ifnet *ifp); -static void sncstart_locked(struct ifnet *ifp); -static void sncreset(struct snc_softc *sc); - -static void caminitialise(struct snc_softc *); -static void camentry(struct snc_softc *, int, u_char *ea); -static void camprogram(struct snc_softc *); -static void initialise_tda(struct snc_softc *); -static void initialise_rda(struct snc_softc *); -static void initialise_rra(struct snc_softc *); -#ifdef SNCDEBUG -static void camdump(struct snc_softc *sc); -#endif - -static void sonictxint(struct snc_softc *); -static void sonicrxint(struct snc_softc *); - -static u_int sonicput(struct snc_softc *sc, struct mbuf *m0, int mtd_next); -static int sonic_read(struct snc_softc *, u_int32_t, int); -static struct mbuf *sonic_get(struct snc_softc *, u_int32_t, int); - -int snc_enable(struct snc_softc *); -void snc_disable(struct snc_softc *); - -int snc_mediachange(struct ifnet *); -void snc_mediastatus(struct ifnet *, struct ifmediareq *); - -#undef assert -#undef _assert - -#ifdef NDEBUG -#define assert(e) ((void)0) -#define _assert(e) ((void)0) -#else -#define _assert(e) assert(e) -#ifdef __STDC__ -#define assert(e) ((e) ? (void)0 : __assert("snc ", __FILE__, __LINE__, #e)) -#else /* PCC */ -#define assert(e) ((e) ? (void)0 : __assert("snc "__FILE__, __LINE__, "e")) -#endif -#endif - -#ifdef SNCDEBUG -#define SNC_SHOWTXHDR 0x01 /* show tx ether_header */ -#define SNC_SHOWRXHDR 0x02 /* show rx ether_header */ -#define SNC_SHOWCAMENT 0x04 /* show CAM entry */ -#endif /* SNCDEBUG */ -int sncdebug = 0; - - -int -sncconfig(struct snc_softc *sc, int *media, int nmedia, int defmedia, - u_int8_t *myea) -{ - struct ifnet *ifp; - int i; - -#ifdef SNCDEBUG - if ((sncdebug & SNC_SHOWCAMENT) != 0) { - camdump(sc); - } -#endif - - ifp = sc->sc_ifp = if_alloc(IFT_ETHER); - if (ifp == NULL) { - device_printf(sc->sc_dev, "can not if_alloc()\n"); - return (ENOMEM); - } - -#ifdef SNCDEBUG - device_printf(sc->sc_dev, - "buffers: rra=0x%x cda=0x%x rda=0x%x tda=0x%x\n", - sc->v_rra[0], sc->v_cda, - sc->v_rda, sc->mtda[0].mtd_vtxp); -#endif - - ifp->if_softc = sc; - if_initname(ifp, device_get_name(sc->sc_dev), - device_get_unit(sc->sc_dev)); - ifp->if_ioctl = sncioctl; - ifp->if_start = sncstart; - ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; - ifp->if_init = sncinit; - IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); - - /* Initialize media goo. */ - ifmedia_init(&sc->sc_media, 0, snc_mediachange, - snc_mediastatus); - if (media != NULL) { - for (i = 0; i < nmedia; i++) - ifmedia_add(&sc->sc_media, media[i], 0, NULL); - ifmedia_set(&sc->sc_media, defmedia); - } else { - ifmedia_add(&sc->sc_media, IFM_ETHER|IFM_MANUAL, 0, NULL); - ifmedia_set(&sc->sc_media, IFM_ETHER|IFM_MANUAL); - } - - ether_ifattach(ifp, myea); - return (0); -} - -void -sncshutdown(void *arg) -{ - struct snc_softc *sc = arg; - - SNC_ASSERT_LOCKED(sc); - sncstop(sc); -} - -/* - * Media change callback. - */ -int -snc_mediachange(struct ifnet *ifp) -{ - struct snc_softc *sc = ifp->if_softc; - int error; - - SNC_LOCK(sc); - if (sc->sc_mediachange) - error = (*sc->sc_mediachange)(sc); - else - error = EINVAL; - SNC_UNLOCK(sc); - return (error); -} - -/* - * Media status callback. - */ -void -snc_mediastatus(struct ifnet *ifp, struct ifmediareq *ifmr) -{ - struct snc_softc *sc = ifp->if_softc; - - SNC_LOCK(sc); - if (sc->sc_enabled == 0) { - ifmr->ifm_active = IFM_ETHER | IFM_NONE; - ifmr->ifm_status = 0; - SNC_UNLOCK(sc); - return; - } - - if (sc->sc_mediastatus) - (*sc->sc_mediastatus)(sc, ifmr); - SNC_UNLOCK(sc); -} - - -static int -sncioctl(struct ifnet *ifp, u_long cmd, caddr_t data) -{ - struct ifreq *ifr; - struct snc_softc *sc = ifp->if_softc; - int err = 0; - - switch (cmd) { - - case SIOCSIFFLAGS: - SNC_LOCK(sc); - if ((ifp->if_flags & IFF_UP) == 0 && - (ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) { - /* - * If interface is marked down and it is running, - * then stop it. - */ - sncstop(sc); - snc_disable(sc); - } else if ((ifp->if_flags & IFF_UP) != 0 && - (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { - /* - * If interface is marked up and it is stopped, - * then start it. - */ - if ((err = snc_enable(sc)) != 0) - break; - sncinit_locked(sc); - } else if (sc->sc_enabled) { - /* - * reset the interface to pick up any other changes - * in flags - */ - sncreset(sc); - sncstart_locked(ifp); - } - SNC_UNLOCK(sc); - break; - - case SIOCADDMULTI: - case SIOCDELMULTI: - SNC_LOCK(sc); - if (sc->sc_enabled == 0) { - err = EIO; - SNC_UNLOCK(sc); - break; - } - sncreset(sc); - SNC_UNLOCK(sc); - err = 0; - break; - case SIOCGIFMEDIA: - case SIOCSIFMEDIA: - ifr = (struct ifreq *) data; - err = ifmedia_ioctl(ifp, ifr, &sc->sc_media, cmd); - break; - default: - err = ether_ioctl(ifp, cmd, data); - break; - } - return (err); -} - -/* - * Encapsulate a packet of type family for the local net. - */ -static void -sncstart(struct ifnet *ifp) -{ - struct snc_softc *sc = ifp->if_softc; - - SNC_LOCK(sc); - sncstart_locked(ifp); - SNC_UNLOCK(sc); -} - -static void -sncstart_locked(struct ifnet *ifp) -{ - struct snc_softc *sc = ifp->if_softc; - struct mbuf *m; - int mtd_next; - - if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != - IFF_DRV_RUNNING) - return; - -outloop: - /* Check for room in the xmit buffer. */ - if ((mtd_next = (sc->mtd_free + 1)) == NTDA) - mtd_next = 0; - - if (mtd_next == sc->mtd_hw) { - ifp->if_drv_flags |= IFF_DRV_OACTIVE; - return; - } - - IF_DEQUEUE(&ifp->if_snd, m); - if (m == 0) - return; - - /* We need the header for m_pkthdr.len. */ - M_ASSERTPKTHDR(m); - - /* - * If there is nothing in the o/p queue, and there is room in - * the Tx ring, then send the packet directly. Otherwise append - * it to the o/p queue. - */ - if ((sonicput(sc, m, mtd_next)) == 0) { - IF_PREPEND(&ifp->if_snd, m); - return; - } - - /* - * If bpf is listening on this interface, let it see the packet - * before we commit it to the wire, but only if we are really - * committed to send it. - * - * XXX: Locking must protect m against premature m_freem() in - * sonictxint(). - */ - BPF_MTAP(ifp, m); - - sc->mtd_prev = sc->mtd_free; - sc->mtd_free = mtd_next; - - if_inc_counter(ifp, IFCOUNTER_OPACKETS, 1); /* # of pkts */ - - /* Jump back for possibly more punishment. */ - goto outloop; -} - -/* - * reset and restart the SONIC. Called in case of fatal - * hardware/software errors. - */ -static void -sncreset(struct snc_softc *sc) -{ - sncstop(sc); - sncinit_locked(sc); -} - -static void -sncinit(void *xsc) -{ - struct snc_softc *sc = xsc; - - SNC_LOCK(sc); - sncinit_locked(sc); - SNC_UNLOCK(sc); -} - -static void -sncinit_locked(struct snc_softc *sc) -{ - u_long s_rcr; - - if (sc->sc_ifp->if_drv_flags & IFF_DRV_RUNNING) - /* already running */ - return; - - NIC_PUT(sc, SNCR_CR, CR_RST); /* DCR only accessible in reset mode! */ - - /* config it */ - NIC_PUT(sc, SNCR_DCR, (sc->sncr_dcr | - (sc->bitmode ? DCR_DW32 : DCR_DW16))); - NIC_PUT(sc, SNCR_DCR2, sc->sncr_dcr2); - - s_rcr = RCR_BRD | RCR_LBNONE; - if (sc->sc_ifp->if_flags & IFF_PROMISC) - s_rcr |= RCR_PRO; - if (sc->sc_ifp->if_flags & IFF_ALLMULTI) - s_rcr |= RCR_AMC; - NIC_PUT(sc, SNCR_RCR, s_rcr); - - NIC_PUT(sc, SNCR_IMR, (IMR_PRXEN | IMR_PTXEN | IMR_TXEREN | IMR_LCDEN)); - - /* clear pending interrupts */ - NIC_PUT(sc, SNCR_ISR, ISR_ALL); - - /* clear tally counters */ - NIC_PUT(sc, SNCR_CRCT, -1); - NIC_PUT(sc, SNCR_FAET, -1); - NIC_PUT(sc, SNCR_MPT, -1); - - initialise_tda(sc); - initialise_rda(sc); - initialise_rra(sc); - - /* enable the chip */ - NIC_PUT(sc, SNCR_CR, 0); - wbflush(); - - /* program the CAM */ - camprogram(sc); - - /* get it to read resource descriptors */ - NIC_PUT(sc, SNCR_CR, CR_RRRA); - wbflush(); - while ((NIC_GET(sc, SNCR_CR)) & CR_RRRA) - continue; - - /* enable rx */ - NIC_PUT(sc, SNCR_CR, CR_RXEN); - wbflush(); - - /* flag interface as "running" */ - sc->sc_ifp->if_drv_flags |= IFF_DRV_RUNNING; - sc->sc_ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - callout_reset(&sc->sc_timer, hz, sncwatchdog, sc); - - return; -} - -/* - * close down an interface and free its buffers - * Called on final close of device, or if sncinit() fails - * part way through. - */ -static int -sncstop(struct snc_softc *sc) -{ - struct mtd *mtd; - - SNC_ASSERT_LOCKED(sc); - - /* stick chip in reset */ - NIC_PUT(sc, SNCR_CR, CR_RST); - wbflush(); - - /* free all receive buffers (currently static so nothing to do) */ - - /* free all pending transmit mbufs */ - while (sc->mtd_hw != sc->mtd_free) { - mtd = &sc->mtda[sc->mtd_hw]; - if (mtd->mtd_mbuf) - m_freem(mtd->mtd_mbuf); - if (++sc->mtd_hw == NTDA) sc->mtd_hw = 0; - } - - callout_stop(&sc->sc_timer); - sc->sc_tx_timeout = 0; - sc->sc_ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); - - return (0); -} - -/* - * Called if any Tx packets remain unsent after 5 seconds, - * In all cases we just reset the chip, and any retransmission - * will be handled by higher level protocol timeouts. - */ -static void -sncwatchdog(void *arg) -{ - struct snc_softc *sc = arg; - struct mtd *mtd; - - SNC_ASSERT_LOCKED(sc); - if (sc->sc_tx_timeout && --sc->sc_tx_timeout == 0) { - if (sc->mtd_hw != sc->mtd_free) { - /* something still pending for transmit */ - mtd = &sc->mtda[sc->mtd_hw]; - if (SRO(sc, mtd->mtd_vtxp, TXP_STATUS) == 0) - log(LOG_ERR, "%s: Tx - timeout\n", - device_get_nameunit(sc->sc_dev)); - else - log(LOG_ERR, "%s: Tx - lost interrupt\n", - device_get_nameunit(sc->sc_dev)); - sncreset(sc); - } - } - callout_reset(&sc->sc_timer, hz, sncwatchdog, sc); -} - -/* - * stuff packet into sonic - */ -static u_int -sonicput(struct snc_softc *sc, struct mbuf *m0, int mtd_next) -{ - struct mtd *mtdp; - struct mbuf *m; - u_int32_t buff; - u_int32_t txp; - u_int len = 0; - u_int totlen = 0; - -#ifdef whyonearthwouldyoudothis - if (NIC_GET(sc, SNCR_CR) & CR_TXP) - return (0); -#endif - - /* grab the replacement mtd */ - mtdp = &sc->mtda[sc->mtd_free]; - - buff = mtdp->mtd_vbuf; - - /* this packet goes to mtdnext fill in the TDA */ - mtdp->mtd_mbuf = m0; - txp = mtdp->mtd_vtxp; - - /* Write to the config word. Every (NTDA/2)+1 packets we set an intr */ - if (sc->mtd_pint == 0) { - sc->mtd_pint = NTDA/2; - SWO(sc, txp, TXP_CONFIG, TCR_PINT); - } else { - sc->mtd_pint--; - SWO(sc, txp, TXP_CONFIG, 0); - } - - for (m = m0; m; m = m->m_next) { - len = m->m_len; - totlen += len; - (*sc->sc_copytobuf)(sc, mtod(m, caddr_t), buff, len); - buff += len; - } - if (totlen >= TXBSIZE) { - panic("%s: sonicput: packet overflow", - device_get_nameunit(sc->sc_dev)); - } - - SWO(sc, txp, TXP_FRAGOFF + (0 * TXP_FRAGSIZE) + TXP_FPTRLO, - LOWER(mtdp->mtd_vbuf)); - SWO(sc, txp, TXP_FRAGOFF + (0 * TXP_FRAGSIZE) + TXP_FPTRHI, - UPPER(mtdp->mtd_vbuf)); - - if (totlen < ETHERMIN + sizeof(struct ether_header)) { - int pad = ETHERMIN + sizeof(struct ether_header) - totlen; - (*sc->sc_zerobuf)(sc, mtdp->mtd_vbuf + totlen, pad); - totlen = ETHERMIN + sizeof(struct ether_header); - } - - SWO(sc, txp, TXP_FRAGOFF + (0 * TXP_FRAGSIZE) + TXP_FSIZE, - totlen); - SWO(sc, txp, TXP_FRAGCNT, 1); - SWO(sc, txp, TXP_PKTSIZE, totlen); - - /* link onto the next mtd that will be used */ - SWO(sc, txp, TXP_FRAGOFF + (1 * TXP_FRAGSIZE) + TXP_FPTRLO, - LOWER(sc->mtda[mtd_next].mtd_vtxp) | EOL); - - /* - * The previous txp.tlink currently contains a pointer to - * our txp | EOL. Want to clear the EOL, so write our - * pointer to the previous txp. - */ - SWO(sc, sc->mtda[sc->mtd_prev].mtd_vtxp, sc->mtd_tlinko, - LOWER(mtdp->mtd_vtxp)); - - /* make sure chip is running */ - wbflush(); - NIC_PUT(sc, SNCR_CR, CR_TXP); - wbflush(); - - /* 5 seconds to watch for failing to transmit */ - sc->sc_tx_timeout = 5; - - return (totlen); -} - -/* - * These are called from sonicioctl() when /etc/ifconfig is run to set - * the address or switch the i/f on. - */ -/* - * CAM support - */ -static void -caminitialise(struct snc_softc *sc) -{ - u_int32_t v_cda = sc->v_cda; - int i; - int camoffset; - - for (i = 0; i < MAXCAM; i++) { - camoffset = i * CDA_CAMDESC; - SWO(sc, v_cda, (camoffset + CDA_CAMEP), i); - SWO(sc, v_cda, (camoffset + CDA_CAMAP2), 0); - SWO(sc, v_cda, (camoffset + CDA_CAMAP1), 0); - SWO(sc, v_cda, (camoffset + CDA_CAMAP0), 0); - } - SWO(sc, v_cda, CDA_ENABLE, 0); - -#ifdef SNCDEBUG - if ((sncdebug & SNC_SHOWCAMENT) != 0) { - camdump(sc); - } -#endif -} - -static void -camentry(struct snc_softc *sc, int entry, u_char *ea) -{ - u_int32_t v_cda = sc->v_cda; - int camoffset = entry * CDA_CAMDESC; - - SWO(sc, v_cda, camoffset + CDA_CAMEP, entry); - SWO(sc, v_cda, camoffset + CDA_CAMAP2, (ea[5] << 8) | ea[4]); - SWO(sc, v_cda, camoffset + CDA_CAMAP1, (ea[3] << 8) | ea[2]); - SWO(sc, v_cda, camoffset + CDA_CAMAP0, (ea[1] << 8) | ea[0]); - SWO(sc, v_cda, CDA_ENABLE, - (SRO(sc, v_cda, CDA_ENABLE) | (1 << entry))); -} - -static void -camprogram(struct snc_softc *sc) -{ - struct ifmultiaddr *ifma; - struct ifnet *ifp; - int timeout; - int mcount = 0; - - caminitialise(sc); - - ifp = sc->sc_ifp; - - /* Always load our own address first. */ - camentry (sc, mcount, IF_LLADDR(sc->sc_ifp)); - mcount++; - - /* Assume we won't need allmulti bit. */ - ifp->if_flags &= ~IFF_ALLMULTI; - - /* Loop through multicast addresses */ - if_maddr_rlock(ifp); - TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - if (mcount == MAXCAM) { - ifp->if_flags |= IFF_ALLMULTI; - break; - } - - /* program the CAM with the specified entry */ - camentry(sc, mcount, - LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); - mcount++; - } - if_maddr_runlock(ifp); - - NIC_PUT(sc, SNCR_CDP, LOWER(sc->v_cda)); - NIC_PUT(sc, SNCR_CDC, MAXCAM); - NIC_PUT(sc, SNCR_CR, CR_LCAM); - wbflush(); - - timeout = 10000; - while ((NIC_GET(sc, SNCR_CR) & CR_LCAM) && timeout--) - continue; - if (timeout == 0) { - /* XXX */ - panic("%s: CAM initialisation failed\n", - device_get_nameunit(sc->sc_dev)); - } - timeout = 10000; - while (((NIC_GET(sc, SNCR_ISR) & ISR_LCD) == 0) && timeout--) - continue; - - if (NIC_GET(sc, SNCR_ISR) & ISR_LCD) - NIC_PUT(sc, SNCR_ISR, ISR_LCD); - else - device_printf(sc->sc_dev, - "CAM initialisation without interrupt\n"); -} - -#ifdef SNCDEBUG -static void -camdump(struct snc_softc *sc) -{ - int i; - - printf("CAM entries:\n"); - NIC_PUT(sc, SNCR_CR, CR_RST); - wbflush(); - - for (i = 0; i < 16; i++) { - u_short ap2, ap1, ap0; - NIC_PUT(sc, SNCR_CEP, i); - wbflush(); - ap2 = NIC_GET(sc, SNCR_CAP2); - ap1 = NIC_GET(sc, SNCR_CAP1); - ap0 = NIC_GET(sc, SNCR_CAP0); - printf("%d: ap2=0x%x ap1=0x%x ap0=0x%x\n", i, ap2, ap1, ap0); - } - printf("CAM enable 0x%x\n", NIC_GET(sc, SNCR_CEP)); - - NIC_PUT(sc, SNCR_CR, 0); - wbflush(); -} -#endif - -static void -initialise_tda(struct snc_softc *sc) -{ - struct mtd *mtd; - int i; - - for (i = 0; i < NTDA; i++) { - mtd = &sc->mtda[i]; - mtd->mtd_mbuf = 0; - } - - sc->mtd_hw = 0; - sc->mtd_prev = NTDA - 1; - sc->mtd_free = 0; - sc->mtd_tlinko = TXP_FRAGOFF + 1*TXP_FRAGSIZE + TXP_FPTRLO; - sc->mtd_pint = NTDA/2; - - NIC_PUT(sc, SNCR_UTDA, UPPER(sc->mtda[0].mtd_vtxp)); - NIC_PUT(sc, SNCR_CTDA, LOWER(sc->mtda[0].mtd_vtxp)); -} - -static void -initialise_rda(struct snc_softc *sc) -{ - int i; - u_int32_t vv_rda = 0; - u_int32_t v_rda = 0; - - /* link the RDA's together into a circular list */ - for (i = 0; i < (sc->sc_nrda - 1); i++) { - v_rda = sc->v_rda + (i * RXPKT_SIZE(sc)); - vv_rda = sc->v_rda + ((i+1) * RXPKT_SIZE(sc)); - SWO(sc, v_rda, RXPKT_RLINK, LOWER(vv_rda)); - SWO(sc, v_rda, RXPKT_INUSE, 1); - } - v_rda = sc->v_rda + ((sc->sc_nrda - 1) * RXPKT_SIZE(sc)); - SWO(sc, v_rda, RXPKT_RLINK, LOWER(sc->v_rda) | EOL); - SWO(sc, v_rda, RXPKT_INUSE, 1); - - /* mark end of receive descriptor list */ - sc->sc_rdamark = sc->sc_nrda - 1; - - sc->sc_rxmark = 0; - - NIC_PUT(sc, SNCR_URDA, UPPER(sc->v_rda)); - NIC_PUT(sc, SNCR_CRDA, LOWER(sc->v_rda)); - wbflush(); -} - -static void -initialise_rra(struct snc_softc *sc) -{ - int i; - u_int v; - int bitmode = sc->bitmode; - - if (bitmode) - NIC_PUT(sc, SNCR_EOBC, RBASIZE(sc) / 2 - 2); - else - NIC_PUT(sc, SNCR_EOBC, RBASIZE(sc) / 2 - 1); - - NIC_PUT(sc, SNCR_URRA, UPPER(sc->v_rra[0])); - NIC_PUT(sc, SNCR_RSA, LOWER(sc->v_rra[0])); - /* rea must point just past the end of the rra space */ - NIC_PUT(sc, SNCR_REA, LOWER(sc->v_rea)); - NIC_PUT(sc, SNCR_RRP, LOWER(sc->v_rra[0])); - NIC_PUT(sc, SNCR_RSC, 0); - - /* fill up SOME of the rra with buffers */ - for (i = 0; i < NRBA; i++) { - v = SONIC_GETDMA(sc->rbuf[i]); - SWO(sc, sc->v_rra[i], RXRSRC_PTRHI, UPPER(v)); - SWO(sc, sc->v_rra[i], RXRSRC_PTRLO, LOWER(v)); - SWO(sc, sc->v_rra[i], RXRSRC_WCHI, UPPER(PAGE_SIZE/2)); - SWO(sc, sc->v_rra[i], RXRSRC_WCLO, LOWER(PAGE_SIZE/2)); - } - sc->sc_rramark = NRBA; - NIC_PUT(sc, SNCR_RWP, LOWER(sc->v_rra[sc->sc_rramark])); - wbflush(); -} - -void -sncintr(void *arg) -{ - struct snc_softc *sc = (struct snc_softc *)arg; - int isr; - - if (sc->sc_enabled == 0) - return; - - SNC_LOCK(sc); - while ((isr = (NIC_GET(sc, SNCR_ISR) & ISR_ALL)) != 0) { - /* scrub the interrupts that we are going to service */ - NIC_PUT(sc, SNCR_ISR, isr); - wbflush(); - - if (isr & (ISR_BR | ISR_LCD | ISR_TC)) - device_printf(sc->sc_dev, - "unexpected interrupt status 0x%x\n", - isr); - - if (isr & (ISR_TXDN | ISR_TXER | ISR_PINT)) - sonictxint(sc); - - if (isr & ISR_PKTRX) - sonicrxint(sc); - - if (isr & (ISR_HBL | ISR_RDE | ISR_RBE | ISR_RBAE | ISR_RFO)) { - if (isr & ISR_HBL) - /* - * The repeater is not providing a heartbeat. - * In itself this isn't harmful, lots of the - * cheap repeater hubs don't supply a heartbeat. - * So ignore the lack of heartbeat. Its only - * if we can't detect a carrier that we have a - * problem. - */ - ; - if (isr & ISR_RDE) - device_printf(sc->sc_dev, - "receive descriptors exhausted\n"); - if (isr & ISR_RBE) - device_printf(sc->sc_dev, - "receive buffers exhausted\n"); - if (isr & ISR_RBAE) - device_printf(sc->sc_dev, - "receive buffer area exhausted\n"); - if (isr & ISR_RFO) - device_printf(sc->sc_dev, - "receive FIFO overrun\n"); - } - if (isr & (ISR_CRC | ISR_FAE | ISR_MP)) { -#ifdef notdef - if (isr & ISR_CRC) - sc->sc_crctally++; - if (isr & ISR_FAE) - sc->sc_faetally++; - if (isr & ISR_MP) - sc->sc_mptally++; -#endif - } - sncstart_locked(sc->sc_ifp); - } - SNC_UNLOCK(sc); - return; -} - -/* - * Transmit interrupt routine - */ -static void -sonictxint(struct snc_softc *sc) -{ - struct mtd *mtd; - u_int32_t txp; - unsigned short txp_status; - int mtd_hw; - struct ifnet *ifp = sc->sc_ifp; - - mtd_hw = sc->mtd_hw; - - if (mtd_hw == sc->mtd_free) - return; - - while (mtd_hw != sc->mtd_free) { - mtd = &sc->mtda[mtd_hw]; - - txp = mtd->mtd_vtxp; - - if (SRO(sc, txp, TXP_STATUS) == 0) { - break; /* it hasn't really gone yet */ - } - -#ifdef SNCDEBUG - if ((sncdebug & SNC_SHOWTXHDR) != 0) - { - struct ether_header eh; - - (*sc->sc_copyfrombuf)(sc, &eh, mtd->mtd_vbuf, sizeof(eh)); - device_printf(sc->sc_dev, - "xmit status=0x%x len=%d type=0x%x from %6D", - SRO(sc, txp, TXP_STATUS), - SRO(sc, txp, TXP_PKTSIZE), - htons(eh.ether_type), - eh.ether_shost, ":"); - printf(" (to %6D)\n", eh.ether_dhost, ":"); - } -#endif /* SNCDEBUG */ - - sc->sc_tx_timeout = 0; - ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - - if (mtd->mtd_mbuf != 0) { - m_freem(mtd->mtd_mbuf); - mtd->mtd_mbuf = 0; - } - if (++mtd_hw == NTDA) mtd_hw = 0; - - txp_status = SRO(sc, txp, TXP_STATUS); - - if_inc_counter(ifp, IFCOUNTER_COLLISIONS, - (txp_status & TCR_EXC) ? 16 : - ((txp_status & TCR_NC) >> 12)); - - if ((txp_status & TCR_PTX) == 0) { - if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); - device_printf(sc->sc_dev, "Tx packet status=0x%x\n", - txp_status); - - /* XXX - DG This looks bogus */ - if (mtd_hw != sc->mtd_free) { - printf("resubmitting remaining packets\n"); - mtd = &sc->mtda[mtd_hw]; - NIC_PUT(sc, SNCR_CTDA, LOWER(mtd->mtd_vtxp)); - NIC_PUT(sc, SNCR_CR, CR_TXP); - wbflush(); - break; - } - } - } - - sc->mtd_hw = mtd_hw; - return; -} - -/* - * Receive interrupt routine - */ -static void -sonicrxint(struct snc_softc *sc) -{ - u_int32_t rda; - int orra; - int len; - int rramark; - int rdamark; - u_int16_t rxpkt_ptr; - - rda = sc->v_rda + (sc->sc_rxmark * RXPKT_SIZE(sc)); - - while (SRO(sc, rda, RXPKT_INUSE) == 0) { - u_int status = SRO(sc, rda, RXPKT_STATUS); - - orra = RBASEQ(SRO(sc, rda, RXPKT_SEQNO)) & RRAMASK; - rxpkt_ptr = SRO(sc, rda, RXPKT_PTRLO); - /* - * Do not trunc ether_header length. - * Our sonic_read() and sonic_get() require it. - */ - len = SRO(sc, rda, RXPKT_BYTEC) - FCSSIZE; - if (status & RCR_PRX) { - /* XXX: Does PAGE_MASK require? */ - u_int32_t pkt = - sc->rbuf[orra & RBAMASK] + (rxpkt_ptr & PAGE_MASK); - if (sonic_read(sc, pkt, len)) - if_inc_counter(sc->sc_ifp, IFCOUNTER_IPACKETS, 1); - else - if_inc_counter(sc->sc_ifp, IFCOUNTER_IERRORS, 1); - } else - if_inc_counter(sc->sc_ifp, IFCOUNTER_IERRORS, 1); - - /* - * give receive buffer area back to chip. - * - * If this was the last packet in the RRA, give the RRA to - * the chip again. - * If sonic read didn't copy it out then we would have to - * wait !! - * (dont bother add it back in again straight away) - * - * Really, we're doing v_rra[rramark] = v_rra[orra] but - * we have to use the macros because SONIC might be in - * 16 or 32 bit mode. - */ - if (status & RCR_LPKT) { - u_int32_t tmp1, tmp2; - - rramark = sc->sc_rramark; - tmp1 = sc->v_rra[rramark]; - tmp2 = sc->v_rra[orra]; - SWO(sc, tmp1, RXRSRC_PTRLO, - SRO(sc, tmp2, RXRSRC_PTRLO)); - SWO(sc, tmp1, RXRSRC_PTRHI, - SRO(sc, tmp2, RXRSRC_PTRHI)); - SWO(sc, tmp1, RXRSRC_WCLO, - SRO(sc, tmp2, RXRSRC_WCLO)); - SWO(sc, tmp1, RXRSRC_WCHI, - SRO(sc, tmp2, RXRSRC_WCHI)); - - /* zap old rra for fun */ - SWO(sc, tmp2, RXRSRC_WCHI, 0); - SWO(sc, tmp2, RXRSRC_WCLO, 0); - - sc->sc_rramark = (++rramark) & RRAMASK; - NIC_PUT(sc, SNCR_RWP, LOWER(sc->v_rra[rramark])); - wbflush(); - } - - /* - * give receive descriptor back to chip simple - * list is circular - */ - rdamark = sc->sc_rdamark; - SWO(sc, rda, RXPKT_INUSE, 1); - SWO(sc, rda, RXPKT_RLINK, - SRO(sc, rda, RXPKT_RLINK) | EOL); - SWO(sc, (sc->v_rda + (rdamark * RXPKT_SIZE(sc))), RXPKT_RLINK, - SRO(sc, (sc->v_rda + (rdamark * RXPKT_SIZE(sc))), - RXPKT_RLINK) & ~EOL); - sc->sc_rdamark = sc->sc_rxmark; - - if (++sc->sc_rxmark >= sc->sc_nrda) - sc->sc_rxmark = 0; - rda = sc->v_rda + (sc->sc_rxmark * RXPKT_SIZE(sc)); - } -} - -/* - * sonic_read -- pull packet off interface and forward to - * appropriate protocol handler - */ -static int -sonic_read(struct snc_softc *sc, u_int32_t pkt, int len) -{ - struct ifnet *ifp = sc->sc_ifp; - struct ether_header *et; - struct mbuf *m; - - if (len <= sizeof(struct ether_header) || - len > ETHERMTU + sizeof(struct ether_header)) { - device_printf(sc->sc_dev, - "invalid packet length %d bytes\n", len); - return (0); - } - - /* Pull packet off interface. */ - m = sonic_get(sc, pkt, len); - if (m == 0) { - return (0); - } - - /* We assume that the header fit entirely in one mbuf. */ - et = mtod(m, struct ether_header *); - -#ifdef SNCDEBUG - if ((sncdebug & SNC_SHOWRXHDR) != 0) - { - device_printf(sc->sc_dev, "rcvd 0x%x len=%d type=0x%x from %6D", - pkt, len, htons(et->ether_type), - et->ether_shost, ":"); - printf(" (to %6D)\n", et->ether_dhost, ":"); - } -#endif /* SNCDEBUG */ - - /* Pass the packet up. */ - SNC_UNLOCK(sc); - (*ifp->if_input)(ifp, m); - SNC_LOCK(sc); - return (1); -} - - -/* - * munge the received packet into an mbuf chain - */ -static struct mbuf * -sonic_get(struct snc_softc *sc, u_int32_t pkt, int datalen) -{ - struct mbuf *m, *top, **mp; - int len; - /* - * Do not trunc ether_header length. - * Our sonic_read() and sonic_get() require it. - */ - - MGETHDR(m, M_NOWAIT, MT_DATA); - if (m == 0) - return (0); - m->m_pkthdr.rcvif = sc->sc_ifp; - m->m_pkthdr.len = datalen; - len = MHLEN; - top = 0; - mp = ⊤ - - while (datalen > 0) { - if (top) { - MGET(m, M_NOWAIT, MT_DATA); - if (m == 0) { - m_freem(top); - return (0); - } - len = MLEN; - } - if (datalen >= MINCLSIZE) { - if (!(MCLGET(m, M_NOWAIT))) { - if (top) m_freem(top); - return (0); - } - len = MCLBYTES; - } -#if 0 - /* XXX: Require? */ - if (!top) { - register int pad = - ALIGN(sizeof(struct ether_header)) - - sizeof(struct ether_header); - m->m_data += pad; - len -= pad; - } -#endif - m->m_len = len = min(datalen, len); - - (*sc->sc_copyfrombuf)(sc, mtod(m, caddr_t), pkt, len); - pkt += len; - datalen -= len; - *mp = m; - mp = &m->m_next; - } - - return (top); -} -/* - * Enable power on the interface. - */ -int -snc_enable(struct snc_softc *sc) -{ - -#ifdef SNCDEBUG - device_printf(sc->sc_dev, "snc_enable()\n"); -#endif /* SNCDEBUG */ - - if (sc->sc_enabled == 0 && sc->sc_enable != NULL) { - if ((*sc->sc_enable)(sc) != 0) { - device_printf(sc->sc_dev, "device enable failed\n"); - return (EIO); - } - } - - sc->sc_enabled = 1; - return (0); -} - -/* - * Disable power on the interface. - */ -void -snc_disable(struct snc_softc *sc) -{ - -#ifdef SNCDEBUG - device_printf(sc->sc_dev, "snc_disable()\n"); -#endif /* SNCDEBUG */ - - if (sc->sc_enabled != 0 && sc->sc_disable != NULL) { - (*sc->sc_disable)(sc); - sc->sc_enabled = 0; - } -} - - diff --git a/sys/dev/snc/dp83932reg.h b/sys/dev/snc/dp83932reg.h deleted file mode 100644 index 31ab550b83ca..000000000000 --- a/sys/dev/snc/dp83932reg.h +++ /dev/null @@ -1,271 +0,0 @@ -/* $FreeBSD$ */ -/* $NecBSD: dp83932reg.h,v 1.2 1999/02/12 05:50:13 kmatsuda Exp $ */ -/* $NetBSD: if_snreg.h,v 1.4 1997/06/15 20:20:12 scottr Exp $ */ - -/*- - * Copyright (c) 1991 Algorithmics Ltd (http://www.algor.co.uk) - * You may use, copy, and modify this program so long as you retain the - * copyright line. - */ - -/* - * if_snreg.h -- National Semiconductor DP8393X (SONIC) register defs - */ - -/* - * SONIC registers as seen by the processor - */ -#define SNCR_CR 0x00 /* Command */ -#define SNCR_DCR 0x01 /* Data Configuration */ -#define SNCR_RCR 0x02 /* Receive Control */ -#define SNCR_TCR 0x03 /* Transmit Control */ -#define SNCR_IMR 0x04 /* Interrupt Mask */ -#define SNCR_ISR 0x05 /* Interrupt Status */ -#define SNCR_UTDA 0x06 /* Upper Transmit Descriptor Address */ -#define SNCR_CTDA 0x07 /* Current Transmit Descriptor Address */ -#define SNCR_TPS 0x08 /* Transmit Packet Size */ -#define SNCR_TFC 0x09 /* Transmit Fragment Count */ -#define SNCR_TSA0 0x0a /* Transmit Start Address 0 */ -#define SNCR_TSA1 0x0b /* Transmit Start Address 1 */ -#define SNCR_TFS 0x0c /* Transmit Fragment Size */ -#define SNCR_URDA 0x0d /* Upper Receive Descriptor Address */ -#define SNCR_CRDA 0x0e /* Current Receive Descriptor Address */ -#define SNCR_CRBA0 0x0f /* Current Receive Buffer Address 0 */ -#define SNCR_CRBA1 0x10 /* Current Receive Buffer Address 1 */ -#define SNCR_RBWC0 0x11 /* Remaining Buffer Word Count 0 */ -#define SNCR_RBWC1 0x12 /* Remaining Buffer Word Count 1 */ -#define SNCR_EOBC 0x13 /* End Of Buffer Word Count */ -#define SNCR_URRA 0x14 /* Upper Receive Resource Address */ -#define SNCR_RSA 0x15 /* Resource Start Address */ -#define SNCR_REA 0x16 /* Resource End Address */ -#define SNCR_RRP 0x17 /* Resource Read Pointer */ -#define SNCR_RWP 0x18 /* Resource Write Pointer */ -#define SNCR_TRBA0 0x19 /* Temporary Receive Buffer Address 0 */ -#define SNCR_TRBA1 0x1a /* Temporary Receive Buffer Address 1 */ -#define SNCR_TBWC0 0x1b /* Temporary Buffer Word Count 0 */ -#define SNCR_TBWC1 0x1c /* Temporary Buffer Word Count 1 */ -#define SNCR_ADDR0 0x1d /* Address Generator 0 */ -#define SNCR_ADDR1 0x1e /* Address Generator 1 */ -#define SNCR_LLFA 0x1f /* Last Link Field Address */ -#define SNCR_TTDA 0x20 /* Temp Transmit Descriptor Address */ -#define SNCR_CEP 0x21 /* CAM Entry Pointer */ -#define SNCR_CAP2 0x22 /* CAM Address Port 2 */ -#define SNCR_CAP1 0x23 /* CAM Address Port 1 */ -#define SNCR_CAP0 0x24 /* CAM Address Port 0 */ -#define SNCR_CE 0x25 /* CAM Enable */ -#define SNCR_CDP 0x26 /* CAM Descriptor Pointer */ -#define SNCR_CDC 0x27 /* CAM Descriptor Count */ -#define SNCR_SR 0x28 /* Silicon Revision */ -#define SNCR_WT0 0x29 /* Watchdog Timer 0 */ -#define SNCR_WT1 0x2a /* Watchdog Timer 1 */ -#define SNCR_RSC 0x2b /* Receive Sequence Counter */ -#define SNCR_CRCT 0x2c /* CRC Error Tally */ -#define SNCR_FAET 0x2d /* FAE Tally */ -#define SNCR_MPT 0x2e /* Missed Packet Tally */ -#define SNCR_MDT 0x2f /* Maximum Deferral Timer */ -#define SNCR_RTC 0x30 /* Receive Test Control */ -#define SNCR_TTC 0x31 /* Transmit Test Control */ -#define SNCR_DTC 0x32 /* DMA Test Control */ -#define SNCR_CC0 0x33 /* CAM Comparison 0 */ -#define SNCR_CC1 0x34 /* CAM Comparison 1 */ -#define SNCR_CC2 0x35 /* CAM Comparison 2 */ -#define SNCR_CM 0x36 /* CAM Match */ -#define SNCR_RES1 0x37 /* reserved */ -#define SNCR_RES2 0x38 /* reserved */ -#define SNCR_RBC 0x39 /* Receiver Byte Count */ -#define SNCR_RES3 0x3a /* reserved */ -#define SNCR_TBO 0x3b /* Transmitter Backoff Counter */ -#define SNCR_TRC 0x3c /* Transmitter Random Counter */ -#define SNCR_TBM 0x3d /* Transmitter Backoff Mask */ -#define SNCR_RES4 0x3e /* Reserved */ -#define SNCR_DCR2 0x3f /* Data Configuration 2 (AVF) */ - -#define SNC_NREGS 0x40 - -/* - * Register Interpretations - */ - -/* - * The command register is used for issuing commands to the SONIC. - * With the exception of CR_RST, the bit is reset when the operation - * completes. - */ -#define CR_LCAM 0x0200 /* load CAM with descriptor at s_cdp */ -#define CR_RRRA 0x0100 /* read next RRA descriptor at s_rrp */ -#define CR_RST 0x0080 /* software reset */ -#define CR_ST 0x0020 /* start timer */ -#define CR_STP 0x0010 /* stop timer */ -#define CR_RXEN 0x0008 /* receiver enable */ -#define CR_RXDIS 0x0004 /* receiver disable */ -#define CR_TXP 0x0002 /* transmit packets */ -#define CR_HTX 0x0001 /* halt transmission */ - -/* - * The data configuration register establishes the SONIC's bus cycle - * operation. This register can only be accessed when the SONIC is in - * reset mode (s_cr.CR_RST is set.) - */ -#define DCR_EXBUS 0x8000 /* extended bus mode (AVF) */ -#define DCR_LBR 0x2000 /* latched bus retry */ -#define DCR_PO1 0x1000 /* programmable output 1 */ -#define DCR_PO0 0x0800 /* programmable output 0 */ -#define DCR_STERM 0x0400 /* synchronous termination */ -#define DCR_USR1 0x0200 /* reflects USR1 input pin */ -#define DCR_USR0 0x0100 /* reflects USR0 input pin */ -#define DCR_WC1 0x0080 /* wait state control 1 */ -#define DCR_WC0 0x0040 /* wait state control 0 */ -#define DCR_DW 0x0020 /* data width select */ -#define DCR_BMS 0x0010 /* DMA block mode select */ -#define DCR_RFT1 0x0008 /* receive FIFO threshold control 1 */ -#define DCR_RFT0 0x0004 /* receive FIFO threshold control 0 */ -#define DCR_TFT1 0x0002 /* transmit FIFO threshold control 1 */ -#define DCR_TFT0 0x0001 /* transmit FIFO threshold control 0 */ - -/* data configuration register aliases */ -#define DCR_SYNC DCR_STERM /* synchronous (memory cycle 2 clocks) */ -#define DCR_ASYNC 0 /* asynchronous (memory cycle 3 clocks) */ - -#define DCR_WAIT0 0 /* 0 wait states added */ -#define DCR_WAIT1 DCR_WC0 /* 1 wait state added */ -#define DCR_WAIT2 DCR_WC1 /* 2 wait states added */ -#define DCR_WAIT3 (DCR_WC1|DCR_WC0) /* 3 wait states added */ - -#define DCR_DW16 0 /* use 16-bit DMA accesses */ -#define DCR_DW32 DCR_DW /* use 32-bit DMA accesses */ - -#define DCR_DMAEF 0 /* DMA until TX/RX FIFO has emptied/filled */ -#define DCR_DMABLOCK DCR_BMS /* DMA until RX/TX threshold crossed */ - -#define DCR_RFT4 0 /* receive threshold 4 bytes */ -#define DCR_RFT8 DCR_RFT0 /* receive threshold 8 bytes */ -#define DCR_RFT16 DCR_RFT1 /* receive threshold 16 bytes */ -#define DCR_RFT24 (DCR_RFT1|DCR_RFT0) /* receive threshold 24 bytes */ - -#define DCR_TFT8 0 /* transmit threshold 8 bytes */ -#define DCR_TFT16 DCR_TFT0 /* transmit threshold 16 bytes */ -#define DCR_TFT24 DCR_TFT1 /* transmit threshold 24 bytes */ -#define DCR_TFT28 (DCR_TFT1|DCR_TFT0) /* transmit threshold 28 bytes */ - -/* - * The receive control register is used to filter incoming packets and - * provides status information on packets received. - * The contents of the register are copied into the RXpkt.status field - * when a packet is received. RCR_MC - RCR_PRX are then reset. - */ -#define RCR_ERR 0x8000 /* accept packets with CRC errors */ -#define RCR_RNT 0x4000 /* accept runt (length < 64) packets */ -#define RCR_BRD 0x2000 /* accept broadcast packets */ -#define RCR_PRO 0x1000 /* accept all physical address packets */ -#define RCR_AMC 0x0800 /* accept all multicast packets */ -#define RCR_LB1 0x0400 /* loopback control 1 */ -#define RCR_LB0 0x0200 /* loopback control 0 */ -#define RCR_MC 0x0100 /* multicast packet received */ -#define RCR_BC 0x0080 /* broadcast packet received */ -#define RCR_LPKT 0x0040 /* last packet in RBA (RBWC < EOBC) */ -#define RCR_CRS 0x0020 /* carrier sense activity */ -#define RCR_COL 0x0010 /* collision activity */ -#define RCR_CRC 0x0008 /* CRC error */ -#define RCR_FAE 0x0004 /* frame alignment error */ -#define RCR_LBK 0x0002 /* loopback packet received */ -#define RCR_PRX 0x0001 /* packet received without errors */ - -/* receiver control register aliases */ -/* the loopback control bits provide the following options */ -#define RCR_LBNONE 0 /* no loopback - normal operation */ -#define RCR_LBMAC RCR_LB0 /* MAC loopback */ -#define RCR_LBENDEC RCR_LB1 /* ENDEC loopback */ -#define RCR_LBTRANS (RCR_LB1|RCR_LB0) /* transceiver loopback */ - -/* - * The transmit control register controls the SONIC's transmit operations. - * TCR_PINT - TCR_EXDIS are loaded from the TXpkt.config field at the - * start of transmission. TCR_EXD-TCR_PTX are cleared at the beginning - * of transmission and updated when the transmission is completed. - */ -#define TCR_PINT 0x8000 /* interrupt when transmission starts */ -#define TCR_POWC 0x4000 /* program out of window collision timer */ -#define TCR_CRCI 0x2000 /* transmit packet without 4 byte FCS */ -#define TCR_EXDIS 0x1000 /* disable excessive deferral timer */ -#define TCR_EXD 0x0400 /* excessive deferrals occurred (>3.2ms) */ -#define TCR_DEF 0x0200 /* deferred transmissions occurred */ -#define TCR_NCRS 0x0100 /* carrier not present during transmission */ -#define TCR_CRSL 0x0080 /* carrier lost during transmission */ -#define TCR_EXC 0x0040 /* excessive collisions (>16) detected */ -#define TCR_OWC 0x0020 /* out of window (bad) collision occurred */ -#define TCR_PMB 0x0008 /* packet monitored bad - the tansmitted - * packet had a bad source address or CRC */ -#define TCR_FU 0x0004 /* FIFO underrun (memory access failed) */ -#define TCR_BCM 0x0002 /* byte count mismatch (TXpkt.pkt_size - * != sum(TXpkt.frag_size) */ -#define TCR_PTX 0x0001 /* packet transmitted without errors */ -#define TCR_NC 0xf000 /* after transmission, # of colls */ - -/* transmit control register aliases */ -#define TCR_OWCSFD 0 /* start after start of frame delimiter */ -#define TCR_OWCPRE TCR_POWC /* start after first bit of preamble */ - - -/* - * The interrupt mask register masks the interrupts that - * are generated from the interrupt status register. - * All reserved bits should be written with 0. - */ -#define IMR_BREN 0x4000 /* bus retry occurred enable */ -#define IMR_HBLEN 0x2000 /* heartbeat lost enable */ -#define IMR_LCDEN 0x1000 /* load CAM done interrupt enable */ -#define IMR_PINTEN 0x0800 /* programmable interrupt enable */ -#define IMR_PRXEN 0x0400 /* packet received enable */ -#define IMR_PTXEN 0x0200 /* packet transmitted enable */ -#define IMR_TXEREN 0x0100 /* transmit error enable */ -#define IMR_TCEN 0x0080 /* timer complete enable */ -#define IMR_RDEEN 0x0040 /* receive descriptors exhausted enable */ -#define IMR_RBEEN 0x0020 /* receive buffers exhausted enable */ -#define IMR_RBAEEN 0x0010 /* receive buffer area exceeded enable */ -#define IMR_CRCEN 0x0008 /* CRC tally counter rollover enable */ -#define IMR_FAEEN 0x0004 /* FAE tally counter rollover enable */ -#define IMR_MPEN 0x0002 /* MP tally counter rollover enable */ -#define IMR_RFOEN 0x0001 /* receive FIFO overrun enable */ - - -/* - * The interrupt status register indicates the source of an interrupt when - * the INT pin goes active. The interrupt is acknowledged by writing - * the appropriate bit(s) in this register. - */ -#define ISR_ALL 0x7fff /* all interrupts */ -#define ISR_BR 0x4000 /* bus retry occurred */ -#define ISR_HBL 0x2000 /* CD heartbeat lost */ -#define ISR_LCD 0x1000 /* load CAM command has completed */ -#define ISR_PINT 0x0800 /* programmed interrupt from TXpkt.config */ -#define ISR_PKTRX 0x0400 /* packet received */ -#define ISR_TXDN 0x0200 /* no remaining packets to be transmitted */ -#define ISR_TXER 0x0100 /* packet transmission caused error */ -#define ISR_TC 0x0080 /* timer complete */ -#define ISR_RDE 0x0040 /* receive descriptors exhausted */ -#define ISR_RBE 0x0020 /* receive buffers exhausted */ -#define ISR_RBAE 0x0010 /* receive buffer area exceeded */ -#define ISR_CRC 0x0008 /* CRC tally counter rollover */ -#define ISR_FAE 0x0004 /* FAE tally counter rollover */ -#define ISR_MP 0x0002 /* MP tally counter rollover */ -#define ISR_RFO 0x0001 /* receive FIFO overrun */ - -/* - * The second data configuration register allows additional user defined - * pins to be controlled. These bits are only available if s_dcr.DCR_EXBUS - * is set. - */ -#define DCR2_EXPO3 0x8000 /* EXUSR3 output */ -#define DCR2_EXPO2 0x4000 /* EXUSR2 output */ -#define DCR2_EXPO1 0x2000 /* EXUSR1 output */ -#define DCR2_EXPO0 0x1000 /* EXUSR0 output */ -#define DCR2_HD 0x0800 /* heart beat disable (83934/83936) */ -#define DCR2_JD 0x0200 /* TPI jabber timer disable (83934/83936) */ -#define DCR2_AUTO 0x0100 /* AUI/TPI auto selection (83934/83936) */ -#define DCR2_XWRAP 0x0040 /* TPI transceiver loopback (83934/83936) */ -#define DCR2_FD 0x0020 /* full duplex (83936) */ -#define DCR2_PHL 0x0010 /* extend HOLD signal by 1/2 clock */ -#define DCR2_LRDY 0x0008 /* set latched ready mode */ -#define DCR2_PCM 0x0004 /* packet compress on match */ -#define DCR2_PCNM 0x0002 /* packet compress on mismatch */ -#define DCR2_RJM 0x0001 /* reject on match */ diff --git a/sys/dev/snc/dp83932subr.c b/sys/dev/snc/dp83932subr.c deleted file mode 100644 index a34c554aa5e1..000000000000 --- a/sys/dev/snc/dp83932subr.c +++ /dev/null @@ -1,839 +0,0 @@ -/* $NecBSD: dp83932subr.c,v 1.5.6.2 1999/10/09 05:47:23 kmatsuda Exp $ */ -/* $NetBSD$ */ - -/*- - * Copyright (c) 1997, 1998, 1999 - * Kouichi Matsuda. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Kouichi Matsuda for - * NetBSD/pc98. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); -/* - * Routines of NEC PC-9801-83, 84, 103, 104, PC-9801N-25 and PC-9801N-J02, J02R - * Ethernet interface for NetBSD/pc98, ported by Kouichi Matsuda. - * - * These cards use National Semiconductor DP83934AVQB as Ethernet Controller - * and National Semiconductor NS46C46 as (64 * 16 bits) Microwire Serial EEPROM. - */ - -/* - * Modified for FreeBSD(98) 4.0 from NetBSD/pc98 1.4.2 by Motomichi Matsuzaki. - */ - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include - -static __inline u_int16_t snc_nec16_select_bank - (struct snc_softc *, u_int32_t, u_int32_t); - -/* - * Interface exists: make available by filling in network interface - * record. System will initialize the interface when it is ready - * to accept packets. - */ -int -sncsetup(struct snc_softc *sc, u_int8_t *lladdr) -{ - u_int32_t p, pp; - int i; - int offset; - - /* - * Put the pup in reset mode (sncinit() will fix it later), - * stop the timer, disable all interrupts and clear any interrupts. - */ - NIC_PUT(sc, SNCR_CR, CR_STP); - wbflush(); - NIC_PUT(sc, SNCR_CR, CR_RST); - wbflush(); - NIC_PUT(sc, SNCR_IMR, 0); - wbflush(); - NIC_PUT(sc, SNCR_ISR, ISR_ALL); - wbflush(); - - /* - * because the SONIC is basically 16bit device it 'concatenates' - * a higher buffer address to a 16 bit offset--this will cause wrap - * around problems near the end of 64k !! - */ - p = pp = 0; - - for (i = 0; i < NRRA; i++) { - sc->v_rra[i] = SONIC_GETDMA(p); - p += RXRSRC_SIZE(sc); - } - sc->v_rea = SONIC_GETDMA(p); - - p = SOALIGN(sc, p); - - sc->v_cda = SONIC_GETDMA(p); - p += CDA_SIZE(sc); - - p = SOALIGN(sc, p); - - for (i = 0; i < NTDA; i++) { - struct mtd *mtdp = &sc->mtda[i]; - mtdp->mtd_vtxp = SONIC_GETDMA(p); - p += TXP_SIZE(sc); - } - - p = SOALIGN(sc, p); - - if ((p - pp) > PAGE_SIZE) { - device_printf (sc->sc_dev, "sizeof RRA (%ld) + CDA (%ld) +" - "TDA (%ld) > PAGE_SIZE (%d). Punt!\n", - (u_long)sc->v_cda - (u_long)sc->v_rra[0], - (u_long)sc->mtda[0].mtd_vtxp - (u_long)sc->v_cda, - (u_long)p - (u_long)sc->mtda[0].mtd_vtxp, - PAGE_SIZE); - return(1); - } - - p = pp + PAGE_SIZE; - pp = p; - - sc->sc_nrda = PAGE_SIZE / RXPKT_SIZE(sc); - sc->v_rda = SONIC_GETDMA(p); - - p = pp + PAGE_SIZE; - - for (i = 0; i < NRBA; i++) { - sc->rbuf[i] = p; - p += PAGE_SIZE; - } - - pp = p; - offset = TXBSIZE; - for (i = 0; i < NTDA; i++) { - struct mtd *mtdp = &sc->mtda[i]; - - mtdp->mtd_vbuf = SONIC_GETDMA(p); - offset += TXBSIZE; - if (offset < PAGE_SIZE) { - p += TXBSIZE; - } else { - p = pp + PAGE_SIZE; - pp = p; - offset = TXBSIZE; - } - } - - return (0); -} - -/* - * miscellaneous NEC/SONIC detect functions. - */ - -/* - * check if a specified irq is acceptable. - */ -u_int8_t -snc_nec16_validate_irq(int irq) -{ - const u_int8_t encoded_irq[16] = { - -1, -1, -1, 0, -1, 1, 2, -1, -1, 3, 4, -1, 5, 6, -1, -1 - }; - - return encoded_irq[irq]; -} - -/* - * specify irq to board. - */ -int -snc_nec16_register_irq(struct snc_softc *sc, int irq) -{ - bus_space_tag_t iot = sc->sc_iot; - bus_space_handle_t ioh = sc->sc_ioh; - u_int8_t encoded_irq; - - encoded_irq = snc_nec16_validate_irq(irq); - if (encoded_irq == (u_int8_t) -1) { - printf("snc_nec16_register_irq: unsupported irq (%d)\n", irq); - return 0; - } - - /* select SNECR_IRQSEL register */ - bus_space_write_1(iot, ioh, SNEC_ADDR, SNECR_IRQSEL); - /* write encoded irq value */ - bus_space_write_1(iot, ioh, SNEC_CTRLB, encoded_irq); - - return 1; -} - -/* - * check if a specified memory base address is acceptable. - */ -int -snc_nec16_validate_mem(int maddr) -{ - - /* Check on Normal mode with max range, only */ - if ((maddr & ~0x1E000) != 0xC0000) { - printf("snc_nec16_validate_mem: " - "unsupported window base (0x%x)\n", maddr); - return 0; - } - - return 1; -} - -/* - * specify memory base address to board and map to first bank. - */ -int -snc_nec16_register_mem(struct snc_softc *sc, int maddr) -{ - bus_space_tag_t iot = sc->sc_iot; - bus_space_handle_t ioh = sc->sc_ioh; - - if (snc_nec16_validate_mem(maddr) == 0) - return 0; - - /* select SNECR_MEMSEL register */ - bus_space_write_1(iot, ioh, SNEC_ADDR, SNECR_MEMSEL); - /* write encoded memory base select value */ - bus_space_write_1(iot, ioh, SNEC_CTRLB, SNECR_MEMSEL_PHYS2EN(maddr)); - - /* - * set current bank to 0 (bottom) and map - */ - /* select SNECR_MEMBS register */ - bus_space_write_1(iot, ioh, SNEC_ADDR, SNECR_MEMBS); - /* select new bank */ - bus_space_write_1(iot, ioh, SNEC_CTRLB, - SNECR_MEMBS_B2EB(0) | SNECR_MEMBS_BSEN); - /* set current bank to 0 */ - sc->curbank = 0; - - return 1; -} - -int -snc_nec16_check_memory(bus_space_tag_t iot, bus_space_handle_t ioh, - bus_space_tag_t memt, bus_space_handle_t memh) -{ - u_int16_t val; - int i, j; - - val = 0; - for (i = 0; i < SNEC_NBANK; i++) { - /* select new bank */ - bus_space_write_1(iot, ioh, SNEC_ADDR, SNECR_MEMBS); - bus_space_write_1(iot, ioh, SNEC_CTRLB, - SNECR_MEMBS_B2EB(i) | SNECR_MEMBS_BSEN); - - /* write test pattern */ - for (j = 0; j < SNEC_NMEMS / 2; j++) { - bus_space_write_2(memt, memh, j * 2, val + j); - } - val += 0x1000; - } - - val = 0; - for (i = 0; i < SNEC_NBANK; i++) { - /* select new bank */ - bus_space_write_1(iot, ioh, SNEC_ADDR, SNECR_MEMBS); - bus_space_write_1(iot, ioh, SNEC_CTRLB, - SNECR_MEMBS_B2EB(i) | SNECR_MEMBS_BSEN); - - /* read test pattern */ - for (j = 0; j < SNEC_NMEMS / 2; j++) { - if (bus_space_read_2(memt, memh, j * 2) != val + j) - break; - } - - if (j < SNEC_NMEMS / 2) { - printf("snc_nec16_check_memory: " - "memory check failed at 0x%04x%04x" - "val 0x%04x != expected 0x%04x\n", i, j, - bus_space_read_2(memt, memh, j * 2), - val + j); - return 0; - } - val += 0x1000; - } - - /* zero clear mem */ - for (i = 0; i < SNEC_NBANK; i++) { - /* select new bank */ - bus_space_write_1(iot, ioh, SNEC_ADDR, SNECR_MEMBS); - bus_space_write_1(iot, ioh, SNEC_CTRLB, - SNECR_MEMBS_B2EB(i) | SNECR_MEMBS_BSEN); - - bus_space_set_region_4(memt, memh, 0, 0, SNEC_NMEMS >> 2); - } - - /* again read test if these are 0 */ - for (i = 0; i < SNEC_NBANK; i++) { - /* select new bank */ - bus_space_write_1(iot, ioh, SNEC_ADDR, SNECR_MEMBS); - bus_space_write_1(iot, ioh, SNEC_CTRLB, - SNECR_MEMBS_B2EB(i) | SNECR_MEMBS_BSEN); - - /* check if cleared */ - for (j = 0; j < SNEC_NMEMS; j += 2) { - if (bus_space_read_2(memt, memh, j) != 0) - break; - } - - if (j != SNEC_NMEMS) { - printf("snc_nec16_check_memory: " - "memory zero clear failed at 0x%04x%04x\n", i, j); - return 0; - } - } - - return 1; -} - -int -snc_nec16_detectsubr(bus_space_tag_t iot, bus_space_handle_t ioh, - bus_space_tag_t memt, bus_space_handle_t memh, int irq, int maddr, - u_int8_t type) -{ - u_int16_t cr; - u_int8_t ident; - int rv = 0; - - if (snc_nec16_validate_irq(irq) == (u_int8_t) -1) - return 0; - /* XXX: maddr already checked */ - if (snc_nec16_validate_mem(maddr) == 0) - return 0; - - bus_space_write_1(iot, ioh, SNEC_ADDR, SNECR_IDENT); - ident = bus_space_read_1(iot, ioh, SNEC_CTRLB); - if (ident == 0xff || ident == 0x00) { - /* not found */ - return 0; - } - - switch (type) { - case SNEC_TYPE_LEGACY: - rv = (ident == SNECR_IDENT_LEGACY_CBUS); - break; - case SNEC_TYPE_PNP: - rv = ((ident == SNECR_IDENT_PNP_CBUS) || - (ident == SNECR_IDENT_PNP_PCMCIABUS)); - break; - default: - break; - } - - if (rv == 0) { - printf("snc_nec16_detectsubr: parent bus mismatch\n"); - return 0; - } - - /* select SONIC register SNCR_CR */ - bus_space_write_1(iot, ioh, SNEC_ADDR, SNCR_CR); - bus_space_write_2(iot, ioh, SNEC_CTRL, CR_RXDIS | CR_STP | CR_RST); - DELAY(400); - - cr = bus_space_read_2(iot, ioh, SNEC_CTRL); - if (cr != (CR_RXDIS | CR_STP | CR_RST)) { -#ifdef DIAGNOSTIC - printf("snc_nec16_detectsubr: card reset failed, cr = 0x%04x\n", - cr); -#endif - return 0; - } - - if (snc_nec16_check_memory(iot, ioh, memt, memh) == 0) - return 0; - - return 1; -} - -/* XXX */ -#define SNC_VENDOR_NEC 0x00004c -#define SNC_NEC_SERIES_LEGACY_CBUS 0xa5 -#define SNC_NEC_SERIES_PNP_PCMCIA 0xd5 -#define SNC_NEC_SERIES_PNP_PCMCIA2 0x6d /* XXX */ -#define SNC_NEC_SERIES_PNP_CBUS 0x0d -#define SNC_NEC_SERIES_PNP_CBUS2 0x3d - -u_int8_t * -snc_nec16_detect_type(u_int8_t *myea) -{ - u_int32_t vendor = (myea[0] << 16) | (myea[1] << 8) | myea[2]; - u_int8_t series = myea[3]; - u_int8_t type = myea[4] & 0x80; - u_int8_t *typestr; - - switch (vendor) { - case SNC_VENDOR_NEC: - switch (series) { - case SNC_NEC_SERIES_LEGACY_CBUS: - if (type) - typestr = "NEC PC-9801-84"; - else - typestr = "NEC PC-9801-83"; - break; - case SNC_NEC_SERIES_PNP_CBUS: - case SNC_NEC_SERIES_PNP_CBUS2: - if (type) - typestr = "NEC PC-9801-104"; - else - typestr = "NEC PC-9801-103"; - break; - case SNC_NEC_SERIES_PNP_PCMCIA: - case SNC_NEC_SERIES_PNP_PCMCIA2: - /* XXX: right ? */ - if (type) - typestr = "NEC PC-9801N-J02R"; - else - typestr = "NEC PC-9801N-J02"; - break; - default: - typestr = "NEC unknown (PC-9801N-25?)"; - break; - } - break; - default: - typestr = "unknown (3rd vendor?)"; - break; - } - - return typestr; -} - -int -snc_nec16_get_enaddr(bus_space_tag_t iot, bus_space_handle_t ioh, - u_int8_t *myea) -{ - u_int8_t eeprom[SNEC_EEPROM_SIZE]; - u_int8_t rom_sum, sum = 0x00; - int i; - - snc_nec16_read_eeprom(iot, ioh, eeprom); - - for (i = SNEC_EEPROM_KEY0; i < SNEC_EEPROM_CKSUM; i++) { - sum = sum ^ eeprom[i]; - } - - rom_sum = eeprom[SNEC_EEPROM_CKSUM]; - - if (sum != rom_sum) { - printf("snc_nec16_get_enaddr: " - "checksum mismatch; calculated %02x != read %02x", - sum, rom_sum); - return 0; - } - - for (i = 0; i < ETHER_ADDR_LEN; i++) - myea[i] = eeprom[SNEC_EEPROM_SA0 + i]; - - return 1; -} - -/* - * read from NEC/SONIC NIC register. - */ -u_int16_t -snc_nec16_nic_get(struct snc_softc *sc, u_int8_t reg) -{ - u_int16_t val; - - /* select SONIC register */ - bus_space_write_1(sc->sc_iot, sc->sc_ioh, SNEC_ADDR, reg); - val = bus_space_read_2(sc->sc_iot, sc->sc_ioh, SNEC_CTRL); - - return val; -} - -/* - * write to NEC/SONIC NIC register. - */ -void -snc_nec16_nic_put(struct snc_softc *sc, u_int8_t reg, u_int16_t val) -{ - - /* select SONIC register */ - bus_space_write_1(sc->sc_iot, sc->sc_ioh, SNEC_ADDR, reg); - bus_space_write_2(sc->sc_iot, sc->sc_ioh, SNEC_CTRL, val); -} - - -/* - * select memory bank and map - * where exists specified (internal buffer memory) offset. - */ -static __inline u_int16_t -snc_nec16_select_bank(struct snc_softc *sc, u_int32_t base, u_int32_t offset) -{ - bus_space_tag_t iot = sc->sc_iot; - bus_space_handle_t ioh = sc->sc_ioh; - u_int8_t bank; - u_int16_t noffset; - - /* bitmode is fixed to 16 bit. */ - bank = (base + offset * 2) >> 13; - noffset = (base + offset * 2) & (SNEC_NMEMS - 1); - -#ifdef SNCDEBUG - if (noffset % 2) { - device_printf(sc->sc_dev, "noffset is odd (0x%04x)\n", - noffset); - } -#endif /* SNCDEBUG */ - - if (sc->curbank != bank) { - /* select SNECR_MEMBS register */ - bus_space_write_1(iot, ioh, SNEC_ADDR, SNECR_MEMBS); - /* select new bank */ - bus_space_write_1(iot, ioh, SNEC_CTRLB, - SNECR_MEMBS_B2EB(bank) | SNECR_MEMBS_BSEN); - /* update current bank */ - sc->curbank = bank; - } - - return noffset; -} - -/* - * write to SONIC descriptors. - */ -void -snc_nec16_writetodesc(struct snc_softc *sc, u_int32_t base, u_int32_t offset, - u_int16_t val) -{ - bus_space_tag_t memt = sc->sc_memt; - bus_space_handle_t memh = sc->sc_memh; - u_int16_t noffset; - - noffset = snc_nec16_select_bank(sc, base, offset); - - bus_space_write_2(memt, memh, noffset, val); -} - -/* - * read from SONIC descriptors. - */ -u_int16_t -snc_nec16_readfromdesc(struct snc_softc *sc, u_int32_t base, u_int32_t offset) -{ - bus_space_tag_t memt = sc->sc_memt; - bus_space_handle_t memh = sc->sc_memh; - u_int16_t noffset; - - noffset = snc_nec16_select_bank(sc, base, offset); - - return bus_space_read_2(memt, memh, noffset); -} - -/* - * read from SONIC data buffer. - */ -void -snc_nec16_copyfrombuf(struct snc_softc *sc, void *dst, u_int32_t offset, - size_t size) -{ - bus_space_tag_t memt = sc->sc_memt; - bus_space_handle_t memh = sc->sc_memh; - u_int16_t noffset; - u_int8_t* bptr = dst; - - noffset = snc_nec16_select_bank(sc, offset, 0); - - /* XXX: should check if offset + size < 0x2000. */ - - bus_space_barrier(memt, memh, noffset, size, - BUS_SPACE_BARRIER_READ); - - if (size > 3) { - if (noffset & 3) { - size_t asize = 4 - (noffset & 3); - - bus_space_read_region_1(memt, memh, noffset, - bptr, asize); - bptr += asize; - noffset += asize; - size -= asize; - } - bus_space_read_region_4(memt, memh, noffset, - (u_int32_t *) bptr, size >> 2); - bptr += size & ~3; - noffset += size & ~3; - size &= 3; - } - if (size) - bus_space_read_region_1(memt, memh, noffset, bptr, size); -} - -/* - * write to SONIC data buffer. - */ -void -snc_nec16_copytobuf(struct snc_softc *sc, void *src, u_int32_t offset, - size_t size) -{ - bus_space_tag_t memt = sc->sc_memt; - bus_space_handle_t memh = sc->sc_memh; - u_int16_t noffset, onoffset; - size_t osize = size; - u_int8_t* bptr = src; - - noffset = snc_nec16_select_bank(sc, offset, 0); - onoffset = noffset; - - /* XXX: should check if offset + size < 0x2000. */ - - if (size > 3) { - if (noffset & 3) { - size_t asize = 4 - (noffset & 3); - - bus_space_write_region_1(memt, memh, noffset, - bptr, asize); - bptr += asize; - noffset += asize; - size -= asize; - } - bus_space_write_region_4(memt, memh, noffset, - (u_int32_t *)bptr, size >> 2); - bptr += size & ~3; - noffset += size & ~3; - size -= size & ~3; - } - if (size) - bus_space_write_region_1(memt, memh, noffset, bptr, size); - - bus_space_barrier(memt, memh, onoffset, osize, - BUS_SPACE_BARRIER_WRITE); -} - -/* - * write (fill) 0 to SONIC data buffer. - */ -void -snc_nec16_zerobuf(struct snc_softc *sc, u_int32_t offset, size_t size) -{ - bus_space_tag_t memt = sc->sc_memt; - bus_space_handle_t memh = sc->sc_memh; - u_int16_t noffset, onoffset; - size_t osize = size; - - noffset = snc_nec16_select_bank(sc, offset, 0); - onoffset = noffset; - - /* XXX: should check if offset + size < 0x2000. */ - - if (size > 3) { - if (noffset & 3) { - size_t asize = 4 - (noffset & 3); - - bus_space_set_region_1(memt, memh, noffset, 0, asize); - noffset += asize; - size -= asize; - } - bus_space_set_region_4(memt, memh, noffset, 0, size >> 2); - noffset += size & ~3; - size -= size & ~3; - } - if (size) - bus_space_set_region_1(memt, memh, noffset, 0, size); - - bus_space_barrier(memt, memh, onoffset, osize, - BUS_SPACE_BARRIER_WRITE); -} - - -/* - * Routines to read bytes sequentially from EEPROM through NEC PC-9801-83, - * 84, 103, 104, PC-9801N-25 and PC-9801N-J02, J02R for NetBSD/pc98. - * Ported by Kouichi Matsuda. - * - * This algorism is generic to read data sequentially from 4-Wire - * Microwire Serial EEPROM. - */ - -#define SNEC_EEP_DELAY 1000 - -void -snc_nec16_read_eeprom(bus_space_tag_t iot, bus_space_handle_t ioh, - u_int8_t *data) -{ - u_int8_t n, val, bit; - - /* Read bytes from EEPROM; two bytes per an iteration. */ - for (n = 0; n < SNEC_EEPROM_SIZE / 2; n++) { - /* select SNECR_EEP */ - bus_space_write_1(iot, ioh, SNEC_ADDR, SNECR_EEP); - - bus_space_write_1(iot, ioh, SNEC_CTRLB, 0x00); - DELAY(SNEC_EEP_DELAY); - - /* Start EEPROM access. */ - bus_space_write_1(iot, ioh, SNEC_CTRLB, SNECR_EEP_CS); - DELAY(SNEC_EEP_DELAY); - - bus_space_write_1(iot, ioh, SNEC_CTRLB, - SNECR_EEP_CS | SNECR_EEP_SK); - DELAY(SNEC_EEP_DELAY); - - bus_space_write_1(iot, ioh, SNEC_CTRLB, - SNECR_EEP_CS | SNECR_EEP_DI); - DELAY(SNEC_EEP_DELAY); - - bus_space_write_1(iot, ioh, SNEC_CTRLB, - SNECR_EEP_CS | SNECR_EEP_SK | SNECR_EEP_DI); - DELAY(SNEC_EEP_DELAY); - - bus_space_write_1(iot, ioh, SNEC_CTRLB, - SNECR_EEP_CS | SNECR_EEP_DI); - DELAY(SNEC_EEP_DELAY); - - bus_space_write_1(iot, ioh, SNEC_CTRLB, - SNECR_EEP_CS | SNECR_EEP_SK | SNECR_EEP_DI); - DELAY(SNEC_EEP_DELAY); - - bus_space_write_1(iot, ioh, SNEC_CTRLB, SNECR_EEP_CS); - DELAY(SNEC_EEP_DELAY); - - bus_space_write_1(iot, ioh, SNEC_CTRLB, - SNECR_EEP_CS | SNECR_EEP_SK); - DELAY(SNEC_EEP_DELAY); - - /* Pass the iteration count to the chip. */ - for (bit = 0x20; bit != 0x00; bit >>= 1) { - bus_space_write_1(iot, ioh, SNEC_CTRLB, SNECR_EEP_CS | - ((n & bit) ? SNECR_EEP_DI : 0x00)); - DELAY(SNEC_EEP_DELAY); - - bus_space_write_1(iot, ioh, SNEC_CTRLB, - SNECR_EEP_CS | SNECR_EEP_SK | - ((n & bit) ? SNECR_EEP_DI : 0x00)); - DELAY(SNEC_EEP_DELAY); - } - - bus_space_write_1(iot, ioh, SNEC_CTRLB, SNECR_EEP_CS); - (void) bus_space_read_1(iot, ioh, SNEC_CTRLB); /* ACK */ - DELAY(SNEC_EEP_DELAY); - - /* Read a byte. */ - val = 0; - for (bit = 0x80; bit != 0x00; bit >>= 1) { - bus_space_write_1(iot, ioh, SNEC_CTRLB, - SNECR_EEP_CS | SNECR_EEP_SK); - DELAY(SNEC_EEP_DELAY); - - bus_space_write_1(iot, ioh, SNEC_CTRLB, SNECR_EEP_CS); - - if (bus_space_read_1(iot, ioh, SNEC_CTRLB) & SNECR_EEP_DO) - val |= bit; - } - *data++ = val; - - /* Read one more byte. */ - val = 0; - for (bit = 0x80; bit != 0x00; bit >>= 1) { - bus_space_write_1(iot, ioh, SNEC_CTRLB, - SNECR_EEP_CS | SNECR_EEP_SK); - DELAY(SNEC_EEP_DELAY); - - bus_space_write_1(iot, ioh, SNEC_CTRLB, SNECR_EEP_CS); - - if (bus_space_read_1(iot, ioh, SNEC_CTRLB) & SNECR_EEP_DO) - val |= bit; - } - *data++ = val; - - bus_space_write_1(iot, ioh, SNEC_CTRLB, 0x00); - DELAY(SNEC_EEP_DELAY); - } - -#ifdef SNCDEBUG - /* Report what we got. */ - data -= SNEC_EEPROM_SIZE; - log(LOG_INFO, "%s: EEPROM:" - " %02x%02x%02x%02x %02x%02x%02x%02x -" - " %02x%02x%02x%02x %02x%02x%02x%02x -" - " %02x%02x%02x%02x %02x%02x%02x%02x -" - " %02x%02x%02x%02x %02x%02x%02x%02x\n", - "snc_nec16_read_eeprom", - data[ 0], data[ 1], data[ 2], data[ 3], - data[ 4], data[ 5], data[ 6], data[ 7], - data[ 8], data[ 9], data[10], data[11], - data[12], data[13], data[14], data[15], - data[16], data[17], data[18], data[19], - data[20], data[21], data[22], data[23], - data[24], data[25], data[26], data[27], - data[28], data[29], data[30], data[31]); -#endif -} - -#ifdef SNCDEBUG -void -snc_nec16_dump_reg(bus_space_tag_t iot, bus_space_handle_t ioh) -{ - u_int8_t n; - u_int16_t val; - - printf("SONIC registers (word):"); - for (n = 0; n < SNC_NREGS; n++) { - /* select required SONIC register */ - bus_space_write_1(iot, ioh, SNEC_ADDR, n); - DELAY(10); - val = bus_space_read_2(iot, ioh, SNEC_CTRL); - if ((n % 0x10) == 0) - printf("\n%04x ", val); - else - printf("%04x ", val); - } - printf("\n"); - - printf("NEC/SONIC registers (byte):\n"); - for (n = SNECR_MEMBS; n <= SNECR_IDENT; n += 2) { - /* select required SONIC register */ - bus_space_write_1(iot, ioh, SNEC_ADDR, n); - DELAY(10); - val = (u_int16_t) bus_space_read_1(iot, ioh, SNEC_CTRLB); - printf("%04x ", val); - } - printf("\n"); -} - -#endif /* SNCDEBUG */ diff --git a/sys/dev/snc/dp83932subr.h b/sys/dev/snc/dp83932subr.h deleted file mode 100644 index f5df4f97970f..000000000000 --- a/sys/dev/snc/dp83932subr.h +++ /dev/null @@ -1,78 +0,0 @@ -/* $FreeBSD$ */ -/* $NecBSD: dp83932subr.h,v 1.5 1999/02/02 00:47:25 kmatsuda Exp $ */ -/* $NetBSD$ */ - -/*- - * Copyright (c) 1997, 1998, 1999 - * Kouichi Matsuda. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Kouichi Matsuda for - * NetBSD/pc98. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/* - * Routines of NEC PC-9801-83, 84, 103, 104, PC-9801N-25 and PC-9801N-J02, J02R - * Ethernet interface for NetBSD/pc98, ported by Kouichi Matsuda. - * - * These cards use National Semiconductor DP83934AVQB as Ethernet Controller - * and National Semiconductor NS46C46 as (64 * 16 bits) Microwire Serial EEPROM. - */ - -int sncsetup(struct snc_softc *, u_int8_t *); - -u_int8_t snc_nec16_validate_irq(int); -int snc_nec16_register_irq(struct snc_softc *, int); -int snc_nec16_validate_mem(int); -int snc_nec16_register_mem(struct snc_softc *, int); - -u_int16_t snc_nec16_nic_get(struct snc_softc *, u_int8_t); -void snc_nec16_nic_put(struct snc_softc *, u_int8_t, u_int16_t); - - -void snc_nec16_writetodesc - (struct snc_softc *, u_int32_t, u_int32_t, u_int16_t); -u_int16_t snc_nec16_readfromdesc - (struct snc_softc *, u_int32_t, u_int32_t); - -void snc_nec16_copyfrombuf(struct snc_softc *, void *, u_int32_t, size_t); -void snc_nec16_copytobuf(struct snc_softc *, void *, u_int32_t, size_t); -void snc_nec16_zerobuf(struct snc_softc *, u_int32_t, size_t); - -int snc_nec16_detectsubr - (bus_space_tag_t, bus_space_handle_t, bus_space_tag_t, - bus_space_handle_t, int, int, u_int8_t); -int snc_nec16_check_memory - (bus_space_tag_t, bus_space_handle_t, bus_space_tag_t, - bus_space_handle_t); - -int snc_nec16_get_enaddr - (bus_space_tag_t, bus_space_handle_t, u_int8_t *); -u_int8_t *snc_nec16_detect_type(u_int8_t *); -void snc_nec16_read_eeprom - (bus_space_tag_t, bus_space_handle_t, u_int8_t *); - -#ifdef SNCDEBUG -void snc_nec16_dump_reg(bus_space_tag_t, bus_space_handle_t); -#endif /* SNDEBUG */ diff --git a/sys/dev/snc/dp83932var.h b/sys/dev/snc/dp83932var.h deleted file mode 100644 index 6ee51085b9b0..000000000000 --- a/sys/dev/snc/dp83932var.h +++ /dev/null @@ -1,286 +0,0 @@ -/* $FreeBSD$ */ -/* $NecBSD: dp83932var.h,v 1.3 1999/01/24 01:39:51 kmatsuda Exp $ */ -/* $NetBSD: if_snvar.h,v 1.12 1998/05/01 03:42:47 scottr Exp $ */ - -/*- - * [NetBSD for NEC PC-98 series] - * Copyright (c) 1997, 1998, 1999 - * Kouichi Matsuda. All rights reserved. - * - * Copyright (c) 1991 Algorithmics Ltd (http://www.algor.co.uk) - * You may use, copy, and modify this program so long as you retain the - * copyright line. - */ - -/* - * if_snvar.h -- National Semiconductor DP8393X (SONIC) NetBSD/mac68k vars - */ -/* - * Modified for NetBSD/pc98 1.2.1 from NetBSD/mac68k 1.2D by Kouichi Matsuda. - * Make adapted for NEC PC-9801-83, 84, PC-9801-103, 104, PC-9801N-25 and - * PC-9801N-J02, J02R, which uses National Semiconductor DP83934AVQB as - * Ethernet Controller and National Semiconductor NS46C46 as - * (64 * 16 bits) Microwire Serial EEPROM. - */ - -/* - * Vendor types - */ - -/* - * SONIC buffers need to be aligned 16 or 32 bit aligned. - * These macros calculate and verify alignment. - */ -#define ROUNDUP(p, N) (((int) p + N - 1) & ~(N - 1)) - -#define SOALIGN(m, array) (m ? (ROUNDUP(array, 4)) : (ROUNDUP(array, 2))) - -#define LOWER(x) ((unsigned)(x) & 0xffff) -#define UPPER(x) ((unsigned)(x) >> 16) - -/* - * Memory access macros. Since we handle SONIC in 16 bit mode (PB5X0) - * and 32 bit mode (everything else) using a single GENERIC kernel - * binary, all structures have to be accessed using macros which can - * adjust the offsets appropriately. - */ -/* m is not sc->bitmode, we treat m as sc. */ -#define SWO(m, a, o, x) (*(m)->sc_writetodesc)((m), (a), (o), (x)) -#define SRO(m, a, o) (*(m)->sc_readfromdesc)((m), (a), (o)) - -/* - * Register access macros. We use bus_space_* to talk to the Sonic - * registers. A mapping table is used in case a particular configuration - * hooked the regs up at non-word offsets. - */ -#define NIC_GET(sc, reg) (*(sc)->sc_nic_get)(sc, reg) -#define NIC_PUT(sc, reg, val) (*(sc)->sc_nic_put)(sc, reg, val) - -#define SONIC_GETDMA(p) (p) - -/* pc98 does not have any write buffers to flush... */ -#define wbflush() - -/* - * buffer sizes in 32 bit mode - * 1 TXpkt is 4 hdr words + (3 * FRAGMAX) + 1 link word == 23 words == 92 bytes - * - * 1 RxPkt is 7 words == 28 bytes - * 1 Rda is 4 words == 16 bytes - * - * The CDA is 17 words == 68 bytes - * - * total space in page 0 = NTDA * 92 + NRRA * 16 + NRDA * 28 + 68 - */ - -#define NRBA 16 /* # receive buffers < NRRA */ -#define RBAMASK (NRBA-1) -#define NTDA 16 /* # transmit descriptors */ -#define NRRA 64 /* # receive resource descriptors */ -#define RRAMASK (NRRA-1) /* the reason why NRRA must be power of two */ - -#define FCSSIZE 4 /* size of FCS appended to packets */ - -/* - * maximum receive packet size plus 2 byte pad to make each - * one aligned. 4 byte slop (required for eobc) - */ -#define RBASIZE(sc) (sizeof(struct ether_header) + ETHERMTU + FCSSIZE + \ - ((sc)->bitmode ? 6 : 2)) - -/* - * transmit buffer area - */ -#define TXBSIZE 1536 /* 6*2^8 -- the same size as the 8390 TXBUF */ - -#define SN_NPAGES 2 + NRBA + (NTDA/2) - -typedef struct mtd { - u_int32_t mtd_vtxp; - u_int32_t mtd_vbuf; - struct mbuf *mtd_mbuf; -} mtd_t; - -/* - * The snc_softc for PC-98 if_snc. - */ -typedef struct snc_softc { - struct ifnet * sc_ifp; - - device_t sc_dev; - - struct resource * ioport; - int ioport_rid; - struct resource * iomem; - int iomem_rid; - struct resource * irq; - int irq_rid; - void * irq_handle; - - bus_space_tag_t sc_iot; /* bus identifier for io */ - bus_space_tag_t sc_memt; /* bus identifier for mem */ - bus_space_handle_t sc_ioh; /* io handle */ - bus_space_handle_t sc_memh; /* bus memory handle */ - - int bitmode; /* 32 bit mode == 1, 16 == 0 */ - - u_int16_t sncr_dcr; /* DCR for this instance */ - u_int16_t sncr_dcr2; /* DCR2 for this instance */ - - int sc_rramark; /* index into v_rra of wp */ - u_int32_t v_rra[NRRA]; /* DMA addresses of v_rra */ - u_int32_t v_rea; /* ptr to the end of the rra space */ - - int sc_rxmark; /* current hw pos in rda ring */ - int sc_rdamark; /* current sw pos in rda ring */ - int sc_nrda; /* total number of RDAs */ - u_int32_t v_rda; - - u_int32_t rbuf[NRBA]; - - struct mtd mtda[NTDA]; - int mtd_hw; /* idx of first mtd given to hw */ - int mtd_prev; /* idx of last mtd given to hardware */ - int mtd_free; /* next free mtd to use */ - int mtd_tlinko; /* - * offset of tlink of last txp given - * to SONIC. Need to clear EOL on - * this word to add a desc. - */ - int mtd_pint; /* Counter to set TXP_PINT */ - - u_int32_t v_cda; - - u_int8_t curbank; /* current window bank */ - - struct ifmedia sc_media; /* supported media information */ - - /* - * NIC register access functions: - */ - u_int16_t (*sc_nic_get) - (struct snc_softc *, u_int8_t); - void (*sc_nic_put) - (struct snc_softc *, u_int8_t, u_int16_t); - - /* - * Memory functions: - * - * copy to/from descriptor - * copy to/from buffer - * zero bytes in buffer - */ - void (*sc_writetodesc) - (struct snc_softc *, u_int32_t, u_int32_t, u_int16_t); - u_int16_t (*sc_readfromdesc) - (struct snc_softc *, u_int32_t, u_int32_t); - void (*sc_copytobuf) - (struct snc_softc *, void *, u_int32_t, size_t); - void (*sc_copyfrombuf) - (struct snc_softc *, void *, u_int32_t, size_t); - void (*sc_zerobuf) - (struct snc_softc *, u_int32_t, size_t); - - /* - * Machine-dependent functions: - * - * hardware reset hook - may be NULL - * hardware init hook - may be NULL - * media change hook - may be NULL - */ - void (*sc_hwreset)(struct snc_softc *); - void (*sc_hwinit)(struct snc_softc *); - int (*sc_mediachange)(struct snc_softc *); - void (*sc_mediastatus)(struct snc_softc *, struct ifmediareq *); - - int sc_enabled; /* boolean; power enabled on interface */ - - int (*sc_enable)(struct snc_softc *); - void (*sc_disable)(struct snc_softc *); - - void *sc_sh; /* shutdownhook cookie */ - int gone; - struct mtx sc_lock; - struct callout sc_timer; - int sc_tx_timeout; -} snc_softc_t; - -#define SNC_LOCK(sc) mtx_lock(&(sc)->sc_lock) -#define SNC_UNLOCK(sc) mtx_unlock(&(sc)->sc_lock) -#define SNC_ASSERT_LOCKED(sc) mtx_assert(&(sc)->sc_lock, MA_OWNED) - -/* - * Accessing SONIC data structures and registers as 32 bit values - * makes code endianness independent. The SONIC is however always in - * bigendian mode so it is necessary to ensure that data structures shared - * between the CPU and the SONIC are always in bigendian order. - */ - -/* - * Receive Resource Descriptor - * This structure describes the buffers into which packets - * will be received. Note that more than one packet may be - * packed into a single buffer if constraints permit. - */ -#define RXRSRC_PTRLO 0 /* buffer address LO */ -#define RXRSRC_PTRHI 1 /* buffer address HI */ -#define RXRSRC_WCLO 2 /* buffer size (16bit words) LO */ -#define RXRSRC_WCHI 3 /* buffer size (16bit words) HI */ - -#define RXRSRC_SIZE(sc) (sc->bitmode ? (4 * 4) : (4 * 2)) - -/* - * Receive Descriptor - * This structure holds information about packets received. - */ -#define RXPKT_STATUS 0 -#define RXPKT_BYTEC 1 -#define RXPKT_PTRLO 2 -#define RXPKT_PTRHI 3 -#define RXPKT_SEQNO 4 -#define RXPKT_RLINK 5 -#define RXPKT_INUSE 6 -#define RXPKT_SIZE(sc) (sc->bitmode ? (7 * 4) : (7 * 2)) - -#define RBASEQ(x) (((x)>>8)&0xff) -#define PSNSEQ(x) ((x) & 0xff) - -/* - * Transmit Descriptor - * This structure holds information about packets to be transmitted. - */ -#define FRAGMAX 8 /* maximum number of fragments in a packet */ - -#define TXP_STATUS 0 /* + transmitted packet status */ -#define TXP_CONFIG 1 /* transmission configuration */ -#define TXP_PKTSIZE 2 /* entire packet size in bytes */ -#define TXP_FRAGCNT 3 /* # fragments in packet */ - -#define TXP_FRAGOFF 4 /* offset to first fragment */ -#define TXP_FRAGSIZE 3 /* size of each fragment desc */ -#define TXP_FPTRLO 0 /* ptr to packet fragment LO */ -#define TXP_FPTRHI 1 /* ptr to packet fragment HI */ -#define TXP_FSIZE 2 /* fragment size */ - -#define TXP_WORDS (TXP_FRAGOFF + (FRAGMAX*TXP_FRAGSIZE) + 1) /* 1 for tlink */ -#define TXP_SIZE(sc) ((sc->bitmode) ? (TXP_WORDS*4) : (TXP_WORDS*2)) - -#define EOL 0x0001 /* end of list marker for link fields */ - -/* - * CDA, the CAM descriptor area. The SONIC has a 16 entry CAM to - * match incoming addresses against. It is programmed via DMA - * from a memory region. - */ -#define MAXCAM 16 /* number of user entries in CAM */ -#define CDA_CAMDESC 4 /* # words i na descriptor */ -#define CDA_CAMEP 0 /* CAM Address Port 0 xx-xx-xx-xx-YY-YY */ -#define CDA_CAMAP0 1 /* CAM Address Port 1 xx-xx-YY-YY-xx-xx */ -#define CDA_CAMAP1 2 /* CAM Address Port 2 YY-YY-xx-xx-xx-xx */ -#define CDA_CAMAP2 3 -#define CDA_ENABLE 64 /* mask enabling CAM entries */ -#define CDA_SIZE(sc) ((4*16 + 1) * ((sc->bitmode) ? 4 : 2)) - -int sncconfig(struct snc_softc *, int *, int, int, u_int8_t *); -void sncintr(void *); -void sncshutdown(void *); diff --git a/sys/dev/snc/if_snc.c b/sys/dev/snc/if_snc.c deleted file mode 100644 index 99f458354a7d..000000000000 --- a/sys/dev/snc/if_snc.c +++ /dev/null @@ -1,255 +0,0 @@ -/*- - * Copyright (c) 1995, David Greenman - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice unmodified, this list of conditions, and the following - * disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -#include -__FBSDID("$FreeBSD$"); - -/* - * National Semiconductor DP8393X SONIC Driver - * - * This is the bus independent attachment on FreeBSD 4.x - * written by Motomichi Matsuzaki - */ - -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -/* devclass for "snc" */ -devclass_t snc_devclass; - -/**************************************************************** - Resource management functions - ****************************************************************/ - -/* - * Allocate a port resource with the given resource id. - */ -int -snc_alloc_port(device_t dev, int rid) -{ - struct snc_softc *sc = device_get_softc(dev); - struct resource *res; - - res = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, - SNEC_NREGS, RF_ACTIVE); - if (res) { - sc->ioport = res; - sc->ioport_rid = rid; - sc->sc_iot = rman_get_bustag(res); - sc->sc_ioh = rman_get_bushandle(res); - return (0); - } else { - device_printf(dev, "can't assign port\n"); - return (ENOENT); - } -} - -/* - * Allocate a memory resource with the given resource id. - */ -int -snc_alloc_memory(device_t dev, int rid) -{ - struct snc_softc *sc = device_get_softc(dev); - struct resource *res; - - res = bus_alloc_resource_anywhere(dev, SYS_RES_MEMORY, &rid, - SNEC_NMEMS, RF_ACTIVE); - if (res) { - sc->iomem = res; - sc->iomem_rid = rid; - sc->sc_memt = rman_get_bustag(res); - sc->sc_memh = rman_get_bushandle(res); - return (0); - } else { - device_printf(dev, "can't assign memory\n"); - return (ENOENT); - } -} - -/* - * Allocate an irq resource with the given resource id. - */ -int -snc_alloc_irq(device_t dev, int rid, int flags) -{ - struct snc_softc *sc = device_get_softc(dev); - struct resource *res; - - res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE | flags); - if (res) { - sc->irq = res; - sc->irq_rid = rid; - return (0); - } else { - device_printf(dev, "can't assign irq\n"); - return (ENOENT); - } -} - -/* - * Release all resources - */ -void -snc_release_resources(device_t dev) -{ - struct snc_softc *sc = device_get_softc(dev); - - if (sc->ioport) { - bus_release_resource(dev, SYS_RES_IOPORT, - sc->ioport_rid, sc->ioport); - sc->ioport = 0; - } - if (sc->iomem) { - bus_release_resource(dev, SYS_RES_MEMORY, - sc->iomem_rid, sc->iomem); - sc->iomem = 0; - } - if (sc->irq) { - bus_release_resource(dev, SYS_RES_IRQ, - sc->irq_rid, sc->irq); - sc->irq = 0; - } - if (sc->sc_ifp) { - if_free(sc->sc_ifp); - sc->sc_ifp = 0; - } -} - -/**************************************************************** - Probe routine - ****************************************************************/ - -int -snc_probe(device_t dev, int type) -{ - struct snc_softc *sc = device_get_softc(dev); - - return snc_nec16_detectsubr(sc->sc_iot, sc->sc_ioh, - sc->sc_memt, sc->sc_memh, - rman_get_start(sc->irq), - rman_get_start(sc->iomem), - type); -} - -/**************************************************************** - Attach routine - ****************************************************************/ - -int -snc_attach(device_t dev) -{ - struct snc_softc *sc = device_get_softc(dev); - u_int8_t myea[ETHER_ADDR_LEN]; - int error; - - if (snc_nec16_register_irq(sc, rman_get_start(sc->irq)) == 0 || - snc_nec16_register_mem(sc, rman_get_start(sc->iomem)) == 0) { - snc_release_resources(dev); - return(ENOENT); - } - - snc_nec16_get_enaddr(sc->sc_iot, sc->sc_ioh, myea); - device_printf(dev, "%s Ethernet\n", snc_nec16_detect_type(myea)); - - sc->sc_dev = dev; - - sc->sncr_dcr = DCR_SYNC | DCR_WAIT0 | - DCR_DMABLOCK | DCR_RFT16 | DCR_TFT28; - sc->sncr_dcr2 = 0; /* XXX */ - sc->bitmode = 0; /* 16 bit card */ - - sc->sc_nic_put = snc_nec16_nic_put; - sc->sc_nic_get = snc_nec16_nic_get; - sc->sc_writetodesc = snc_nec16_writetodesc; - sc->sc_readfromdesc = snc_nec16_readfromdesc; - sc->sc_copytobuf = snc_nec16_copytobuf; - sc->sc_copyfrombuf = snc_nec16_copyfrombuf; - sc->sc_zerobuf = snc_nec16_zerobuf; - - /* sncsetup returns 1 if something fails */ - if (sncsetup(sc, myea)) { - snc_release_resources(dev); - return(ENOENT); - } - - mtx_init(&sc->sc_lock, device_get_nameunit(dev), MTX_NETWORK_LOCK, - MTX_DEF); - callout_init_mtx(&sc->sc_timer, &sc->sc_lock, 0); - error = sncconfig(sc, NULL, 0, 0, myea); - if (error) { - snc_release_resources(dev); - mtx_destroy(&sc->sc_lock); - return (error); - } - - error = bus_setup_intr(dev, sc->irq, INTR_TYPE_NET | INTR_MPSAFE, - NULL, sncintr, sc, &sc->irq_handle); - if (error) { - printf("snc_isa_attach: bus_setup_intr() failed\n"); - ether_ifdetach(sc->sc_ifp); - snc_release_resources(dev); - mtx_destroy(&sc->sc_lock); - return (error); - } - - return 0; -} - -/**************************************************************** - Shutdown routine - ****************************************************************/ - -int -snc_shutdown(device_t dev) -{ - struct snc_softc *sc = device_get_softc(dev); - - SNC_LOCK(sc); - sncshutdown(sc); - SNC_UNLOCK(sc); - - return (0); -} diff --git a/sys/dev/snc/if_snc_cbus.c b/sys/dev/snc/if_snc_cbus.c deleted file mode 100644 index 484b677967a3..000000000000 --- a/sys/dev/snc/if_snc_cbus.c +++ /dev/null @@ -1,211 +0,0 @@ -/*- - * Copyright (c) 1995, David Greenman - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice unmodified, this list of conditions, and the following - * disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -#include -__FBSDID("$FreeBSD$"); - -/* - * National Semiconductor DP8393X SONIC Driver - * - * This is the C-bus specific attachment on FreeBSD - * written by Motomichi Matsuzaki - */ - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include /* as dependency for isa/isa_common.h */ -#include /* for snc_isapnp_reconfig() */ - -#include -#include -#include - -static void snc_isapnp_reconfig (device_t); -static int snc_isa_probe (device_t); -static int snc_isa_attach (device_t); - -static struct isa_pnp_id snc_ids[] = { - { 0x6180a3b8, NULL }, /* NEC8061 NEC PC-9801-104 */ - { 0, NULL } -}; - -static void -snc_isapnp_reconfig(device_t dev) -{ - struct isa_device *idev = DEVTOISA(dev); - struct isa_config config; - rman_res_t start, count; - int rid; - - bzero(&config, sizeof(config)); - - for (rid = 0; rid < ISA_NMEM; rid++) { - if (bus_get_resource(dev, SYS_RES_MEMORY, rid, &start, &count)) - break; - config.ic_mem[rid].ir_start = start; - config.ic_mem[rid].ir_end = start; - config.ic_mem[rid].ir_size = count; - } - config.ic_nmem = rid; - for (rid = 0; rid < ISA_NPORT; rid++) { - if (bus_get_resource(dev, SYS_RES_IOPORT, rid, &start, &count)) - break; - config.ic_port[rid].ir_start = start; - config.ic_port[rid].ir_end = start; - config.ic_port[rid].ir_size = count; - } - config.ic_nport = rid; - for (rid = 0; rid < ISA_NIRQ; rid++) { - if (bus_get_resource(dev, SYS_RES_IRQ, rid, &start, &count)) - break; - config.ic_irqmask[rid] = 1 << start; - } - config.ic_nirq = rid; - for (rid = 0; rid < ISA_NDRQ; rid++) { - if (bus_get_resource(dev, SYS_RES_DRQ, rid, &start, &count)) - break; - config.ic_drqmask[rid] = 1 << start; - } - config.ic_ndrq = rid; - - idev->id_config_cb(idev->id_config_arg, &config, 1); -} - -static int -snc_isa_probe(device_t dev) -{ - struct snc_softc *sc = device_get_softc(dev); - int type; - int error = 0; - - bzero(sc, sizeof(struct snc_softc)); - - /* Check isapnp ids */ - error = ISA_PNP_PROBE(device_get_parent(dev), dev, snc_ids); - - /* If the card had a PnP ID that didn't match any we know about */ - if (error == ENXIO) { - return(error); - } - - switch (error) { - case 0: /* Matched PnP */ - type = SNEC_TYPE_PNP; - break; - - case ENOENT: /* Legacy ISA */ - type = SNEC_TYPE_LEGACY; - break; - - default: /* If we had some other problem. */ - return(error); - } - - if (type == SNEC_TYPE_PNP && isa_get_portsize(dev) == 0) { - int port; - int rid = 0; - struct resource *res = NULL; - - for (port = 0x0888; port <= 0x3888; port += 0x1000) { - bus_set_resource(dev, SYS_RES_IOPORT, rid, - port, SNEC_NREGS); - res = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, - &rid, SNEC_NREGS, - 0 /* !RF_ACTIVE */); - if (res) break; - } - - printf("snc_isa_probe: broken PnP resource, "); - if (res) { - printf("use port 0x%x\n", port); - bus_release_resource(dev, SYS_RES_IOPORT, rid, res); - snc_isapnp_reconfig(dev); - } else { - printf("and can't find port\n"); - } - } - - error = snc_alloc_port(dev, 0); - error = max(error, snc_alloc_memory(dev, 0)); - error = max(error, snc_alloc_irq(dev, 0, 0)); - - if (!error && !snc_probe(dev, type)) - error = ENOENT; - - snc_release_resources(dev); - return (error); -} - -static int -snc_isa_attach(device_t dev) -{ - struct snc_softc *sc = device_get_softc(dev); - - bzero(sc, sizeof(struct snc_softc)); - - snc_alloc_port(dev, 0); - snc_alloc_memory(dev, 0); - snc_alloc_irq(dev, 0, 0); - - /* This interface is always enabled. */ - sc->sc_enabled = 1; - - return snc_attach(dev); -} - -static device_method_t snc_isa_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, snc_isa_probe), - DEVMETHOD(device_attach, snc_isa_attach), - DEVMETHOD(device_shutdown, snc_shutdown), - - { 0, 0 } -}; - -static driver_t snc_isa_driver = { - "snc", - snc_isa_methods, - sizeof(struct snc_softc) -}; - -DRIVER_MODULE(snc, isa, snc_isa_driver, snc_devclass, 0, 0); -MODULE_DEPEND(snc, isa, 1, 1, 1); -MODULE_DEPEND(snc, ether, 1, 1, 1); diff --git a/sys/dev/snc/if_snc_pccard.c b/sys/dev/snc/if_snc_pccard.c deleted file mode 100644 index 7f975be19163..000000000000 --- a/sys/dev/snc/if_snc_pccard.c +++ /dev/null @@ -1,164 +0,0 @@ -/*- - * Copyright (c) 1995, David Greenman - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice unmodified, this list of conditions, and the following - * disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -#include -__FBSDID("$FreeBSD$"); - -/* - * National Semiconductor DP8393X SONIC Driver - * - * This is the PC Card attachment on FreeBSD - * written by Motomichi Matsuzaki and - * Hiroshi Yamashita - */ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include "pccarddevs.h" - -static const struct pccard_product snc_pccard_products[] = { - PCMCIA_CARD(NEC, PC9801N_J02), - PCMCIA_CARD(NEC, PC9801N_J02R), - { NULL } -}; - -/* - * PC Card (PCMCIA) specific code. - */ -static int snc_pccard_probe(device_t); -static int snc_pccard_attach(device_t); -static int snc_pccard_detach(device_t); - - -static device_method_t snc_pccard_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, snc_pccard_probe), - DEVMETHOD(device_attach, snc_pccard_attach), - DEVMETHOD(device_detach, snc_pccard_detach), - - { 0, 0 } -}; - -static driver_t snc_pccard_driver = { - "snc", - snc_pccard_methods, - sizeof(struct snc_softc) -}; - -DRIVER_MODULE(snc, pccard, snc_pccard_driver, snc_devclass, 0, 0); -MODULE_DEPEND(snc, ether, 1, 1, 1); -PCCARD_PNP_INFO(snc_pccard_products); - -/* - * snc_pccard_detach - detach this instance from the device. - */ -static int -snc_pccard_detach(device_t dev) -{ - struct snc_softc *sc = device_get_softc(dev); - struct ifnet *ifp = sc->sc_ifp; - - if (sc->gone) { - device_printf(dev, "already unloaded\n"); - return (0); - } - SNC_LOCK(sc); - sncshutdown(sc); - SNC_UNLOCK(sc); - callout_drain(&sc->sc_timer); - ether_ifdetach(ifp); - sc->gone = 1; - bus_teardown_intr(dev, sc->irq, sc->irq_handle); - snc_release_resources(dev); - mtx_destroy(&sc->sc_lock); - return (0); -} - -/* - * Probe the pccard. - */ -static int -snc_pccard_probe(device_t dev) -{ - const struct pccard_product *pp; - - if ((pp = pccard_product_lookup(dev, snc_pccard_products, - sizeof(snc_pccard_products[0]), NULL)) == NULL) - return (EIO); - if (pp->pp_name != NULL) - device_set_desc(dev, pp->pp_name); - return (0); -} - -static int -snc_pccard_attach(device_t dev) -{ - struct snc_softc *sc = device_get_softc(dev); - int error; - - /* - * Not sure that this belongs here or in snc_pccard_attach - */ - if ((error = snc_alloc_port(dev, 0)) != 0) - goto err; - if ((error = snc_alloc_memory(dev, 0)) != 0) - goto err; - if ((error = snc_alloc_irq(dev, 0, 0)) != 0) - goto err; - if ((error = snc_probe(dev, SNEC_TYPE_PNP)) != 0) - goto err; - /* This interface is always enabled. */ - sc->sc_enabled = 1; - /* pccard_get_ether(dev, ether_addr); */ - if ((error = snc_attach(dev)) != 0) - goto err; - return 0; -err:; - snc_release_resources(dev); - return error; -} diff --git a/sys/dev/snc/if_sncreg.h b/sys/dev/snc/if_sncreg.h deleted file mode 100644 index 5973881e8904..000000000000 --- a/sys/dev/snc/if_sncreg.h +++ /dev/null @@ -1,140 +0,0 @@ -/* $FreeBSD$ */ -/* $NecBSD: if_snreg.h,v 1.3 1999/01/24 01:39:52 kmatsuda Exp $ */ -/* $NetBSD$ */ - -/*- - * Copyright (c) 1997, 1998, 1999 - * Kouichi Matsuda. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Kouichi Matsuda for - * NetBSD/pc98. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/* - * Modified for NetBSD/pc98 1.2.1 from NetBSD/mac68k 1.2D by Kouichi Matsuda. - * Make adapted for NEC PC-9801-83, 84, PC-9801-103, 104, PC-9801N-25 and - * PC-9801N-J02R, which uses National Semiconductor DP83934AVQB as - * Ethernet Controller and National Semiconductor NS46C46 as (64 * 16 bits) - * Microwire Serial EEPROM. - */ - -/* - * XXX: Should not be HERE. (Should be shared with...) - */ - -/* - * NEC/SONIC port mappings, offset from iobase. - */ -#define SNEC_CTRL 0 /* SONIC control port (word) */ -#define SNEC_CTRLB 1 /* NEC/SONIC control port (byte) */ -#define SNEC_RSVD0 2 /* not used */ -#define SNEC_ADDR 3 /* SONIC, NEC/SONIC register address set port */ -#define SNEC_RSVD1 4 /* not used */ -#define SNEC_RSVD2 5 /* not used */ - -#define SNEC_NREGS 6 - -/* bank memory size */ -#define SNEC_NMEMS (PAGE_SIZE * 2) -/* how many bank */ -#define SNEC_NBANK 0x10 -/* internal buffer size */ -#define SNEC_NBUF (SNEC_NMEMS * SNEC_NBANK) - - -/* - * NEC/SONIC specific internal registers. - */ - -/* - * Memory Bank Select Register (MEMBS) - */ -#define SNECR_MEMBS 0x80 -#define SNECR_MEMBS_BSEN 0x01 /* enable memory bank select */ -#define SNECR_MEMBS_EBNMSK 0x1c /* encoded bank select number */ -/* Translate bank number to encoded bank select number. */ -#define SNECR_MEMBS_B2EB(bank) (bank << 2) -#define SNECR_MEMBS_PCMCIABUS 0x80 /* bus type identification */ - -/* - * Memory Base Address Select Register (MEMSEL) - */ -#define SNECR_MEMSEL 0x82 -/* Translate base phys address to encoded select number. */ -#define SNECR_MEMSEL_PHYS2EN(maddr) ((maddr >> 13) & 0x0f) - -/* - * Encoded Irq Select Register (IRQSEL) - */ -#define SNECR_IRQSEL 0x84 - -/* - * EEPROM Access Register (EEP) - */ -#define SNECR_EEP 0x86 -#define SNECR_EEP_DI 0x10 /* EEPROM Serial Data Input (high) */ -#define SNECR_EEP_CS 0x20 /* EEPROM Chip Select (high) */ -#define SNECR_EEP_SK 0x40 /* EEPROM Serial Data Clock (high) */ -#define SNECR_EEP_DO 0x80 /* EEPROM Serial Data Output (high) */ - -/* EEPROM data locations */ -#define SNEC_EEPROM_KEY0 6 /* Station Address Check Sum Key #1 */ -#define SNEC_EEPROM_KEY1 7 /* Station Address Check Sum Key #2 */ -#define SNEC_EEPROM_SA0 8 /* Station Address #1 */ -#define SNEC_EEPROM_SA1 9 /* Station Address #2 */ -#define SNEC_EEPROM_SA2 10 /* Station Address #3 */ -#define SNEC_EEPROM_SA3 11 /* Station Address #4 */ -#define SNEC_EEPROM_SA4 12 /* Station Address #5 */ -#define SNEC_EEPROM_SA5 13 /* Station Address #6 */ -#define SNEC_EEPROM_CKSUM 14 /* Station Address Check Sum */ - -#define SNEC_EEPROM_SIZE 32 /* valid EEPROM data (max 128 bytes) */ - -/* - * Bus and Mode Identification Register (IDENT) - */ -#define SNECR_IDENT 0x88 - /* Bit 0: Bus Identification. */ -#define SNECR_IDENT_CBUS 0x01 /* on PC-98 C-Bus */ -#define SNECR_IDENT_PCMCIABUS 0x00 /* on PCMCIA Bus */ - /* Bit 2: always 1 */ -#define SNECR_IDENT_MAGIC 0x04 - /* Bit 4: Bus Configuration Mode Identification. */ -#define SNECR_IDENT_PNP 0x10 /* Plug and Play (C-Bus and PCMCIA) */ -#define SNECR_IDENT_LEGACY 0x00 /* Legacy C-Bus */ - -#define SNECR_IDENT_LEGACY_CBUS \ - (SNECR_IDENT_LEGACY | SNECR_IDENT_MAGIC | SNECR_IDENT_CBUS) -#define SNECR_IDENT_PNP_CBUS \ - (SNECR_IDENT_PNP | SNECR_IDENT_MAGIC | SNECR_IDENT_CBUS) -#define SNECR_IDENT_PNP_PCMCIABUS \ - (SNECR_IDENT_PNP | SNECR_IDENT_MAGIC | SNECR_IDENT_PCMCIABUS) - -/* - * XXX: parent bus type aliases - */ -#define SNEC_TYPE_LEGACY 0 -#define SNEC_TYPE_PNP 1 - diff --git a/sys/dev/snc/if_sncvar.h b/sys/dev/snc/if_sncvar.h deleted file mode 100644 index 05d699be0c3b..000000000000 --- a/sys/dev/snc/if_sncvar.h +++ /dev/null @@ -1,47 +0,0 @@ -/*- - * Copyright (c) 1995, David Greenman - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice unmodified, this list of conditions, and the following - * disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -/* - * National Semiconductor DP8393X SONIC Driver - * - * This is the machine dependent attachment on FreeBSD 4.x - * written by Motomichi Matsuzaki - */ - -extern devclass_t snc_devclass; - -void snc_release_resources (device_t); -int snc_alloc_port (device_t, int); -int snc_alloc_memory (device_t, int); -int snc_alloc_irq (device_t, int, int); - -int snc_probe (device_t, int); -int snc_attach (device_t); - -int snc_shutdown (device_t); diff --git a/sys/dev/sound/isa/mss.c b/sys/dev/sound/isa/mss.c index 4f5548e91ff5..68ae2d9de065 100644 --- a/sys/dev/sound/isa/mss.c +++ b/sys/dev/sound/isa/mss.c @@ -96,9 +96,7 @@ static driver_intr_t mss_intr; /* prototypes for local functions */ static int mss_detect(device_t dev, struct mss_info *mss); -#ifndef PC98 static int opti_detect(device_t dev, struct mss_info *mss); -#endif static char *ymf_test(device_t dev, struct mss_info *mss); static void ad_unmute(struct mss_info *mss); @@ -117,9 +115,7 @@ static void ad_leave_MCE(struct mss_info *mss); /* OPTi-specific functions */ static void opti_write(struct mss_info *mss, u_char reg, u_char data); -#ifndef PC98 static u_char opti_read(struct mss_info *mss, u_char reg); -#endif static int opti_init(device_t dev, struct mss_info *mss); /* io primitives */ @@ -1330,11 +1326,7 @@ mss_probe(device_t dev) rman_get_start(mss->io_base), tmpx)); goto no; } -#ifdef PC98 - if (irq > 12) { -#else if (irq > 11) { -#endif printf("MSS: Bad IRQ %d\n", irq); goto no; } @@ -1381,7 +1373,6 @@ mss_detect(device_t dev, struct mss_info *mss) name = "AD1848"; mss->bd_id = MD_AD1848; /* AD1848 or CS4248 */ -#ifndef PC98 if (opti_detect(dev, mss)) { switch (mss->bd_id) { case MD_OPTI924: @@ -1394,7 +1385,6 @@ mss_detect(device_t dev, struct mss_info *mss) printf("Found OPTi device %s\n", name); if (opti_init(dev, mss) == 0) goto gotit; } -#endif /* * Check that the I/O address is in use. @@ -1601,7 +1591,6 @@ mss_detect(device_t dev, struct mss_info *mss) return ENXIO; } -#ifndef PC98 static int opti_detect(device_t dev, struct mss_info *mss) { @@ -1647,7 +1636,6 @@ opti_detect(device_t dev, struct mss_info *mss) } return 0; } -#endif static char * ymf_test(device_t dev, struct mss_info *mss) @@ -1682,10 +1670,6 @@ ymf_test(device_t dev, struct mss_info *mss) if (!j) { bus_release_resource(dev, SYS_RES_IOPORT, mss->conf_rid, mss->conf_base); -#ifdef PC98 - /* PC98 need this. I don't know reason why. */ - bus_delete_resource(dev, SYS_RES_IOPORT, mss->conf_rid); -#endif mss->conf_base = NULL; continue; } @@ -1709,23 +1693,16 @@ mss_doattach(device_t dev, struct mss_info *mss) rdma = rman_get_start(mss->drq2); if (flags & DV_F_TRUE_MSS) { /* has IRQ/DMA registers, set IRQ and DMA addr */ -#ifdef PC98 /* CS423[12] in PC98 can use IRQ3,5,10,12 */ - static char interrupt_bits[13] = - {-1, -1, -1, 0x08, -1, 0x10, -1, -1, -1, -1, 0x18, -1, 0x20}; -#else static char interrupt_bits[12] = {-1, -1, -1, -1, -1, 0x28, -1, 0x08, -1, 0x10, 0x18, 0x20}; -#endif static char pdma_bits[4] = {1, 2, -1, 3}; static char valid_rdma[4] = {1, 0, -1, 0}; char bits; if (!mss->irq || (bits = interrupt_bits[rman_get_start(mss->irq)]) == -1) goto no; -#ifndef PC98 /* CS423[12] in PC98 don't support this. */ io_wr(mss, 0, bits | 0x40); /* config port */ if ((io_rd(mss, 3) & 0x40) == 0) device_printf(dev, "IRQ Conflict?\n"); -#endif /* Write IRQ+DMA setup */ if (pdma_bits[pdma] == -1) goto no; bits |= pdma_bits[pdma]; @@ -2184,7 +2161,6 @@ opti_write(struct mss_info *mss, u_char reg, u_char val) } } -#ifndef PC98 u_char opti_read(struct mss_info *mss, u_char reg) { @@ -2208,7 +2184,6 @@ opti_read(struct mss_info *mss, u_char reg) } return -1; } -#endif static device_method_t pnpmss_methods[] = { /* Device interface */ diff --git a/sys/dev/sound/isa/mss.h b/sys/dev/sound/isa/mss.h index aaa28c0e8f8a..1b4147de9a90 100644 --- a/sys/dev/sound/isa/mss.h +++ b/sys/dev/sound/isa/mss.h @@ -215,20 +215,12 @@ mixer_ent mix_devices[32][2] = { MIX_NONE(SOUND_MIXER_VOLUME), MIX_NONE(SOUND_MIXER_BASS), MIX_NONE(SOUND_MIXER_TREBLE), -#ifdef PC98 /* PC98's synth is assigned to AUX#2 */ -MIX_ENT(SOUND_MIXER_SYNTH, 4, 1, 0, 5, 5, 1, 0, 5), -#else /* AT386's synth is assigned to AUX#1 */ MIX_ENT(SOUND_MIXER_SYNTH, 2, 1, 0, 5, 3, 1, 0, 5), -#endif MIX_ENT(SOUND_MIXER_PCM, 6, 1, 0, 6, 7, 1, 0, 6), MIX_ENT(SOUND_MIXER_SPEAKER, 26, 1, 0, 4, 0, 0, 0, 0), MIX_ENT(SOUND_MIXER_LINE, 18, 1, 0, 5, 19, 1, 0, 5), MIX_ENT(SOUND_MIXER_MIC, 0, 0, 5, 1, 1, 0, 5, 1), -#ifdef PC98 /* PC98's cd-audio is assigned to AUX#1 */ -MIX_ENT(SOUND_MIXER_CD, 2, 1, 0, 5, 3, 1, 0, 5), -#else /* AT386's cd-audio is assigned to AUX#2 */ MIX_ENT(SOUND_MIXER_CD, 4, 1, 0, 5, 5, 1, 0, 5), -#endif MIX_ENT(SOUND_MIXER_IMIX, 13, 1, 2, 6, 0, 0, 0, 0), MIX_NONE(SOUND_MIXER_ALTPCM), MIX_NONE(SOUND_MIXER_RECLEV), diff --git a/sys/dev/sound/isa/sbc.c b/sys/dev/sound/isa/sbc.c index 6a8e1d34f144..25fcd15c7d1d 100644 --- a/sys/dev/sound/isa/sbc.c +++ b/sys/dev/sound/isa/sbc.c @@ -98,20 +98,6 @@ static devclass_t sbc_devclass; static int io_range[3] = {0x10, 0x2, 0x4}; -#ifdef PC98 /* I/O address table for PC98 */ -static bus_addr_t pcm_iat[] = { - 0x000, 0x100, 0x200, 0x300, 0x400, 0x500, 0x600, 0x700, - 0x800, 0x900, 0xa00, 0xb00, 0xc00, 0xd00, 0xe00, 0xf00 -}; -static bus_addr_t midi_iat[] = { - 0x000, 0x100 -}; -static bus_addr_t opl_iat[] = { - 0x000, 0x100, 0x200, 0x300 -}; -static bus_addr_t *sb_iat[] = { pcm_iat, midi_iat, opl_iat }; -#endif - static int sb_rd(struct resource *io, int reg); static void sb_wr(struct resource *io, int reg, u_int8_t val); static int sb_dspready(struct resource *io); @@ -297,17 +283,9 @@ sbc_probe(device_t dev) int rid = 0, ver; struct resource *io; -#ifdef PC98 - io = isa_alloc_resourcev(dev, SYS_RES_IOPORT, &rid, - pcm_iat, 16, RF_ACTIVE); -#else io = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, 16, RF_ACTIVE); -#endif if (!io) goto bad; -#ifdef PC98 - isa_load_resourcev(io, pcm_iat, 16); -#endif if (sb_reset_dsp(io)) goto bad2; ver = sb_identify_board(io); if (ver == 0) goto bad2; @@ -399,20 +377,6 @@ sbc_attach(device_t dev) /* soft irq/dma configuration */ x = -1; irq = rman_get_start(scp->irq[0]); -#ifdef PC98 - /* SB16 in PC98 use different IRQ table */ - if (irq == 3) x = 1; - else if (irq == 5) x = 8; - else if (irq == 10) x = 2; - else if (irq == 12) x = 4; - if (x == -1) { - err = "bad irq (3/5/10/12 valid)"; - goto bad; - } - else sb_setmixer(scp->io[0], IRQ_NR, x); - /* SB16 in PC98 use different dma setting */ - sb_setmixer(scp->io[0], DMA_NR, dh == 0 ? 1 : 2); -#else if (irq == 5) x = 2; else if (irq == 7) x = 4; else if (irq == 9) x = 1; @@ -423,7 +387,6 @@ sbc_attach(device_t dev) } else sb_setmixer(scp->io[0], IRQ_NR, x); sb_setmixer(scp->io[0], DMA_NR, (1 << dh) | (1 << dl)); -#endif if (bootverbose) { device_printf(dev, "setting card to irq %d, drq %d", irq, dl); if (dl != dh) printf(", %d", dh); @@ -578,22 +541,13 @@ sbc_alloc_resource(device_t bus, device_t child, int type, int *rid, struct sbc_softc *scp; int *alloced, rid_max, alloced_max; struct resource **res; -#ifdef PC98 - int i; -#endif scp = device_get_softc(bus); switch (type) { case SYS_RES_IOPORT: alloced = scp->io_alloced; res = scp->io; -#ifdef PC98 - rid_max = 0; - for (i = 0; i < IO_MAX; i++) - rid_max += io_range[i]; -#else rid_max = IO_MAX - 1; -#endif alloced_max = 1; break; case SYS_RES_DRQ: @@ -694,26 +648,12 @@ alloc_resource(struct sbc_softc *scp) for (i = 0 ; i < IO_MAX ; i++) { if (scp->io[i] == NULL) { -#ifdef PC98 - scp->io_rid[i] = i > 0 ? - scp->io_rid[i - 1] + io_range[i - 1] : 0; - scp->io[i] = isa_alloc_resourcev(scp->dev, - SYS_RES_IOPORT, - &scp->io_rid[i], - sb_iat[i], - io_range[i], - RF_ACTIVE); - if (scp->io[i] != NULL) - isa_load_resourcev(scp->io[i], sb_iat[i], - io_range[i]); -#else scp->io_rid[i] = i; scp->io[i] = bus_alloc_resource_anywhere(scp->dev, SYS_RES_IOPORT, &scp->io_rid[i], io_range[i], RF_ACTIVE); -#endif if (i == 0 && scp->io[i] == NULL) return (1); scp->io_alloced[i] = 0; diff --git a/sys/dev/syscons/daemon/daemon_saver.c b/sys/dev/syscons/daemon/daemon_saver.c index 1a92ff9afef1..5b30a398e7bc 100644 --- a/sys/dev/syscons/daemon/daemon_saver.c +++ b/sys/dev/syscons/daemon/daemon_saver.c @@ -371,15 +371,7 @@ daemon_init(video_adapter_t *adp) sprintf(message, "%s - %s %s", prison0.pr_hostname, ostype, osrelease); mtx_unlock(&prison0.pr_mtx); blanked = 0; - switch (adp->va_mode) { - case M_PC98_80x25: - case M_PC98_80x30: - attr_mask = ~FG_UNDERLINE; - break; - default: - attr_mask = ~0; - break; - } + attr_mask = ~0; return 0; } diff --git a/sys/dev/syscons/dragon/dragon_saver.c b/sys/dev/syscons/dragon/dragon_saver.c index 6294daa77615..df29d8277f03 100644 --- a/sys/dev/syscons/dragon/dragon_saver.c +++ b/sys/dev/syscons/dragon/dragon_saver.c @@ -47,17 +47,10 @@ static u_char *vid; static int blanked; -#ifdef PC98 -#define VIDEO_MODE M_PC98_EGC640x400 -#define VIDEO_MODE_NAME "M_PC98_EGC640x400" -#define SCRW 640 -#define SCRH 400 -#else #define VIDEO_MODE M_VGA_CG320 #define VIDEO_MODE_NAME "M_VGA_CG320" #define SCRW 320 #define SCRH 200 -#endif #define ORDER 13 #define CURVE 3 #define OUT 100 @@ -72,11 +65,7 @@ gpset(int x, int y, int val) if (x < 0 || y < 0 || SCRW <= x || SCRH <= y) { return 0; } -#ifdef PC98 - vid[(x + y * SCRW) >> 3] = (0x80 >> (x & 7)); /* write new dot */ -#else vid[x + y * SCRW] = val; -#endif return 1; } @@ -86,11 +75,6 @@ gdraw(int dx, int dy, int val) int i; int set = 0; -#ifdef PC98 - outb(0x7c, 0xcc); /* GRCG on & RMW mode(disable planeI,G) */ - outb(0x7e, (val & 1) ? 0xff: 0); /* tile B */ - outb(0x7e, (val & 2) ? 0xff: 0); /* tile R */ -#endif if (dx != 0) { i = cur_x; cur_x += dx; @@ -115,9 +99,6 @@ gdraw(int dx, int dy, int val) set |= gpset(cur_x, i, val); } } -#ifdef PC98 - outb(0x7c, 0); /* GRCG off */ -#endif return set; } diff --git a/sys/dev/syscons/fire/fire_saver.c b/sys/dev/syscons/fire/fire_saver.c index 4c995efcd640..4b0a0e00a604 100644 --- a/sys/dev/syscons/fire/fire_saver.c +++ b/sys/dev/syscons/fire/fire_saver.c @@ -143,10 +143,6 @@ fire_init(video_adapter_t *adp) if (!vidd_get_info(adp, M_VGA_CG320, &info)) { scrmode = M_VGA_CG320; - } else if (!vidd_get_info(adp, M_PC98_PEGC640x480, &info)) { - scrmode = M_PC98_PEGC640x480; - } else if (!vidd_get_info(adp, M_PC98_PEGC640x400, &info)) { - scrmode = M_PC98_PEGC640x400; } else { log(LOG_NOTICE, "%s: the console does not support M_VGA_CG320\n", diff --git a/sys/dev/syscons/logo/logo_saver.c b/sys/dev/syscons/logo/logo_saver.c index 5828d7e44bd6..071261ead62d 100644 --- a/sys/dev/syscons/logo/logo_saver.c +++ b/sys/dev/syscons/logo/logo_saver.c @@ -140,10 +140,6 @@ logo_init(video_adapter_t *adp) scrmode = M_VESA_CG800x600; } else if (!vidd_get_info(adp, M_VGA_CG320, &info)) { scrmode = M_VGA_CG320; - } else if (!vidd_get_info(adp, M_PC98_PEGC640x480, &info)) { - scrmode = M_PC98_PEGC640x480; - } else if (!vidd_get_info(adp, M_PC98_PEGC640x400, &info)) { - scrmode = M_PC98_PEGC640x400; } else { log(LOG_NOTICE, "%s: the console does not support M_VGA_CG320\n", diff --git a/sys/dev/syscons/plasma/plasma_saver.c b/sys/dev/syscons/plasma/plasma_saver.c index 761aa5cc5752..376c639231e0 100644 --- a/sys/dev/syscons/plasma/plasma_saver.c +++ b/sys/dev/syscons/plasma/plasma_saver.c @@ -49,8 +49,6 @@ */ static int modes[] = { M_VGA_CG640, - M_PC98_PEGC640x480, - M_PC98_PEGC640x400, M_VGA_CG320, -1 }; diff --git a/sys/dev/syscons/rain/rain_saver.c b/sys/dev/syscons/rain/rain_saver.c index ff2892416b97..1ddbdc748451 100644 --- a/sys/dev/syscons/rain/rain_saver.c +++ b/sys/dev/syscons/rain/rain_saver.c @@ -143,10 +143,6 @@ rain_init(video_adapter_t *adp) if (!vidd_get_info(adp, M_VGA_CG320, &info)) { scrmode = M_VGA_CG320; - } else if (!vidd_get_info(adp, M_PC98_PEGC640x480, &info)) { - scrmode = M_PC98_PEGC640x480; - } else if (!vidd_get_info(adp, M_PC98_PEGC640x400, &info)) { - scrmode = M_PC98_PEGC640x400; } else { log(LOG_NOTICE, "%s: the console does not support M_VGA_CG320\n", diff --git a/sys/dev/syscons/scmouse.c b/sys/dev/syscons/scmouse.c index db26787c264e..f96c157cb4b5 100644 --- a/sys/dev/syscons/scmouse.c +++ b/sys/dev/syscons/scmouse.c @@ -249,7 +249,6 @@ sc_remove_mouse_image(scr_stat *scp) i = scp->mouse_oldpos; mark_for_update(scp, i); mark_for_update(scp, i); -#ifndef PC98 if (i + scp->xsize + 1 < size) { mark_for_update(scp, i + scp->xsize + 1); } else if (i + scp->xsize < size) { @@ -257,7 +256,6 @@ sc_remove_mouse_image(scr_stat *scp) } else if (i + 1 < size) { mark_for_update(scp, i + 1); } -#endif /* PC98 */ scp->status &= ~MOUSE_VISIBLE; SC_VIDEO_UNLOCK(scp->sc); } diff --git a/sys/dev/syscons/scvidctl.c b/sys/dev/syscons/scvidctl.c index 6ae923dfe291..0176147dcd51 100644 --- a/sys/dev/syscons/scvidctl.c +++ b/sys/dev/syscons/scvidctl.c @@ -655,12 +655,6 @@ sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, struct thread *td) case SW_ENH_B80x25: case SW_ENH_C80x25: case SW_ENH_B80x43: case SW_ENH_C80x43: case SW_EGAMONO80x25: - -#ifdef PC98 - /* PC98 TEXT MODES */ - case SW_PC98_80x25: - case SW_PC98_80x30: -#endif if (!(adp->va_flags & V_ADP_MODECHANGE)) return ENODEV; return sc_set_text_mode(scp, tp, cmd & 0xff, 0, 0, 0, 0); @@ -671,11 +665,6 @@ sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, struct thread *td) case SW_CG640x350: case SW_ENH_CG640: case SW_BG640x480: case SW_CG640x480: case SW_VGA_CG320: case SW_VGA_MODEX: -#ifdef PC98 - /* PC98 GRAPHICS MODES */ - case SW_PC98_EGC640x400: case SW_PC98_PEGC640x400: - case SW_PC98_PEGC640x480: -#endif if (!(adp->va_flags & V_ADP_MODECHANGE)) return ENODEV; return sc_set_graphics_mode(scp, tp, cmd & 0xff); @@ -725,10 +714,8 @@ sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, struct thread *td) vidd_load_palette(adp, scp->sc->palette); #endif -#ifndef PC98 /* move hardware cursor out of the way */ vidd_set_hw_cursor(adp, -1, -1); -#endif /* FALLTHROUGH */ @@ -744,7 +731,6 @@ sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, struct thread *td) splx(s); return error; } -#ifndef PC98 scp->status |= UNKNOWN_MODE | MOUSE_HIDDEN; splx(s); /* no restore fonts & palette */ @@ -752,14 +738,6 @@ sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, struct thread *td) set_mode(scp); sc_clear_screen(scp); scp->status &= ~UNKNOWN_MODE; -#else /* PC98 */ - scp->status &= ~UNKNOWN_MODE; - /* no restore fonts & palette */ - if (scp == scp->sc->cur_scp) - set_mode(scp); - sc_clear_screen(scp); - splx(s); -#endif /* PC98 */ return 0; #ifdef SC_PIXEL_MODE @@ -798,10 +776,6 @@ sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, struct thread *td) } scp->status |= UNKNOWN_MODE | MOUSE_HIDDEN; splx(s); -#ifdef PC98 - if (scp == scp->sc->cur_scp) - set_mode(scp); -#endif return 0; default: diff --git a/sys/dev/syscons/star/star_saver.c b/sys/dev/syscons/star/star_saver.c index 56bfc011eb50..e8e60415eed3 100644 --- a/sys/dev/syscons/star/star_saver.c +++ b/sys/dev/syscons/star/star_saver.c @@ -58,9 +58,6 @@ star_saver(video_adapter_t *adp, int blank) static u_char pattern[] = {"...........++++*** "}; static char color16[] = {FG_DARKGREY, FG_LIGHTGREY, FG_WHITE, FG_LIGHTCYAN}; - static char color8[] = {FG_BLUE, FG_BROWN, - FG_LIGHTGREY, FG_CYAN}; - static char *colors; static u_short stars[NUM_STARS][2]; sc = sc_find_softc(adp, NULL); @@ -72,16 +69,6 @@ star_saver(video_adapter_t *adp, int blank) if (adp->va_info.vi_flags & V_INFO_GRAPHICS) return EAGAIN; if (!blanked) { - switch (adp->va_mode) { - case M_PC98_80x25: - case M_PC98_80x30: - colors = color8; - break; - default: - colors = color16; - break; - } - /* clear the screen and set the border color */ sc_vtb_clear(&scp->scr, sc->scr_map[0x20], (FG_LIGHTGREY | BG_BLACK) << 8); @@ -97,7 +84,7 @@ star_saver(video_adapter_t *adp, int blank) cell = random() % NUM_STARS; sc_vtb_putc(&scp->scr, stars[cell][0], sc->scr_map[pattern[stars[cell][1]]], - colors[random()%sizeof(color16)] << 8); + color16[random()%sizeof(color16)] << 8); if ((stars[cell][1]+=(random()%4)) >= sizeof(pattern)-1) { stars[cell][0] = random() % (scp->xsize*scp->ysize); stars[cell][1] = 0; diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index 30c7a1a1327d..5bbfebc52f20 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -316,7 +316,6 @@ static char { KD_CGA, { "CGA", "CGA" } }, { KD_EGA, { "EGA", "EGA (mono)" } }, { KD_VGA, { "VGA", "VGA (mono)" } }, - { KD_PC98, { "PC-98x1", "PC-98x1" } }, { KD_TGA, { "TGA", "TGA" } }, { -1, { "Unknown", "Unknown" } }, }; @@ -2012,9 +2011,7 @@ sccnupdate(scr_stat *scp) static void scrn_timer(void *arg) { -#ifndef PC98 static time_t kbd_time_stamp = 0; -#endif sc_softc_t *sc; scr_stat *scp; int again, rate; @@ -2034,7 +2031,6 @@ scrn_timer(void *arg) if (suspend_in_progress || sc->font_loading_in_progress) goto done; -#ifndef PC98 if ((sc->kbd == NULL) && (sc->config & SC_AUTODETECT_KBD)) { /* try to allocate a keyboard automatically */ if (kbd_time_stamp != time_uptime) { @@ -2049,7 +2045,6 @@ scrn_timer(void *arg) } } } -#endif /* PC98 */ /* should we stop the screen saver? */ if (kdb_active || panicstr || shutdown_in_progress) @@ -2809,11 +2804,7 @@ exchange_scr(sc_softc_t *sc) /* set up the video for the new screen */ scp = sc->cur_scp = sc->new_scp; -#ifdef PC98 - if (sc->old_scp->mode != scp->mode || ISUNKNOWNSC(sc->old_scp) || ISUNKNOWNSC(sc->new_scp)) -#else if (sc->old_scp->mode != scp->mode || ISUNKNOWNSC(sc->old_scp)) -#endif set_mode(scp); #ifndef __sparc64__ else @@ -2988,11 +2979,7 @@ scinit(int unit, int flags) * static buffers for the console. This is less than ideal, * but is necessry evil for the time being. XXX */ -#ifdef PC98 - static u_short sc_buffer[ROW*COL*2];/* XXX */ -#else static u_short sc_buffer[ROW*COL]; /* XXX */ -#endif #ifndef SC_NO_FONT_LOADING static u_char font_8[256*8]; static u_char font_14[256*14]; @@ -3193,9 +3180,6 @@ scinit(int unit, int flags) /* initialize mapscrn arrays to a one to one map */ for (i = 0; i < sizeof(sc->scr_map); i++) sc->scr_map[i] = sc->scr_rmap[i] = i; -#ifdef PC98 - sc->scr_map[0x5c] = (u_char)0xfc; /* for backslash */ -#endif sc->flags |= SC_INIT_DONE; } diff --git a/sys/dev/syscons/syscons.h b/sys/dev/syscons/syscons.h index 3454700c9475..24d386afc16b 100644 --- a/sys/dev/syscons/syscons.h +++ b/sys/dev/syscons/syscons.h @@ -38,14 +38,6 @@ #include #include -/* machine-dependent part of the header */ - -#ifdef PC98 -#include -#elif defined(__i386__) -/* nothing for the moment */ -#endif - /* default values for configuration options */ #ifndef MAXCONS diff --git a/sys/dev/syscons/warp/warp_saver.c b/sys/dev/syscons/warp/warp_saver.c index a800118774aa..93383ddaebc9 100644 --- a/sys/dev/syscons/warp/warp_saver.c +++ b/sys/dev/syscons/warp/warp_saver.c @@ -129,10 +129,6 @@ warp_init(video_adapter_t *adp) if (!vidd_get_info(adp, M_VGA_CG320, &info)) { scrmode = M_VGA_CG320; - } else if (!vidd_get_info(adp, M_PC98_PEGC640x480, &info)) { - scrmode = M_PC98_PEGC640x480; - } else if (!vidd_get_info(adp, M_PC98_PEGC640x400, &info)) { - scrmode = M_PC98_PEGC640x400; } else { log(LOG_NOTICE, "%s: the console does not support M_VGA_CG320\n", diff --git a/sys/dev/uart/uart.h b/sys/dev/uart/uart.h index c40846b758de..987f4a0d1bdf 100644 --- a/sys/dev/uart/uart.h +++ b/sys/dev/uart/uart.h @@ -71,10 +71,6 @@ extern struct uart_class uart_sab82532_class __attribute__((weak)); extern struct uart_class uart_sbbc_class __attribute__((weak)); extern struct uart_class uart_z8530_class __attribute__((weak)); -#ifdef PC98 -struct uart_class *uart_pc98_getdev(u_long port); -#endif - /* * Device flags. */ diff --git a/sys/dev/uart/uart_bus_isa.c b/sys/dev/uart/uart_bus_isa.c index 1fda15f2be02..e22bc78a4b9d 100644 --- a/sys/dev/uart/uart_bus_isa.c +++ b/sys/dev/uart/uart_bus_isa.c @@ -146,18 +146,6 @@ static struct isa_pnp_id isa_ns8250_ids[] = { {0x0300695c, NULL}, /* WCI0003 - Fax/Voice/Modem/Speakphone/Asvd */ {0x01a0896a, NULL}, /* ZTIA001 - Zoom Internal V90 Faxmodem */ {0x61f7896a, NULL}, /* ZTIF761 - Zoom ComStar 33.6 */ - /* The following are found in PC98 hardware. */ - {0x4180a3b8, NULL}, /* NEC8041 - PC-9821CB-B04 */ - {0x0181a3b8, NULL}, /* NEC8101 - PC-9821CB2-B04 */ - {0x5181a3b8, NULL}, /* NEC8151 - Internal FAX/Modem for Cx3, Cb3 */ - {0x9181a3b8, NULL}, /* NEC8191 - PC-9801-120 */ - {0xe181a3b8, NULL}, /* NEC81E1 - Internal FAX/Modem */ - {0x1182a3b8, NULL}, /* NEC8211 - PC-9801-123 */ - {0x3182a3b8, NULL}, /* NEC8231 - Internal FAX/Modem (Voice) */ - {0x4182a3b8, NULL}, /* NEC8241 - PC-9821NR-B05 */ - {0x5182a3b8, NULL}, /* NEC8251 - Internel FAX/Modem */ - {0x7182a3b8, NULL}, /* NEC8271 - PC-9801-125 */ - {0x11802fbf, NULL}, /* OYO8011 - Internal FAX/Modem (Ring) */ {0} }; @@ -175,15 +163,8 @@ uart_isa_probe(device_t dev) return (ENXIO); /* Probe PnP _and_ non-PnP ns8250 here. */ -#ifdef PC98 - if (isa_get_logicalid(dev)) - sc->sc_class = &uart_ns8250_class; - else - sc->sc_class = uart_pc98_getdev(bus_get_resource_start(dev, - SYS_RES_IOPORT, 0)); -#else sc->sc_class = &uart_ns8250_class; -#endif + return (uart_bus_probe(dev, 0, 0, 0, 0)); } diff --git a/sys/dev/uart/uart_cpu_pc98.c b/sys/dev/uart/uart_cpu_pc98.c deleted file mode 100644 index c211b3dbe95d..000000000000 --- a/sys/dev/uart/uart_cpu_pc98.c +++ /dev/null @@ -1,132 +0,0 @@ -/*- - * Copyright (c) 2008 TAKAHASHI Yoshihiro - * Copyright (c) 2003 M. Warner Losh, Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include - -#include - -#include -#include - -bus_space_tag_t uart_bus_space_io = X86_BUS_SPACE_IO; -bus_space_tag_t uart_bus_space_mem = X86_BUS_SPACE_MEM; - -static struct { - u_long iobase; - struct uart_class *class; -} uart_pc98_devs[] = { - { 0x238, &uart_ns8250_class }, - { 0, NULL } -}; - -struct uart_class * -uart_pc98_getdev(u_long port) -{ - int i; - - for (i = 0; uart_pc98_devs[i].iobase; i++) { - if (port == uart_pc98_devs[i].iobase) - return (uart_pc98_devs[i].class); - } - return (NULL); -} - -int -uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2) -{ - - if (bus_space_compare(b1->bst, b1->bsh, b2->bst, b2->bsh) == 0) - return (1); - - return (0); -} - -int -uart_cpu_getdev(int devtype, struct uart_devinfo *di) -{ - struct uart_class *class; - unsigned int i, ivar; - - class = &uart_ns8250_class; - if (class == NULL) - return (ENXIO); - - /* Check the environment. */ - if (uart_getenv(devtype, di, class) == 0) - return (0); - - /* - * There is a serial port on all pc98 hardware. It is 8251 or - * an enhance version of that. Some pc98 have the second serial - * port which is 16550A compatible. - */ - for (i = 0; i < 2; i++) { - if (resource_int_value("uart", i, "flags", &ivar)) - continue; - if (devtype == UART_DEV_CONSOLE && !UART_FLAGS_CONSOLE(ivar)) - continue; - if (devtype == UART_DEV_DBGPORT && !UART_FLAGS_DBGPORT(ivar)) - continue; - /* - * We have a possible device. Make sure it's enabled and - * that we have an I/O port. - */ - if (resource_int_value("uart", i, "disabled", &ivar) == 0 && - ivar != 0) - continue; - if (resource_int_value("uart", i, "port", &ivar) != 0 || - ivar == 0) - continue; - - class = uart_pc98_getdev(ivar); - if (class == NULL) - continue; - - di->ops = uart_getops(class); - di->bas.chan = 0; - di->bas.bst = uart_bus_space_io; - if (bus_space_map(di->bas.bst, ivar, uart_getrange(class), 0, - &di->bas.bsh) != 0) - continue; - di->bas.regshft = 0; - di->bas.rclk = 0; - if (resource_int_value("uart", i, "baud", &ivar) != 0) - ivar = 0; - di->baudrate = ivar; - di->databits = 8; - di->stopbits = 1; - di->parity = UART_PARITY_NONE; - return (0); - } - - return (ENXIO); -} diff --git a/sys/geom/geom_bsd.c b/sys/geom/geom_bsd.c index 6cb65cd0366c..be3ec333aec9 100644 --- a/sys/geom/geom_bsd.c +++ b/sys/geom/geom_bsd.c @@ -441,16 +441,6 @@ g_bsd_taste(struct g_class *mp, struct g_provider *pp, int flags) break; } - /* Same thing if we are inside a PC98 */ - error = g_getattr("PC98::type", cp, &i); - if (!error) { - if (i != 0xc494 && flags == G_TF_NORMAL) - break; - error = g_getattr("PC98::offset", cp, &ms->mbroffset); - if (error) - break; - } - /* Same thing if we are inside a GPT */ error = g_getattr("GPT::type", cp, &uuid); if (!error) { diff --git a/sys/geom/geom_pc98.c b/sys/geom/geom_pc98.c deleted file mode 100644 index f4435cb103a9..000000000000 --- a/sys/geom/geom_pc98.c +++ /dev/null @@ -1,372 +0,0 @@ -/*- - * Copyright (c) 2002 Poul-Henning Kamp - * Copyright (c) 2002 Networks Associates Technology, Inc. - * All rights reserved. - * - * This software was developed for the FreeBSD Project by Poul-Henning Kamp - * and NAI Labs, the Security Research Division of Network Associates, Inc. - * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the - * DARPA CHATS research program. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -FEATURE(geom_pc98, "GEOM NEC PC9800 partitioning support"); - -#define PC98_CLASS_NAME "PC98" - -struct g_pc98_softc { - u_int fwsectors, fwheads, sectorsize; - int type[PC98_NPARTS]; - u_char sec[8192]; -}; - -static void -g_pc98_print(int i, struct pc98_partition *dp) -{ - char sname[17]; - - strncpy(sname, dp->dp_name, 16); - sname[16] = '\0'; - - hexdump(dp, sizeof(dp[0]), NULL, 0); - printf("[%d] mid:%d(0x%x) sid:%d(0x%x)", - i, dp->dp_mid, dp->dp_mid, dp->dp_sid, dp->dp_sid); - printf(" s:%d/%d/%d", dp->dp_scyl, dp->dp_shd, dp->dp_ssect); - printf(" e:%d/%d/%d", dp->dp_ecyl, dp->dp_ehd, dp->dp_esect); - printf(" sname:%s\n", sname); -} - -/* - * XXX: Add gctl_req arg and give good error msgs. - * XXX: Check that length argument does not bring boot code inside any slice. - */ -static int -g_pc98_modify(struct g_geom *gp, struct g_pc98_softc *ms, u_char *sec, int len __unused) -{ - int i, error; - off_t s[PC98_NPARTS], l[PC98_NPARTS]; - struct pc98_partition dp[PC98_NPARTS]; - - g_topology_assert(); - - if (sec[0x1fe] != 0x55 || sec[0x1ff] != 0xaa) - return (EBUSY); - -#if 0 - /* - * By convetion, it seems that the ipl program has a jump at location - * 0 to the real start of the boot loader. By convetion, it appears - * that after this jump, there's a string, terminated by at last one, - * if not more, zeros, followed by the target of the jump. FreeBSD's - * pc98 boot0 uses 'IPL1' followed by 3 zeros here, likely for - * compatibility with some older boot loader. Linux98's boot loader - * appears to use 'Linux 98' followed by only two. GRUB/98 appears to - * use 'GRUB/98 ' followed by none. These last two appear to be - * ported from the ia32 versions, but appear to show similar - * convention. Grub/98 has an additional NOP after the jmp, which - * isn't present in others. - * - * The following test was inspired by looking only at partitions - * with FreeBSD's boot0 (or one that it is compatible with). As - * such, if failed when other IPL programs were used. - */ - if (sec[4] != 'I' || sec[5] != 'P' || sec[6] != 'L' || sec[7] != '1') - return (EBUSY); -#endif - - for (i = 0; i < PC98_NPARTS; i++) - pc98_partition_dec( - sec + 512 + i * sizeof(struct pc98_partition), &dp[i]); - - for (i = 0; i < PC98_NPARTS; i++) { - /* If start and end are identical it's bogus */ - if (dp[i].dp_ssect == dp[i].dp_esect && - dp[i].dp_shd == dp[i].dp_ehd && - dp[i].dp_scyl == dp[i].dp_ecyl) - s[i] = l[i] = 0; - else if (dp[i].dp_ecyl == 0) - s[i] = l[i] = 0; - else { - s[i] = (off_t)dp[i].dp_scyl * - ms->fwsectors * ms->fwheads * ms->sectorsize; - l[i] = (off_t)(dp[i].dp_ecyl - dp[i].dp_scyl + 1) * - ms->fwsectors * ms->fwheads * ms->sectorsize; - } - if (bootverbose) { - printf("PC98 Slice %d on %s:\n", i + 1, gp->name); - g_pc98_print(i, dp + i); - } - if (s[i] < 0 || l[i] < 0) - error = EBUSY; - else - error = g_slice_config(gp, i, G_SLICE_CONFIG_CHECK, - s[i], l[i], ms->sectorsize, - "%ss%d", gp->name, i + 1); - if (error) - return (error); - } - - for (i = 0; i < PC98_NPARTS; i++) { - ms->type[i] = (dp[i].dp_sid << 8) | dp[i].dp_mid; - g_slice_config(gp, i, G_SLICE_CONFIG_SET, s[i], l[i], - ms->sectorsize, "%ss%d", gp->name, i + 1); - } - - bcopy(sec, ms->sec, sizeof (ms->sec)); - - return (0); -} - -static int -g_pc98_ioctl(struct g_provider *pp, u_long cmd, void *data, int fflag, struct thread *td) -{ - struct g_geom *gp; - struct g_pc98_softc *ms; - struct g_slicer *gsp; - struct g_consumer *cp; - int error, opened; - - gp = pp->geom; - gsp = gp->softc; - ms = gsp->softc; - - opened = 0; - error = 0; - switch(cmd) { - case DIOCSPC98: { - if (!(fflag & FWRITE)) - return (EPERM); - g_topology_lock(); - cp = LIST_FIRST(&gp->consumer); - if (cp->acw == 0) { - error = g_access(cp, 0, 1, 0); - if (error == 0) - opened = 1; - } - if (!error) - error = g_pc98_modify(gp, ms, data, 8192); - if (!error) - error = g_write_data(cp, 0, data, 8192); - if (opened) - g_access(cp, 0, -1 , 0); - g_topology_unlock(); - return(error); - } - default: - return (ENOIOCTL); - } -} - -static int -g_pc98_start(struct bio *bp) -{ - struct g_provider *pp; - struct g_geom *gp; - struct g_pc98_softc *mp; - struct g_slicer *gsp; - int idx; - - pp = bp->bio_to; - idx = pp->index; - gp = pp->geom; - gsp = gp->softc; - mp = gsp->softc; - if (bp->bio_cmd == BIO_GETATTR) { - if (g_handleattr_int(bp, "PC98::type", mp->type[idx])) - return (1); - if (g_handleattr_off_t(bp, "PC98::offset", - gsp->slices[idx].offset)) - return (1); - } - - return (0); -} - -static void -g_pc98_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, - struct g_consumer *cp __unused, struct g_provider *pp) -{ - struct g_pc98_softc *mp; - struct g_slicer *gsp; - struct pc98_partition dp; - char sname[17]; - - gsp = gp->softc; - mp = gsp->softc; - g_slice_dumpconf(sb, indent, gp, cp, pp); - if (pp != NULL) { - pc98_partition_dec( - mp->sec + 512 + - pp->index * sizeof(struct pc98_partition), &dp); - strncpy(sname, dp.dp_name, 16); - sname[16] = '\0'; - if (indent == NULL) { - sbuf_printf(sb, " ty %d", mp->type[pp->index]); - sbuf_printf(sb, " sn %s", sname); - } else { - sbuf_printf(sb, "%s%d\n", indent, - mp->type[pp->index]); - sbuf_printf(sb, "%s%s\n", indent, - sname); - } - } -} - -static struct g_geom * -g_pc98_taste(struct g_class *mp, struct g_provider *pp, int flags) -{ - struct g_geom *gp; - struct g_consumer *cp; - int error; - struct g_pc98_softc *ms; - u_int fwsectors, fwheads, sectorsize; - u_char *buf; - - g_trace(G_T_TOPOLOGY, "g_pc98_taste(%s,%s)", mp->name, pp->name); - g_topology_assert(); - if (flags == G_TF_NORMAL && - !strcmp(pp->geom->class->name, PC98_CLASS_NAME)) - return (NULL); - gp = g_slice_new(mp, PC98_NPARTS, pp, &cp, &ms, sizeof *ms, - g_pc98_start); - if (gp == NULL) - return (NULL); - g_topology_unlock(); - do { - if (gp->rank != 2 && flags == G_TF_NORMAL) - break; - error = g_getattr("GEOM::fwsectors", cp, &fwsectors); - if (error || fwsectors == 0) { - fwsectors = 17; - if (bootverbose) - printf("g_pc98_taste: guessing %d sectors\n", - fwsectors); - } - error = g_getattr("GEOM::fwheads", cp, &fwheads); - if (error || fwheads == 0) { - fwheads = 8; - if (bootverbose) - printf("g_pc98_taste: guessing %d heads\n", - fwheads); - } - sectorsize = cp->provider->sectorsize; - if (sectorsize % 512 != 0) - break; - buf = g_read_data(cp, 0, 8192, NULL); - if (buf == NULL) - break; - ms->fwsectors = fwsectors; - ms->fwheads = fwheads; - ms->sectorsize = sectorsize; - g_topology_lock(); - g_pc98_modify(gp, ms, buf, 8192); - g_topology_unlock(); - g_free(buf); - break; - } while (0); - g_topology_lock(); - g_access(cp, -1, 0, 0); - if (LIST_EMPTY(&gp->provider)) { - g_slice_spoiled(cp); - return (NULL); - } - return (gp); -} - -static void -g_pc98_config(struct gctl_req *req, struct g_class *mp, const char *verb) -{ - struct g_geom *gp; - struct g_consumer *cp; - struct g_pc98_softc *ms; - struct g_slicer *gsp; - int opened = 0, error = 0; - void *data; - int len; - - g_topology_assert(); - gp = gctl_get_geom(req, mp, "geom"); - if (gp == NULL) - return; - if (strcmp(verb, "write PC98")) { - gctl_error(req, "Unknown verb"); - return; - } - gsp = gp->softc; - ms = gsp->softc; - data = gctl_get_param(req, "data", &len); - if (data == NULL) - return; - if (len < 8192 || (len % 512)) { - gctl_error(req, "Wrong request length"); - return; - } - cp = LIST_FIRST(&gp->consumer); - if (cp->acw == 0) { - error = g_access(cp, 0, 1, 0); - if (error == 0) - opened = 1; - } - if (!error) - error = g_pc98_modify(gp, ms, data, len); - if (error) - gctl_error(req, "conflict with open slices"); - if (!error) - error = g_write_data(cp, 0, data, len); - if (error) - gctl_error(req, "sector zero write failed"); - if (opened) - g_access(cp, 0, -1 , 0); - return; -} - -static struct g_class g_pc98_class = { - .name = PC98_CLASS_NAME, - .version = G_VERSION, - .taste = g_pc98_taste, - .dumpconf = g_pc98_dumpconf, - .ctlreq = g_pc98_config, - .ioctl = g_pc98_ioctl, -}; - -DECLARE_GEOM_CLASS(g_pc98_class, g_pc98); diff --git a/sys/geom/geom_pc98_enc.c b/sys/geom/geom_pc98_enc.c deleted file mode 100644 index cf0f7f3fe7bc..000000000000 --- a/sys/geom/geom_pc98_enc.c +++ /dev/null @@ -1,78 +0,0 @@ -/*- - * Copyright (c) 2003 TAKAHASHI Yoshihiro - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include - -void -pc98_partition_dec(void const *pp, struct pc98_partition *d) -{ - unsigned char const *ptr = pp; - u_int i; - - d->dp_mid = ptr[0]; - d->dp_sid = ptr[1]; - d->dp_dum1 = ptr[2]; - d->dp_dum2 = ptr[3]; - d->dp_ipl_sct = ptr[4]; - d->dp_ipl_head = ptr[5]; - d->dp_ipl_cyl = le16dec(ptr + 6); - d->dp_ssect = ptr[8]; - d->dp_shd = ptr[9]; - d->dp_scyl = le16dec(ptr + 10); - d->dp_esect = ptr[12]; - d->dp_ehd = ptr[13]; - d->dp_ecyl = le16dec(ptr + 14); - for (i = 0; i < sizeof (d->dp_name); i++) - d->dp_name[i] = ptr[16 + i]; -} - -void -pc98_partition_enc(void *pp, struct pc98_partition *d) -{ - unsigned char *ptr = pp; - u_int i; - - ptr[0] = d->dp_mid; - ptr[1] = d->dp_sid; - ptr[2] = d->dp_dum1; - ptr[3] = d->dp_dum2; - ptr[4] = d->dp_ipl_sct; - ptr[5] = d->dp_ipl_head; - le16enc(ptr + 6, d->dp_ipl_cyl); - ptr[8] = d->dp_ssect; - ptr[9] = d->dp_shd; - le16enc(ptr + 10, d->dp_scyl); - ptr[12] = d->dp_esect; - ptr[13] = d->dp_ehd; - le16enc(ptr + 14, d->dp_ecyl); - for (i = 0; i < sizeof (d->dp_name); i++) - ptr[16 + i] = d->dp_name[i]; -} diff --git a/sys/geom/part/g_part_pc98.c b/sys/geom/part/g_part_pc98.c deleted file mode 100644 index 2012d2b28220..000000000000 --- a/sys/geom/part/g_part_pc98.c +++ /dev/null @@ -1,617 +0,0 @@ -/*- - * Copyright (c) 2008 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "g_part_if.h" - -FEATURE(geom_part_pc98, "GEOM partitioning class for PC-9800 disk partitions"); - -#define SECSIZE 512 -#define MENUSIZE 7168 -#define BOOTSIZE 8192 - -struct g_part_pc98_table { - struct g_part_table base; - u_char boot[SECSIZE]; - u_char table[SECSIZE]; - u_char menu[MENUSIZE]; -}; - -struct g_part_pc98_entry { - struct g_part_entry base; - struct pc98_partition ent; -}; - -static int g_part_pc98_add(struct g_part_table *, struct g_part_entry *, - struct g_part_parms *); -static int g_part_pc98_bootcode(struct g_part_table *, struct g_part_parms *); -static int g_part_pc98_create(struct g_part_table *, struct g_part_parms *); -static int g_part_pc98_destroy(struct g_part_table *, struct g_part_parms *); -static void g_part_pc98_dumpconf(struct g_part_table *, struct g_part_entry *, - struct sbuf *, const char *); -static int g_part_pc98_dumpto(struct g_part_table *, struct g_part_entry *); -static int g_part_pc98_modify(struct g_part_table *, struct g_part_entry *, - struct g_part_parms *); -static const char *g_part_pc98_name(struct g_part_table *, struct g_part_entry *, - char *, size_t); -static int g_part_pc98_probe(struct g_part_table *, struct g_consumer *); -static int g_part_pc98_read(struct g_part_table *, struct g_consumer *); -static int g_part_pc98_setunset(struct g_part_table *, struct g_part_entry *, - const char *, unsigned int); -static const char *g_part_pc98_type(struct g_part_table *, - struct g_part_entry *, char *, size_t); -static int g_part_pc98_write(struct g_part_table *, struct g_consumer *); -static int g_part_pc98_resize(struct g_part_table *, struct g_part_entry *, - struct g_part_parms *); - -static kobj_method_t g_part_pc98_methods[] = { - KOBJMETHOD(g_part_add, g_part_pc98_add), - KOBJMETHOD(g_part_bootcode, g_part_pc98_bootcode), - KOBJMETHOD(g_part_create, g_part_pc98_create), - KOBJMETHOD(g_part_destroy, g_part_pc98_destroy), - KOBJMETHOD(g_part_dumpconf, g_part_pc98_dumpconf), - KOBJMETHOD(g_part_dumpto, g_part_pc98_dumpto), - KOBJMETHOD(g_part_modify, g_part_pc98_modify), - KOBJMETHOD(g_part_resize, g_part_pc98_resize), - KOBJMETHOD(g_part_name, g_part_pc98_name), - KOBJMETHOD(g_part_probe, g_part_pc98_probe), - KOBJMETHOD(g_part_read, g_part_pc98_read), - KOBJMETHOD(g_part_setunset, g_part_pc98_setunset), - KOBJMETHOD(g_part_type, g_part_pc98_type), - KOBJMETHOD(g_part_write, g_part_pc98_write), - { 0, 0 } -}; - -static struct g_part_scheme g_part_pc98_scheme = { - "PC98", - g_part_pc98_methods, - sizeof(struct g_part_pc98_table), - .gps_entrysz = sizeof(struct g_part_pc98_entry), - .gps_minent = PC98_NPARTS, - .gps_maxent = PC98_NPARTS, - .gps_bootcodesz = BOOTSIZE, -}; -G_PART_SCHEME_DECLARE(g_part_pc98); - -static int -pc98_parse_type(const char *type, u_char *dp_mid, u_char *dp_sid) -{ - const char *alias; - char *endp; - long lt; - - if (type[0] == '!') { - lt = strtol(type + 1, &endp, 0); - if (type[1] == '\0' || *endp != '\0' || lt <= 0 || - lt >= 65536) - return (EINVAL); - /* Make sure the active and bootable flags aren't set. */ - if (lt & ((PC98_SID_ACTIVE << 8) | PC98_MID_BOOTABLE)) - return (ENOATTR); - *dp_mid = (*dp_mid & PC98_MID_BOOTABLE) | (u_char)lt; - *dp_sid = (*dp_sid & PC98_SID_ACTIVE) | (u_char)(lt >> 8); - return (0); - } - alias = g_part_alias_name(G_PART_ALIAS_FREEBSD); - if (!strcasecmp(type, alias)) { - *dp_mid = (*dp_mid & PC98_MID_BOOTABLE) | PC98_MID_386BSD; - *dp_sid = (*dp_sid & PC98_SID_ACTIVE) | PC98_SID_386BSD; - return (0); - } - return (EINVAL); -} - -static int -pc98_set_slicename(const char *label, u_char *dp_name) -{ - int len; - - len = strlen(label); - if (len > sizeof(((struct pc98_partition *)NULL)->dp_name)) - return (EINVAL); - bzero(dp_name, sizeof(((struct pc98_partition *)NULL)->dp_name)); - strncpy(dp_name, label, len); - - return (0); -} - -static void -pc98_set_chs(struct g_part_table *table, uint32_t lba, u_short *cylp, - u_char *hdp, u_char *secp) -{ - uint32_t cyl, hd, sec; - - sec = lba % table->gpt_sectors + 1; - lba /= table->gpt_sectors; - hd = lba % table->gpt_heads; - lba /= table->gpt_heads; - cyl = lba; - - *cylp = htole16(cyl); - *hdp = hd; - *secp = sec; -} - -static int -pc98_align(struct g_part_table *basetable, uint32_t *start, uint32_t *size) -{ - uint32_t cyl; - - cyl = basetable->gpt_heads * basetable->gpt_sectors; - if (*size < cyl) - return (EINVAL); - if (start != NULL && (*start % cyl)) { - *size += (*start % cyl) - cyl; - *start -= (*start % cyl) - cyl; - } - if (*size % cyl) - *size -= (*size % cyl); - if (*size < cyl) - return (EINVAL); - return (0); -} - -static int -g_part_pc98_add(struct g_part_table *basetable, struct g_part_entry *baseentry, - struct g_part_parms *gpp) -{ - struct g_part_pc98_entry *entry; - uint32_t start, size; - int error; - - entry = (struct g_part_pc98_entry *)baseentry; - start = gpp->gpp_start; - size = gpp->gpp_size; - if (pc98_align(basetable, &start, &size) != 0) - return (EINVAL); - if (baseentry->gpe_deleted) - bzero(&entry->ent, sizeof(entry->ent)); - else - entry->ent.dp_mid = entry->ent.dp_sid = 0; - - KASSERT(baseentry->gpe_start <= start, (__func__)); - KASSERT(baseentry->gpe_end >= start + size - 1, (__func__)); - baseentry->gpe_start = start; - baseentry->gpe_end = start + size - 1; - pc98_set_chs(basetable, baseentry->gpe_start, &entry->ent.dp_scyl, - &entry->ent.dp_shd, &entry->ent.dp_ssect); - pc98_set_chs(basetable, baseentry->gpe_end, &entry->ent.dp_ecyl, - &entry->ent.dp_ehd, &entry->ent.dp_esect); - - error = pc98_parse_type(gpp->gpp_type, &entry->ent.dp_mid, - &entry->ent.dp_sid); - if (error) - return (error); - - if (gpp->gpp_parms & G_PART_PARM_LABEL) - return (pc98_set_slicename(gpp->gpp_label, entry->ent.dp_name)); - - return (0); -} - -static int -g_part_pc98_bootcode(struct g_part_table *basetable, struct g_part_parms *gpp) -{ - struct g_part_pc98_table *table; - const u_char *codeptr; - - if (gpp->gpp_codesize != BOOTSIZE) - return (EINVAL); - - table = (struct g_part_pc98_table *)basetable; - codeptr = gpp->gpp_codeptr; - bcopy(codeptr, table->boot, SECSIZE); - bcopy(codeptr + SECSIZE*2, table->menu, MENUSIZE); - - return (0); -} - -static int -g_part_pc98_create(struct g_part_table *basetable, struct g_part_parms *gpp) -{ - struct g_provider *pp; - struct g_part_pc98_table *table; - - pp = gpp->gpp_provider; - if (pp->sectorsize < SECSIZE || pp->mediasize < BOOTSIZE) - return (ENOSPC); - if (pp->sectorsize > SECSIZE) - return (ENXIO); - - basetable->gpt_first = basetable->gpt_heads * basetable->gpt_sectors; - basetable->gpt_last = MIN(pp->mediasize / SECSIZE, UINT32_MAX) - 1; - - table = (struct g_part_pc98_table *)basetable; - le16enc(table->boot + PC98_MAGICOFS, PC98_MAGIC); - return (0); -} - -static int -g_part_pc98_destroy(struct g_part_table *basetable, struct g_part_parms *gpp) -{ - - /* Wipe the first two sectors to clear the partitioning. */ - basetable->gpt_smhead |= 3; - return (0); -} - -static void -g_part_pc98_dumpconf(struct g_part_table *table, - struct g_part_entry *baseentry, struct sbuf *sb, const char *indent) -{ - struct g_part_pc98_entry *entry; - char name[sizeof(entry->ent.dp_name) + 1]; - u_int type; - - entry = (struct g_part_pc98_entry *)baseentry; - if (entry == NULL) { - /* confxml: scheme information */ - return; - } - - type = entry->ent.dp_mid + (entry->ent.dp_sid << 8); - strncpy(name, entry->ent.dp_name, sizeof(name) - 1); - name[sizeof(name) - 1] = '\0'; - if (indent == NULL) { - /* conftxt: libdisk compatibility */ - sbuf_printf(sb, " xs PC98 xt %u sn %s", type, name); - } else { - /* confxml: partition entry information */ - sbuf_printf(sb, "%s\n"); - if (entry->ent.dp_mid & PC98_MID_BOOTABLE) - sbuf_printf(sb, "%sbootable\n", - indent); - if (entry->ent.dp_sid & PC98_SID_ACTIVE) - sbuf_printf(sb, "%sactive\n", indent); - sbuf_printf(sb, "%s%u\n", indent, - type & 0x7f7f); - } -} - -static int -g_part_pc98_dumpto(struct g_part_table *table, struct g_part_entry *baseentry) -{ - struct g_part_pc98_entry *entry; - - /* Allow dumping to a FreeBSD partition only. */ - entry = (struct g_part_pc98_entry *)baseentry; - return (((entry->ent.dp_mid & PC98_MID_MASK) == PC98_MID_386BSD && - (entry->ent.dp_sid & PC98_SID_MASK) == PC98_SID_386BSD) ? 1 : 0); -} - -static int -g_part_pc98_modify(struct g_part_table *basetable, - struct g_part_entry *baseentry, struct g_part_parms *gpp) -{ - struct g_part_pc98_entry *entry; - int error; - - entry = (struct g_part_pc98_entry *)baseentry; - - if (gpp->gpp_parms & G_PART_PARM_TYPE) { - error = pc98_parse_type(gpp->gpp_type, &entry->ent.dp_mid, - &entry->ent.dp_sid); - if (error) - return (error); - } - - if (gpp->gpp_parms & G_PART_PARM_LABEL) - return (pc98_set_slicename(gpp->gpp_label, entry->ent.dp_name)); - - return (0); -} - -static int -g_part_pc98_resize(struct g_part_table *basetable, - struct g_part_entry *baseentry, struct g_part_parms *gpp) -{ - struct g_part_pc98_entry *entry; - struct g_provider *pp; - uint32_t size; - - if (baseentry == NULL) { - pp = LIST_FIRST(&basetable->gpt_gp->consumer)->provider; - basetable->gpt_last = MIN(pp->mediasize / SECSIZE, - UINT32_MAX) - 1; - return (0); - } - size = gpp->gpp_size; - if (pc98_align(basetable, NULL, &size) != 0) - return (EINVAL); - /* XXX: prevent unexpected shrinking. */ - pp = baseentry->gpe_pp; - if ((g_debugflags & 0x10) == 0 && size < gpp->gpp_size && - pp->mediasize / pp->sectorsize > size) - return (EBUSY); - entry = (struct g_part_pc98_entry *)baseentry; - baseentry->gpe_end = baseentry->gpe_start + size - 1; - pc98_set_chs(basetable, baseentry->gpe_end, &entry->ent.dp_ecyl, - &entry->ent.dp_ehd, &entry->ent.dp_esect); - - return (0); -} - -static const char * -g_part_pc98_name(struct g_part_table *table, struct g_part_entry *baseentry, - char *buf, size_t bufsz) -{ - - snprintf(buf, bufsz, "s%d", baseentry->gpe_index); - return (buf); -} - -static int -g_part_pc98_probe(struct g_part_table *table, struct g_consumer *cp) -{ - struct g_provider *pp; - u_char *buf, *p; - int error, index, res, sum; - uint16_t magic, ecyl, scyl; - - pp = cp->provider; - - /* Sanity-check the provider. */ - if (pp->sectorsize < SECSIZE || pp->mediasize < BOOTSIZE) - return (ENOSPC); - if (pp->sectorsize > SECSIZE) - return (ENXIO); - - /* Check that there's a PC98 partition table. */ - buf = g_read_data(cp, 0L, 2 * SECSIZE, &error); - if (buf == NULL) - return (error); - - /* We goto out on mismatch. */ - res = ENXIO; - - magic = le16dec(buf + PC98_MAGICOFS); - if (magic != PC98_MAGIC) - goto out; - - sum = 0; - for (index = SECSIZE; index < 2 * SECSIZE; index++) - sum += buf[index]; - if (sum == 0) { - res = G_PART_PROBE_PRI_LOW; - goto out; - } - - for (index = 0; index < PC98_NPARTS; index++) { - p = buf + SECSIZE + index * PC98_PARTSIZE; - if (p[0] == 0 || p[1] == 0) /* !dp_mid || !dp_sid */ - continue; - scyl = le16dec(p + 10); - ecyl = le16dec(p + 14); - if (scyl == 0 || ecyl == 0) - goto out; - if (p[8] == p[12] && /* dp_ssect == dp_esect */ - p[9] == p[13] && /* dp_shd == dp_ehd */ - scyl == ecyl) - goto out; - } - - res = G_PART_PROBE_PRI_HIGH; - - out: - g_free(buf); - return (res); -} - -static int -g_part_pc98_read(struct g_part_table *basetable, struct g_consumer *cp) -{ - struct pc98_partition ent; - struct g_provider *pp; - struct g_part_pc98_table *table; - struct g_part_pc98_entry *entry; - u_char *buf, *p; - off_t msize; - off_t start, end; - u_int cyl; - int error, index; - - pp = cp->provider; - table = (struct g_part_pc98_table *)basetable; - msize = MIN(pp->mediasize / SECSIZE, UINT32_MAX); - - buf = g_read_data(cp, 0L, BOOTSIZE, &error); - if (buf == NULL) - return (error); - - cyl = basetable->gpt_heads * basetable->gpt_sectors; - - bcopy(buf, table->boot, sizeof(table->boot)); - bcopy(buf + SECSIZE, table->table, sizeof(table->table)); - bcopy(buf + SECSIZE*2, table->menu, sizeof(table->menu)); - - for (index = PC98_NPARTS - 1; index >= 0; index--) { - p = buf + SECSIZE + index * PC98_PARTSIZE; - ent.dp_mid = p[0]; - ent.dp_sid = p[1]; - ent.dp_dum1 = p[2]; - ent.dp_dum2 = p[3]; - ent.dp_ipl_sct = p[4]; - ent.dp_ipl_head = p[5]; - ent.dp_ipl_cyl = le16dec(p + 6); - ent.dp_ssect = p[8]; - ent.dp_shd = p[9]; - ent.dp_scyl = le16dec(p + 10); - ent.dp_esect = p[12]; - ent.dp_ehd = p[13]; - ent.dp_ecyl = le16dec(p + 14); - bcopy(p + 16, ent.dp_name, sizeof(ent.dp_name)); - if (ent.dp_sid == 0) - continue; - - start = ent.dp_scyl * cyl; - end = (ent.dp_ecyl + 1) * cyl - 1; - entry = (struct g_part_pc98_entry *)g_part_new_entry(basetable, - index + 1, start, end); - entry->ent = ent; - } - - basetable->gpt_entries = PC98_NPARTS; - basetable->gpt_first = cyl; - basetable->gpt_last = msize - 1; - - g_free(buf); - return (0); -} - -static int -g_part_pc98_setunset(struct g_part_table *table, struct g_part_entry *baseentry, - const char *attrib, unsigned int set) -{ - struct g_part_entry *iter; - struct g_part_pc98_entry *entry; - int changed, mid, sid; - - if (baseentry == NULL) - return (ENODEV); - - mid = sid = 0; - if (strcasecmp(attrib, "active") == 0) - sid = 1; - else if (strcasecmp(attrib, "bootable") == 0) - mid = 1; - if (mid == 0 && sid == 0) - return (EINVAL); - - LIST_FOREACH(iter, &table->gpt_entry, gpe_entry) { - if (iter->gpe_deleted) - continue; - if (iter != baseentry) - continue; - changed = 0; - entry = (struct g_part_pc98_entry *)iter; - if (set) { - if (mid && !(entry->ent.dp_mid & PC98_MID_BOOTABLE)) { - entry->ent.dp_mid |= PC98_MID_BOOTABLE; - changed = 1; - } - if (sid && !(entry->ent.dp_sid & PC98_SID_ACTIVE)) { - entry->ent.dp_sid |= PC98_SID_ACTIVE; - changed = 1; - } - } else { - if (mid && (entry->ent.dp_mid & PC98_MID_BOOTABLE)) { - entry->ent.dp_mid &= ~PC98_MID_BOOTABLE; - changed = 1; - } - if (sid && (entry->ent.dp_sid & PC98_SID_ACTIVE)) { - entry->ent.dp_sid &= ~PC98_SID_ACTIVE; - changed = 1; - } - } - if (changed && !iter->gpe_created) - iter->gpe_modified = 1; - } - return (0); -} - -static const char * -g_part_pc98_type(struct g_part_table *basetable, struct g_part_entry *baseentry, - char *buf, size_t bufsz) -{ - struct g_part_pc98_entry *entry; - u_int type; - - entry = (struct g_part_pc98_entry *)baseentry; - type = (entry->ent.dp_mid & PC98_MID_MASK) | - ((entry->ent.dp_sid & PC98_SID_MASK) << 8); - if (type == (PC98_MID_386BSD | (PC98_SID_386BSD << 8))) - return (g_part_alias_name(G_PART_ALIAS_FREEBSD)); - snprintf(buf, bufsz, "!%d", type); - return (buf); -} - -static int -g_part_pc98_write(struct g_part_table *basetable, struct g_consumer *cp) -{ - struct g_part_entry *baseentry; - struct g_part_pc98_entry *entry; - struct g_part_pc98_table *table; - u_char *p; - int error, index; - - table = (struct g_part_pc98_table *)basetable; - baseentry = LIST_FIRST(&basetable->gpt_entry); - for (index = 1; index <= basetable->gpt_entries; index++) { - p = table->table + (index - 1) * PC98_PARTSIZE; - entry = (baseentry != NULL && index == baseentry->gpe_index) - ? (struct g_part_pc98_entry *)baseentry : NULL; - if (entry != NULL && !baseentry->gpe_deleted) { - p[0] = entry->ent.dp_mid; - p[1] = entry->ent.dp_sid; - p[2] = entry->ent.dp_dum1; - p[3] = entry->ent.dp_dum2; - p[4] = entry->ent.dp_ipl_sct; - p[5] = entry->ent.dp_ipl_head; - le16enc(p + 6, entry->ent.dp_ipl_cyl); - p[8] = entry->ent.dp_ssect; - p[9] = entry->ent.dp_shd; - le16enc(p + 10, entry->ent.dp_scyl); - p[12] = entry->ent.dp_esect; - p[13] = entry->ent.dp_ehd; - le16enc(p + 14, entry->ent.dp_ecyl); - bcopy(entry->ent.dp_name, p + 16, - sizeof(entry->ent.dp_name)); - } else - bzero(p, PC98_PARTSIZE); - - if (entry != NULL) - baseentry = LIST_NEXT(baseentry, gpe_entry); - } - - error = g_write_data(cp, 0, table->boot, SECSIZE); - if (!error) - error = g_write_data(cp, SECSIZE, table->table, SECSIZE); - if (!error) - error = g_write_data(cp, SECSIZE*2, table->menu, MENUSIZE); - return (error); -} diff --git a/sys/i386/bios/apm.c b/sys/i386/bios/apm.c index a4d3bd79ee39..a38ab16bbc56 100644 --- a/sys/i386/bios/apm.c +++ b/sys/i386/bios/apm.c @@ -82,19 +82,6 @@ int apm_evindex; #define APMDEV_NORMAL 0 #define APMDEV_CTL 1 -#ifdef PC98 -extern int bios32_apm98(struct bios_regs *, u_int, u_short); - -/* PC98's SMM definition */ -#define APM_NECSMM_PORT 0x6b8e -#define APM_NECSMM_PORTSZ 1 -#define APM_NECSMM_EN 0x10 -static __inline void apm_enable_smm(struct apm_softc *); -static __inline void apm_disable_smm(struct apm_softc *); -int apm_necsmm_addr; -u_int32_t apm_necsmm_mask; -#endif - static struct apmhook *hook[NAPM_HOOK]; /* XXX */ #define is_enabled(foo) ((foo) ? "enabled" : "disabled") @@ -137,30 +124,6 @@ SYSCTL_INT(_debug, OID_AUTO, apm_debug, CTLFLAG_RW, &apm_debug, 0, ""); SYSCTL_INT(_machdep, OID_AUTO, apm_swab_batt_minutes, CTLFLAG_RWTUN, &apm_swab_batt_minutes, 0, "Byte swap battery time value."); -#ifdef PC98 -static __inline void -apm_enable_smm(sc) - struct apm_softc *sc; -{ - bus_space_tag_t iot = sc->sc_iot; - bus_space_handle_t ioh = sc->sc_ioh; - if (apm_necsmm_addr != 0) - bus_space_write_1(iot, ioh, 0, - (bus_space_read_1(iot, ioh, 0) | ~apm_necsmm_mask)); -} - -static __inline void -apm_disable_smm(sc) - struct apm_softc *sc; -{ - bus_space_tag_t iot = sc->sc_iot; - bus_space_handle_t ioh = sc->sc_ioh; - if (apm_necsmm_addr != 0) - bus_space_write_1(iot, ioh, 0, - (bus_space_read_1(iot, ioh, 0) & apm_necsmm_mask)); -} -#endif - /* * return 0 if the function successfull, * return 1 if the function unsuccessfull, @@ -180,12 +143,6 @@ apm_bioscall(void) } sc->bios_busy = 1; -#ifdef PC98 - set_bios_selectors(&sc->bios.seg, BIOSCODE_FLAG | BIOSDATA_FLAG); - if (bios32_apm98(&sc->bios.r, sc->bios.entry, - GSEL(GBIOSCODE32_SEL, SEL_KPL)) != 0) - return 1; -#else if (sc->connectmode == APM_PROT32CONNECT) { set_bios_selectors(&sc->bios.seg, BIOSCODE_FLAG | BIOSDATA_FLAG); @@ -194,7 +151,6 @@ apm_bioscall(void) } else { errno = bios16(&sc->bios, NULL); } -#endif sc->bios_busy = 0; return (errno); } @@ -207,11 +163,6 @@ apm_check_function_supported(u_int version, u_int func) if (func == APM_DRVVERSION) { return (1); } -#ifdef PC98 - if (func == APM_GETPWSTATUS) { - return (1); - } -#endif switch (version) { case INTVERSION(1, 0): @@ -310,17 +261,12 @@ apm_suspend_system(int state) sc->bios.r.ecx = state; sc->bios.r.edx = 0; -#ifdef PC98 - apm_disable_smm(sc); -#endif if (apm_bioscall()) { printf("Entire system suspend failure: errcode = %d\n", 0xff & (sc->bios.r.eax >> 8)); return 1; } -#ifdef PC98 - apm_enable_smm(sc); -#endif + return 0; } @@ -894,9 +840,6 @@ apm_probe(device_t dev) #define APM_KERNBASE KERNBASE struct vm86frame vmf; struct apm_softc *sc = &apm_softc; -#ifdef PC98 - int rid; -#endif device_set_desc(dev, "APM BIOS"); if (device_get_unit(dev) > 0) { @@ -936,38 +879,6 @@ apm_probe(device_t dev) vmf.vmf_bx = 0; vm86_intcall(APM_INT, &vmf); /* disconnect, just in case */ -#ifdef PC98 - /* PC98 have bogos APM 32bit BIOS */ - if ((vmf.vmf_cx & APM_32BIT_SUPPORT) == 0) - return ENXIO; - rid = 0; - bus_set_resource(dev, SYS_RES_IOPORT, rid, - APM_NECSMM_PORT, APM_NECSMM_PORTSZ); - sc->sc_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, - APM_NECSMM_PORT, ~0, APM_NECSMM_PORTSZ, RF_ACTIVE); - if (sc->sc_res == NULL) { - printf("apm: cannot open NEC smm device\n"); - return ENXIO; - } - bus_release_resource(dev, SYS_RES_IOPORT, rid, sc->sc_res); - - vmf.vmf_ah = APM_BIOS; - vmf.vmf_al = APM_PROT32CONNECT; - vmf.vmf_bx = 0; - if (vm86_intcall(APM_INT, &vmf)) { - printf("apm: 32-bit connection error.\n"); - return (ENXIO); - } - - sc->bios.seg.code32.base = (vmf.vmf_ax << 4) + APM_KERNBASE; - sc->bios.seg.code32.limit = 0xffff; - sc->bios.seg.code16.base = (vmf.vmf_cx << 4) + APM_KERNBASE; - sc->bios.seg.code16.limit = 0xffff; - sc->bios.seg.data.base = (vmf.vmf_dx << 4) + APM_KERNBASE; - sc->bios.seg.data.limit = 0xffff; - sc->bios.entry = vmf.vmf_ebx; - sc->connectmode = APM_PROT32CONNECT; -#else if ((vmf.vmf_cx & APM_32BIT_SUPPORT) != 0) { vmf.vmf_ah = APM_BIOS; vmf.vmf_al = APM_PROT32CONNECT; @@ -1000,7 +911,7 @@ apm_probe(device_t dev) sc->bios.entry = vmf.vmf_bx; sc->connectmode = APM_PROT16CONNECT; } -#endif + return(0); } @@ -1134,9 +1045,6 @@ apm_processevent(void) break; } } while (apm_event != PMEV_NOEVENT); -#ifdef PC98 - apm_disable_smm(sc); -#endif } /* @@ -1150,16 +1058,12 @@ apm_attach(device_t dev) { struct apm_softc *sc = &apm_softc; int drv_version; -#ifdef PC98 - int rid; -#endif + mtx_init(&sc->mtx, device_get_nameunit(dev), "apm", MTX_DEF); cv_init(&sc->cv, "cbb cv"); -#ifndef PC98 if (device_get_flags(dev) & 0x20) atrtcclock_disable = 1; -#endif sc->initialized = 0; @@ -1181,22 +1085,6 @@ apm_attach(device_t dev) APM_DPRINT("apm: CS_limit=0x%x, DS_limit=0x%x\n", sc->bios.seg.code16.limit, sc->bios.seg.data.limit); -#ifdef PC98 - rid = 0; - sc->sc_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, - APM_NECSMM_PORT, ~0, APM_NECSMM_PORTSZ, RF_ACTIVE); - if (sc->sc_res == NULL) - panic("%s: counldn't map I/O ports", device_get_name(dev)); - sc->sc_iot = rman_get_bustag(sc->sc_res); - sc->sc_ioh = rman_get_bushandle(sc->sc_res); - - if (apm_version==0x112 || apm_version==0x111 || apm_version==0x110) - apm_necsmm_addr = APM_NECSMM_PORT; - else - apm_necsmm_addr = 0; - apm_necsmm_mask = ~APM_NECSMM_EN; -#endif /* PC98 */ - /* * In one test, apm bios version was 1.02; an attempt to register * a 1.04 driver resulted in a 1.00 connection! Registering a @@ -1391,23 +1279,6 @@ apmioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td return (EPERM); /* XXX compatibility with the old interface */ args = (struct apm_bios_arg *)addr; -#ifdef PC98 - if (((args->eax >> 8) & 0xff) == 0x53) { - sc->bios.r.eax = args->eax & ~0xffff; - sc->bios.r.eax |= APM_BIOS << 8; - switch (args->eax & 0xff) { - case 0x0a: - sc->bios.r.eax |= APM_GETPWSTATUS; - break; - case 0x0e: - sc->bios.r.eax |= APM_DRVVERSION; - break; - default: - sc->bios.r.eax |= args->eax & 0xff; - break; - } - } else -#endif sc->bios.r.eax = args->eax; sc->bios.r.ebx = args->ebx; sc->bios.r.ecx = args->ecx; diff --git a/sys/i386/bios/apm.h b/sys/i386/bios/apm.h index 03c4470ba340..70cb15a5bdad 100644 --- a/sys/i386/bios/apm.h +++ b/sys/i386/bios/apm.h @@ -27,11 +27,6 @@ /* static data */ struct apm_softc { -#ifdef PC98 - bus_space_tag_t sc_iot; - bus_space_handle_t sc_ioh; - struct resource *sc_res; -#endif struct mtx mtx; struct cv cv; struct proc *event_thread; diff --git a/sys/i386/i386/genassym.c b/sys/i386/i386/genassym.c index a0e4d242cfa2..60482c9d5948 100644 --- a/sys/i386/i386/genassym.c +++ b/sys/i386/i386/genassym.c @@ -229,13 +229,6 @@ ASSYM(BC32SEL, GSEL(GBIOSCODE32_SEL, SEL_KPL)); ASSYM(GPROC0_SEL, GPROC0_SEL); ASSYM(VM86_FRAMESIZE, sizeof(struct vm86frame)); -#ifdef PC98 -#include - -ASSYM(BUS_SPACE_HANDLE_BASE, offsetof(struct bus_space_handle, bsh_base)); -ASSYM(BUS_SPACE_HANDLE_IAT, offsetof(struct bus_space_handle, bsh_iat)); -#endif - #ifdef HWPMC_HOOKS ASSYM(PMC_FN_USER_CALLCHAIN, PMC_FN_USER_CALLCHAIN); #endif diff --git a/sys/i386/i386/initcpu.c b/sys/i386/i386/initcpu.c index f67593794908..6b1f8639ad41 100644 --- a/sys/i386/i386/initcpu.c +++ b/sys/i386/i386/initcpu.c @@ -92,10 +92,6 @@ init_bluelightning(void) { register_t saveintr; -#if defined(PC98) && !defined(CPU_UPGRADE_HW_CACHE) - need_post_dma_flush = 1; -#endif - saveintr = intr_disable(); load_cr0(rcr0() | CR0_CD | CR0_NW); @@ -182,14 +178,6 @@ init_cy486dx(void) ccr2 |= CCR2_SUSP_HLT; #endif -#ifdef PC98 - /* Enables WB cache interface pin and Lock NW bit in CR0. */ - ccr2 |= CCR2_WB | CCR2_LOCK_NW; - /* Unlock NW bit in CR0. */ - write_cyrix_reg(CCR2, ccr2 & ~CCR2_LOCK_NW); - load_cr0((rcr0() & ~CR0_CD) | CR0_NW); /* CD = 0, NW = 1 */ -#endif - write_cyrix_reg(CCR2, ccr2); intr_restore(saveintr); } @@ -303,10 +291,6 @@ init_i486_on_386(void) { register_t saveintr; -#if defined(PC98) && !defined(CPU_UPGRADE_HW_CACHE) - need_post_dma_flush = 1; -#endif - saveintr = intr_disable(); load_cr0(rcr0() & ~(CR0_CD | CR0_NW)); /* CD = 0, NW = 0 */ @@ -806,52 +790,6 @@ initializecpucache(void) cpu_feature &= ~CPUID_CLFSH; cpu_stdext_feature &= ~CPUID_STDEXT_CLFLUSHOPT; } - -#if defined(PC98) && !defined(CPU_UPGRADE_HW_CACHE) - /* - * OS should flush L1 cache by itself because no PC-98 supports - * non-Intel CPUs. Use wbinvd instruction before DMA transfer - * when need_pre_dma_flush = 1, use invd instruction after DMA - * transfer when need_post_dma_flush = 1. If your CPU upgrade - * product supports hardware cache control, you can add the - * CPU_UPGRADE_HW_CACHE option in your kernel configuration file. - * This option eliminates unneeded cache flush instruction(s). - */ - if (cpu_vendor_id == CPU_VENDOR_CYRIX) { - switch (cpu) { -#ifdef I486_CPU - case CPU_486DLC: - need_post_dma_flush = 1; - break; - case CPU_M1SC: - need_pre_dma_flush = 1; - break; - case CPU_CY486DX: - need_pre_dma_flush = 1; -#ifdef CPU_I486_ON_386 - need_post_dma_flush = 1; -#endif - break; -#endif - default: - break; - } - } else if (cpu_vendor_id == CPU_VENDOR_AMD) { - switch (cpu_id & 0xFF0) { - case 0x470: /* Enhanced Am486DX2 WB */ - case 0x490: /* Enhanced Am486DX4 WB */ - case 0x4F0: /* Am5x86 WB */ - need_pre_dma_flush = 1; - break; - } - } else if (cpu_vendor_id == CPU_VENDOR_IBM) { - need_post_dma_flush = 1; - } else { -#ifdef CPU_I486_ON_386 - need_pre_dma_flush = 1; -#endif - } -#endif /* PC98 && !CPU_UPGRADE_HW_CACHE */ } #if defined(I586_CPU) && defined(CPU_WT_ALLOC) @@ -884,19 +822,13 @@ enable_K5_wt_alloc(void) else msr = 0; msr |= AMD_WT_ALLOC_TME | AMD_WT_ALLOC_FRE; -#ifdef PC98 - if (!(inb(0x43b) & 4)) { - wrmsr(0x86, 0x0ff00f0); - msr |= AMD_WT_ALLOC_PRE; - } -#else + /* * There is no way to know wheter 15-16M hole exists or not. * Therefore, we disable write allocate for this range. */ - wrmsr(0x86, 0x0ff00f0); - msr |= AMD_WT_ALLOC_PRE; -#endif + wrmsr(0x86, 0x0ff00f0); + msr |= AMD_WT_ALLOC_PRE; wrmsr(0x85, msr); msr=rdmsr(0x83); @@ -940,19 +872,9 @@ enable_K6_wt_alloc(void) size = 0x7f; whcr = (rdmsr(0xc0000082) & ~(0x7fLL << 1)) | (size << 1); -#if defined(PC98) || defined(NO_MEMORY_HOLE) - if (whcr & (0x7fLL << 1)) { -#ifdef PC98 - /* - * If bit 2 of port 0x43b is 0, disable wrte allocate for the - * 15-16M range. - */ - if (!(inb(0x43b) & 4)) - whcr &= ~0x0001LL; - else -#endif - whcr |= 0x0001LL; - } +#if defined(NO_MEMORY_HOLE) + if (whcr & (0x7fLL << 1)) + whcr |= 0x0001LL; #else /* * There is no way to know wheter 15-16M hole exists or not. @@ -1000,19 +922,9 @@ enable_K6_2_wt_alloc(void) size = 0x3ff; whcr = (rdmsr(0xc0000082) & ~(0x3ffLL << 22)) | (size << 22); -#if defined(PC98) || defined(NO_MEMORY_HOLE) - if (whcr & (0x3ffLL << 22)) { -#ifdef PC98 - /* - * If bit 2 of port 0x43b is 0, disable wrte allocate for the - * 15-16M range. - */ - if (!(inb(0x43b) & 4)) - whcr &= ~(1LL << 16); - else -#endif - whcr |= 1LL << 16; - } +#if defined(NO_MEMORY_HOLE) + if (whcr & (0x3ffLL << 22)) + whcr |= 1LL << 16; #else /* * There is no way to know wheter 15-16M hole exists or not. diff --git a/sys/i386/i386/locore.s b/sys/i386/i386/locore.s index 4d8e22fc3002..f41a77c45ff6 100644 --- a/sys/i386/i386/locore.s +++ b/sys/i386/i386/locore.s @@ -120,12 +120,6 @@ vm86phystk: .long 0 /* PA of vm86/bios stack */ vm86paddr: .long 0 /* address of vm86 region */ vm86pa: .long 0 /* phys addr of vm86 region */ -#ifdef PC98 - .globl pc98_system_parameter -pc98_system_parameter: - .space 0x240 -#endif - /********************************************************************** * * Some handy macros @@ -183,18 +177,8 @@ pc98_system_parameter: */ NON_GPROF_ENTRY(btext) -#ifdef PC98 - /* save SYSTEM PARAMETER for resume (NS/T or other) */ - movl $0xa1400,%esi - movl $R(pc98_system_parameter),%edi - movl $0x0240,%ecx - cld - rep - movsb -#else /* IBM-PC */ /* Tell the bios to warmboot next time */ movw $0x1234,0x472 -#endif /* PC98 */ /* Set up a real frame in case the double return in newboot is executed. */ pushl %ebp @@ -240,33 +224,6 @@ NON_GPROF_ENTRY(btext) */ movl $R(tmpstk),%esp -#ifdef PC98 - /* pc98_machine_type & M_EPSON_PC98 */ - testb $0x02,R(pc98_system_parameter)+220 - jz 3f - /* epson_machine_id <= 0x0b */ - cmpb $0x0b,R(pc98_system_parameter)+224 - ja 3f - - /* count up memory */ - movl $0x100000,%eax /* next, talley remaining memory */ - movl $0xFFF-0x100,%ecx -1: movl 0(%eax),%ebx /* save location to check */ - movl $0xa55a5aa5,0(%eax) /* write test pattern */ - cmpl $0xa55a5aa5,0(%eax) /* does not check yet for rollover */ - jne 2f - movl %ebx,0(%eax) /* restore memory */ - addl $PAGE_SIZE,%eax - loop 1b -2: subl $0x100000,%eax - shrl $17,%eax - movb %al,R(pc98_system_parameter)+1 -3: - - movw R(pc98_system_parameter+0x86),%ax - movw %ax,R(cpu_id) -#endif - call identify_cpu call create_pagetables diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 9200d00401f5..855386bf0931 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -109,11 +109,7 @@ __FBSDID("$FreeBSD$"); #include #endif -#ifdef PC98 -#include -#else #include -#endif #include @@ -185,14 +181,6 @@ SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL); int _udatasel, _ucodesel; u_int basemem; -#ifdef PC98 -int need_pre_dma_flush; /* If 1, use wbinvd befor DMA transfer. */ -int need_post_dma_flush; /* If 1, use invd after DMA transfer. */ - -static int ispc98 = 1; -SYSCTL_INT(_machdep, OID_AUTO, ispc98, CTLFLAG_RD, &ispc98, 0, ""); -#endif - int cold = 1; #ifdef COMPAT_43 @@ -249,7 +237,6 @@ cpu_startup(dummy) uintmax_t memsize; char *sysenv; -#ifndef PC98 /* * On MacBooks, we need to disallow the legacy USB circuit to * generate an SMI# because this can cause several problems, @@ -275,7 +262,6 @@ cpu_startup(dummy) } freeenv(sysenv); } -#endif /* !PC98 */ /* * Good {morning,afternoon,evening,night}. @@ -1618,7 +1604,6 @@ sdtossd(sd, ssd) ssd->ssd_gran = sd->sd_gran; } -#if !defined(PC98) static int add_physmap_entry(uint64_t base, uint64_t length, vm_paddr_t *physmap, int *physmap_idxp) @@ -1725,7 +1710,6 @@ add_smap_entries(struct bios_smap *smapbase, vm_paddr_t *physmap, if (!add_smap_entry(smap, physmap, physmap_idxp)) break; } -#endif /* !PC98 */ static void basemem_setup(void) @@ -1788,269 +1772,6 @@ basemem_setup(void) * * XXX first should be vm_paddr_t. */ -#ifdef PC98 -static void -getmemsize(int first) -{ - int off, physmap_idx, pa_indx, da_indx; - u_long physmem_tunable, memtest; - vm_paddr_t physmap[PHYSMAP_SIZE]; - pt_entry_t *pte; - quad_t dcons_addr, dcons_size; - int i; - int pg_n; - u_int extmem; - u_int under16; - vm_paddr_t pa; - - bzero(physmap, sizeof(physmap)); - - /* XXX - some of EPSON machines can't use PG_N */ - pg_n = PG_N; - if (pc98_machine_type & M_EPSON_PC98) { - switch (epson_machine_id) { -#ifdef WB_CACHE - default: -#endif - case EPSON_PC486_HX: - case EPSON_PC486_HG: - case EPSON_PC486_HA: - pg_n = 0; - break; - } - } - - under16 = pc98_getmemsize(&basemem, &extmem); - basemem_setup(); - - physmap[0] = 0; - physmap[1] = basemem * 1024; - physmap_idx = 2; - physmap[physmap_idx] = 0x100000; - physmap[physmap_idx + 1] = physmap[physmap_idx] + extmem * 1024; - - /* - * Now, physmap contains a map of physical memory. - */ - -#ifdef SMP - /* make hole for AP bootstrap code */ - physmap[1] = mp_bootaddress(physmap[1]); -#endif - - /* - * Maxmem isn't the "maximum memory", it's one larger than the - * highest page of the physical address space. It should be - * called something like "Maxphyspage". We may adjust this - * based on ``hw.physmem'' and the results of the memory test. - */ - Maxmem = atop(physmap[physmap_idx + 1]); - -#ifdef MAXMEM - Maxmem = MAXMEM / 4; -#endif - - if (TUNABLE_ULONG_FETCH("hw.physmem", &physmem_tunable)) - Maxmem = atop(physmem_tunable); - - /* - * By default keep the memtest enabled. Use a general name so that - * one could eventually do more with the code than just disable it. - */ - memtest = 1; - TUNABLE_ULONG_FETCH("hw.memtest.tests", &memtest); - - if (atop(physmap[physmap_idx + 1]) != Maxmem && - (boothowto & RB_VERBOSE)) - printf("Physical memory use set to %ldK\n", Maxmem * 4); - - /* - * If Maxmem has been increased beyond what the system has detected, - * extend the last memory segment to the new limit. - */ - if (atop(physmap[physmap_idx + 1]) < Maxmem) - physmap[physmap_idx + 1] = ptoa((vm_paddr_t)Maxmem); - - /* - * We need to divide chunk if Maxmem is larger than 16MB and - * under 16MB area is not full of memory. - * (1) system area (15-16MB region) is cut off - * (2) extended memory is only over 16MB area (ex. Melco "HYPERMEMORY") - */ - if ((under16 != 16 * 1024) && (extmem > 15 * 1024)) { - /* 15M - 16M region is cut off, so need to divide chunk */ - physmap[physmap_idx + 1] = under16 * 1024; - physmap_idx += 2; - physmap[physmap_idx] = 0x1000000; - physmap[physmap_idx + 1] = physmap[2] + extmem * 1024; - } - - /* call pmap initialization to make new kernel address space */ - pmap_bootstrap(first); - - /* - * Size up each available chunk of physical memory. - */ - physmap[0] = PAGE_SIZE; /* mask off page 0 */ - pa_indx = 0; - da_indx = 1; - phys_avail[pa_indx++] = physmap[0]; - phys_avail[pa_indx] = physmap[0]; - dump_avail[da_indx] = physmap[0]; - pte = CMAP3; - - /* - * Get dcons buffer address - */ - if (getenv_quad("dcons.addr", &dcons_addr) == 0 || - getenv_quad("dcons.size", &dcons_size) == 0) - dcons_addr = 0; - - /* - * physmap is in bytes, so when converting to page boundaries, - * round up the start address and round down the end address. - */ - for (i = 0; i <= physmap_idx; i += 2) { - vm_paddr_t end; - - end = ptoa((vm_paddr_t)Maxmem); - if (physmap[i + 1] < end) - end = trunc_page(physmap[i + 1]); - for (pa = round_page(physmap[i]); pa < end; pa += PAGE_SIZE) { - int tmp, page_bad, full; - int *ptr = (int *)CADDR3; - - full = FALSE; - /* - * block out kernel memory as not available. - */ - if (pa >= KERNLOAD && pa < first) - goto do_dump_avail; - - /* - * block out dcons buffer - */ - if (dcons_addr > 0 - && pa >= trunc_page(dcons_addr) - && pa < dcons_addr + dcons_size) - goto do_dump_avail; - - page_bad = FALSE; - if (memtest == 0) - goto skip_memtest; - - /* - * map page into kernel: valid, read/write,non-cacheable - */ - *pte = pa | PG_V | PG_RW | pg_n; - invltlb(); - - tmp = *(int *)ptr; - /* - * Test for alternating 1's and 0's - */ - *(volatile int *)ptr = 0xaaaaaaaa; - if (*(volatile int *)ptr != 0xaaaaaaaa) - page_bad = TRUE; - /* - * Test for alternating 0's and 1's - */ - *(volatile int *)ptr = 0x55555555; - if (*(volatile int *)ptr != 0x55555555) - page_bad = TRUE; - /* - * Test for all 1's - */ - *(volatile int *)ptr = 0xffffffff; - if (*(volatile int *)ptr != 0xffffffff) - page_bad = TRUE; - /* - * Test for all 0's - */ - *(volatile int *)ptr = 0x0; - if (*(volatile int *)ptr != 0x0) - page_bad = TRUE; - /* - * Restore original value. - */ - *(int *)ptr = tmp; - -skip_memtest: - /* - * Adjust array of valid/good pages. - */ - if (page_bad == TRUE) - continue; - /* - * If this good page is a continuation of the - * previous set of good pages, then just increase - * the end pointer. Otherwise start a new chunk. - * Note that "end" points one higher than end, - * making the range >= start and < end. - * If we're also doing a speculative memory - * test and we at or past the end, bump up Maxmem - * so that we keep going. The first bad page - * will terminate the loop. - */ - if (phys_avail[pa_indx] == pa) { - phys_avail[pa_indx] += PAGE_SIZE; - } else { - pa_indx++; - if (pa_indx == PHYS_AVAIL_ARRAY_END) { - printf( - "Too many holes in the physical address space, giving up\n"); - pa_indx--; - full = TRUE; - goto do_dump_avail; - } - phys_avail[pa_indx++] = pa; /* start */ - phys_avail[pa_indx] = pa + PAGE_SIZE; /* end */ - } - physmem++; -do_dump_avail: - if (dump_avail[da_indx] == pa) { - dump_avail[da_indx] += PAGE_SIZE; - } else { - da_indx++; - if (da_indx == DUMP_AVAIL_ARRAY_END) { - da_indx--; - goto do_next; - } - dump_avail[da_indx++] = pa; /* start */ - dump_avail[da_indx] = pa + PAGE_SIZE; /* end */ - } -do_next: - if (full) - break; - } - } - *pte = 0; - invltlb(); - - /* - * XXX - * The last chunk must contain at least one page plus the message - * buffer to avoid complicating other code (message buffer address - * calculation, etc.). - */ - while (phys_avail[pa_indx - 1] + PAGE_SIZE + - round_page(msgbufsize) >= phys_avail[pa_indx]) { - physmem -= atop(phys_avail[pa_indx] - phys_avail[pa_indx - 1]); - phys_avail[pa_indx--] = 0; - phys_avail[pa_indx--] = 0; - } - - Maxmem = atop(phys_avail[pa_indx]); - - /* Trim off space for the message buffer. */ - phys_avail[pa_indx] -= round_page(msgbufsize); - - /* Map the message buffer. */ - for (off = 0; off < round_page(msgbufsize); off += PAGE_SIZE) - pmap_kenter((vm_offset_t)msgbufp + off, phys_avail[pa_indx] + - off); -} -#else /* PC98 */ static void getmemsize(int first) { @@ -2428,7 +2149,6 @@ getmemsize(int first) pmap_kenter((vm_offset_t)msgbufp + off, phys_avail[pa_indx] + off); } -#endif /* PC98 */ static void i386_kdb_init(void) @@ -2464,13 +2184,6 @@ init386(first) */ proc_linkup0(&proc0, &thread0); -#ifdef PC98 - /* - * Initialize DMAC - */ - pc98_init_dmac(); -#endif - metadata_missing = 0; if (bootinfo.bi_modulep) { preload_metadata = (caddr_t)bootinfo.bi_modulep + KERNBASE; @@ -2666,9 +2379,7 @@ init386(first) /* Initialize the PIC early for vm86 calls. */ #ifdef DEV_ISA #ifdef DEV_ATPIC -#ifndef PC98 elcr_probe(); -#endif atpic_startup(); #else /* Reset and mask the atpics and leave them shut down. */ @@ -2787,7 +2498,6 @@ cpu_pcpu_init(struct pcpu *pcpu, int cpuid, size_t size) pcpu->pc_acpi_id = 0xffffffff; } -#ifndef PC98 static int smap_sysctl_handler(SYSCTL_HANDLER_ARGS) { @@ -2823,7 +2533,6 @@ smap_sysctl_handler(SYSCTL_HANDLER_ARGS) } SYSCTL_PROC(_machdep, OID_AUTO, smap, CTLTYPE_OPAQUE|CTLFLAG_RD, NULL, 0, smap_sysctl_handler, "S,bios_smap_xattr", "Raw BIOS SMAP data"); -#endif /* !PC98 */ void spinlock_enter(void) diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c index c2c200a09b64..fcb787dc196f 100644 --- a/sys/i386/i386/mp_machdep.c +++ b/sys/i386/i386/mp_machdep.c @@ -100,7 +100,7 @@ __FBSDID("$FreeBSD$"); #define CHECK_POINTS */ -#if defined(CHECK_POINTS) && !defined(PC98) +#if defined(CHECK_POINTS) #define CHECK_READ(A) (outb(CMOS_REG, (A)), inb(CMOS_DATA)) #define CHECK_WRITE(A,D) (outb(CMOS_REG, (A)), outb(CMOS_DATA, (D))) @@ -309,9 +309,7 @@ init_secondary(void) static int start_all_aps(void) { -#ifndef PC98 u_char mpbiosreason; -#endif u_int32_t mpbioswarmvec; int apic_id, cpu, i; @@ -322,10 +320,8 @@ start_all_aps(void) /* save the current value of the warm-start vector */ mpbioswarmvec = *((u_int32_t *) WARMBOOT_OFF); -#ifndef PC98 outb(CMOS_REG, BIOS_RESET); mpbiosreason = inb(CMOS_DATA); -#endif /* set up temporary P==V mapping for AP boot */ /* XXX this is a hack, we should boot the AP on its own stack/PTD */ @@ -346,10 +342,8 @@ start_all_aps(void) /* setup a vector to our boot code */ *((volatile u_short *) WARMBOOT_OFF) = WARMBOOT_TARGET; *((volatile u_short *) WARMBOOT_SEG) = (boot_address >> 4); -#ifndef PC98 outb(CMOS_REG, BIOS_RESET); outb(CMOS_DATA, BIOS_WARM); /* 'warm-start' */ -#endif bootSTK = (char *)bootstacks[cpu] + kstack_pages * PAGE_SIZE - 4; @@ -373,10 +367,8 @@ start_all_aps(void) /* restore the warmstart vector */ *(u_int32_t *) WARMBOOT_OFF = mpbioswarmvec; -#ifndef PC98 outb(CMOS_REG, BIOS_RESET); outb(CMOS_DATA, mpbiosreason); -#endif /* Undo V==P hack from above */ for (i = TMPMAP_START; i < NKPT; i++) diff --git a/sys/i386/i386/mpboot.s b/sys/i386/i386/mpboot.s index 8f5098d14f81..cdbd28363708 100644 --- a/sys/i386/i386/mpboot.s +++ b/sys/i386/i386/mpboot.s @@ -47,7 +47,7 @@ #define CHECK_POINTS */ -#if defined(CHECK_POINTS) && !defined(PC98) +#if defined(CHECK_POINTS) #define CMOS_REG (0x70) #define CMOS_DATA (0x71) diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index b051179b7c25..2f63b5ed1f9f 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -89,11 +89,7 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef PC98 -#include -#else #include -#endif #ifdef XBOX #include @@ -676,9 +672,7 @@ static void cpu_reset_real() { struct region_descriptor null_idt; -#ifndef PC98 int b; -#endif disable_intr(); #ifdef CPU_ELAN @@ -692,16 +686,6 @@ cpu_reset_real() outl(0xcfc, 0xf); } -#ifdef PC98 - /* - * Attempt to do a CPU reset via CPU reset port. - */ - if ((inb(0x35) & 0xa0) != 0xa0) { - outb(0x37, 0x0f); /* SHUT0 = 0. */ - outb(0x37, 0x0b); /* SHUT1 = 0. */ - } - outb(0xf0, 0x00); /* Reset. */ -#else #if !defined(BROKEN_KEYBOARD_RESET) /* * Attempt to do a CPU reset via the keyboard controller, @@ -740,7 +724,6 @@ cpu_reset_real() outb(0x92, b | 0x1); DELAY(500000); /* wait 0.5 sec to see if that did it */ } -#endif /* PC98 */ printf("No known reset method worked, attempting CPU shutdown\n"); DELAY(1000000); /* wait 1 sec for printf to complete */ diff --git a/sys/i386/isa/elink.h b/sys/i386/isa/elink.h index 9b27088e7899..b0083ca3f2e7 100644 --- a/sys/i386/isa/elink.h +++ b/sys/i386/isa/elink.h @@ -29,11 +29,7 @@ * $FreeBSD$ */ -#ifdef PC98 -#define ELINK_ID_PORT 0x71d0 -#else #define ELINK_ID_PORT 0x100 -#endif #define ELINK_RESET 0xc0 #define ELINK_507_POLY 0xe7 diff --git a/sys/i386/isa/npx.c b/sys/i386/isa/npx.c index 944ebf7c474b..d481279e53f4 100644 --- a/sys/i386/isa/npx.c +++ b/sys/i386/isa/npx.c @@ -1357,9 +1357,7 @@ static driver_t npxisa_driver = { static devclass_t npxisa_devclass; DRIVER_MODULE(npxisa, isa, npxisa_driver, npxisa_devclass, 0, 0); -#ifndef PC98 DRIVER_MODULE(npxisa, acpi, npxisa_driver, npxisa_devclass, 0, 0); -#endif #endif /* DEV_ISA */ static MALLOC_DEFINE(M_FPUKERN_CTX, "fpukern_ctx", diff --git a/sys/i386/pci/pci_pir.c b/sys/i386/pci/pci_pir.c index 6aeaae3502be..60f947ad7ffc 100644 --- a/sys/i386/pci/pci_pir.c +++ b/sys/i386/pci/pci_pir.c @@ -108,13 +108,8 @@ static int pir_interrupt_weight[NUM_ISA_INTERRUPTS]; SYSCTL_DECL(_hw_pci); /* XXX this likely should live in a header file */ -#ifdef PC98 -/* IRQs 3, 5, 7, 9, 10, 11, 12, 13 */ -#define PCI_IRQ_OVERRIDE_MASK 0x3e68 -#else /* IRQs 3, 4, 5, 6, 7, 9, 10, 11, 12, 14, 15 */ #define PCI_IRQ_OVERRIDE_MASK 0xdef8 -#endif static uint32_t pci_irq_override_mask = PCI_IRQ_OVERRIDE_MASK; SYSCTL_INT(_hw_pci, OID_AUTO, irq_override_mask, CTLFLAG_RDTUN, diff --git a/sys/isa/isareg.h b/sys/isa/isareg.h index c959d74128d0..ff2e264b1e59 100644 --- a/sys/isa/isareg.h +++ b/sys/isa/isareg.h @@ -33,10 +33,6 @@ * $FreeBSD$ */ -#ifdef PC98 -#error isareg.h is included from PC-9801 source -#endif - #ifndef _ISA_ISA_H_ #define _ISA_ISA_H_ diff --git a/sys/isa/isavar.h b/sys/isa/isavar.h index 3b1a2e63e8b2..f9c2f9d6abe8 100644 --- a/sys/isa/isavar.h +++ b/sys/isa/isavar.h @@ -186,19 +186,6 @@ void isa_hint_device_unit(device_t bus, device_t child, const char *name, int *unitp); int isab_attach(device_t dev); -#ifdef PC98 -#include - -/* - * Allocate discontinuous resources for ISA bus. - */ -struct resource * -isa_alloc_resourcev(device_t child, int type, int *rid, - bus_addr_t *res, bus_size_t count, u_int flags); -int -isa_load_resourcev(struct resource *re, bus_addr_t *res, bus_size_t count); -#endif - #endif /* _KERNEL */ #endif /* !_ISA_ISAVAR_H_ */ diff --git a/sys/isa/pnp.c b/sys/isa/pnp.c index db37fa629ea3..5b7a45c8aaf6 100644 --- a/sys/isa/pnp.c +++ b/sys/isa/pnp.c @@ -94,17 +94,6 @@ struct pnp_quirk pnp_quirks[] = { { 0 } }; -#ifdef PC98 -/* Some NEC PnP cards have 9 bytes serial code. */ -static pnp_id necids[] = { - {0x4180a3b8, 0xffffffff, 0x00}, /* PC-9801CB-B04 (NEC8041) */ - {0x5181a3b8, 0xffffffff, 0x46}, /* PC-9821CB2-B04(NEC8151) */ - {0x5182a3b8, 0xffffffff, 0xb8}, /* PC-9801-XX (NEC8251) */ - {0x9181a3b8, 0xffffffff, 0x00}, /* PC-9801-120 (NEC8191) */ - {0, 0, 0} -}; -#endif - /* The READ_DATA port that we are using currently */ static int pnp_rd_port; @@ -677,10 +666,6 @@ pnp_isolation_protocol(device_t parent) u_char *resources = NULL; int space = 0; int error; -#ifdef PC98 - int n, necpnp; - u_char buffer[10]; -#endif /* * Put all cards into the Sleep state so that we can clear @@ -722,28 +707,6 @@ pnp_isolation_protocol(device_t parent) * logical devices on the card. */ pnp_write(PNP_SET_CSN, csn); -#ifdef PC98 - if (bootverbose) - printf("PnP Vendor ID = %x\n", id.vendor_id); - /* Check for NEC PnP (9 bytes serial). */ - for (n = necpnp = 0; necids[n].vendor_id; n++) { - if (id.vendor_id == necids[n].vendor_id) { - necpnp = 1; - break; - } - } - if (necpnp) { - if (bootverbose) - printf("An NEC-PnP card (%s).\n", - pnp_eisaformat(id.vendor_id)); - /* Read dummy 9 bytes serial area. */ - pnp_get_resource_info(buffer, 9); - } else { - if (bootverbose) - printf("A Normal-ISA-PnP card (%s).\n", - pnp_eisaformat(id.vendor_id)); - } -#endif if (bootverbose) printf("Reading PnP configuration for %s.\n", pnp_eisaformat(id.vendor_id)); diff --git a/sys/isa/pnpreg.h b/sys/isa/pnpreg.h index abd181198d41..1b4cdc77822f 100644 --- a/sys/isa/pnpreg.h +++ b/sys/isa/pnpreg.h @@ -40,13 +40,8 @@ #define PNP_MAX_CARDS 8 /* Static ports to access PnP state machine */ -#ifdef PC98 -#define _PNP_ADDRESS 0x259 -#define _PNP_WRITE_DATA 0xa59 -#else #define _PNP_ADDRESS 0x279 #define _PNP_WRITE_DATA 0xa79 -#endif /* PnP Registers. Write to ADDRESS and then use WRITE/READ_DATA */ #define PNP_SET_RD_DATA 0x00 diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 77ca00bd4e7c..8a832b9a3588 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -599,7 +599,7 @@ _vxge= vxge _wbwd= wbwd _wi= wi _xe= xe -.if ${MACHINE} != "pc98" + _aac= aac _aacraid= aacraid _acpi= acpi @@ -680,7 +680,6 @@ _wpifw= wpifw .endif _x86bios= x86bios .endif -.endif .if ${MACHINE_CPUARCH} == "amd64" _efirt= efirt @@ -730,7 +729,6 @@ _sbni= sbni _streams= streams _stg= stg _svr4= svr4 -.if ${MACHINE} == "i386" .if ${MK_EISA} != "no" _ahb= ahb .endif @@ -740,13 +738,6 @@ _ctau= ctau .endif _dpt= dpt _ex= ex -.elif ${MACHINE} == "pc98" -_canbepm= canbepm -_canbus= canbus -_ct= ct -_pmc= pmc -_snc= snc -.endif .endif .if ${MACHINE_CPUARCH} == "arm" diff --git a/sys/modules/Makefile.inc b/sys/modules/Makefile.inc index b20b99b7a75c..a81b6b1edc37 100644 --- a/sys/modules/Makefile.inc +++ b/sys/modules/Makefile.inc @@ -1,7 +1,3 @@ # $FreeBSD$ -.if ${MACHINE} == "pc98" -CFLAGS+= -DPC98 -.endif - SUBDIR_PARALLEL= yes diff --git a/sys/modules/aic/Makefile b/sys/modules/aic/Makefile index 860d9a8a9499..4c0277f86eb0 100644 --- a/sys/modules/aic/Makefile +++ b/sys/modules/aic/Makefile @@ -3,14 +3,8 @@ .PATH: ${.CURDIR}/../../dev/aic KMOD= aic -SRCS= aic.c aic_pccard.c +SRCS= aic.c aic_isa.c aic_pccard.c SRCS+= device_if.h bus_if.h pci_if.h isa_if.h card_if.h pccarddevs.h SRCS+= opt_cam.h opt_scsi.h -.if ${MACHINE} == "pc98" -SRCS+= aic_cbus.c -.else -SRCS+= aic_isa.c -.endif - .include diff --git a/sys/modules/apm/Makefile b/sys/modules/apm/Makefile index 96703b15fab6..d7be22d65982 100644 --- a/sys/modules/apm/Makefile +++ b/sys/modules/apm/Makefile @@ -1,15 +1,9 @@ # $FreeBSD$ .PATH: ${.CURDIR}/../../i386/bios -.if ${MACHINE} == "pc98" -.PATH: ${.CURDIR}/../../pc98/apm -.endif KMOD= apm SRCS= apm.c apm.h -.if ${MACHINE} == "pc98" -SRCS+= apm_bioscall.S -.endif SRCS+= device_if.h bus_if.h EXPORT_SYMS= apm_display \ diff --git a/sys/modules/ata/Makefile b/sys/modules/ata/Makefile index c14fb8c2ccd5..21d853325824 100644 --- a/sys/modules/ata/Makefile +++ b/sys/modules/ata/Makefile @@ -2,11 +2,7 @@ SUBDIR = atacore SUBDIR += atacard -.if ${MACHINE} == "pc98" -SUBDIR += atacbus -.else SUBDIR += ataisa -.endif SUBDIR += atapci .include diff --git a/sys/modules/canbepm/Makefile b/sys/modules/canbepm/Makefile deleted file mode 100644 index 0eb911243eee..000000000000 --- a/sys/modules/canbepm/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# $FreeBSD$ - -.PATH: ${.CURDIR}/../../pc98/pc98 -KMOD = canbepm -SRCS = canbepm.c -SRCS += device_if.h bus_if.h canbus_if.h - -.include diff --git a/sys/modules/canbus/Makefile b/sys/modules/canbus/Makefile deleted file mode 100644 index 19487e01ef3d..000000000000 --- a/sys/modules/canbus/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# $FreeBSD$ - -.PATH: ${.CURDIR}/../../pc98/pc98 -KMOD = canbus -SRCS = canbus.c -SRCS += device_if.h bus_if.h canbus_if.h canbus_if.c - -.include diff --git a/sys/modules/ct/Makefile b/sys/modules/ct/Makefile deleted file mode 100644 index 91cb936dbb4a..000000000000 --- a/sys/modules/ct/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# $FreeBSD$ - -.PATH: ${.CURDIR}/../../dev/ct - -KMOD= ct -SRCS= bshw_machdep.c ct.c ct_isa.c -SRCS+= device_if.h bus_if.h isa_if.h -SRCS+= opt_ct.h opt_cam.h opt_scsi.h opt_ddb.h - -.include diff --git a/sys/modules/drm2/Makefile b/sys/modules/drm2/Makefile index 6ba0def9597e..52fc3e241ff1 100644 --- a/sys/modules/drm2/Makefile +++ b/sys/modules/drm2/Makefile @@ -3,7 +3,7 @@ SYSDIR?=${.CURDIR}/../.. .include "${SYSDIR}/conf/kern.opts.mk" -.if ${MACHINE_CPUARCH} == "amd64" +.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" _i915kms= i915kms _radeonkms= radeonkms . if ${MK_SOURCELESS_UCODE} != "no" @@ -11,16 +11,6 @@ _radeonkmsfw= radeonkmsfw . endif .endif -.if ${MACHINE_CPUARCH} == "i386" -. if ${MACHINE} != "pc98" -_i915kms= i915kms -_radeonkms= radeonkms -. if ${MK_SOURCELESS_UCODE} != "no" -_radeonkmsfw= radeonkmsfw -. endif -. endif -.endif - .if ${MACHINE_CPUARCH} == "powerpc" _radeonkms= radeonkms . if ${MK_SOURCELESS_UCODE} != "no" diff --git a/sys/modules/ed/Makefile b/sys/modules/ed/Makefile index 427b99f973cd..a6a74b16470c 100644 --- a/sys/modules/ed/Makefile +++ b/sys/modules/ed/Makefile @@ -5,14 +5,10 @@ KMOD= if_ed SRCS= if_ed.c SRCS+= if_ed_novell.c if_ed_wd80x3.c if_ed_rtl80x9.c isa_if.h -.if ${MACHINE} == "pc98" -SRCS+= if_ed_cbus.c -.else SRCS+= if_ed_isa.c SRCS.ED_HPP=if_ed_hpp.c SRCS.ED_SIC=if_ed_sic.c SRCS.ED_3C503=if_ed_3c503.c -.endif SRCS+= if_ed_pccard.c pccarddevs.h card_if.h SRCS.DEV_PCI=if_ed_pci.c pci_if.h diff --git a/sys/modules/fdc/Makefile b/sys/modules/fdc/Makefile index 40eb42719379..b19f204aacd0 100644 --- a/sys/modules/fdc/Makefile +++ b/sys/modules/fdc/Makefile @@ -3,14 +3,10 @@ KMOD= fdc .PATH: ${.CURDIR}/../../dev/fdc -.if ${MACHINE} == "pc98" -SRCS= fdc.c fdc_cbus.c -.else SRCS= fdc.c fdc_isa.c fdc_pccard.c .if ${MACHINE} == "i386" || ${MACHINE} == "amd64" SRCS+= opt_acpi.h acpi_if.h fdc_acpi.c .endif -.endif SRCS+= opt_fdc.h bus_if.h card_if.h device_if.h \ isa_if.h pccarddevs.h diff --git a/sys/modules/fe/Makefile b/sys/modules/fe/Makefile index 77af85bfd63b..81a7e12905e0 100644 --- a/sys/modules/fe/Makefile +++ b/sys/modules/fe/Makefile @@ -3,13 +3,7 @@ .PATH: ${.CURDIR}/../../dev/fe KMOD= if_fe -SRCS= if_fe.c if_fe_pccard.c - -.if ${MACHINE} == "pc98" -SRCS+= if_fe_cbus.c -.else -SRCS+= if_fe_isa.c -.endif +SRCS= if_fe.c if_fe_isa.c if_fe_pccard.c SRCS+= bus_if.h card_if.h device_if.h isa_if.h pccarddevs.h diff --git a/sys/modules/geom/geom_part/Makefile b/sys/modules/geom/geom_part/Makefile index aa6059c3ba82..a83ef624db78 100644 --- a/sys/modules/geom/geom_part/Makefile +++ b/sys/modules/geom/geom_part/Makefile @@ -7,7 +7,6 @@ SUBDIR= geom_part_apm \ geom_part_gpt \ geom_part_ldm \ geom_part_mbr \ - geom_part_pc98 \ geom_part_vtoc8 .include diff --git a/sys/modules/geom/geom_part/geom_part_pc98/Makefile b/sys/modules/geom/geom_part/geom_part_pc98/Makefile deleted file mode 100644 index 283809f3d6b3..000000000000 --- a/sys/modules/geom/geom_part/geom_part_pc98/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# $FreeBSD$ - -.PATH: ${.CURDIR}/../../../../geom/part - -KMOD= geom_part_pc98 -SRCS= g_part_pc98.c - -SRCS+= bus_if.h device_if.h g_part_if.h - -.include diff --git a/sys/modules/geom/geom_pc98/Makefile b/sys/modules/geom/geom_pc98/Makefile deleted file mode 100644 index 2c5952d3e4f0..000000000000 --- a/sys/modules/geom/geom_pc98/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# $FreeBSD$ - -.PATH: ${.CURDIR}/../../../geom - -KMOD= geom_pc98 -SRCS= geom_pc98.c geom_pc98_enc.c - -.include diff --git a/sys/modules/i2c/controllers/Makefile b/sys/modules/i2c/controllers/Makefile index 132ff2d3babe..d4e8296ba960 100644 --- a/sys/modules/i2c/controllers/Makefile +++ b/sys/modules/i2c/controllers/Makefile @@ -1,9 +1,5 @@ # $FreeBSD$ -.if ${MACHINE} == "pc98" -SUBDIR = lpbb -.else SUBDIR = alpm amdpm amdsmb ichiic ichsmb intpm ismt nfsmb viapm lpbb pcf -.endif .include diff --git a/sys/modules/le/Makefile b/sys/modules/le/Makefile index d267cbec2c26..4880af1d2caa 100644 --- a/sys/modules/le/Makefile +++ b/sys/modules/le/Makefile @@ -3,16 +3,12 @@ .PATH: ${.CURDIR}/../../dev/le KMOD= if_le -SRCS= am7990.c am79900.c ${if_le_cbus} ${if_le_isa} ${if_le_lebuffer} +SRCS= am7990.c am79900.c ${if_le_isa} ${if_le_lebuffer} SRCS+= ${if_le_ledma} if_le_pci.c lance.c ${lebuffer_sbus} SRCS+= bus_if.h device_if.h ${isa_if} ${ofw_bus_if} pci_if.h .if ${MACHINE_CPUARCH} == "i386" -.if ${MACHINE} == "pc98" -if_le_cbus= if_le_cbus.c -.else if_le_isa= if_le_isa.c -.endif isa_if= isa_if.h .endif diff --git a/sys/modules/mse/Makefile b/sys/modules/mse/Makefile index 4cc68c1f9c6d..af515b2e80b9 100644 --- a/sys/modules/mse/Makefile +++ b/sys/modules/mse/Makefile @@ -3,12 +3,6 @@ .PATH: ${.CURDIR}/../../dev/mse KMOD= mse -SRCS= mse.c device_if.h bus_if.h isa_if.h - -.if (${MACHINE} == "pc98") -SRCS+= mse_cbus.c -.else -SRCS+= mse_isa.c -.endif +SRCS= mse.c mse_isa.c device_if.h bus_if.h isa_if.h .include diff --git a/sys/modules/pmc/Makefile b/sys/modules/pmc/Makefile deleted file mode 100644 index 60dd3503dfcd..000000000000 --- a/sys/modules/pmc/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# $FreeBSD$ - -.PATH: ${.CURDIR}/../../pc98/cbus - -KMOD= pmc -SRCS= pmc.c -SRCS+= bus_if.h device_if.h isa_if.h - -.include diff --git a/sys/modules/ppc/Makefile b/sys/modules/ppc/Makefile index 53621f119baa..76323b4cd065 100644 --- a/sys/modules/ppc/Makefile +++ b/sys/modules/ppc/Makefile @@ -6,15 +6,8 @@ SRCS= bus_if.h device_if.h ppbus_if.h isa_if.h pci_if.h serdev_if.h \ opt_ppc.h opt_isa.h \ ppc.c ppc_pci.c ppc_puc.c -.if ${MACHINE_CPUARCH} == "amd64" +.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" SRCS+= ppc_acpi.c ppc_isa.c .endif -.if ${MACHINE_CPUARCH} == "i386" -.if ${MACHINE} != "pc98" -SRCS+= ppc_acpi.c -.endif -SRCS+= ppc_isa.c -.endif - .include diff --git a/sys/modules/sio/Makefile b/sys/modules/sio/Makefile index 057e9c614d42..9e162807b66a 100644 --- a/sys/modules/sio/Makefile +++ b/sys/modules/sio/Makefile @@ -1,29 +1,15 @@ # $FreeBSD$ -.if ${MACHINE} == "pc98" -.PATH: ${.CURDIR}/../../pc98/cbus -.endif .PATH: ${.CURDIR}/../../dev/sio KMOD= sio SRCS= bus_if.h card_if.h device_if.h isa_if.h pci_if.h serdev_if.h \ opt_compat.h opt_gdb.h opt_kdb.h opt_sio.h \ - sio.c sio_pccard.c sio_pci.c sio_puc.c pccarddevs.h -.if ${MACHINE} == "pc98" -SRCS+= sio_cbus.c -.else -SRCS+= sio_isa.c -.endif + sio.c sio_isa.c sio_pccard.c sio_pci.c sio_puc.c pccarddevs.h .if !defined(KERNBUILDDIR) opt_compat.h: echo "#define COMPAT_43 1" > ${.TARGET} - -.if ${MACHINE} == "pc98" -opt_sio.h: - echo "#define COM_MULTIPORT 1" > ${.TARGET} - echo "#define COM_ESP 1" >> ${.TARGET} -.endif .endif .include diff --git a/sys/modules/snc/Makefile b/sys/modules/snc/Makefile deleted file mode 100644 index 837248609c87..000000000000 --- a/sys/modules/snc/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# $FreeBSD$ - -.PATH: ${.CURDIR}/../../dev/snc - -KMOD= if_snc -SRCS= if_snc.c if_snc_cbus.c if_snc_pccard.c dp83932.c dp83932subr.c -SRCS+= opt_inet.h device_if.h bus_if.h isa_if.h card_if.h pccarddevs.h - -.include diff --git a/sys/modules/sound/sound/Makefile b/sys/modules/sound/sound/Makefile index ff9c48e66f7e..274d25f69170 100644 --- a/sys/modules/sound/sound/Makefile +++ b/sys/modules/sound/sound/Makefile @@ -34,8 +34,7 @@ CLEANFILES+= feeder_eq_gen.h feeder_rate_gen.h snd_fxdiv_gen.h EXPORT_SYMS= YES # XXX evaluate -.if ${MACHINE_CPUARCH} != "i386" && ${MACHINE_CPUARCH} != "amd64" && \ - ${MACHINE_CPUARCH} != "pc98" +.if ${MACHINE_CPUARCH} != "i386" && ${MACHINE_CPUARCH} != "amd64" # Create an empty opt_isa.h in order to keep kmod.mk from linking in an # existing one from KERNBUILDDIR which possibly has DEV_ISA defined so # sound.ko is always built without isadma support. diff --git a/sys/pc98/apm/apm_bioscall.S b/sys/pc98/apm/apm_bioscall.S deleted file mode 100644 index fa42734a7cbf..000000000000 --- a/sys/pc98/apm/apm_bioscall.S +++ /dev/null @@ -1,87 +0,0 @@ -/*- - * Copyright (c) 1997 Jonathan Lemon - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -/* - * Functions for calling x86 BIOS functions from the BSD kernel - */ - -#include - - .text - -/* - * bios32_apm98(regs, offset, segment) - * struct bios_regs *regs; - * u_int offset; - * u_short segment; - */ -ENTRY(bios32_apm98) - pushl %ebp - movl 16(%esp),%ebp - mov %bp,bioscall_vector+4 - movl 12(%esp),%ebp - movl %ebp,bioscall_vector - movl 8(%esp),%ebp - pushl %ebx - pushl %esi - pushl %edi - movl 0(%ebp),%eax - movl 4(%ebp),%ebx - movl 8(%ebp),%ecx - movl 12(%ebp),%edx - movl 16(%ebp),%esi - movl 20(%ebp),%edi - pushl %ebp - pushfl - cli - lcall *bioscall_vector - movl %eax,%edi - movl %edx,%esi - lahf - movl apm_necsmm_addr,%edx - andl %edx,%edx - jz 9f - inb %dx,%al - andl apm_necsmm_mask,%eax - outb %al,%dx -9: - sti - popl %ebp - movl %edi,0(%ebp) - movl %ebx,4(%ebp) - movl %ecx,8(%ebp) - movl %esi,12(%ebp) - movl $0,16(%ebp) /* esi is cannot get */ - movl $0,20(%ebp) /* edi is cannot get */ - movl %edi,%eax - andl $0x100,%eax - popl %edi - popl %esi - popl %ebx - popl %ebp - ret diff --git a/sys/pc98/cbus/30line.h b/sys/pc98/cbus/30line.h deleted file mode 100644 index c2e0f107a260..000000000000 --- a/sys/pc98/cbus/30line.h +++ /dev/null @@ -1,130 +0,0 @@ -/*- - * Copyright (c) 1994, 1995, 1996. FreeBSD(98) porting team. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer as - * the first lines of this file unmodified. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef __PC98_PC98_30LINE_H__ -#define __PC98_PC98_30LINE_H__ - -#define LINE30_ROW 30 -#define _HS 1 + 1 -#define _VS 2 -#define _HFP 3 + 1 -#define _HBP 14 + 1 -#define _VFP 11 -#define _VBP 44 - -#define _CR 80 -#define _LF LINE30_ROW*16 - -#define _GDC_RESET 0x00 -#define _GDC_SYNC 0x0e -#define _GDC_MASTER 0x6f -#define _GDC_SLAVE 0x6e -#define _GDC_START 0x0d -#define _GDC_STOP 0x0c -#define _GDC_SCROLL 0x70 -#define _GDC_PITCH 0x47 - -#define GDC_CR 0 -#define GDC_VS 1 -#define GDC_HS 2 -#define GDC_HFP 3 -#define GDC_HBP 4 -#define GDC_VFP 5 -#define GDC_VBP 6 -#define GDC_LF 7 - - -#define _24KHZ 0 -#define _31KHZ 1 - -#define _2_5MHZ 0 -#define _5MHZ 1 - -#define _25L 0 -#define _30L 1 - -#define T25_G400 0 -#define T30_G400 1 -#define T30_G480 2 - -static void master_gdc_cmd(unsigned int); -static void master_gdc_prm(unsigned int); -static void master_gdc_word_prm(unsigned int); -#ifdef LINE30 -static void master_gdc_fifo_empty(void); -#endif -static void master_gdc_wait_vsync(void); - -static void gdc_cmd(unsigned int); -#ifdef LINE30 -static void gdc_prm(unsigned int); -static void gdc_word_prm(unsigned int); -static void gdc_fifo_empty(void); -#endif -static void gdc_wait_vsync(void); - -#ifdef LINE30 -static int check_gdc_clock(void); - -static int gdc_INFO = _25L; -#endif -static int gdc_FH = _24KHZ; -static void initialize_gdc(unsigned int, int); - -#ifdef LINE30 -static unsigned int master_param[2][2][8] = { -{{78, 8, 7, 9, 7, 7, 25, 400}, /* 400/24k */ - {_CR-2, _VS, _HS-1, _HFP-1, _HBP-1, _VFP, _VBP, _LF}}, /* 480/24k */ -{{78, 2, 7, 3, 7, 13, 34, 400}, /* 400/31k */ - {78, 2, 11, 3, 3, 6, 37, 480}}}; /* 480/31k */ - -static unsigned int slave_param[2][6][8] = { -{{38, 8, 3, 4, 3, 7, 25, 400}, /* normal */ - {78, 8, 7, 9, 7, 7, 25, 400}, - {_CR/2-2, _VS, (_HS)/2-1, (_HFP)/2-1, (_HBP)/2-1, - _VFP+(_LF-400)/2+8, _VBP+(_LF-400)/2-8, 400}, /* 30 & 400 */ - {_CR-2, _VS, _HS-1, _HFP-1, _HBP-1, - _VFP+(_LF-400)/2+8, _VBP+(_LF-400)/2-8, 400}, - {_CR/2-2, _VS, (_HS)/2-1, (_HFP)/2-1, (_HBP)/2-1, - _VFP, _VBP, _LF}, /* 30 & 480 */ - {_CR-2, _VS, _HS-1, _HFP-1, _HBP-1, _VFP, _VBP, _LF}}, -{{38, 2, 3, 1, 3, 13, 34, 400}, /* normal */ - {78, 2, 7, 3, 7, 13, 34, 400}, - {38, 2, 5, 1, 1, 6+48, 37+32, 400}, /* 30 & 400 */ - {78, 2, 11, 3, 3, 6+48, 37+32, 400}, - {38, 2, 5, 1, 1, 6, 37, 480}, /* 30 & 480 */ - {78, 2, 11, 3, 3, 6, 37, 480}}}; - -static int SlavePCH[2] = {40,80}; -static int MasterPCH = 80; -static int SlaveScrlLF[3] = {400,400,_LF}; -#endif - -#endif /* __PC98_PC98_30LINE_H__ */ diff --git a/sys/pc98/cbus/cbus.h b/sys/pc98/cbus/cbus.h deleted file mode 100644 index 302245f896f6..000000000000 --- a/sys/pc98/cbus/cbus.h +++ /dev/null @@ -1,63 +0,0 @@ -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)isa.h 5.7 (Berkeley) 5/9/91 - * $FreeBSD$ - */ - -#ifndef _PC98_PC98_PC98_H_ -#define _PC98_PC98_PC98_H_ - -/* - * PC98 Bus conventions - * modified for PC9801 by A.Kojima F.Ukai M.Ishii - * Kyoto University Microcomputer Club (KMC) - */ - -/* - * Input / Output Port Assignments -- PC98 IO address ... very dirty (^_^; - */ - -#define IO_ICU1 0x000 /* 8259A Interrupt Controller #1 */ -#define IO_ICU2 0x008 /* 8259A Interrupt Controller #2 */ -#define IO_RTC 0x020 /* 4990A RTC */ -#define IO_SYSPORT 0x031 /* 8255A System Port */ -#define IO_KBD 0x041 /* 8251A Keyboard */ -#define IO_COM2 0x0B1 /* 8251A RS232C serial I/O (ext) */ -#define IO_COM3 0x0B9 /* 8251A RS232C serial I/O (ext) */ -#define IO_FDPORT 0x0BE /* FD I/F port (1M<->640K,EMTON) */ - -/* - * Input / Output Port Sizes - */ -#define IO_KBDSIZE 16 /* 8042 Keyboard controllers */ - -#endif /* !_PC98_PC98_PC98_H_ */ diff --git a/sys/pc98/cbus/cbus_dma.c b/sys/pc98/cbus/cbus_dma.c deleted file mode 100644 index 02d9d0c67ae3..000000000000 --- a/sys/pc98/cbus/cbus_dma.c +++ /dev/null @@ -1,534 +0,0 @@ -/*- - * Copyright (c) 1991 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)isa.c 7.2 (Berkeley) 5/13/91 - */ - -#include -__FBSDID("$FreeBSD$"); - -/* - * code to manage AT bus - * - * 92/08/18 Frank P. MacLachlan (fpm@crash.cts.com): - * Fixed uninitialized variable problem and added code to deal - * with DMA page boundaries in isa_dmarangecheck(). Fixed word - * mode DMA count compution and reorganized DMA setup code in - * isa_dmastart() - */ - -#include "opt_pc98.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static int isa_dmarangecheck(caddr_t va, u_int length, int chan); - -static caddr_t dma_bouncebuf[4]; -static u_int dma_bouncebufsize[4]; -static u_int8_t dma_bounced = 0; -static u_int8_t dma_busy = 0; /* Used in isa_dmastart() */ -static u_int8_t dma_inuse = 0; /* User for acquire/release */ -static u_int8_t dma_auto_mode = 0; -static struct mtx isa_dma_lock; -MTX_SYSINIT(isa_dma_lock, &isa_dma_lock, "isa DMA lock", MTX_DEF); - -#define VALID_DMA_MASK (3) - -/* high byte of address is stored in this port for i-th dma channel */ -static int dmapageport[4] = { 0x27, 0x21, 0x23, 0x25 }; - -/* - * Setup a DMA channel's bounce buffer. - */ -int -isa_dma_init(int chan, u_int bouncebufsize, int flag) -{ - void *buf; - -#ifdef DIAGNOSTIC - if (chan & ~VALID_DMA_MASK) - panic("isa_dma_init: channel out of range"); - if (dma_bouncebuf[chan] != NULL) - panic("isa_dma_init: impossible request"); -#endif - - - /* Try malloc() first. It works better if it works. */ - buf = malloc(bouncebufsize, M_DEVBUF, flag); - if (buf != NULL) { - if (isa_dmarangecheck(buf, bouncebufsize, chan) != 0) { - free(buf, M_DEVBUF); - buf = NULL; - } - } - - if (buf == NULL) { - buf = contigmalloc(bouncebufsize, M_DEVBUF, flag, 0ul, 0xfffffful, - 1ul, chan & 4 ? 0x20000ul : 0x10000ul); - } - - if (buf == NULL) - return (ENOMEM); - - mtx_lock(&isa_dma_lock); - - dma_bouncebufsize[chan] = bouncebufsize; - dma_bouncebuf[chan] = buf; - - mtx_unlock(&isa_dma_lock); - - return (0); -} - -/* - * Register a DMA channel's usage. Usually called from a device driver - * in open() or during its initialization. - */ -int -isa_dma_acquire(chan) - int chan; -{ -#ifdef DIAGNOSTIC - if (chan & ~VALID_DMA_MASK) - panic("isa_dma_acquire: channel out of range"); -#endif - - mtx_lock(&isa_dma_lock); - if (dma_inuse & (1 << chan)) { - printf("isa_dma_acquire: channel %d already in use\n", chan); - mtx_unlock(&isa_dma_lock); - return (EBUSY); - } - dma_inuse |= (1 << chan); - dma_auto_mode &= ~(1 << chan); - mtx_unlock(&isa_dma_lock); - - return (0); -} - -/* - * Unregister a DMA channel's usage. Usually called from a device driver - * during close() or during its shutdown. - */ -void -isa_dma_release(chan) - int chan; -{ -#ifdef DIAGNOSTIC - if (chan & ~VALID_DMA_MASK) - panic("isa_dma_release: channel out of range"); - - mtx_lock(&isa_dma_lock); - if ((dma_inuse & (1 << chan)) == 0) - printf("isa_dma_release: channel %d not in use\n", chan); -#else - mtx_lock(&isa_dma_lock); -#endif - - if (dma_busy & (1 << chan)) { - dma_busy &= ~(1 << chan); - /* - * XXX We should also do "dma_bounced &= (1 << chan);" - * because we are acting on behalf of isa_dmadone() which - * was not called to end the last DMA operation. This does - * not matter now, but it may in the future. - */ - } - - dma_inuse &= ~(1 << chan); - dma_auto_mode &= ~(1 << chan); - - mtx_unlock(&isa_dma_lock); -} - -/* - * isa_dmastart(): program 8237 DMA controller channel, avoid page alignment - * problems by using a bounce buffer. - */ -void -isa_dmastart(int flags, caddr_t addr, u_int nbytes, int chan) -{ - vm_paddr_t phys; - int waport; - caddr_t newaddr; - int dma_range_checked; - - /* translate to physical */ - phys = pmap_extract(kernel_pmap, (vm_offset_t)addr); - dma_range_checked = isa_dmarangecheck(addr, nbytes, chan); - -#ifdef DIAGNOSTIC - if (chan & ~VALID_DMA_MASK) - panic("isa_dmastart: channel out of range"); - - if ((chan < 4 && nbytes > (1<<16)) - || (chan >= 4 && (nbytes > (1<<17) || (u_int)addr & 1))) - panic("isa_dmastart: impossible request"); - - mtx_lock(&isa_dma_lock); - if ((dma_inuse & (1 << chan)) == 0) - printf("isa_dmastart: channel %d not acquired\n", chan); -#else - mtx_lock(&isa_dma_lock); -#endif - -#if 0 - /* - * XXX This should be checked, but drivers like ad1848 only call - * isa_dmastart() once because they use Auto DMA mode. If we - * leave this in, drivers that do this will print this continuously. - */ - if (dma_busy & (1 << chan)) - printf("isa_dmastart: channel %d busy\n", chan); -#endif - - dma_busy |= (1 << chan); - - if (dma_range_checked) { - if (dma_bouncebuf[chan] == NULL - || dma_bouncebufsize[chan] < nbytes) - panic("isa_dmastart: bad bounce buffer"); - dma_bounced |= (1 << chan); - newaddr = dma_bouncebuf[chan]; - - /* copy bounce buffer on write */ - if (!(flags & ISADMA_READ)) - bcopy(addr, newaddr, nbytes); - addr = newaddr; - } - - if (flags & ISADMA_RAW) { - dma_auto_mode |= (1 << chan); - } else { - dma_auto_mode &= ~(1 << chan); - } - - if (need_pre_dma_flush) - wbinvd(); /* wbinvd (WB cache flush) */ - - /* set dma channel mode, and reset address ff */ - - /* If ISADMA_RAW flag is set, then use autoinitialise mode */ - if (flags & ISADMA_RAW) { - if (flags & ISADMA_READ) - outb(DMA1_MODE, DMA37MD_AUTO|DMA37MD_WRITE|chan); - else - outb(DMA1_MODE, DMA37MD_AUTO|DMA37MD_READ|chan); - } else { - if (flags & ISADMA_READ) - outb(DMA1_MODE, DMA37MD_SINGLE|DMA37MD_WRITE|chan); - else - outb(DMA1_MODE, DMA37MD_SINGLE|DMA37MD_READ|chan); - } - outb(DMA1_FFC, 0); - - /* send start address */ - waport = DMA1_CHN(chan); - outb(waport, phys); - outb(waport, phys>>8); - outb(dmapageport[chan], phys>>16); - - /* send count */ - outb(waport + 2, --nbytes); - outb(waport + 2, nbytes>>8); - - /* unmask channel */ - outb(DMA1_SMSK, chan); - - mtx_unlock(&isa_dma_lock); -} - -void -isa_dmadone(int flags, caddr_t addr, int nbytes, int chan) -{ - - if (flags & ISADMA_READ) { - /* cache flush only after reading 92/12/9 by A.Kojima */ - if (need_post_dma_flush) - invd(); - } - -#ifdef DIAGNOSTIC - if (chan & ~VALID_DMA_MASK) - panic("isa_dmadone: channel out of range"); - - if ((dma_inuse & (1 << chan)) == 0) - printf("isa_dmadone: channel %d not acquired\n", chan); -#endif - - mtx_lock(&isa_dma_lock); - if (((dma_busy & (1 << chan)) == 0) && - (dma_auto_mode & (1 << chan)) == 0 ) - printf("isa_dmadone: channel %d not busy\n", chan); - - if ((dma_auto_mode & (1 << chan)) == 0) - outb(DMA1_SMSK, (chan & 3) | 4); - - if (dma_bounced & (1 << chan)) { - /* copy bounce buffer on read */ - if (flags & ISADMA_READ) - bcopy(dma_bouncebuf[chan], addr, nbytes); - - dma_bounced &= ~(1 << chan); - } - dma_busy &= ~(1 << chan); - mtx_unlock(&isa_dma_lock); -} - -/* - * Check for problems with the address range of a DMA transfer - * (non-contiguous physical pages, outside of bus address space, - * crossing DMA page boundaries). - * Return true if special handling needed. - */ - -static int -isa_dmarangecheck(caddr_t va, u_int length, int chan) -{ - vm_paddr_t phys, priorpage = 0; - vm_offset_t endva; - u_int dma_pgmsk = (chan & 4) ? ~(128*1024-1) : ~(64*1024-1); - - endva = (vm_offset_t)round_page((vm_offset_t)va + length); - for (; va < (caddr_t) endva ; va += PAGE_SIZE) { - phys = trunc_page(pmap_extract(kernel_pmap, (vm_offset_t)va)); -#ifdef EPSON_BOUNCEDMA -#define ISARAM_END 0x0f00000 -#else -#define ISARAM_END 0x1000000 -#endif - if (phys == 0) - panic("isa_dmacheck: no physical page present"); - if (phys >= ISARAM_END) - return (1); - if (priorpage) { - if (priorpage + PAGE_SIZE != phys) - return (1); - /* check if crossing a DMA page boundary */ - if (((u_int)priorpage ^ (u_int)phys) & dma_pgmsk) - return (1); - } - priorpage = phys; - } - return (0); -} - -/* - * Query the progress of a transfer on a DMA channel. - * - * To avoid having to interrupt a transfer in progress, we sample - * each of the high and low databytes twice, and apply the following - * logic to determine the correct count. - * - * Reads are performed with interrupts disabled, thus it is to be - * expected that the time between reads is very small. At most - * one rollover in the low count byte can be expected within the - * four reads that are performed. - * - * There are three gaps in which a rollover can occur : - * - * - read low1 - * gap1 - * - read high1 - * gap2 - * - read low2 - * gap3 - * - read high2 - * - * If a rollover occurs in gap1 or gap2, the low2 value will be - * greater than the low1 value. In this case, low2 and high2 are a - * corresponding pair. - * - * In any other case, low1 and high1 can be considered to be correct. - * - * The function returns the number of bytes remaining in the transfer, - * or -1 if the channel requested is not active. - * - */ -static int -isa_dmastatus_locked(int chan) -{ - u_long cnt = 0; - int ffport, waport; - u_long low1, high1, low2, high2; - - mtx_assert(&isa_dma_lock, MA_OWNED); - - /* channel active? */ - if ((dma_inuse & (1 << chan)) == 0) { - printf("isa_dmastatus: channel %d not active\n", chan); - return(-1); - } - /* channel busy? */ - - if (((dma_busy & (1 << chan)) == 0) && - (dma_auto_mode & (1 << chan)) == 0 ) { - printf("chan %d not busy\n", chan); - return -2 ; - } - ffport = DMA1_FFC; - waport = DMA1_CHN(chan) + 2; - - disable_intr(); /* no interrupts Mr Jones! */ - outb(ffport, 0); /* clear register LSB flipflop */ - low1 = inb(waport); - high1 = inb(waport); - outb(ffport, 0); /* clear again */ - low2 = inb(waport); - high2 = inb(waport); - enable_intr(); /* enable interrupts again */ - - /* - * Now decide if a wrap has tried to skew our results. - * Note that after TC, the count will read 0xffff, while we want - * to return zero, so we add and then mask to compensate. - */ - if (low1 >= low2) { - cnt = (low1 + (high1 << 8) + 1) & 0xffff; - } else { - cnt = (low2 + (high2 << 8) + 1) & 0xffff; - } - - if (chan >= 4) /* high channels move words */ - cnt *= 2; - return(cnt); -} - -int -isa_dmastatus(int chan) -{ - int status; - - mtx_lock(&isa_dma_lock); - status = isa_dmastatus_locked(chan); - mtx_unlock(&isa_dma_lock); - - return (status); -} - -/* - * Reached terminal count yet ? - */ -int -isa_dmatc(int chan) -{ - - return(inb(DMA1_STATUS) & (1 << chan)); -} - -/* - * Stop a DMA transfer currently in progress. - */ -int -isa_dmastop(int chan) -{ - int status; - - mtx_lock(&isa_dma_lock); - if ((dma_inuse & (1 << chan)) == 0) - printf("isa_dmastop: channel %d not acquired\n", chan); - - if (((dma_busy & (1 << chan)) == 0) && - ((dma_auto_mode & (1 << chan)) == 0)) { - printf("chan %d not busy\n", chan); - mtx_unlock(&isa_dma_lock); - return -2 ; - } - - if ((chan & 4) == 0) - outb(DMA1_SMSK, (chan & 3) | 4 /* disable mask */); - - status = isa_dmastatus_locked(chan); - - mtx_unlock(&isa_dma_lock); - - return (status); -} - -/* - * Attach to the ISA PnP descriptor for the AT DMA controller - */ -static struct isa_pnp_id atdma_ids[] = { - { 0x0002d041 /* PNP0200 */, "AT DMA controller" }, - { 0 } -}; - -static int -atdma_probe(device_t dev) -{ - int result; - - if ((result = ISA_PNP_PROBE(device_get_parent(dev), dev, atdma_ids)) <= 0) - device_quiet(dev); - return(result); -} - -static int -atdma_attach(device_t dev) -{ - return(0); -} - -static device_method_t atdma_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, atdma_probe), - DEVMETHOD(device_attach, atdma_attach), - DEVMETHOD(device_detach, bus_generic_detach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - DEVMETHOD(device_suspend, bus_generic_suspend), - DEVMETHOD(device_resume, bus_generic_resume), - { 0, 0 } -}; - -static driver_t atdma_driver = { - "atdma", - atdma_methods, - 1, /* no softc */ -}; - -static devclass_t atdma_devclass; - -DRIVER_MODULE(atdma, isa, atdma_driver, atdma_devclass, 0, 0); diff --git a/sys/pc98/cbus/cbus_dmareg.h b/sys/pc98/cbus/cbus_dmareg.h deleted file mode 100644 index 9401b916560e..000000000000 --- a/sys/pc98/cbus/cbus_dmareg.h +++ /dev/null @@ -1,44 +0,0 @@ -/*- - * Copyright (C) 2005 TAKAHASHI Yoshihiro. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _PC98_CBUS_CBUS_DMAREG_H_ -#define _PC98_CBUS_CBUS_DMAREG_H_ - -#include - -#define IO_DMA 0x01 /* 8237A DMA Controller */ - -/* - * Register definitions for DMA controller 1 (channels 0..3): - */ -#define DMA1_CHN(c) (IO_DMA + (4*(c))) /* addr reg for channel c */ -#define DMA1_STATUS (IO_DMA + 0x10) /* status register */ -#define DMA1_SMSK (IO_DMA + 0x14) /* single mask register */ -#define DMA1_MODE (IO_DMA + 0x16) /* mode register */ -#define DMA1_FFC (IO_DMA + 0x18) /* clear first/last FF */ - -#endif /* _PC98_CBUS_CBUS_DMAREG_H_ */ diff --git a/sys/pc98/cbus/gdc.c b/sys/pc98/cbus/gdc.c deleted file mode 100644 index 4fff4cebaf07..000000000000 --- a/sys/pc98/cbus/gdc.c +++ /dev/null @@ -1,1487 +0,0 @@ -/*- - * Copyright (c) 1999 FreeBSD(98) port team. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer as - * the first lines of this file unmodified. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include "opt_gdc.h" -#include "opt_fb.h" -#include "opt_syscons.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include -#include - -#include - -#ifdef LINE30 -#include -#endif -#include -#include - -#define TEXT_GDC 0x60 -#define GRAPHIC_GDC 0xa0 -#define ROW 25 -#define COL 80 - -#define DRIVER_NAME "gdc" - -/* cdev driver declaration */ - -#define GDC_UNIT(dev) dev2unit(dev) -#define GDC_MKMINOR(unit) (unit) - -typedef struct gdc_softc { - video_adapter_t *adp; - struct resource *res_tgdc, *res_ggdc; - struct resource *res_egc, *res_pegc, *res_grcg, *res_kcg; - struct resource *res_tmem, *res_gmem1, *res_gmem2; -#ifdef FB_INSTALL_CDEV - genfb_softc_t gensc; -#endif -} gdc_softc_t; - -#define GDC_SOFTC(unit) \ - ((gdc_softc_t *)devclass_get_softc(gdc_devclass, unit)) - -static bus_addr_t gdc_iat[] = {0, 2, 4, 6, 8, 10, 12, 14}; - -static devclass_t gdc_devclass; - -static int gdc_probe_unit(int unit, gdc_softc_t *sc, int flags); -static int gdc_attach_unit(int unit, gdc_softc_t *sc, int flags); -static int gdc_alloc_resource(device_t dev); -static int gdc_release_resource(device_t dev); - -#ifdef FB_INSTALL_CDEV - -static d_open_t gdcopen; -static d_close_t gdcclose; -static d_read_t gdcread; -static d_write_t gdcwrite; -static d_ioctl_t gdcioctl; -static d_mmap_t gdcmmap; - -static struct cdevsw gdc_cdevsw = { - .d_version = D_VERSION, - .d_flags = D_NEEDGIANT, - .d_open = gdcopen, - .d_close = gdcclose, - .d_read = gdcread, - .d_write = gdcwrite, - .d_ioctl = gdcioctl, - .d_mmap = gdcmmap, - .d_name = DRIVER_NAME, -}; - -#endif /* FB_INSTALL_CDEV */ - -static void -gdc_identify(driver_t *driver, device_t parent) -{ - BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, DRIVER_NAME, 0); -} - -static int -gdcprobe(device_t dev) -{ - int error; - - /* Check isapnp ids */ - if (isa_get_vendorid(dev)) - return (ENXIO); - - device_set_desc(dev, "Generic GDC"); - - error = gdc_alloc_resource(dev); - if (error) - return (error); - - error = gdc_probe_unit(device_get_unit(dev), - device_get_softc(dev), - device_get_flags(dev)); - - gdc_release_resource(dev); - - return (error); -} - -static int -gdc_attach(device_t dev) -{ - gdc_softc_t *sc; - int error; - - error = gdc_alloc_resource(dev); - if (error) - return (error); - - sc = device_get_softc(dev); - error = gdc_attach_unit(device_get_unit(dev), - sc, - device_get_flags(dev)); - if (error) { - gdc_release_resource(dev); - return error; - } - -#ifdef FB_INSTALL_CDEV - /* attach a virtual frame buffer device */ - error = fb_attach(GDC_MKMINOR(device_get_unit(dev)), - sc->adp, &gdc_cdevsw); - if (error) { - gdc_release_resource(dev); - return error; - } -#endif /* FB_INSTALL_CDEV */ - - if (bootverbose) - vidd_diag(sc->adp, bootverbose); - - return 0; -} - -static int -gdc_probe_unit(int unit, gdc_softc_t *sc, int flags) -{ - video_switch_t *sw; - - sw = vid_get_switch(DRIVER_NAME); - if (sw == NULL) - return ENXIO; - return (*sw->probe)(unit, &sc->adp, NULL, flags); -} - -static int -gdc_attach_unit(int unit, gdc_softc_t *sc, int flags) -{ - video_switch_t *sw; - - sw = vid_get_switch(DRIVER_NAME); - if (sw == NULL) - return ENXIO; - return (*sw->init)(unit, sc->adp, flags); -} - - -static int -gdc_alloc_resource(device_t dev) -{ - int rid; - gdc_softc_t *sc; - - sc = device_get_softc(dev); - - /* TEXT GDC */ - rid = 0; - bus_set_resource(dev, SYS_RES_IOPORT, rid, TEXT_GDC, 1); - sc->res_tgdc = isa_alloc_resourcev(dev, SYS_RES_IOPORT, &rid, - gdc_iat, 8, RF_ACTIVE); - if (sc->res_tgdc == NULL) { - gdc_release_resource(dev); - return (ENXIO); - } - isa_load_resourcev(sc->res_tgdc, gdc_iat, 8); - - /* GRAPHIC GDC */ - rid = 8; - bus_set_resource(dev, SYS_RES_IOPORT, rid, GRAPHIC_GDC, 1); - sc->res_ggdc = isa_alloc_resourcev(dev, SYS_RES_IOPORT, &rid, - gdc_iat, 8, RF_ACTIVE); - if (sc->res_ggdc == NULL) { - gdc_release_resource(dev); - return (ENXIO); - } - isa_load_resourcev(sc->res_ggdc, gdc_iat, 8); - - /* EGC */ - rid = 16; - bus_set_resource(dev, SYS_RES_IOPORT, rid, 0x4a0, 1); - sc->res_egc = isa_alloc_resourcev(dev, SYS_RES_IOPORT, &rid, - gdc_iat, 8, RF_ACTIVE); - if (sc->res_egc == NULL) { - gdc_release_resource(dev); - return (ENXIO); - } - isa_load_resourcev(sc->res_egc, gdc_iat, 8); - - /* PEGC */ - rid = 24; - bus_set_resource(dev, SYS_RES_IOPORT, rid, 0x9a0, 1); - sc->res_pegc = isa_alloc_resourcev(dev, SYS_RES_IOPORT, &rid, - gdc_iat, 8, RF_ACTIVE); - if (sc->res_pegc == NULL) { - gdc_release_resource(dev); - return (ENXIO); - } - isa_load_resourcev(sc->res_pegc, gdc_iat, 8); - - /* CRTC/GRCG */ - rid = 32; - bus_set_resource(dev, SYS_RES_IOPORT, rid, 0x70, 1); - sc->res_grcg = isa_alloc_resourcev(dev, SYS_RES_IOPORT, &rid, - gdc_iat, 8, RF_ACTIVE); - if (sc->res_grcg == NULL) { - gdc_release_resource(dev); - return (ENXIO); - } - isa_load_resourcev(sc->res_grcg, gdc_iat, 8); - - /* KCG */ - rid = 40; - bus_set_resource(dev, SYS_RES_IOPORT, rid, 0xa1, 1); - sc->res_kcg = isa_alloc_resourcev(dev, SYS_RES_IOPORT, &rid, - gdc_iat, 8, RF_ACTIVE); - if (sc->res_kcg == NULL) { - gdc_release_resource(dev); - return (ENXIO); - } - isa_load_resourcev(sc->res_kcg, gdc_iat, 8); - - - /* TEXT Memory */ - rid = 0; - sc->res_tmem = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, - 0xa0000, 0xa4fff, 0x5000, RF_ACTIVE); - if (sc->res_tmem == NULL) { - gdc_release_resource(dev); - return (ENXIO); - } - - /* GRAPHIC Memory */ - rid = 1; - sc->res_gmem1 = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, - 0xa8000, 0xbffff, 0x18000, - RF_ACTIVE); - if (sc->res_gmem1 == NULL) { - gdc_release_resource(dev); - return (ENXIO); - } - rid = 2; - sc->res_gmem2 = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, - 0xe0000, 0xe7fff, 0x8000, - RF_ACTIVE); - if (sc->res_gmem2 == NULL) { - gdc_release_resource(dev); - return (ENXIO); - } - - return (0); -} - -static int -gdc_release_resource(device_t dev) -{ - gdc_softc_t *sc; - - sc = device_get_softc(dev); - - if (sc->res_tgdc) - bus_release_resource(dev, SYS_RES_IOPORT, 0, sc->res_tgdc); - if (sc->res_ggdc) - bus_release_resource(dev, SYS_RES_IOPORT, 8, sc->res_ggdc); - if (sc->res_egc) - bus_release_resource(dev, SYS_RES_IOPORT, 16, sc->res_egc); - if (sc->res_pegc) - bus_release_resource(dev, SYS_RES_IOPORT, 24, sc->res_pegc); - if (sc->res_grcg) - bus_release_resource(dev, SYS_RES_IOPORT, 32, sc->res_grcg); - if (sc->res_kcg) - bus_release_resource(dev, SYS_RES_IOPORT, 40, sc->res_kcg); - - if (sc->res_tmem) - bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->res_tmem); - if (sc->res_gmem1) - bus_release_resource(dev, SYS_RES_MEMORY, 1, sc->res_gmem1); - if (sc->res_gmem2) - bus_release_resource(dev, SYS_RES_MEMORY, 2, sc->res_gmem2); - - return (0); -} - -/* cdev driver functions */ - -#ifdef FB_INSTALL_CDEV - -static int -gdcopen(struct cdev *dev, int flag, int mode, struct thread *td) -{ - gdc_softc_t *sc; - - sc = GDC_SOFTC(GDC_UNIT(dev)); - if (sc == NULL) - return ENXIO; - if (mode & (O_CREAT | O_APPEND | O_TRUNC)) - return ENODEV; - - return genfbopen(&sc->gensc, sc->adp, flag, mode, td); -} - -static int -gdcclose(struct cdev *dev, int flag, int mode, struct thread *td) -{ - gdc_softc_t *sc; - - sc = GDC_SOFTC(GDC_UNIT(dev)); - return genfbclose(&sc->gensc, sc->adp, flag, mode, td); -} - -static int -gdcread(struct cdev *dev, struct uio *uio, int flag) -{ - gdc_softc_t *sc; - - sc = GDC_SOFTC(GDC_UNIT(dev)); - return genfbread(&sc->gensc, sc->adp, uio, flag); -} - -static int -gdcwrite(struct cdev *dev, struct uio *uio, int flag) -{ - gdc_softc_t *sc; - - sc = GDC_SOFTC(GDC_UNIT(dev)); - return genfbread(&sc->gensc, sc->adp, uio, flag); -} - -static int -gdcioctl(struct cdev *dev, u_long cmd, caddr_t arg, int flag, struct thread *td) -{ - gdc_softc_t *sc; - - sc = GDC_SOFTC(GDC_UNIT(dev)); - return genfbioctl(&sc->gensc, sc->adp, cmd, arg, flag, td); -} - -static int -gdcmmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, - int prot, vm_memattr_t *memattr) -{ - gdc_softc_t *sc; - - sc = GDC_SOFTC(GDC_UNIT(dev)); - return genfbmmap(&sc->gensc, sc->adp, offset, paddr, prot, memattr); -} - -#endif /* FB_INSTALL_CDEV */ - -static device_method_t gdc_methods[] = { - DEVMETHOD(device_identify, gdc_identify), - DEVMETHOD(device_probe, gdcprobe), - DEVMETHOD(device_attach, gdc_attach), - { 0, 0 } -}; - -static driver_t gdcdriver = { - DRIVER_NAME, - gdc_methods, - sizeof(gdc_softc_t), -}; - -DRIVER_MODULE(gdc, isa, gdcdriver, gdc_devclass, 0, 0); - -/* LOW-LEVEL */ - - -#include - -#define TEXT_BUF_BASE 0x000a0000 -#define TEXT_BUF_SIZE 0x00008000 -#define GRAPHICS_BUF_BASE 0x000a8000 -#define GRAPHICS_BUF_SIZE 0x00040000 -#define VIDEO_BUF_BASE 0x000a0000 -#define VIDEO_BUF_SIZE 0x00048000 - -#define probe_done(adp) ((adp)->va_flags & V_ADP_PROBED) -#define init_done(adp) ((adp)->va_flags & V_ADP_INITIALIZED) -#define config_done(adp) ((adp)->va_flags & V_ADP_REGISTERED) - -/* - * NOTE: `va_window' should have a virtual address, but is initialized - * with a physical address in the following table, they will be - * converted at run-time. - */ -static video_adapter_t adapter_init_value[] = { - { 0, - KD_PC98, "gdc", /* va_type, va_name */ - 0, 0, /* va_unit, va_minor */ - V_ADP_COLOR | V_ADP_MODECHANGE | V_ADP_BORDER, - TEXT_GDC, 16, TEXT_GDC, /* va_io*, XXX */ - VIDEO_BUF_BASE, VIDEO_BUF_SIZE, /* va_mem* */ - TEXT_BUF_BASE, TEXT_BUF_SIZE, TEXT_BUF_SIZE, 0, /* va_window* */ - 0, 0, /* va_buffer, va_buffer_size */ - 0, M_PC98_80x25, 0, /* va_*mode* */ - }, -}; - -static video_adapter_t biosadapter[1]; - -/* video driver declarations */ -static int gdc_configure(int flags); -static int gdc_err(video_adapter_t *adp, ...); -static vi_probe_t gdc_probe; -static vi_init_t gdc_init; -static vi_get_info_t gdc_get_info; -static vi_query_mode_t gdc_query_mode; -static vi_set_mode_t gdc_set_mode; -static vi_set_border_t gdc_set_border; -static vi_save_state_t gdc_save_state; -static vi_load_state_t gdc_load_state; -static vi_read_hw_cursor_t gdc_read_hw_cursor; -static vi_set_hw_cursor_t gdc_set_hw_cursor; -static vi_set_hw_cursor_shape_t gdc_set_hw_cursor_shape; -static vi_blank_display_t gdc_blank_display; -static vi_mmap_t gdc_mmap_buf; -static vi_ioctl_t gdc_dev_ioctl; -static vi_clear_t gdc_clear; -static vi_fill_rect_t gdc_fill_rect; -static vi_bitblt_t gdc_bitblt; -static vi_diag_t gdc_diag; -static vi_save_palette_t gdc_save_palette; -static vi_load_palette_t gdc_load_palette; -static vi_set_win_org_t gdc_set_origin; - -static video_switch_t gdcvidsw = { - gdc_probe, - gdc_init, - gdc_get_info, - gdc_query_mode, - gdc_set_mode, - (vi_save_font_t *)gdc_err, - (vi_load_font_t *)gdc_err, - (vi_show_font_t *)gdc_err, - gdc_save_palette, - gdc_load_palette, - gdc_set_border, - gdc_save_state, - gdc_load_state, - gdc_set_origin, - gdc_read_hw_cursor, - gdc_set_hw_cursor, - gdc_set_hw_cursor_shape, - gdc_blank_display, - gdc_mmap_buf, - gdc_dev_ioctl, - gdc_clear, - gdc_fill_rect, - gdc_bitblt, - (int (*)(void))gdc_err, - (int (*)(void))gdc_err, - gdc_diag, -}; - -VIDEO_DRIVER(gdc, gdcvidsw, gdc_configure); - -/* GDC BIOS standard video modes */ -#define EOT (-1) -#define NA (-2) - -static video_info_t bios_vmode[] = { - { M_PC98_80x25, V_INFO_COLOR, 80, 25, 8, 16, 4, 1, - TEXT_BUF_BASE, TEXT_BUF_SIZE, TEXT_BUF_SIZE, 0, 0, V_INFO_MM_TEXT }, -#ifdef LINE30 - { M_PC98_80x30, V_INFO_COLOR, 80, 30, 8, 16, 4, 1, - TEXT_BUF_BASE, TEXT_BUF_SIZE, TEXT_BUF_SIZE, 0, 0, V_INFO_MM_TEXT }, -#endif -#ifndef GDC_NOGRAPHICS - { M_PC98_EGC640x400, V_INFO_COLOR | V_INFO_GRAPHICS, - 640, 400, 8, 16, 4, 4, - GRAPHICS_BUF_BASE, GRAPHICS_BUF_SIZE, GRAPHICS_BUF_SIZE, 0, 0, - V_INFO_MM_PLANAR }, - { M_PC98_PEGC640x400, V_INFO_COLOR | V_INFO_GRAPHICS | V_INFO_VESA, - 640, 400, 8, 16, 8, 1, - GRAPHICS_BUF_BASE, 0x00008000, 0x00008000, 0, 0, - V_INFO_MM_PACKED, 1 }, -#ifdef LINE30 - { M_PC98_PEGC640x480, V_INFO_COLOR | V_INFO_GRAPHICS | V_INFO_VESA, - 640, 480, 8, 16, 8, 1, - GRAPHICS_BUF_BASE, 0x00008000, 0x00008000, 0, 0, - V_INFO_MM_PACKED, 1 }, -#endif -#endif - { EOT }, -}; - -static int gdc_init_done = FALSE; - -/* local functions */ -static int map_gen_mode_num(int type, int color, int mode); -static int probe_adapters(void); - -#define prologue(adp, flag, err) \ - if (!gdc_init_done || !((adp)->va_flags & (flag))) \ - return (err) - -/* a backdoor for the console driver */ -static int -gdc_configure(int flags) -{ - probe_adapters(); - biosadapter[0].va_flags |= V_ADP_INITIALIZED; - if (!config_done(&biosadapter[0])) { - if (vid_register(&biosadapter[0]) < 0) - return 1; - biosadapter[0].va_flags |= V_ADP_REGISTERED; - } - - return 1; -} - -/* local subroutines */ - -/* map a generic video mode to a known mode number */ -static int -map_gen_mode_num(int type, int color, int mode) -{ - static struct { - int from; - int to; - } mode_map[] = { - { M_TEXT_80x25, M_PC98_80x25, }, -#ifdef LINE30 - { M_TEXT_80x30, M_PC98_80x30, }, -#endif - }; - int i; - - for (i = 0; i < nitems(mode_map); ++i) { - if (mode_map[i].from == mode) - return mode_map[i].to; - } - return mode; -} - -static int -verify_adapter(video_adapter_t *adp) -{ -#ifndef GDC_NOGRAPHICS - int i; - - if (PC98_SYSTEM_PARAMETER(0x45c) & 0x40) { /* PEGC exists */ - adp->va_flags |= V_ADP_VESA; /* XXX */ - } else { - for (i = 0; bios_vmode[i].vi_mode != EOT; ++i) { - if (bios_vmode[i].vi_flags & V_INFO_VESA) - bios_vmode[i].vi_mode = NA; - } - } -#endif - return 0; -} - -/* probe video adapters and return the number of detected adapters */ -static int -probe_adapters(void) -{ - video_info_t info; - - /* do this test only once */ - if (gdc_init_done) - return 1; - gdc_init_done = TRUE; - - biosadapter[0] = adapter_init_value[0]; - biosadapter[0].va_flags |= V_ADP_PROBED; - biosadapter[0].va_mode = - biosadapter[0].va_initial_mode = biosadapter[0].va_initial_bios_mode; - - if ((PC98_SYSTEM_PARAMETER(0x597) & 0x80) || - (PC98_SYSTEM_PARAMETER(0x458) & 0x80)) { - gdc_FH = (inb(0x9a8) & 1) ? _31KHZ : _24KHZ; - } else { - gdc_FH = _24KHZ; - } - - gdc_get_info(&biosadapter[0], biosadapter[0].va_initial_mode, &info); - initialize_gdc(T25_G400, info.vi_flags & V_INFO_GRAPHICS); - - biosadapter[0].va_window = BIOS_PADDRTOVADDR(info.vi_window); - biosadapter[0].va_window_size = info.vi_window_size; - biosadapter[0].va_window_gran = info.vi_window_gran; - biosadapter[0].va_buffer = 0; - biosadapter[0].va_buffer_size = 0; - if (info.vi_flags & V_INFO_GRAPHICS) { - switch (info.vi_depth/info.vi_planes) { - case 1: - biosadapter[0].va_line_width = info.vi_width/8; - break; - case 2: - biosadapter[0].va_line_width = info.vi_width/4; - break; - case 4: - biosadapter[0].va_line_width = info.vi_width/2; - break; - case 8: - default: /* shouldn't happen */ - biosadapter[0].va_line_width = info.vi_width; - break; - } - } else { - biosadapter[0].va_line_width = info.vi_width; - } - bcopy(&info, &biosadapter[0].va_info, sizeof(info)); - - verify_adapter(&biosadapter[0]); - - return 1; -} - -static void master_gdc_cmd(unsigned int cmd) -{ - while ( (inb(TEXT_GDC) & 2) != 0); - outb(TEXT_GDC+2, cmd); -} - -static void master_gdc_prm(unsigned int pmtr) -{ - while ( (inb(TEXT_GDC) & 2) != 0); - outb(TEXT_GDC, pmtr); -} - -static void master_gdc_word_prm(unsigned int wpmtr) -{ - master_gdc_prm(wpmtr & 0x00ff); - master_gdc_prm((wpmtr >> 8) & 0x00ff); -} - -#ifdef LINE30 -static void master_gdc_fifo_empty(void) -{ - while ( (inb(TEXT_GDC) & 4) == 0); -} -#endif - -static void master_gdc_wait_vsync(void) -{ - while ( (inb(TEXT_GDC) & 0x20) != 0); - while ( (inb(TEXT_GDC) & 0x20) == 0); -} - -static void gdc_cmd(unsigned int cmd) -{ - while ( (inb(GRAPHIC_GDC) & 2) != 0); - outb( GRAPHIC_GDC+2, cmd); -} - -#ifdef LINE30 -static void gdc_prm(unsigned int pmtr) -{ - while ( (inb(GRAPHIC_GDC) & 2) != 0); - outb( GRAPHIC_GDC, pmtr); -} - -static void gdc_word_prm(unsigned int wpmtr) -{ - gdc_prm(wpmtr & 0x00ff); - gdc_prm((wpmtr >> 8) & 0x00ff); -} - -static void gdc_fifo_empty(void) -{ - while ( (inb(GRAPHIC_GDC) & 0x04) == 0); -} -#endif - -static void gdc_wait_vsync(void) -{ - while ( (inb(GRAPHIC_GDC) & 0x20) != 0); - while ( (inb(GRAPHIC_GDC) & 0x20) == 0); -} - -#ifdef LINE30 -static int check_gdc_clock(void) -{ - if ((inb(IO_SYSPORT) & 0x80) == 0){ - return _5MHZ; - } else { - return _2_5MHZ; - } -} -#endif - -static void initialize_gdc(unsigned int mode, int isGraph) -{ -#ifdef LINE30 - /* start 30line initialize */ - int m_mode, s_mode, gdc_clock, hsync_clock; - - gdc_clock = check_gdc_clock(); - m_mode = (mode == T25_G400) ? _25L : _30L; - s_mode = 2*mode+gdc_clock; - gdc_INFO = m_mode; - - master_gdc_wait_vsync(); - - if ((PC98_SYSTEM_PARAMETER(0x597) & 0x80) || - (PC98_SYSTEM_PARAMETER(0x458) & 0x80)) { - if (PC98_SYSTEM_PARAMETER(0x481) & 0x08) { - hsync_clock = (m_mode == _25L) ? gdc_FH : _31KHZ; - outb(0x9a8, (hsync_clock == _31KHZ) ? 1 : 0); - } else { - hsync_clock = gdc_FH; - } - } else { - hsync_clock = _24KHZ; - } - - if ((gdc_clock == _2_5MHZ) && - (slave_param[hsync_clock][s_mode][GDC_LF] > 400)) { - outb(0x6a, 0x83); - outb(0x6a, 0x85); - gdc_clock = _5MHZ; - s_mode = 2*mode+gdc_clock; - } - - master_gdc_cmd(_GDC_RESET); - master_gdc_cmd(_GDC_MASTER); - gdc_cmd(_GDC_RESET); - gdc_cmd(_GDC_SLAVE); - - /* GDC Master */ - master_gdc_cmd(_GDC_SYNC); - master_gdc_prm(0x00); /* flush less */ /* text & graph */ - master_gdc_prm(master_param[hsync_clock][m_mode][GDC_CR]); - master_gdc_word_prm(((master_param[hsync_clock][m_mode][GDC_HFP] << 10) - + (master_param[hsync_clock][m_mode][GDC_VS] << 5) - + master_param[hsync_clock][m_mode][GDC_HS])); - master_gdc_prm(master_param[hsync_clock][m_mode][GDC_HBP]); - master_gdc_prm(master_param[hsync_clock][m_mode][GDC_VFP]); - master_gdc_word_prm(((master_param[hsync_clock][m_mode][GDC_VBP] << 10) - + (master_param[hsync_clock][m_mode][GDC_LF]))); - master_gdc_fifo_empty(); - master_gdc_cmd(_GDC_PITCH); - master_gdc_prm(MasterPCH); - master_gdc_fifo_empty(); - - /* GDC slave */ - gdc_cmd(_GDC_SYNC); - gdc_prm(0x06); - gdc_prm(slave_param[hsync_clock][s_mode][GDC_CR]); - gdc_word_prm((slave_param[hsync_clock][s_mode][GDC_HFP] << 10) - + (slave_param[hsync_clock][s_mode][GDC_VS] << 5) - + (slave_param[hsync_clock][s_mode][GDC_HS])); - gdc_prm(slave_param[hsync_clock][s_mode][GDC_HBP]); - gdc_prm(slave_param[hsync_clock][s_mode][GDC_VFP]); - gdc_word_prm((slave_param[hsync_clock][s_mode][GDC_VBP] << 10) - + (slave_param[hsync_clock][s_mode][GDC_LF])); - gdc_fifo_empty(); - gdc_cmd(_GDC_PITCH); - gdc_prm(SlavePCH[gdc_clock]); - gdc_fifo_empty(); - - /* set Master GDC scroll param */ - master_gdc_wait_vsync(); - master_gdc_wait_vsync(); - master_gdc_wait_vsync(); - master_gdc_cmd(_GDC_SCROLL); - master_gdc_word_prm(0); - master_gdc_word_prm((master_param[hsync_clock][m_mode][GDC_LF] << 4) - | 0x0000); - master_gdc_fifo_empty(); - - /* set Slave GDC scroll param */ - gdc_wait_vsync(); - gdc_cmd(_GDC_SCROLL); - gdc_word_prm(0); - if (gdc_clock == _5MHZ) { - gdc_word_prm((SlaveScrlLF[mode] << 4) | 0x4000); - } else { - gdc_word_prm(SlaveScrlLF[mode] << 4); - } - gdc_fifo_empty(); - - gdc_word_prm(0); - if (gdc_clock == _5MHZ) { - gdc_word_prm((SlaveScrlLF[mode] << 4) | 0x4000); - } else { - gdc_word_prm(SlaveScrlLF[mode] << 4); - } - gdc_fifo_empty(); - - /* sync start */ - gdc_cmd(isGraph ? _GDC_START : _GDC_STOP); - - gdc_wait_vsync(); - gdc_wait_vsync(); - gdc_wait_vsync(); - - master_gdc_cmd(isGraph ? _GDC_STOP : _GDC_START); -#else - master_gdc_wait_vsync(); - master_gdc_cmd(isGraph ? _GDC_STOP : _GDC_START); /* text */ - gdc_wait_vsync(); - gdc_cmd(isGraph ? _GDC_START : _GDC_STOP); /* graphics */ -#endif -} - -#ifndef GDC_NOGRAPHICS -static u_char b_palette[] = { - /* R G B */ - 0x00, 0x00, 0x00, /* 0 */ - 0x00, 0x00, 0x7f, /* 1 */ - 0x7f, 0x00, 0x00, /* 2 */ - 0x7f, 0x00, 0x7f, /* 3 */ - 0x00, 0x7f, 0x00, /* 4 */ - 0x00, 0x7f, 0x7f, /* 5 */ - 0x7f, 0x7f, 0x00, /* 6 */ - 0x7f, 0x7f, 0x7f, /* 7 */ - 0x40, 0x40, 0x40, /* 8 */ - 0x00, 0x00, 0xff, /* 9 */ - 0xff, 0x00, 0x00, /* 10 */ - 0xff, 0x00, 0xff, /* 11 */ - 0x00, 0xff, 0x00, /* 12 */ - 0x00, 0xff, 0xff, /* 13 */ - 0xff, 0xff, 0x00, /* 14 */ - 0xff, 0xff, 0xff, /* 15 */ -}; -#endif - -static int -gdc_load_palette(video_adapter_t *adp, u_char *palette) -{ -#ifndef GDC_NOGRAPHICS - int i; - - if (adp->va_info.vi_flags & V_INFO_VESA) { - gdc_wait_vsync(); - for (i = 0; i < 256; ++i) { - outb(0xa8, i); - outb(0xac, *palette++); /* R */ - outb(0xaa, *palette++); /* G */ - outb(0xae, *palette++); /* B */ - } - } else { - /* - * XXX - Even though PC-98 text color is independent of palette, - * we should set palette in text mode. - * Because the background color of text mode is palette 0's one. - */ - outb(0x6a, 1); /* 16 colors mode */ - bcopy(palette, b_palette, sizeof(b_palette)); - - gdc_wait_vsync(); - for (i = 0; i < 16; ++i) { - outb(0xa8, i); - outb(0xac, *palette++ >> 4); /* R */ - outb(0xaa, *palette++ >> 4); /* G */ - outb(0xae, *palette++ >> 4); /* B */ - } - } -#endif - return 0; -} - -static int -gdc_save_palette(video_adapter_t *adp, u_char *palette) -{ -#ifndef GDC_NOGRAPHICS - int i; - - if (adp->va_info.vi_flags & V_INFO_VESA) { - for (i = 0; i < 256; ++i) { - outb(0xa8, i); - *palette++ = inb(0xac); /* R */ - *palette++ = inb(0xaa); /* G */ - *palette++ = inb(0xae); /* B */ - } - } else { - bcopy(b_palette, palette, sizeof(b_palette)); - } -#endif - return 0; -} - -static int -gdc_set_origin(video_adapter_t *adp, off_t offset) -{ -#ifndef GDC_NOGRAPHICS - if (adp->va_info.vi_flags & V_INFO_VESA) { - writew(BIOS_PADDRTOVADDR(0x000e0004), offset >> 15); - } -#endif - return 0; -} - -/* entry points */ - -static int -gdc_err(video_adapter_t *adp, ...) -{ - return ENODEV; -} - -static int -gdc_probe(int unit, video_adapter_t **adpp, void *arg, int flags) -{ - probe_adapters(); - if (unit >= 1) - return ENXIO; - - *adpp = &biosadapter[unit]; - - return 0; -} - -static int -gdc_init(int unit, video_adapter_t *adp, int flags) -{ - if ((unit >= 1) || (adp == NULL) || !probe_done(adp)) - return ENXIO; - - if (!init_done(adp)) { - /* nothing to do really... */ - adp->va_flags |= V_ADP_INITIALIZED; - } - - if (!config_done(adp)) { - if (vid_register(adp) < 0) - return ENXIO; - adp->va_flags |= V_ADP_REGISTERED; - } - - return 0; -} - -/* - * get_info(): - * Return the video_info structure of the requested video mode. - */ -static int -gdc_get_info(video_adapter_t *adp, int mode, video_info_t *info) -{ - int i; - - if (!gdc_init_done) - return ENXIO; - - mode = map_gen_mode_num(adp->va_type, adp->va_flags & V_ADP_COLOR, mode); - for (i = 0; bios_vmode[i].vi_mode != EOT; ++i) { - if (bios_vmode[i].vi_mode == NA) - continue; - if (mode == bios_vmode[i].vi_mode) { - *info = bios_vmode[i]; - info->vi_buffer_size = info->vi_window_size*info->vi_planes; - return 0; - } - } - return EINVAL; -} - -/* - * query_mode(): - * Find a video mode matching the requested parameters. - * Fields filled with 0 are considered "don't care" fields and - * match any modes. - */ -static int -gdc_query_mode(video_adapter_t *adp, video_info_t *info) -{ - int i; - - if (!gdc_init_done) - return ENXIO; - - for (i = 0; bios_vmode[i].vi_mode != EOT; ++i) { - if (bios_vmode[i].vi_mode == NA) - continue; - - if ((info->vi_width != 0) - && (info->vi_width != bios_vmode[i].vi_width)) - continue; - if ((info->vi_height != 0) - && (info->vi_height != bios_vmode[i].vi_height)) - continue; - if ((info->vi_cwidth != 0) - && (info->vi_cwidth != bios_vmode[i].vi_cwidth)) - continue; - if ((info->vi_cheight != 0) - && (info->vi_cheight != bios_vmode[i].vi_cheight)) - continue; - if ((info->vi_depth != 0) - && (info->vi_depth != bios_vmode[i].vi_depth)) - continue; - if ((info->vi_planes != 0) - && (info->vi_planes != bios_vmode[i].vi_planes)) - continue; - /* XXX: should check pixel format, memory model */ - if ((info->vi_flags != 0) - && (info->vi_flags != bios_vmode[i].vi_flags)) - continue; - - /* verify if this mode is supported on this adapter */ - if (gdc_get_info(adp, bios_vmode[i].vi_mode, info)) - continue; - return 0; - } - return ENODEV; -} - -/* - * set_mode(): - * Change the video mode. - */ -static int -gdc_set_mode(video_adapter_t *adp, int mode) -{ - video_info_t info; - - prologue(adp, V_ADP_MODECHANGE, ENODEV); - - mode = map_gen_mode_num(adp->va_type, - adp->va_flags & V_ADP_COLOR, mode); - if (gdc_get_info(adp, mode, &info)) - return EINVAL; - - switch (info.vi_mode) { -#ifndef GDC_NOGRAPHICS - case M_PC98_PEGC640x480: /* PEGC 640x480 */ - initialize_gdc(T30_G480, info.vi_flags & V_INFO_GRAPHICS); - break; - case M_PC98_PEGC640x400: /* PEGC 640x400 */ - case M_PC98_EGC640x400: /* EGC GRAPHICS */ -#endif - case M_PC98_80x25: /* VGA TEXT */ - initialize_gdc(T25_G400, info.vi_flags & V_INFO_GRAPHICS); - break; - case M_PC98_80x30: /* VGA TEXT */ - initialize_gdc(T30_G400, info.vi_flags & V_INFO_GRAPHICS); - break; - default: - break; - } - -#ifndef GDC_NOGRAPHICS - if (info.vi_flags & V_INFO_VESA) { - outb(0x6a, 0x07); /* enable mode F/F change */ - outb(0x6a, 0x21); /* enhanced graphics */ - if (info.vi_height > 400) - outb(0x6a, 0x69); /* 800 lines */ - writeb(BIOS_PADDRTOVADDR(0x000e0100), 0); /* packed pixel */ - } else { - if (adp->va_flags & V_ADP_VESA) { - outb(0x6a, 0x07); /* enable mode F/F change */ - outb(0x6a, 0x20); /* normal graphics */ - outb(0x6a, 0x68); /* 400 lines */ - } - outb(0x6a, 1); /* 16 colors */ - } -#endif - - adp->va_mode = mode; - adp->va_flags &= ~V_ADP_COLOR; - adp->va_flags |= - (info.vi_flags & V_INFO_COLOR) ? V_ADP_COLOR : 0; -#if 0 - adp->va_crtc_addr = - (adp->va_flags & V_ADP_COLOR) ? COLOR_CRTC : MONO_CRTC; -#endif - adp->va_window = BIOS_PADDRTOVADDR(info.vi_window); - adp->va_window_size = info.vi_window_size; - adp->va_window_gran = info.vi_window_gran; - if (info.vi_buffer_size == 0) { - adp->va_buffer = 0; - adp->va_buffer_size = 0; - } else { - adp->va_buffer = BIOS_PADDRTOVADDR(info.vi_buffer); - adp->va_buffer_size = info.vi_buffer_size; - } - if (info.vi_flags & V_INFO_GRAPHICS) { - switch (info.vi_depth/info.vi_planes) { - case 1: - adp->va_line_width = info.vi_width/8; - break; - case 2: - adp->va_line_width = info.vi_width/4; - break; - case 4: - adp->va_line_width = info.vi_width/2; - break; - case 8: - default: /* shouldn't happen */ - adp->va_line_width = info.vi_width; - break; - } - } else { - adp->va_line_width = info.vi_width; - } - bcopy(&info, &adp->va_info, sizeof(info)); - - /* move hardware cursor out of the way */ - vidd_set_hw_cursor(adp, -1, -1); - - return 0; -} - -/* - * set_border(): - * Change the border color. - */ -static int -gdc_set_border(video_adapter_t *adp, int color) -{ - outb(0x6c, color << 4); - return 0; -} - -/* - * save_state(): - * Read video card register values. - */ -static int -gdc_save_state(video_adapter_t *adp, void *p, size_t size) -{ - return ENODEV; -} - -/* - * load_state(): - * Set video card registers at once. - */ -static int -gdc_load_state(video_adapter_t *adp, void *p) -{ - return ENODEV; -} - -/* - * read_hw_cursor(): - * Read the position of the hardware text cursor. - */ -static int -gdc_read_hw_cursor(video_adapter_t *adp, int *col, int *row) -{ - u_int16_t off; - int s; - - if (!gdc_init_done) - return ENXIO; - - if (adp->va_info.vi_flags & V_INFO_GRAPHICS) - return ENODEV; - - s = spltty(); - master_gdc_cmd(0xe0); /* _GDC_CSRR */ - while((inb(TEXT_GDC + 0) & 0x1) == 0) {} /* GDC wait */ - off = inb(TEXT_GDC + 2); /* EADl */ - off |= (inb(TEXT_GDC + 2) << 8); /* EADh */ - inb(TEXT_GDC + 2); /* dummy */ - inb(TEXT_GDC + 2); /* dummy */ - inb(TEXT_GDC + 2); /* dummy */ - splx(s); - - if (off >= ROW*COL) - off = 0; - *row = off / adp->va_info.vi_width; - *col = off % adp->va_info.vi_width; - - return 0; -} - -/* - * set_hw_cursor(): - * Move the hardware text cursor. If col and row are both -1, - * the cursor won't be shown. - */ -static int -gdc_set_hw_cursor(video_adapter_t *adp, int col, int row) -{ - u_int16_t off; - int s; - - if (!gdc_init_done) - return ENXIO; - - if ((col == -1) && (row == -1)) { - off = -1; - } else { - if (adp->va_info.vi_flags & V_INFO_GRAPHICS) - return ENODEV; - off = row*adp->va_info.vi_width + col; - } - - s = spltty(); - master_gdc_cmd(0x49); /* _GDC_CSRW */ - master_gdc_word_prm(off); - splx(s); - - return 0; -} - -/* - * set_hw_cursor_shape(): - * Change the shape of the hardware text cursor. If the height is zero - * or negative, the cursor won't be shown. - */ -static int -gdc_set_hw_cursor_shape(video_adapter_t *adp, int base, int height, - int celsize, int blink) -{ - int start; - int end; - int s; - - if (!gdc_init_done) - return ENXIO; - - start = celsize - (base + height); - end = celsize - base - 1; - -#if 0 - /* - * muPD7220 GDC has anomaly that if end == celsize - 1 then start - * must be 0, otherwise the cursor won't be correctly shown - * in the first row in the screen. We shall set end to celsize - 2; - * if end == celsize -1 && start > 0. XXX - */ - if ((end == celsize - 1) && (start > 0) && (start < end)) - --end; -#endif - - s = spltty(); - master_gdc_cmd(0x4b); /* _GDC_CSRFORM */ - master_gdc_prm(((height > 0) ? 0x80 : 0) /* cursor on/off */ - | ((celsize - 1) & 0x1f)); /* cel size */ - master_gdc_word_prm(((end & 0x1f) << 11) /* end line */ - | (12 << 6) /* blink rate */ - | (blink ? 0 : 0x20) /* blink on/off */ - | (start & 0x1f)); /* start line */ - splx(s); - - return 0; -} - -/* - * blank_display() - * Put the display in power save/power off mode. - */ -static int -gdc_blank_display(video_adapter_t *adp, int mode) -{ - int s; - static int standby = 0; - - if (!gdc_init_done) - return ENXIO; - - s = splhigh(); - switch (mode) { - case V_DISPLAY_SUSPEND: - case V_DISPLAY_STAND_BY: - outb(0x09a2, 0x80 | 0x40); /* V/H-SYNC mask */ - if (inb(0x09a2) == (0x80 | 0x40)) - standby = 1; - /* FALLTHROUGH */ - - case V_DISPLAY_BLANK: - while (!(inb(TEXT_GDC) & 0x20)) /* V-SYNC wait */ - ; - outb(TEXT_GDC + 8, 0x0e); /* DISP off */ - break; - - case V_DISPLAY_ON: - while (!(inb(TEXT_GDC) & 0x20)) /* V-SYNC wait */ - ; - outb(TEXT_GDC + 8, 0x0f); /* DISP on */ - if (standby) { - outb(0x09a2, 0x00); /* V/H-SYNC unmask */ - standby = 0; - } - break; - } - splx(s); - return 0; -} - -/* - * mmap(): - * Mmap frame buffer. - */ -static int -gdc_mmap_buf(video_adapter_t *adp, vm_ooffset_t offset, vm_offset_t *paddr, - int prot, vm_memattr_t *memattr) -{ - /* FIXME: is this correct? XXX */ - if (offset > VIDEO_BUF_SIZE - PAGE_SIZE) - return -1; - *paddr = adp->va_info.vi_window + offset; - return 0; -} - -#ifndef GDC_NOGRAPHICS -static void -planar_fill(video_adapter_t *adp, int val) -{ - - outb(0x7c, 0x80); /* GRCG on & TDW mode */ - outb(0x7e, 0); /* tile B */ - outb(0x7e, 0); /* tile R */ - outb(0x7e, 0); /* tile G */ - outb(0x7e, 0); /* tile I */ - - fillw_io(0, adp->va_window, 0x8000 / 2); /* XXX */ - - outb(0x7c, 0); /* GRCG off */ -} - -static void -packed_fill(video_adapter_t *adp, int val) -{ - int length; - int at; /* position in the frame buffer */ - int l; - - at = 0; - length = adp->va_line_width*adp->va_info.vi_height; - while (length > 0) { - l = imin(length, adp->va_window_size); - vidd_set_win_org(adp, at); - bzero_io(adp->va_window, l); - length -= l; - at += l; - } -} - -static int -gdc_clear(video_adapter_t *adp) -{ - - switch (adp->va_info.vi_mem_model) { - case V_INFO_MM_TEXT: - /* do nothing? XXX */ - break; - case V_INFO_MM_PLANAR: - planar_fill(adp, 0); - break; - case V_INFO_MM_PACKED: - packed_fill(adp, 0); - break; - } - - return 0; -} -#else /* GDC_NOGRAPHICS */ -static int -gdc_clear(video_adapter_t *adp) -{ - - return 0; -} -#endif /* GDC_NOGRAPHICS */ - -static int -gdc_fill_rect(video_adapter_t *adp, int val, int x, int y, int cx, int cy) -{ - return ENODEV; -} - -static int -gdc_bitblt(video_adapter_t *adp,...) -{ - /* FIXME */ - return ENODEV; -} - -static int -gdc_dev_ioctl(video_adapter_t *adp, u_long cmd, caddr_t arg) -{ - switch (cmd) { - case FBIO_GETWINORG: /* get frame buffer window origin */ - *(u_int *)arg = 0; - return 0; - - case FBIO_SETWINORG: /* set frame buffer window origin */ - case FBIO_SETDISPSTART: /* set display start address */ - case FBIO_SETLINEWIDTH: /* set scan line length in pixel */ - case FBIO_GETPALETTE: /* get color palette */ - case FBIO_SETPALETTE: /* set color palette */ - case FBIOGETCMAP: /* get color palette */ - case FBIOPUTCMAP: /* set color palette */ - return ENODEV; - - case FBIOGTYPE: /* get frame buffer type info. */ - ((struct fbtype *)arg)->fb_type = fb_type(adp->va_type); - ((struct fbtype *)arg)->fb_height = adp->va_info.vi_height; - ((struct fbtype *)arg)->fb_width = adp->va_info.vi_width; - ((struct fbtype *)arg)->fb_depth = adp->va_info.vi_depth; - if ((adp->va_info.vi_depth <= 1) || (adp->va_info.vi_depth > 8)) - ((struct fbtype *)arg)->fb_cmsize = 0; - else - ((struct fbtype *)arg)->fb_cmsize = 1 << adp->va_info.vi_depth; - ((struct fbtype *)arg)->fb_size = adp->va_buffer_size; - return 0; - - default: - return fb_commonioctl(adp, cmd, arg); - } -} - -/* - * diag(): - * Print some information about the video adapter and video modes, - * with requested level of details. - */ -static int -gdc_diag(video_adapter_t *adp, int level) -{ -#if defined(FB_DEBUG) && FB_DEBUG > 1 - int i; -#endif - - if (!gdc_init_done) - return ENXIO; - - fb_dump_adp_info(DRIVER_NAME, adp, level); - -#if defined(FB_DEBUG) && FB_DEBUG > 1 - for (i = 0; bios_vmode[i].vi_mode != EOT; ++i) { - if (bios_vmode[i].vi_mode == NA) - continue; - if (get_mode_param(bios_vmode[i].vi_mode) == NULL) - continue; - fb_dump_mode_info(DRIVER_NAME, adp, &bios_vmode[i], level); - } -#endif - - return 0; -} diff --git a/sys/pc98/cbus/nmi.c b/sys/pc98/cbus/nmi.c deleted file mode 100644 index 16612aa25b44..000000000000 --- a/sys/pc98/cbus/nmi.c +++ /dev/null @@ -1,69 +0,0 @@ -/*- - * Copyright (c) 1991 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)isa.c 7.2 (Berkeley) 5/13/91 - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include - -#include - -#define NMI_PARITY 0x04 -#define NMI_EPARITY 0x02 - -/* - * Handle a NMI, possibly a machine check. - * return true to panic system, false to ignore. - */ -int -isa_nmi(int cd) -{ - int retval = 0; - int port = inb(0x33); - - log(LOG_CRIT, "NMI PC98 port = %x\n", port); - if (port & NMI_PARITY) { - log(LOG_CRIT, "BASE RAM parity error, likely hardware failure."); - retval = 1; - } else if (port & NMI_EPARITY) { - log(LOG_CRIT, "EXTENDED RAM parity error, likely hardware failure."); - retval = 1; - } else { - log(LOG_CRIT, "\nNMI Resume ??\n"); - } - - return(retval); -} diff --git a/sys/pc98/cbus/olpt.c b/sys/pc98/cbus/olpt.c deleted file mode 100644 index 983ec078e213..000000000000 --- a/sys/pc98/cbus/olpt.c +++ /dev/null @@ -1,648 +0,0 @@ -/*- - * Copyright (c) 1990 William F. Jolitz, TeleMuse - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This software is a component of "386BSD" developed by - * William F. Jolitz, TeleMuse. - * 4. Neither the name of the developer nor the name "386BSD" - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS A COMPONENT OF 386BSD DEVELOPED BY WILLIAM F. JOLITZ - * AND IS INTENDED FOR RESEARCH AND EDUCATIONAL PURPOSES ONLY. THIS - * SOFTWARE SHOULD NOT BE CONSIDERED TO BE A COMMERCIAL PRODUCT. - * THE DEVELOPER URGES THAT USERS WHO REQUIRE A COMMERCIAL PRODUCT - * NOT MAKE USE OF THIS WORK. - * - * FOR USERS WHO WISH TO UNDERSTAND THE 386BSD SYSTEM DEVELOPED - * BY WILLIAM F. JOLITZ, WE RECOMMEND THE USER STUDY WRITTEN - * REFERENCES SUCH AS THE "PORTING UNIX TO THE 386" SERIES - * (BEGINNING JANUARY 1991 "DR. DOBBS JOURNAL", USA AND BEGINNING - * JUNE 1991 "UNIX MAGAZIN", GERMANY) BY WILLIAM F. JOLITZ AND - * LYNNE GREER JOLITZ, AS WELL AS OTHER BOOKS ON UNIX AND THE - * ON-LINE 386BSD USER MANUAL BEFORE USE. A BOOK DISCUSSING THE INTERNALS - * OF 386BSD ENTITLED "386BSD FROM THE INSIDE OUT" WILL BE AVAILABLE LATE 1992. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPER ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE DEVELOPER BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: unknown origin, 386BSD 0.1 - * $FreeBSD$ - */ - -/* - * Device Driver for AT parallel printer port - * Written by William Jolitz 12/18/90 - */ - -/* - * Parallel port TCP/IP interfaces added. I looked at the driver from - * MACH but this is a complete rewrite, and btw. incompatible, and it - * should perform better too. I have never run the MACH driver though. - * - * This driver sends two bytes (0x08, 0x00) in front of each packet, - * to allow us to distinguish another format later. - * - * Now added a Linux/Crynwr compatibility mode which is enabled using - * IF_LINK0 - Tim Wilkinson. - * - * TODO: - * Make HDLC/PPP mode, use IF_LLC1 to enable. - * - * Connect the two computers using a Laplink parallel cable to use this - * feature: - * - * +----------------------------------------+ - * |A-name A-End B-End Descr. Port/Bit | - * +----------------------------------------+ - * |DATA0 2 15 Data 0/0x01 | - * |-ERROR 15 2 1/0x08 | - * +----------------------------------------+ - * |DATA1 3 13 Data 0/0x02 | - * |+SLCT 13 3 1/0x10 | - * +----------------------------------------+ - * |DATA2 4 12 Data 0/0x04 | - * |+PE 12 4 1/0x20 | - * +----------------------------------------+ - * |DATA3 5 10 Strobe 0/0x08 | - * |-ACK 10 5 1/0x40 | - * +----------------------------------------+ - * |DATA4 6 11 Data 0/0x10 | - * |BUSY 11 6 1/~0x80 | - * +----------------------------------------+ - * |GND 18-25 18-25 GND - | - * +----------------------------------------+ - * - * Expect transfer-rates up to 75 kbyte/sec. - * - * If GCC could correctly grok - * register int port asm("edx") - * the code would be cleaner - * - * Poul-Henning Kamp - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include - -#define LPINITRDY 4 /* wait up to 4 seconds for a ready */ -#define LPTOUTINITIAL 10 /* initial timeout to wait for ready 1/10 s */ -#define LPTOUTMAX 1 /* maximal timeout 1 s */ -#define LPPRI (PZERO+8) -#define BUFSIZE 1024 - -#ifndef DEBUG -#define lprintf(args) -#else -#define lprintf(args) do { \ - if (lptflag) \ - printf args; \ - } while (0) -static int volatile lptflag = 1; -#endif - -struct lpt_softc { - struct resource *res_port; - struct resource *res_irq; - void *sc_ih; - struct callout timer; - - int sc_port; - short sc_state; - /* default case: negative prime, negative ack, handshake strobe, - prime once */ - u_char sc_control; - char sc_flags; -#define LP_POS_INIT 0x04 /* if we are a postive init signal */ -#define LP_POS_ACK 0x08 /* if we are a positive going ack */ -#define LP_NO_PRIME 0x10 /* don't prime the printer at all */ -#define LP_PRIMEOPEN 0x20 /* prime on every open */ -#define LP_AUTOLF 0x40 /* tell printer to do an automatic lf */ -#define LP_BYPASS 0x80 /* bypass printer ready checks */ - void *sc_inbuf; - short sc_xfercnt ; - char sc_primed; - char *sc_cp ; - u_char sc_irq ; /* IRQ status of port */ -#define LP_HAS_IRQ 0x01 /* we have an irq available */ -#define LP_USE_IRQ 0x02 /* we are using our irq */ -#define LP_ENABLE_IRQ 0x04 /* enable IRQ on open */ - u_char sc_backoff ; /* time to call lptout() again */ -}; - -/* bits for state */ -#define OPEN (1<<0) /* device is open */ -#define ASLP (1<<1) /* awaiting draining of printer */ -#define ERROR (1<<2) /* error was received from printer */ -#define OBUSY (1<<3) /* printer is busy doing output */ -#define LPTOUT (1<<4) /* timeout while not selected */ -#define TOUT (1<<5) /* timeout while not selected */ -#define INIT (1<<6) /* waiting to initialize for open */ -#define INTERRUPTED (1<<7) /* write call was interrupted */ - - -/* status masks to interrogate printer status */ -#define RDY_MASK (LPS_SEL|LPS_OUT|LPS_NBSY|LPS_NERR) /* ready ? */ -#define LP_READY (LPS_SEL|LPS_NBSY|LPS_NERR) - -/* Printer Ready condition - from lpa.c */ -/* Only used in polling code */ -#define NOT_READY(x) ((inb(x) & LPS_NBSY) != LPS_NBSY) - -#define MAX_SLEEP (hz*5) /* Timeout while waiting for device ready */ -#define MAX_SPIN 20 /* Max delay for device ready in usecs */ - -static timeout_t lptout; -static int lpt_probe(device_t); -static int lpt_attach(device_t); -static void lpt_intr(void *); - -static devclass_t olpt_devclass; - -static device_method_t olpt_methods[] = { - DEVMETHOD(device_probe, lpt_probe), - DEVMETHOD(device_attach, lpt_attach), - { 0, 0 } -}; - -static driver_t olpt_driver = { - "olpt", - olpt_methods, - sizeof (struct lpt_softc), -}; - -DRIVER_MODULE(olpt, isa, olpt_driver, olpt_devclass, 0, 0); - -static d_open_t lptopen; -static d_close_t lptclose; -static d_write_t lptwrite; -static d_ioctl_t lptioctl; - -static struct cdevsw lpt_cdevsw = { - .d_version = D_VERSION, - .d_flags = D_NEEDGIANT, - .d_open = lptopen, - .d_close = lptclose, - .d_write = lptwrite, - .d_ioctl = lptioctl, - .d_name = "lpt", -}; - -static bus_addr_t lpt_iat[] = {0, 2, 4, 6}; - -/* - * New lpt port probe Geoff Rehmet - Rhodes University - 14/2/94 - * Based partially on Rod Grimes' printer probe - * - * Logic: - * 1) If no port address was given, use the bios detected ports - * and autodetect what ports the printers are on. - * 2) Otherwise, probe the data port at the address given, - * using the method in Rod Grimes' port probe. - * (Much code ripped off directly from Rod's probe.) - * - * Comments from Rod's probe: - * Logic: - * 1) You should be able to write to and read back the same value - * to the data port. Do an alternating zeros, alternating ones, - * walking zero, and walking one test to check for stuck bits. - * - * 2) You should be able to write to and read back the same value - * to the control port lower 5 bits, the upper 3 bits are reserved - * per the IBM PC technical reference manauls and different boards - * do different things with them. Do an alternating zeros, alternating - * ones, walking zero, and walking one test to check for stuck bits. - * - * Some printers drag the strobe line down when the are powered off - * so this bit has been masked out of the control port test. - * - * XXX Some printers may not like a fast pulse on init or strobe, I - * don't know at this point, if that becomes a problem these bits - * should be turned off in the mask byte for the control port test. - * - * We are finally left with a mask of 0x14, due to some printers - * being adamant about holding other bits high ........ - * - * Before probing the control port, we write a 0 to the data port - - * If not, some printers chuck out garbage when the strobe line - * gets toggled. - * - * 3) Set the data and control ports to a value of 0 - * - * This probe routine has been tested on Epson Lx-800, HP LJ3P, - * Epson FX-1170 and C.Itoh 8510RM - * printers. - * Quick exit on fail added. - */ - -int -lpt_probe(device_t dev) -{ -#define PC98_OLD_LPT 0x40 -#define PC98_IEEE_1284_FUNCTION 0x149 - int rid; - struct resource *res; - - /* Check isapnp ids */ - if (isa_get_vendorid(dev)) - return ENXIO; - - rid = 0; - res = isa_alloc_resourcev(dev, SYS_RES_IOPORT, &rid, lpt_iat, 4, - RF_ACTIVE); - if (res == NULL) - return ENXIO; - isa_load_resourcev(res, lpt_iat, 4); - - if (isa_get_port(dev) == PC98_OLD_LPT) { - unsigned int pc98_ieee_mode, tmp; - - tmp = inb(PC98_IEEE_1284_FUNCTION); - pc98_ieee_mode = tmp; - if ((tmp & 0x10) == 0x10) { - outb(PC98_IEEE_1284_FUNCTION, tmp & ~0x10); - tmp = inb(PC98_IEEE_1284_FUNCTION); - if ((tmp & 0x10) != 0x10) { - outb(PC98_IEEE_1284_FUNCTION, pc98_ieee_mode); - bus_release_resource(dev, SYS_RES_IOPORT, rid, - res); - return ENXIO; - } - } - } - - bus_release_resource(dev, SYS_RES_IOPORT, rid, res); - return 0; -} - -/* XXX Todo - try and detect if interrupt is working */ -int -lpt_attach(device_t dev) -{ - int rid, unit; - struct lpt_softc *sc; - struct cdev *cdev; - - unit = device_get_unit(dev); - sc = device_get_softc(dev); - callout_init(&sc->timer, 0); - - rid = 0; - sc->res_port = isa_alloc_resourcev(dev, SYS_RES_IOPORT, &rid, - lpt_iat, 4, RF_ACTIVE); - if (sc->res_port == NULL) - return ENXIO; - isa_load_resourcev(sc->res_port, lpt_iat, 4); - - sc->sc_port = rman_get_start(sc->res_port); - sc->sc_primed = 0; /* not primed yet */ - - outb(sc->sc_port+lpt_pstb_ctrl, LPC_DIS_PSTB); /* PSTB disable */ - outb(sc->sc_port+lpt_control, LPC_MODE8255); /* 8255 mode set */ - outb(sc->sc_port+lpt_control, LPC_NIRQ8); /* IRQ8 inactive */ - outb(sc->sc_port+lpt_control, LPC_NPSTB); /* PSTB inactive */ - outb(sc->sc_port+lpt_pstb_ctrl, LPC_EN_PSTB); /* PSTB enable */ - - sc->sc_irq = 0; - if (isa_get_irq(dev) != -1) { - rid = 0; - sc->res_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, - RF_ACTIVE); - if (sc->res_irq == NULL) { - bus_release_resource(dev, SYS_RES_IOPORT, 0, - sc->res_port); - return ENXIO; - } - if (bus_setup_intr(dev, sc->res_irq, INTR_TYPE_TTY, NULL, lpt_intr, - sc, &sc->sc_ih)) { - bus_release_resource(dev, SYS_RES_IOPORT, 0, - sc->res_port); - bus_release_resource(dev, SYS_RES_IRQ, 0, - sc->res_irq); - return ENXIO; - } - sc->sc_irq = LP_HAS_IRQ | LP_USE_IRQ | LP_ENABLE_IRQ; - device_printf(dev, "Interrupt-driven port"); - } - - cdev = make_dev(&lpt_cdevsw, 0, - UID_ROOT, GID_WHEEL, 0600, "lpt%d", unit); - cdev->si_drv1 = sc; - cdev = make_dev(&lpt_cdevsw, LP_BYPASS, - UID_ROOT, GID_WHEEL, 0600, "lpctl%d", unit); - cdev->si_drv1 = sc; - - return 0; -} - -/* - * lptopen -- reset the printer, then wait until it's selected and not busy. - * If LP_BYPASS flag is selected, then we do not try to select the - * printer -- this is just used for passing ioctls. - */ - -static int -lptopen (struct cdev *dev, int flags, int fmt, struct thread *td) -{ - struct lpt_softc *sc = dev->si_drv1; - int s; - int port; - - if (sc->sc_port == 0) - return (ENXIO); - - if (sc->sc_state) { - lprintf(("lp: still open %x\n", sc->sc_state)); - return(EBUSY); - } else - sc->sc_state |= INIT; - - sc->sc_flags = dev2unit(dev); - - /* Check for open with BYPASS flag set. */ - if (sc->sc_flags & LP_BYPASS) { - sc->sc_state = OPEN; - return(0); - } - - s = spltty(); - lprintf(("lp flags 0x%x\n", sc->sc_flags)); - port = sc->sc_port; - - /* set IRQ status according to ENABLE_IRQ flag */ - if (sc->sc_irq & LP_ENABLE_IRQ) - sc->sc_irq |= LP_USE_IRQ; - else - sc->sc_irq &= ~LP_USE_IRQ; - - /* init printer */ - sc->sc_state = OPEN; - sc->sc_inbuf = malloc(BUFSIZE, M_DEVBUF, M_WAITOK); - sc->sc_xfercnt = 0; - splx(s); - - /* only use timeout if using interrupt */ - lprintf(("irq %x\n", sc->sc_irq)); - if (sc->sc_irq & LP_USE_IRQ) { - sc->sc_state |= TOUT; - sc->sc_backoff = hz / LPTOUTINITIAL; - callout_reset(&sc->timer, sc->sc_backoff, lptout, sc); - } - - lprintf(("opened.\n")); - return(0); -} - -static void -lptout (void *arg) -{ - struct lpt_softc *sc = arg; - int pl; - - lprintf(("T %x ", inb(sc->sc_port+lpt_status))); - if (sc->sc_state & OPEN) { - sc->sc_backoff++; - if (sc->sc_backoff > hz/LPTOUTMAX) - sc->sc_backoff = sc->sc_backoff > hz/LPTOUTMAX; - callout_reset(&sc->timer, sc->sc_backoff, lptout, sc); - } else - sc->sc_state &= ~TOUT; - - if (sc->sc_state & ERROR) - sc->sc_state &= ~ERROR; - - /* - * Avoid possible hangs do to missed interrupts - */ - if (sc->sc_xfercnt) { - pl = spltty(); - lpt_intr(sc); - splx(pl); - } else { - sc->sc_state &= ~OBUSY; - wakeup(sc); - } -} - -/* - * lptclose -- close the device, free the local line buffer. - * - * Check for interrupted write call added. - */ - -static int -lptclose(struct cdev *dev, int flags, int fmt, struct thread *td) -{ - struct lpt_softc *sc = dev->si_drv1; - - if(sc->sc_flags & LP_BYPASS) - goto end_close; - - sc->sc_state &= ~OPEN; - free(sc->sc_inbuf, M_DEVBUF); - -end_close: - sc->sc_state = 0; - sc->sc_xfercnt = 0; - lprintf(("closed.\n")); - return(0); -} - -/* - * pushbytes() - * Workhorse for actually spinning and writing bytes to printer - * Derived from lpa.c - * Originally by ? - * - * This code is only used when we are polling the port - */ -static int -pushbytes(struct lpt_softc * sc) -{ - int spin, err, tic; - char ch; - int port = sc->sc_port; - - lprintf(("p")); - /* loop for every character .. */ - while (sc->sc_xfercnt > 0) { - /* printer data */ - ch = *(sc->sc_cp); - sc->sc_cp++; - sc->sc_xfercnt--; - - /* - * Wait for printer ready. - * Loop 20 usecs testing BUSY bit, then sleep - * for exponentially increasing timeout. (vak) - */ - for (spin=0; NOT_READY(port+lpt_status) && spin= MAX_SPIN) { - tic = 0; - while (NOT_READY(port+lpt_status)) { - /* - * Now sleep, every cycle a - * little longer .. - */ - tic = tic + tic + 1; - /* - * But no more than 10 seconds. (vak) - */ - if (tic > MAX_SLEEP) - tic = MAX_SLEEP; - err = tsleep(sc, LPPRI, - "lptpoll", tic); - if (err != EWOULDBLOCK) { - return (err); - } - } - } - - /* output data */ - outb(port+lpt_data, ch); - DELAY(1); - outb(port+lpt_control, LPC_PSTB); - DELAY(1); - outb(port+lpt_control, LPC_NPSTB); - } - return(0); -} - -/* - * lptwrite --copy a line from user space to a local buffer, then call - * putc to get the chars moved to the output queue. - * - * Flagging of interrupted write added. - */ - -static int -lptwrite(struct cdev *dev, struct uio * uio, int ioflag) -{ - register unsigned n; - int pl, err; - struct lpt_softc *sc = dev->si_drv1; - - if(sc->sc_flags & LP_BYPASS) { - /* we can't do writes in bypass mode */ - return(EPERM); - } - - sc->sc_state &= ~INTERRUPTED; - while ((n = min(BUFSIZE, uio->uio_resid)) != 0) { - sc->sc_cp = sc->sc_inbuf; - uiomove(sc->sc_cp, n, uio); - sc->sc_xfercnt = n ; - while ((sc->sc_xfercnt > 0)&&(sc->sc_irq & LP_USE_IRQ)) { - lprintf(("i")); - /* if the printer is ready for a char, */ - /* give it one */ - if ((sc->sc_state & OBUSY) == 0){ - lprintf(("\nC %d. ", sc->sc_xfercnt)); - pl = spltty(); - lpt_intr(sc); - (void) splx(pl); - } - lprintf(("W ")); - if (sc->sc_state & OBUSY) - if ((err = tsleep (sc, - LPPRI|PCATCH, "lpwrite", 0))) { - sc->sc_state |= INTERRUPTED; - return(err); - } - } - /* check to see if we must do a polled write */ - if(!(sc->sc_irq & LP_USE_IRQ) && (sc->sc_xfercnt)) { - lprintf(("p")); - if((err = pushbytes(sc))) - return(err); - } - } - return(0); -} - -/* - * lptintr -- handle printer interrupts which occur when the printer is - * ready to accept another char. - * - * do checking for interrupted write call. - */ - -static void -lpt_intr(void *arg) -{ -} - -static int -lptioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *td) -{ - int error = 0; - struct lpt_softc *sc = dev->si_drv1; - u_char old_sc_irq; /* old printer IRQ status */ - - switch (cmd) { - case LPT_IRQ : - if(sc->sc_irq & LP_HAS_IRQ) { - /* - * NOTE: - * If the IRQ status is changed, - * this will only be visible on the - * next open. - * - * If interrupt status changes, - * this gets syslog'd. - */ - old_sc_irq = sc->sc_irq; - if(*(int*)data == 0) - sc->sc_irq &= (~LP_ENABLE_IRQ); - else - sc->sc_irq |= LP_ENABLE_IRQ; - if (old_sc_irq != sc->sc_irq ) - log(LOG_NOTICE, "%s switched to %s mode\n", - devtoname(dev), - (sc->sc_irq & LP_ENABLE_IRQ)? - "interrupt-driven":"polled"); - } else /* polled port */ - error = EOPNOTSUPP; - break; - default: - error = ENODEV; - } - - return(error); -} diff --git a/sys/pc98/cbus/olptreg.h b/sys/pc98/cbus/olptreg.h deleted file mode 100644 index 80bc704f006c..000000000000 --- a/sys/pc98/cbus/olptreg.h +++ /dev/null @@ -1,48 +0,0 @@ -/*- - * Copyright (c) 2005 TAKAHASHI Yoshihiro - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -/* - * modified for PC9801 by A.Kojima - * Kyoto University Microcomputer Club (KMC) - */ - -#define lpt_pstb_ctrl (-9) /* PSTB enable control */ -#define LPC_EN_PSTB 0xc /* PSTB enable */ -#define LPC_DIS_PSTB 0xd /* PSTB disable */ - -#define lpt_data 0 /* Data to/from printer (R/W) */ - -#define lpt_status 2 /* Status of printer (R) */ -#define LPS_NBSY 0x4 /* printer no ack of data */ - -#define lpt_control 6 /* Control printer (W) */ -#define LPC_MODE8255 0x82 /* 8255 mode */ -#define LPC_IRQ8 0x6 /* IRQ8 active */ -#define LPC_NIRQ8 0x7 /* IRQ8 inactive */ -#define LPC_PSTB 0xe /* PSTB active */ -#define LPC_NPSTB 0xf /* PSTB inactive */ diff --git a/sys/pc98/cbus/pckbd.c b/sys/pc98/cbus/pckbd.c deleted file mode 100644 index aec0f0dd2849..000000000000 --- a/sys/pc98/cbus/pckbd.c +++ /dev/null @@ -1,999 +0,0 @@ -/*- - * Copyright (c) 1999 FreeBSD(98) port team. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer as - * the first lines of this file unmodified. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include "opt_compat.h" -#include "opt_kbd.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -#include -#include - -#define DRIVER_NAME "pckbd" - -/* device configuration flags */ -#define KB_CONF_FAIL_IF_NO_KBD (1 << 0) /* don't install if no kbd is found */ - -typedef caddr_t KBDC; - -typedef struct pckbd_state { - KBDC kbdc; /* keyboard controller */ - int ks_mode; /* input mode (K_XLATE,K_RAW,K_CODE) */ - int ks_flags; /* flags */ -#define COMPOSE (1 << 0) - int ks_state; /* shift/lock key state */ - int ks_accents; /* accent key index (> 0) */ - u_int ks_composed_char; /* composed char code (> 0) */ - struct callout ks_timer; -} pckbd_state_t; - -static devclass_t pckbd_devclass; - -static int pckbdprobe(device_t dev); -static int pckbdattach(device_t dev); -static int pckbdresume(device_t dev); -static void pckbd_isa_intr(void *arg); - -static device_method_t pckbd_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, pckbdprobe), - DEVMETHOD(device_attach, pckbdattach), - DEVMETHOD(device_resume, pckbdresume), - { 0, 0 } -}; - -static driver_t pckbd_driver = { - DRIVER_NAME, - pckbd_methods, - 1, -}; - -DRIVER_MODULE(pckbd, isa, pckbd_driver, pckbd_devclass, 0, 0); - -static bus_addr_t pckbd_iat[] = {0, 2}; - -static int pckbd_probe_unit(device_t dev, int port, int irq, - int flags); -static int pckbd_attach_unit(device_t dev, keyboard_t **kbd, - int port, int irq, int flags); -static timeout_t pckbd_timeout; - - -static int -pckbdprobe(device_t dev) -{ - struct resource *res; - int error, rid; - - /* Check isapnp ids */ - if (isa_get_vendorid(dev)) - return (ENXIO); - - device_set_desc(dev, "PC-98 Keyboard"); - - rid = 0; - res = isa_alloc_resourcev(dev, SYS_RES_IOPORT, &rid, pckbd_iat, 2, - RF_ACTIVE); - if (res == NULL) - return ENXIO; - isa_load_resourcev(res, pckbd_iat, 2); - - error = pckbd_probe_unit(dev, - isa_get_port(dev), - (1 << isa_get_irq(dev)), - device_get_flags(dev)); - - bus_release_resource(dev, SYS_RES_IOPORT, rid, res); - - return (error); -} - -static int -pckbdattach(device_t dev) -{ - keyboard_t *kbd; - void *ih; - struct resource *res; - int error, rid; - - rid = 0; - res = isa_alloc_resourcev(dev, SYS_RES_IOPORT, &rid, pckbd_iat, 2, - RF_ACTIVE); - if (res == NULL) - return ENXIO; - isa_load_resourcev(res, pckbd_iat, 2); - - error = pckbd_attach_unit(dev, &kbd, - isa_get_port(dev), - (1 << isa_get_irq(dev)), - device_get_flags(dev)); - - rid = 0; - res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE); - if (res == NULL) - return ENXIO; - bus_setup_intr(dev, res, INTR_TYPE_TTY, NULL, pckbd_isa_intr, kbd, &ih); - - return 0; -} - -static int -pckbdresume(device_t dev) -{ - keyboard_t *kbd; - - kbd = kbd_get_keyboard(kbd_find_keyboard(DRIVER_NAME, - device_get_unit(dev))); - if (kbd) - kbdd_clear_state(kbd); - - return (0); -} - -static void -pckbd_isa_intr(void *arg) -{ - keyboard_t *kbd = arg; - - kbdd_intr(kbd, NULL); -} - -static int -pckbd_probe_unit(device_t dev, int port, int irq, int flags) -{ - keyboard_switch_t *sw; - int args[2]; - int error; - - sw = kbd_get_switch(DRIVER_NAME); - if (sw == NULL) - return ENXIO; - - args[0] = port; - args[1] = irq; - error = (*sw->probe)(device_get_unit(dev), args, flags); - if (error) - return error; - return 0; -} - -static int -pckbd_attach_unit(device_t dev, keyboard_t **kbd, int port, int irq, int flags) -{ - keyboard_switch_t *sw; - pckbd_state_t *state; - int args[2]; - int error; - int unit; - - sw = kbd_get_switch(DRIVER_NAME); - if (sw == NULL) - return ENXIO; - - /* reset, initialize and enable the device */ - unit = device_get_unit(dev); - args[0] = port; - args[1] = irq; - *kbd = NULL; - error = (*sw->probe)(unit, args, flags); - if (error) - return error; - error = (*sw->init)(unit, kbd, args, flags); - if (error) - return error; - (*sw->enable)(*kbd); - -#ifdef KBD_INSTALL_CDEV - /* attach a virtual keyboard cdev */ - error = kbd_attach(*kbd); - if (error) - return error; -#endif /* KBD_INSTALL_CDEV */ - - /* - * This is a kludge to compensate for lost keyboard interrupts. - * A similar code used to be in syscons. See below. XXX - */ - state = (pckbd_state_t *)(*kbd)->kb_data; - callout_init(&state->ks_timer, 0); - pckbd_timeout(*kbd); - - if (bootverbose) - (*sw->diag)(*kbd, bootverbose); - - return 0; -} - -static void -pckbd_timeout(void *arg) -{ - pckbd_state_t *state; - keyboard_t *kbd; - int s; - - /* The following comments are extracted from syscons.c (1.287) */ - /* - * With release 2.1 of the Xaccel server, the keyboard is left - * hanging pretty often. Apparently an interrupt from the - * keyboard is lost, and I don't know why (yet). - * This ugly hack calls scintr if input is ready for the keyboard - * and conveniently hides the problem. XXX - */ - /* - * Try removing anything stuck in the keyboard controller; whether - * it's a keyboard scan code or mouse data. `scintr()' doesn't - * read the mouse data directly, but `kbdio' routines will, as a - * side effect. - */ - s = spltty(); - kbd = (keyboard_t *)arg; - if (kbdd_lock(kbd, TRUE)) { - /* - * We have seen the lock flag is not set. Let's reset - * the flag early, otherwise the LED update routine fails - * which may want the lock during the interrupt routine. - */ - kbdd_lock(kbd, FALSE); - if (kbdd_check_char(kbd)) - kbdd_intr(kbd, NULL); - } - splx(s); - state = (pckbd_state_t *)kbd->kb_data; - callout_reset(&state->ks_timer, hz / 10, pckbd_timeout, arg); -} - -/* LOW-LEVEL */ - -#include - -#define PC98KBD_DEFAULT 0 - -/* keyboard driver declaration */ -static int pckbd_configure(int flags); -static kbd_probe_t pckbd_probe; -static kbd_init_t pckbd_init; -static kbd_term_t pckbd_term; -static kbd_intr_t pckbd_intr; -static kbd_test_if_t pckbd_test_if; -static kbd_enable_t pckbd_enable; -static kbd_disable_t pckbd_disable; -static kbd_read_t pckbd_read; -static kbd_check_t pckbd_check; -static kbd_read_char_t pckbd_read_char; -static kbd_check_char_t pckbd_check_char; -static kbd_ioctl_t pckbd_ioctl; -static kbd_lock_t pckbd_lock; -static kbd_clear_state_t pckbd_clear_state; -static kbd_get_state_t pckbd_get_state; -static kbd_set_state_t pckbd_set_state; -static kbd_poll_mode_t pckbd_poll; - -keyboard_switch_t pckbdsw = { - pckbd_probe, - pckbd_init, - pckbd_term, - pckbd_intr, - pckbd_test_if, - pckbd_enable, - pckbd_disable, - pckbd_read, - pckbd_check, - pckbd_read_char, - pckbd_check_char, - pckbd_ioctl, - pckbd_lock, - pckbd_clear_state, - pckbd_get_state, - pckbd_set_state, - genkbd_get_fkeystr, - pckbd_poll, - genkbd_diag, -}; - -KEYBOARD_DRIVER(pckbd, pckbdsw, pckbd_configure); - -struct kbdc_softc { - int port; /* base port address */ - int lock; /* FIXME: XXX not quite a semaphore... */ -}; - -/* local functions */ -static int probe_keyboard(KBDC kbdc, int flags); -static int init_keyboard(KBDC kbdc, int *type, int flags); -static KBDC kbdc_open(int port); -static int kbdc_lock(KBDC kbdc, int lock); -static int kbdc_data_ready(KBDC kbdc); -static int read_kbd_data(KBDC kbdc); -static int read_kbd_data_no_wait(KBDC kbdc); -static int wait_for_kbd_data(struct kbdc_softc *kbdc); - -/* local variables */ - -/* the initial key map, accent map and fkey strings */ -#include - -/* structures for the default keyboard */ -static keyboard_t default_kbd; -static pckbd_state_t default_kbd_state; -static keymap_t default_keymap; -static accentmap_t default_accentmap; -static fkeytab_t default_fkeytab[NUM_FKEYS]; - -/* - * The back door to the keyboard driver! - * This function is called by the console driver, via the kbdio module, - * to tickle keyboard drivers when the low-level console is being initialized. - * Almost nothing in the kernel has been initialied yet. Try to probe - * keyboards if possible. - * NOTE: because of the way the low-level conole is initialized, this routine - * may be called more than once!! - */ -static int -pckbd_configure(int flags) -{ - keyboard_t *kbd; - int arg[2]; - int i; - - /* XXX: a kludge to obtain the device configuration flags */ - if (resource_int_value(DRIVER_NAME, 0, "flags", &i) == 0) { - flags |= i; - /* if the driver is disabled, unregister the keyboard if any */ - if (resource_disabled(DRIVER_NAME, 0)) { - i = kbd_find_keyboard(DRIVER_NAME, PC98KBD_DEFAULT); - if (i >= 0) { - kbd = kbd_get_keyboard(i); - kbd_unregister(kbd); - kbd->kb_flags &= ~KB_REGISTERED; - return 0; - } - } - } - - /* probe the default keyboard */ - arg[0] = -1; - arg[1] = -1; - kbd = NULL; - if (pckbd_probe(PC98KBD_DEFAULT, arg, flags)) - return 0; - if (pckbd_init(PC98KBD_DEFAULT, &kbd, arg, flags)) - return 0; - - /* return the number of found keyboards */ - return 1; -} - -/* low-level functions */ - -/* detect a keyboard */ -static int -pckbd_probe(int unit, void *arg, int flags) -{ - KBDC kbdc; - int *data = (int *)arg; - - if (unit != PC98KBD_DEFAULT) - return ENXIO; - if (KBD_IS_PROBED(&default_kbd)) - return 0; - - kbdc = kbdc_open(data[0]); - if (kbdc == NULL) - return ENXIO; - if (probe_keyboard(kbdc, flags)) { - if (flags & KB_CONF_FAIL_IF_NO_KBD) - return ENXIO; - } - return 0; -} - -/* reset and initialize the device */ -static int -pckbd_init(int unit, keyboard_t **kbdp, void *arg, int flags) -{ - keyboard_t *kbd; - pckbd_state_t *state; - keymap_t *keymap; - accentmap_t *accmap; - fkeytab_t *fkeymap; - int fkeymap_size; - int *data = (int *)arg; - - if (unit != PC98KBD_DEFAULT) /* shouldn't happen */ - return ENXIO; - - *kbdp = kbd = &default_kbd; - state = &default_kbd_state; - if (!KBD_IS_PROBED(kbd)) { - keymap = &default_keymap; - accmap = &default_accentmap; - fkeymap = default_fkeytab; - fkeymap_size = nitems(default_fkeytab); - - state->kbdc = kbdc_open(data[0]); - if (state->kbdc == NULL) - return ENXIO; - kbd_init_struct(kbd, DRIVER_NAME, KB_OTHER, unit, flags, - data[0], IO_KBDSIZE); - bcopy(&key_map, keymap, sizeof(key_map)); - bcopy(&accent_map, accmap, sizeof(accent_map)); - bcopy(fkey_tab, fkeymap, - imin(fkeymap_size*sizeof(fkeymap[0]), sizeof(fkey_tab))); - kbd_set_maps(kbd, keymap, accmap, fkeymap, fkeymap_size); - kbd->kb_data = (void *)state; - - if (probe_keyboard(state->kbdc, flags)) {/* shouldn't happen */ - if (flags & KB_CONF_FAIL_IF_NO_KBD) - return ENXIO; - } else { - KBD_FOUND_DEVICE(kbd); - } - pckbd_clear_state(kbd); - state->ks_mode = K_XLATE; - KBD_PROBE_DONE(kbd); - } - if (!KBD_IS_INITIALIZED(kbd) && !(flags & KB_CONF_PROBE_ONLY)) { - if (KBD_HAS_DEVICE(kbd) - && init_keyboard(state->kbdc, &kbd->kb_type, kbd->kb_config) - && (kbd->kb_config & KB_CONF_FAIL_IF_NO_KBD)) - return ENXIO; - pckbd_ioctl(kbd, KDSETLED, (caddr_t)&state->ks_state); - KBD_INIT_DONE(kbd); - } - if (!KBD_IS_CONFIGURED(kbd)) { - if (kbd_register(kbd) < 0) - return ENXIO; - KBD_CONFIG_DONE(kbd); - } - - return 0; -} - -/* finish using this keyboard */ -static int -pckbd_term(keyboard_t *kbd) -{ - pckbd_state_t *state = (pckbd_state_t *)kbd->kb_data; - - kbd_unregister(kbd); - callout_drain(&state->ks_timer); - return 0; -} - -/* keyboard interrupt routine */ -static int -pckbd_intr(keyboard_t *kbd, void *arg) -{ - int c; - - if (KBD_IS_ACTIVE(kbd) && KBD_IS_BUSY(kbd)) { - /* let the callback function to process the input */ - (*kbd->kb_callback.kc_func)(kbd, KBDIO_KEYINPUT, - kbd->kb_callback.kc_arg); - } else { - /* read and discard the input; no one is waiting for input */ - do { - c = pckbd_read_char(kbd, FALSE); - } while (c != NOKEY); - } - return 0; -} - -/* test the interface to the device */ -static int -pckbd_test_if(keyboard_t *kbd) -{ - return 0; -} - -/* - * Enable the access to the device; until this function is called, - * the client cannot read from the keyboard. - */ -static int -pckbd_enable(keyboard_t *kbd) -{ - int s; - - s = spltty(); - KBD_ACTIVATE(kbd); - splx(s); - return 0; -} - -/* disallow the access to the device */ -static int -pckbd_disable(keyboard_t *kbd) -{ - int s; - - s = spltty(); - KBD_DEACTIVATE(kbd); - splx(s); - return 0; -} - -/* read one byte from the keyboard if it's allowed */ -static int -pckbd_read(keyboard_t *kbd, int wait) -{ - int c; - - if (wait) - c = read_kbd_data(((pckbd_state_t *)kbd->kb_data)->kbdc); - else - c = read_kbd_data_no_wait(((pckbd_state_t *)kbd->kb_data)->kbdc); - if (c != -1) - ++kbd->kb_count; - return (KBD_IS_ACTIVE(kbd) ? c : -1); -} - -/* check if data is waiting */ -static int -pckbd_check(keyboard_t *kbd) -{ - if (!KBD_IS_ACTIVE(kbd)) - return FALSE; - return kbdc_data_ready(((pckbd_state_t *)kbd->kb_data)->kbdc); -} - -/* read char from the keyboard */ -static u_int -pckbd_read_char(keyboard_t *kbd, int wait) -{ - pckbd_state_t *state; - u_int action; - int scancode; - int keycode; - - state = (pckbd_state_t *)kbd->kb_data; -next_code: - /* do we have a composed char to return? */ - if (!(state->ks_flags & COMPOSE) && (state->ks_composed_char > 0)) { - action = state->ks_composed_char; - state->ks_composed_char = 0; - if (action > UCHAR_MAX) - return ERRKEY; - return action; - } - - /* see if there is something in the keyboard port */ - if (wait) { - do { - scancode = read_kbd_data(state->kbdc); - } while (scancode == -1); - } else { - scancode = read_kbd_data_no_wait(state->kbdc); - if (scancode == -1) - return NOKEY; - } - ++kbd->kb_count; - -#if 0 - printf("pckbd_read_char(): scancode:0x%x\n", scancode); -#endif - - /* return the byte as is for the K_RAW mode */ - if (state->ks_mode == K_RAW) - return scancode; - - /* translate the scan code into a keycode */ - keycode = scancode & 0x7F; - switch(scancode) { - case 0xF3: /* GRPH (compose key) released */ - if (state->ks_flags & COMPOSE) { - state->ks_flags &= ~COMPOSE; - if (state->ks_composed_char > UCHAR_MAX) - state->ks_composed_char = 0; - } - break; - case 0x73: /* GRPH (compose key) pressed */ - if (!(state->ks_flags & COMPOSE)) { - state->ks_flags |= COMPOSE; - state->ks_composed_char = 0; - } - break; - } - - /* return the key code in the K_CODE mode */ - if (state->ks_mode == K_CODE) - return (keycode | (scancode & 0x80)); - - /* compose a character code */ - if (state->ks_flags & COMPOSE) { - switch (scancode) { - /* key pressed, process it */ - case 0x42: case 0x43: case 0x44: /* keypad 7,8,9 */ - state->ks_composed_char *= 10; - state->ks_composed_char += scancode - 0x3B; - if (state->ks_composed_char > UCHAR_MAX) - return ERRKEY; - goto next_code; - case 0x46: case 0x47: case 0x48: /* keypad 4,5,6 */ - state->ks_composed_char *= 10; - state->ks_composed_char += scancode - 0x42; - if (state->ks_composed_char > UCHAR_MAX) - return ERRKEY; - goto next_code; - case 0x4A: case 0x4B: case 0x4C: /* keypad 1,2,3 */ - state->ks_composed_char *= 10; - state->ks_composed_char += scancode - 0x49; - if (state->ks_composed_char > UCHAR_MAX) - return ERRKEY; - goto next_code; - case 0x4E: /* keypad 0 */ - state->ks_composed_char *= 10; - if (state->ks_composed_char > UCHAR_MAX) - return ERRKEY; - goto next_code; - - /* key released, no interest here */ - case 0xC2: case 0xC3: case 0xC4: /* keypad 7,8,9 */ - case 0xC6: case 0xC7: case 0xC8: /* keypad 4,5,6 */ - case 0xCA: case 0xCB: case 0xCC: /* keypad 1,2,3 */ - case 0xCE: /* keypad 0 */ - goto next_code; - - case 0x73: /* GRPH key */ - break; - - default: - if (state->ks_composed_char > 0) { - state->ks_flags &= ~COMPOSE; - state->ks_composed_char = 0; - return ERRKEY; - } - break; - } - } - - /* keycode to key action */ - action = genkbd_keyaction(kbd, keycode, scancode & 0x80, - &state->ks_state, &state->ks_accents); - if (action == NOKEY) - goto next_code; - else - return action; -} - -/* check if char is waiting */ -static int -pckbd_check_char(keyboard_t *kbd) -{ - pckbd_state_t *state; - - if (!KBD_IS_ACTIVE(kbd)) - return FALSE; - state = (pckbd_state_t *)kbd->kb_data; - if (!(state->ks_flags & COMPOSE) && (state->ks_composed_char > 0)) - return TRUE; - return kbdc_data_ready(state->kbdc); -} - -/* some useful control functions */ -static int -pckbd_ioctl(keyboard_t *kbd, u_long cmd, caddr_t arg) -{ - pckbd_state_t *state = kbd->kb_data; - int s; - int i; -#if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \ - defined(COMPAT_FREEBSD4) || defined(COMPAT_43) - int ival; -#endif - - s = spltty(); - switch (cmd) { - - case KDGKBMODE: /* get keyboard mode */ - *(int *)arg = state->ks_mode; - break; -#if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \ - defined(COMPAT_FREEBSD4) || defined(COMPAT_43) - case _IO('K', 7): - ival = IOCPARM_IVAL(arg); - arg = (caddr_t)&ival; - /* FALLTHROUGH */ -#endif - case KDSKBMODE: /* set keyboard mode */ - switch (*(int *)arg) { - case K_XLATE: - if (state->ks_mode != K_XLATE) { - /* make lock key state and LED state match */ - state->ks_state &= ~LOCK_MASK; - state->ks_state |= KBD_LED_VAL(kbd); - } - /* FALLTHROUGH */ - case K_RAW: - case K_CODE: - if (state->ks_mode != *(int *)arg) { - pckbd_clear_state(kbd); - state->ks_mode = *(int *)arg; - } - break; - default: - splx(s); - return EINVAL; - } - break; - - case KDGETLED: /* get keyboard LED */ - *(int *)arg = KBD_LED_VAL(kbd); - break; -#if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \ - defined(COMPAT_FREEBSD4) || defined(COMPAT_43) - case _IO('K', 66): - ival = IOCPARM_IVAL(arg); - arg = (caddr_t)&ival; - /* FALLTHROUGH */ -#endif - case KDSETLED: /* set keyboard LED */ - /* NOTE: lock key state in ks_state won't be changed */ - if (*(int *)arg & ~LOCK_MASK) { - splx(s); - return EINVAL; - } - i = *(int *)arg; - /* replace CAPS LED with ALTGR LED for ALTGR keyboards */ - if (kbd->kb_keymap->n_keys > ALTGR_OFFSET) { - if (i & ALKED) - i |= CLKED; - else - i &= ~CLKED; - } - KBD_LED_VAL(kbd) = *(int *)arg; - break; - - case KDGKBSTATE: /* get lock key state */ - *(int *)arg = state->ks_state & LOCK_MASK; - break; -#if defined(COMPAT_FREEBSD6) || defined(COMPAT_FREEBSD5) || \ - defined(COMPAT_FREEBSD4) || defined(COMPAT_43) - case _IO('K', 20): - ival = IOCPARM_IVAL(arg); - arg = (caddr_t)&ival; - /* FALLTHROUGH */ -#endif - case KDSKBSTATE: /* set lock key state */ - if (*(int *)arg & ~LOCK_MASK) { - splx(s); - return EINVAL; - } - state->ks_state &= ~LOCK_MASK; - state->ks_state |= *(int *)arg; - splx(s); - /* set LEDs and quit */ - return pckbd_ioctl(kbd, KDSETLED, arg); - - case KDSETRAD: /* set keyboard repeat rate (old interface)*/ - break; - case KDSETREPEAT: /* set keyboard repeat rate (new interface) */ - break; - - case PIO_KEYMAP: /* set keyboard translation table */ - case OPIO_KEYMAP: /* set keyboard translation table (compat) */ - case PIO_KEYMAPENT: /* set keyboard translation table entry */ - case PIO_DEADKEYMAP: /* set accent key translation table */ - state->ks_accents = 0; - /* FALLTHROUGH */ - default: - splx(s); - return genkbd_commonioctl(kbd, cmd, arg); - } - - splx(s); - return 0; -} - -/* lock the access to the keyboard */ -static int -pckbd_lock(keyboard_t *kbd, int lock) -{ - return kbdc_lock(((pckbd_state_t *)kbd->kb_data)->kbdc, lock); -} - -/* clear the internal state of the keyboard */ -static void -pckbd_clear_state(keyboard_t *kbd) -{ - pckbd_state_t *state; - - state = (pckbd_state_t *)kbd->kb_data; - state->ks_flags = 0; - state->ks_state &= LOCK_MASK; /* preserve locking key state */ - state->ks_accents = 0; - state->ks_composed_char = 0; -} - -/* save the internal state */ -static int -pckbd_get_state(keyboard_t *kbd, void *buf, size_t len) -{ - if (len == 0) - return sizeof(pckbd_state_t); - if (len < sizeof(pckbd_state_t)) - return -1; - bcopy(kbd->kb_data, buf, sizeof(pckbd_state_t)); - return 0; -} - -/* set the internal state */ -static int -pckbd_set_state(keyboard_t *kbd, void *buf, size_t len) -{ - if (len < sizeof(pckbd_state_t)) - return ENOMEM; - if (((pckbd_state_t *)kbd->kb_data)->kbdc - != ((pckbd_state_t *)buf)->kbdc) - return ENOMEM; - bcopy(buf, kbd->kb_data, sizeof(pckbd_state_t)); - return 0; -} - -/* set polling mode */ -static int -pckbd_poll(keyboard_t *kbd, int on) -{ - return 0; -} - -/* local functions */ - -static int -probe_keyboard(KBDC kbdc, int flags) -{ - return 0; -} - -static int -init_keyboard(KBDC kbdc, int *type, int flags) -{ - *type = KB_OTHER; - return 0; -} - -/* keyboard I/O routines */ - -/* retry count */ -#ifndef KBD_MAXRETRY -#define KBD_MAXRETRY 3 -#endif - -/* timing parameters */ -#ifndef KBD_RESETDELAY -#define KBD_RESETDELAY 200 /* wait 200msec after kbd/mouse reset */ -#endif -#ifndef KBD_MAXWAIT -#define KBD_MAXWAIT 5 /* wait 5 times at most after reset */ -#endif - -/* I/O recovery time */ -#define KBDC_DELAYTIME 37 -#define KBDD_DELAYTIME 37 - -/* I/O ports */ -#define KBD_STATUS_PORT 2 /* status port, read */ -#define KBD_DATA_PORT 0 /* data port, read */ - -/* status bits (KBD_STATUS_PORT) */ -#define KBDS_BUFFER_FULL 0x0002 - -/* macros */ - -#define kbdcp(p) ((struct kbdc_softc *)(p)) - -/* local variables */ - -static struct kbdc_softc kbdc_softc[1] = { { 0 }, }; - -/* associate a port number with a KBDC */ - -static KBDC -kbdc_open(int port) -{ - if (port <= 0) - port = IO_KBD; - - /* PC-98 has only one keyboard I/F */ - kbdc_softc[0].port = port; - kbdc_softc[0].lock = FALSE; - return (KBDC)&kbdc_softc[0]; -} - -/* set/reset polling lock */ -static int -kbdc_lock(KBDC p, int lock) -{ - int prevlock; - - prevlock = kbdcp(p)->lock; - kbdcp(p)->lock = lock; - - return (prevlock != lock); -} - -/* check if any data is waiting to be processed */ -static int -kbdc_data_ready(KBDC p) -{ - return (inb(kbdcp(p)->port + KBD_STATUS_PORT) & KBDS_BUFFER_FULL); -} - -/* wait for data from the keyboard */ -static int -wait_for_kbd_data(struct kbdc_softc *kbdc) -{ - /* CPU will stay inside the loop for 200msec at most */ - int retry = 10000; - int port = kbdc->port; - - while (!(inb(port + KBD_STATUS_PORT) & KBDS_BUFFER_FULL)) { - DELAY(KBDD_DELAYTIME); - DELAY(KBDC_DELAYTIME); - if (--retry < 0) - return 0; - } - DELAY(KBDD_DELAYTIME); - return 1; -} - -/* read one byte from the keyboard */ -static int -read_kbd_data(KBDC p) -{ - if (!wait_for_kbd_data(kbdcp(p))) - return -1; /* timeout */ - DELAY(KBDC_DELAYTIME); - return inb(kbdcp(p)->port + KBD_DATA_PORT); -} - -/* read one byte from the keyboard, but return immediately if - * no data is waiting - */ -static int -read_kbd_data_no_wait(KBDC p) -{ - if (inb(kbdcp(p)->port + KBD_STATUS_PORT) & KBDS_BUFFER_FULL) { - DELAY(KBDD_DELAYTIME); - return inb(kbdcp(p)->port + KBD_DATA_PORT); - } - return -1; /* no data */ -} diff --git a/sys/pc98/cbus/pckbdtables.h b/sys/pc98/cbus/pckbdtables.h deleted file mode 100644 index 5386f52174eb..000000000000 --- a/sys/pc98/cbus/pckbdtables.h +++ /dev/null @@ -1,203 +0,0 @@ -/*- - * Copyright (C) 2005 TAKAHASHI Yoshihiro. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef KBD_DFLT_KEYMAP - -#define NO_ACCENTCHARS - -/* PC-9801 keymap by kuribo@isl.melco.co.jp */ -static keymap_t key_map = { 0x80, { /* PC98 keymap */ -/* alt - * scan cntrl alt alt cntrl - * code base shift cntrl shift alt shift cntrl shift spcl flgs - * --------------------------------------------------------------------------- - */ -{{/*00*/ 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, DBG, 0x1B }, 0x02,0x00 }, -{{/*01*/ '1', '!', '!', '!', '1', '!', '!', '!' }, 0x00,0x00 }, -{{/*02*/ '2', '\"', 0x1A, 0x1A, '2', '@', 0x00, 0x00 }, 0x00,0x00 }, -{{/*03*/ '3', '#', 0x1B, 0x1B, '3', '#', 0x1B, 0x1B }, 0x00,0x00 }, -{{/*04*/ '4', '$', 0x1C, 0x1C, '4', '$', 0x1C, 0x1C }, 0x00,0x00 }, -{{/*05*/ '5', '%', 0x1D, 0x1D, '5', '%', 0x1D, 0x1D }, 0x00,0x00 }, -{{/*06*/ '6', '&', 0x1E, 0x1E, '6', '^', 0x1E, 0x1E }, 0x00,0x00 }, -{{/*07*/ '7', '\'', 0x1F, 0x1F, '7', '&', '&', '&' }, 0x00,0x00 }, -{{/*08*/ '8', '(', 0x7F, 0x7F, '8', '*', 0x08, 0x08 }, 0x00,0x00 }, -{{/*09*/ '9', ')', '9', '9', '9', '(', '(', '(' }, 0x00,0x00 }, -{{/*0a*/ '0', NOP, '0', '0', '0', ')', ')', ')' }, 0x40,0x00 }, -{{/*0b*/ '-', '=', '-', '-', '-', '_', 0x1F, 0x1F }, 0x00,0x00 }, -{{/*0c*/ '^', '`', 0x1E, 0x1E, '=', '+', '+', '+' }, 0x00,0x00 }, -{{/*0d*/ '\\', '|', 0x1C, 0x1C, '\\', '|', 0x1C, 0x1C }, 0x00,0x00 }, -{{/*0e*/ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08 }, 0x00,0x00 }, -{{/*0f*/ '\t', BTAB, '\t', BTAB, '\t', BTAB, '\t', BTAB }, 0x55,0x00 }, -{{/*10*/ 'q', 'Q', 0x11, 0x11, 'q', 'Q', 0x11, 0x11 }, 0x00,0x01 }, -{{/*11*/ 'w', 'W', 0x17, 0x17, 'w', 'W', 0x17, 0x17 }, 0x00,0x01 }, -{{/*12*/ 'e', 'E', 0x05, 0x05, 'e', 'E', 0x05, 0x05 }, 0x00,0x01 }, -{{/*13*/ 'r', 'R', 0x12, 0x12, 'r', 'R', 0x12, 0x12 }, 0x00,0x01 }, -{{/*14*/ 't', 'T', 0x14, 0x14, 't', 'T', 0x14, 0x14 }, 0x00,0x01 }, -{{/*15*/ 'y', 'Y', 0x19, 0x19, 'y', 'Y', 0x19, 0x19 }, 0x00,0x01 }, -{{/*16*/ 'u', 'U', 0x15, 0x15, 'u', 'U', 0x15, 0x15 }, 0x00,0x01 }, -{{/*17*/ 'i', 'I', 0x09, 0x09, 'i', 'I', 0x09, 0x09 }, 0x00,0x01 }, -{{/*18*/ 'o', 'O', 0x0F, 0x0F, 'o', 'O', 0x0F, 0x0F }, 0x00,0x01 }, -{{/*19*/ 'p', 'P', 0x10, 0x10, 'p', 'P', 0x10, 0x10 }, 0x00,0x01 }, -{{/*1a*/ '@', '~', 0x00, 0x00, '[', '{', 0x1B, 0x1B }, 0x00,0x00 }, -{{/*1b*/ '[', '{', 0x1B, 0x1B, ']', '}', 0x1D, 0x1D }, 0x00,0x00 }, -{{/*1c*/ '\r', '\r', '\n', '\n', '\r', '\r', '\n', '\n' }, 0x00,0x00 }, -{{/*1d*/ 'a', 'A', 0x01, 0x01, 'a', 'A', 0x01, 0x01 }, 0x00,0x01 }, -{{/*1e*/ 's', 'S', 0x13, 0x13, 's', 'S', 0x13, 0x13 }, 0x00,0x01 }, -{{/*1f*/ 'd', 'D', 0x04, 0x04, 'd', 'D', 0x04, 0x04 }, 0x00,0x01 }, -{{/*20*/ 'f', 'F', 0x06, 0x06, 'f', 'F', 0x06, 0x06 }, 0x00,0x01 }, -{{/*21*/ 'g', 'G', 0x07, 0x07, 'g', 'G', 0x07, 0x07 }, 0x00,0x01 }, -{{/*22*/ 'h', 'H', 0x08, 0x08, 'h', 'H', 0x08, 0x08 }, 0x00,0x01 }, -{{/*23*/ 'j', 'J', '\n', '\n', 'j', 'J', '\n', '\n' }, 0x00,0x01 }, -{{/*24*/ 'k', 'K', 0x0B, 0x0B, 'k', 'K', 0x0B, 0x0B }, 0x00,0x01 }, -{{/*25*/ 'l', 'L', 0x0C, 0x0C, 'l', 'L', 0x0C, 0x0C }, 0x00,0x01 }, -{{/*26*/ ';', '+', ';', ';', ';', ':', ';', ';' }, 0x00,0x00 }, -{{/*27*/ ':', '*', ':', ':', '\'', '\"', '\'', '\'' }, 0x00,0x00 }, -{{/*28*/ ']', '}', 0x1D, 0x1D, '`', '~', '~', '~' }, 0x00,0x00 }, -{{/*29*/ 'z', 'Z', 0x1A, 0x1A, 'z', 'Z', 0x1A, 0x1A }, 0x00,0x01 }, -{{/*2a*/ 'x', 'X', 0x18, 0x18, 'x', 'X', 0x18, 0x18 }, 0x00,0x01 }, -{{/*2b*/ 'c', 'C', 0x03, 0x03, 'c', 'C', 0x03, 0x03 }, 0x00,0x01 }, -{{/*2c*/ 'v', 'V', 0x16, 0x16, 'v', 'V', 0x16, 0x16 }, 0x00,0x01 }, -{{/*2d*/ 'b', 'B', 0x02, 0x02, 'b', 'B', 0x02, 0x02 }, 0x00,0x01 }, -{{/*2e*/ 'n', 'N', 0x0E, 0x0E, 'n', 'N', 0x0E, 0x0E }, 0x00,0x01 }, -{{/*2f*/ 'm', 'M', '\r', '\r', 'm', 'M', '\r', '\r' }, 0x00,0x01 }, -{{/*30*/ ',', '<', '<', '<', ',', '<', '<', '<' }, 0x00,0x00 }, -{{/*31*/ '.', '>', '>', '>', '.', '>', '>', '>' }, 0x00,0x00 }, -{{/*32*/ '/', '?', 0x7F, 0x7F, '/', '?', 0x7F, 0x7F }, 0x00,0x00 }, -{{/*33*/ NOP, '_', 0x1F, 0x1F, '\\', '|', 0x1C, 0x1C }, 0x80,0x00 }, -{{/*34*/ ' ', ' ', 0x00, 0x00, ' ', ' ', 0x00, 0x00 }, 0x00,0x00 }, -{{/*35*/ 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x1B }, 0x00,0x00 }, -{{/*36*/ F(59), F(59), F(59), F(59), F(59), F(59), F(59), F(59) }, 0xFF,0x00 }, -{{/*37*/ F(51), F(51), F(51), F(51), F(51), F(51), F(51), F(51) }, 0xFF,0x00 }, -{{/*38*/ F(60), F(60), F(60), F(60), F(60), F(60), F(60), F(60) }, 0xFF,0x00 }, -{{/*39*/ 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, 0x7F, RBT, RBT }, 0x03,0x02 }, -{{/*3a*/ F(50), F(50), F(50), F(50), F(50), F(50), F(50), F(50) }, 0xFF,0x00 }, -{{/*3b*/ F(53), F(53), F(53), F(53), F(53), F(53), F(53), F(53) }, 0xFF,0x00 }, -{{/*3c*/ F(55), F(55), F(55), F(55), F(55), F(55), F(55), F(55) }, 0xFF,0x00 }, -{{/*3d*/ F(58), F(58), F(58), F(58), F(58), F(58), F(58), F(58) }, 0xFF,0x00 }, -{{/*3e*/ F(49), F(49), F(49), F(49), F(49), F(49), F(49), F(49) }, 0xFF,0x00 }, -{{/*3f*/ F(57), F(57), F(57), F(57), F(57), F(57), F(57), F(57) }, 0xFF,0x00 }, -{{/*40*/ '-', '-', '-', '-', '-', '-', '-', '-' }, 0x00,0x00 }, -{{/*41*/ '/', '/', '/', '/', '/', '/', '/', '/' }, 0x00,0x00 }, -{{/*42*/ '7', '7', '7', '7', '7', '7', '7', '7' }, 0x00,0x00 }, -{{/*43*/ '8', '8', '8', '8', '8', '8', '8', '8' }, 0x00,0x00 }, -{{/*44*/ '9', '9', '9', '9', '9', '9', '9', '9' }, 0x00,0x00 }, -{{/*45*/ '*', '*', '*', '*', '*', '*', '*', '*' }, 0x00,0x00 }, -{{/*46*/ '4', '4', '4', '4', '4', '4', '4', '4' }, 0x00,0x00 }, -{{/*47*/ '5', '5', '5', '5', '5', '5', '5', '5' }, 0x00,0x00 }, -{{/*48*/ '6', '6', '6', '6', '6', '6', '6', '6' }, 0x00,0x00 }, -{{/*49*/ '+', '+', '+', '+', '+', '+', '+', '+' }, 0x00,0x00 }, -{{/*4a*/ '1', '1', '1', '1', '1', '1', '1', '1' }, 0x00,0x00 }, -{{/*4b*/ '2', '2', '2', '2', '2', '2', '2', '2' }, 0x00,0x00 }, -{{/*4c*/ '3', '3', '3', '3', '3', '3', '3', '3' }, 0x00,0x00 }, -{{/*4d*/ '=', '=', '=', '=', '=', '=', '=', '=' }, 0x00,0x00 }, -{{/*4e*/ '0', '0', '0', '0', '0', '0', '0', '0' }, 0x00,0x00 }, -{{/*4f*/ ',', ',', ',', ',', ',', ',', ',', ',' }, 0x00,0x00 }, -{{/*50*/ '.', '.', '.', '.', '.', '.', '.', '.' }, 0x00,0x00 }, -{{/*51*/ META, META, META, META, META, META, META, META }, 0xFF,0x00 }, -{{/*52*/ F(11), F(23), F(35), F(47), S(11), S(11), S(11), S(11) }, 0xFF,0x00 }, -{{/*53*/ F(12), F(24), F(36), F(48), S(12), S(12), S(12), S(12) }, 0xFF,0x00 }, -{{/*54*/ SLK, SLK, SLK, SLK, SLK, SLK, SLK, SLK }, 0xFF,0x00 }, -{{/*55*/ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP }, 0xFF,0x00 }, -{{/*56*/ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP }, 0xFF,0x00 }, -{{/*57*/ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP }, 0xFF,0x00 }, -{{/*58*/ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP }, 0xFF,0x00 }, -{{/*59*/ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP }, 0xFF,0x00 }, -{{/*5a*/ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP }, 0xFF,0x00 }, -{{/*5b*/ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP }, 0xFF,0x00 }, -{{/*5c*/ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP }, 0xFF,0x00 }, -{{/*5d*/ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP }, 0xFF,0x00 }, -{{/*5e*/ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP }, 0xFF,0x00 }, -{{/*5f*/ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP }, 0xFF,0x00 }, -{{/*60*/ SLK, SPSC, SLK, SPSC, SUSP, NOP, SUSP, NOP }, 0xFF,0x00 }, -{{/*61*/ NEXT, NEXT, DBG, DBG, NOP, NOP, NOP, NOP }, 0xFF,0x00 }, -{{/*62*/ F( 1), F(13), F(25), F(37), S( 1), S( 1), S( 1), S( 1) }, 0xFF,0x00 }, -{{/*63*/ F( 2), F(14), F(26), F(38), S( 2), S( 2), S( 2), S( 2) }, 0xFF,0x00 }, -{{/*64*/ F( 3), F(15), F(27), F(39), S( 3), S( 3), S( 3), S( 3) }, 0xFF,0x00 }, -{{/*65*/ F( 4), F(16), F(28), F(40), S( 4), S( 4), S( 4), S( 4) }, 0xFF,0x00 }, -{{/*66*/ F( 5), F(17), F(29), F(41), S( 5), S( 5), S( 5), S( 5) }, 0xFF,0x00 }, -{{/*67*/ F( 6), F(18), F(30), F(42), S( 6), S( 6), S( 6), S( 6) }, 0xFF,0x00 }, -{{/*68*/ F( 7), F(19), F(31), F(43), S( 7), S( 7), S( 7), S( 7) }, 0xFF,0x00 }, -{{/*69*/ F( 8), F(20), F(32), F(44), S( 8), S( 8), S( 8), S( 8) }, 0xFF,0x00 }, -{{/*6a*/ F( 9), F(21), F(33), F(45), S( 9), S( 9), S( 9), S( 9) }, 0xFF,0x00 }, -{{/*6b*/ F(10), F(22), F(34), F(46), S(10), S(10), S(10), S(10) }, 0xFF,0x00 }, -{{/*6c*/ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP }, 0xFF,0x00 }, -{{/*6d*/ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP }, 0xFF,0x00 }, -{{/*6e*/ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP }, 0xFF,0x00 }, -{{/*6f*/ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP }, 0xFF,0x00 }, -{{/*70*/ LSH, LSH, LSH, LSH, LSH, LSH, LSH, LSH }, 0xFF,0x00 }, -{{/*71*/ CLK, CLK, CLK, CLK, CLK, CLK, CLK, CLK }, 0xFF,0x00 }, -{{/*72*/ LALT, LALT, LALT, LALT, LALT, LALT, LALT, LALT }, 0xFF,0x00 }, -{{/*73*/ LALT, LALT, LALT, LALT, LALT, LALT, LALT, LALT }, 0xFF,0x00 }, -{{/*74*/ LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, LCTR, LCTR }, 0xFF,0x00 }, -{{/*75*/ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP }, 0xFF,0x00 }, -{{/*76*/ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP }, 0xFF,0x00 }, -{{/*77*/ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP }, 0xFF,0x00 }, -{{/*78*/ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP }, 0xFF,0x00 }, -{{/*79*/ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP }, 0xFF,0x00 }, -{{/*7a*/ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP }, 0xFF,0x00 }, -{{/*7b*/ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP }, 0xFF,0x00 }, -{{/*7c*/ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP }, 0xFF,0x00 }, -{{/*7d*/ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP }, 0xFF,0x00 }, -{{/*7e*/ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP }, 0xFF,0x00 }, -{{/*7f*/ NOP, NOP, NOP, NOP, NOP, NOP, NOP, NOP }, 0xFF,0x00 }, -} }; - -static accentmap_t accent_map = { 0, /* empty accent map */ - { - { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, - { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, { 0 }, - } -}; - -#endif /* !KBD_DFLT_KEYMAP */ - -static fkeytab_t fkey_tab[96] = { -/* 01-04 */ {"\033[M", 3}, {"\033[N", 3}, {"\033[O", 3}, {"\033[P", 3}, -/* 05-08 */ {"\033[Q", 3}, {"\033[R", 3}, {"\033[S", 3}, {"\033[T", 3}, -/* 09-12 */ {"\033[U", 3}, {"\033[V", 3}, {"\033[W", 3}, {"\033[X", 3}, -/* 13-16 */ {"\033[Y", 3}, {"\033[Z", 3}, {"\033[a", 3}, {"\033[b", 3}, -/* 17-20 */ {"\033[c", 3}, {"\033[d", 3}, {"\033[e", 3}, {"\033[f", 3}, -/* 21-24 */ {"\033[g", 3}, {"\033[h", 3}, {"\033[i", 3}, {"\033[j", 3}, -/* 25-28 */ {"\033[k", 3}, {"\033[l", 3}, {"\033[m", 3}, {"\033[n", 3}, -/* 29-32 */ {"\033[o", 3}, {"\033[p", 3}, {"\033[q", 3}, {"\033[r", 3}, -/* 33-36 */ {"\033[s", 3}, {"\033[t", 3}, {"\033[u", 3}, {"\033[v", 3}, -/* 37-40 */ {"\033[w", 3}, {"\033[x", 3}, {"\033[y", 3}, {"\033[z", 3}, -/* 41-44 */ {"\033[@", 3}, {"\033[[", 3}, {"\033[\\",3}, {"\033[]", 3}, -/* 45-48 */ {"\033[^", 3}, {"\033[_", 3}, {"\033[`", 3}, {"\033[{", 3}, -/* 49-52 */ {"\033[H", 3}, {"\033[A", 3}, {"\033[I", 3}, {"-" , 1}, -/* 53-56 */ {"\033[D", 3}, {"\033[E", 3}, {"\033[C", 3}, {"+" , 1}, -/* 57-60 */ {"\033[F", 3}, {"\033[B", 3}, {"\033[G", 3}, {"\033[L", 3}, -/* 61-64 */ {"\177", 1}, {"\033[J", 3}, {"\033[~", 3}, {"\033[}", 3}, -/* 65-68 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} , -/* 69-72 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} , -/* 73-76 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} , -/* 77-80 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} , -/* 81-84 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} , -/* 85-88 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} , -/* 89-92 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} , -/* 93-96 */ {"", 0} , {"", 0} , {"", 0} , {"", 0} -}; diff --git a/sys/pc98/cbus/pcrtc.c b/sys/pc98/cbus/pcrtc.c deleted file mode 100644 index 6fcbf57fbc63..000000000000 --- a/sys/pc98/cbus/pcrtc.c +++ /dev/null @@ -1,249 +0,0 @@ -/*- - * Copyright (c) 2008 TAKAHASHI Yoshihiro - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include - -#include -#include - -/* - * modified for PC98 by Kakefuda - */ - -/* - * RTC support routines - */ - -static void rtc_serialcombit(int); -static void rtc_serialcom(int); -static int rtc_inb(void); -static void rtc_outb(int); - -static void -rtc_serialcombit(int i) -{ - outb(IO_RTC, ((i&0x01)<<5)|0x07); - DELAY(1); - outb(IO_RTC, ((i&0x01)<<5)|0x17); - DELAY(1); - outb(IO_RTC, ((i&0x01)<<5)|0x07); - DELAY(1); -} - -static void -rtc_serialcom(int i) -{ - rtc_serialcombit(i&0x01); - rtc_serialcombit((i&0x02)>>1); - rtc_serialcombit((i&0x04)>>2); - rtc_serialcombit((i&0x08)>>3); - outb(IO_RTC, 0x07); - DELAY(1); - outb(IO_RTC, 0x0f); - DELAY(1); - outb(IO_RTC, 0x07); - DELAY(1); -} - -static void -rtc_outb(int val) -{ - int s; - int sa = 0; - - for (s=0;s<8;s++) { - sa = ((val >> s) & 0x01) ? 0x27 : 0x07; - outb(IO_RTC, sa); /* set DI & CLK 0 */ - DELAY(1); - outb(IO_RTC, sa | 0x10); /* CLK 1 */ - DELAY(1); - } - outb(IO_RTC, sa & 0xef); /* CLK 0 */ -} - -static int -rtc_inb(void) -{ - int s; - int sa = 0; - - for (s=0;s<8;s++) { - sa |= ((inb(0x33) & 0x01) << s); - outb(IO_RTC, 0x17); /* CLK 1 */ - DELAY(1); - outb(IO_RTC, 0x07); /* CLK 0 */ - DELAY(2); - } - return sa; -} - -/********************************************************************** - * RTC driver for subr_rtc - */ - -#include "clock_if.h" - -#include - -struct pcrtc_softc { - int port_rid1, port_rid2; - struct resource *port_res1, *port_res2; -}; - -/* - * Attach to the ISA PnP descriptors for the timer and realtime clock. - */ -static struct isa_pnp_id pcrtc_ids[] = { - { 0x000bd041 /* PNP0B00 */, "AT realtime clock" }, - { 0 } -}; - -static int -pcrtc_probe(device_t dev) -{ - int result; - - device_set_desc(dev, "PC Real Time Clock"); - result = ISA_PNP_PROBE(device_get_parent(dev), dev, pcrtc_ids); - /* ENXIO if wrong PnP-ID, ENOENT ifno PnP-ID, zero if good PnP-iD */ - if (result != ENOENT) - return(result); - /* All PC's have an RTC, and we're hosed without it, so... */ - return (BUS_PROBE_LOW_PRIORITY); -} - -static int -pcrtc_attach(device_t dev) -{ - struct pcrtc_softc *sc; - - /* - * Not that we need them or anything, but grab our resources - * so they show up, correctly attributed, in the big picture. - */ - sc = device_get_softc(dev); - sc->port_rid1 = 0; - bus_set_resource(dev, SYS_RES_IOPORT, sc->port_rid1, IO_RTC, 1); - if (!(sc->port_res1 = bus_alloc_resource(dev, SYS_RES_IOPORT, - &sc->port_rid1, IO_RTC, IO_RTC, 1, RF_ACTIVE))) - device_printf(dev, "Warning: Couldn't map I/O.\n"); - sc->port_rid2 = 1; - bus_set_resource(dev, SYS_RES_IOPORT, sc->port_rid2, 0x33, 1); - if (!(sc->port_res2 = bus_alloc_resource(dev, SYS_RES_IOPORT, - &sc->port_rid2, 0x33, 0x33, 1, RF_ACTIVE))) - device_printf(dev, "Warning: Couldn't map I/O.\n"); - - clock_register(dev, 1000000); - return(0); -} - -static int -pcrtc_settime(device_t dev __unused, struct timespec *ts) -{ - struct clocktime ct; - - clock_ts_to_ct(ts, &ct); - - rtc_serialcom(0x01); /* Register shift command. */ - - rtc_outb(bin2bcd(ct.sec)); /* Write back Seconds */ - rtc_outb(bin2bcd(ct.min)); /* Write back Minutes */ - rtc_outb(bin2bcd(ct.hour)); /* Write back Hours */ - - rtc_outb(bin2bcd(ct.day)); /* Write back Day */ - rtc_outb((ct.mon << 4) | ct.dow); /* Write back Month and DOW */ - rtc_outb(bin2bcd(ct.year % 100)); /* Write back Year */ - - rtc_serialcom(0x02); /* Time set & Counter hold command. */ - rtc_serialcom(0x00); /* Register hold command. */ - - return (0); -} - -static int -pcrtc_gettime(device_t dev, struct timespec *ts) -{ - struct clocktime ct; - int i; - - rtc_serialcom(0x03); /* Time Read */ - rtc_serialcom(0x01); /* Register shift command. */ - DELAY(20); - - ct.nsec = 0; - ct.sec = bcd2bin(rtc_inb() & 0xff); /* sec */ - ct.min = bcd2bin(rtc_inb() & 0xff); /* min */ - ct.hour = bcd2bin(rtc_inb() & 0xff); /* hour */ - ct.day = bcd2bin(rtc_inb() & 0xff); /* date */ - i = rtc_inb(); - ct.dow = i & 0x0f; /* dow */ - ct.mon = (i >> 4) & 0x0f; /* month */ - ct.year = bcd2bin(rtc_inb() & 0xff) + 1900; /* year */ - if (ct.year < 1995) - ct.year += 100; - - /* Set dow = -1 because some clocks don't set it correctly. */ - ct.dow = -1; - - return (clock_ct_to_ts(&ct, ts)); -} - -static device_method_t pcrtc_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, pcrtc_probe), - DEVMETHOD(device_attach, pcrtc_attach), - DEVMETHOD(device_detach, bus_generic_detach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - DEVMETHOD(device_suspend, bus_generic_suspend), - /* XXX stop statclock? */ - DEVMETHOD(device_resume, bus_generic_resume), - /* XXX restart statclock? */ - - /* clock interface */ - DEVMETHOD(clock_gettime, pcrtc_gettime), - DEVMETHOD(clock_settime, pcrtc_settime), - - { 0, 0 } -}; - -static driver_t pcrtc_driver = { - "pcrtc", - pcrtc_methods, - sizeof(struct pcrtc_softc), -}; - -static devclass_t pcrtc_devclass; - -DRIVER_MODULE(pcrtc, isa, pcrtc_driver, pcrtc_devclass, 0, 0); diff --git a/sys/pc98/cbus/pmc.c b/sys/pc98/cbus/pmc.c deleted file mode 100644 index ad59767c1f3f..000000000000 --- a/sys/pc98/cbus/pmc.c +++ /dev/null @@ -1,244 +0,0 @@ -/*- - * PMC (Power Management Controller of NEC PC-98Note) Driver - * - * Copyright (c) 2001 Chiharu Shibata. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -struct pmc_isa_softc { - struct resource *port_res; - eventhandler_tag evt; - int flags; -}; - -static int pmc_isa_alloc_resources(device_t); -static void pmc_isa_release_resources(device_t); -static int pmc_isa_probe(device_t); -static int pmc_isa_attach(device_t); -static int pmc_isa_detach(device_t); - -#define PMC_ISA_PORT 0x8f0 -#define PMC_ISA_PORTSIZE 4 - -#define sc_inw(sc, port) \ - bus_space_read_2(rman_get_bustag((sc)->port_res), \ - rman_get_bushandle((sc)->port_res), (port)) - -#define sc_outw(sc, port, value) \ - bus_space_write_2(rman_get_bustag((sc)->port_res), \ - rman_get_bushandle((sc)->port_res), (port), (value)) - -static void -pmc_poweroff(void *arg, int howto) -{ - struct pmc_isa_softc *sc = (struct pmc_isa_softc *)arg; - - if (!sc->flags) { - outb(0x5e8e, inb(0x5e8e) & ~0x11); /* FDD LED off */ - } - - if (!(howto & RB_POWEROFF)) { - return; - } - - sc_outw(sc, 0, 0x0044); - sc_outw(sc, 2, 1 << 10); -#if 1 - /* for 9801NS/T */ - sc_outw(sc, 0, 0xf00a); - sc_outw(sc, 2, 1 << 9); -#endif -} - -static int -pmc_isa_alloc_resources(device_t dev) -{ - struct pmc_isa_softc *sc = device_get_softc(dev); - int rid; - - bzero(sc, sizeof(*sc)); - - rid = 0; - sc->port_res = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, - PMC_ISA_PORTSIZE, RF_ACTIVE); - if (sc->port_res == NULL) { - return (ENOMEM); - } - - return 0; -} - -static void -pmc_isa_release_resources(device_t dev) -{ - struct pmc_isa_softc *sc = device_get_softc(dev); - - if (sc->port_res != NULL) { - bus_release_resource(dev, SYS_RES_IOPORT, 0, sc->port_res); - } - sc->port_res = NULL; -} - -static int -pmc_isa_probe(device_t dev) -{ - struct pmc_isa_softc *sc = device_get_softc(dev); - u_int port; - u_int16_t save, tmp; - -#if 0 - if (isa_get_vendorid(dev)) { - return ENXIO; - } - if (device_get_unit(dev) > 0) { - printf("pmc: Only one PMC driver supported.\n"); - return ENXIO; - } -#endif - port = isa_get_port(dev); - if (port == -1) { - port = PMC_ISA_PORT; - } - if (bootverbose) { - device_printf(dev, "port = 0x%x\n", port); - } - - if (bus_set_resource(dev, SYS_RES_IOPORT, 0, port, PMC_ISA_PORTSIZE)) { - if (bootverbose) { - device_printf(dev, "bus_set_resource failed\n"); - } - return ENXIO; - } - if (pmc_isa_alloc_resources(dev)) { - if (bootverbose) { - device_printf(dev, "pmc_isa_alloc_resources failed\n"); - } - return ENXIO; - } - - /* Check the existence of PMC */ - sc_outw(sc, 0, 0x0052); - save = sc_inw(sc, 2); - tmp = save & ~0x3f; - sc_outw(sc, 2, tmp); - if (sc_inw(sc, 2) != tmp) { - if (bootverbose) { - device_printf(dev, "failed to clear index(0x0052)\n"); - } - - pmc_isa_release_resources(dev); - return ENXIO; - } - - tmp |= 0x3e; - sc_outw(sc, 2, tmp); - if (sc_inw(sc, 2) != tmp) { - if (bootverbose) { - device_printf(dev, "failed to set index(0x0052)\n"); - } - - pmc_isa_release_resources(dev); - return ENXIO; - } - sc_outw(sc, 2, save); - - pmc_isa_release_resources(dev); - - device_set_desc(dev, "Power Management Controller"); - return 0; -} - -static int -pmc_isa_attach(device_t dev) -{ - struct pmc_isa_softc *sc = device_get_softc(dev); - int error; - - error = pmc_isa_alloc_resources(dev); - if (error) { - device_printf(dev, "resource allocation failed\n"); - return error; - } - - /* Power the system off using PMC */ - sc->evt = EVENTHANDLER_REGISTER(shutdown_final, pmc_poweroff, sc, - SHUTDOWN_PRI_LAST); - sc->flags = device_get_flags(dev); - return 0; -} - -static int -pmc_isa_detach(device_t dev) -{ - struct pmc_isa_softc *sc = device_get_softc(dev); - - if (bootverbose) { - device_printf(dev, "pmc_isa_detach called\n"); - } - - if (sc->evt != NULL) { - EVENTHANDLER_DEREGISTER(shutdown_final, sc->evt); - } - sc->evt = NULL; - - pmc_isa_release_resources(dev); - return 0; -} - -static device_method_t pmc_isa_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, pmc_isa_probe), - DEVMETHOD(device_attach, pmc_isa_attach), - DEVMETHOD(device_detach, pmc_isa_detach), - {0, 0} -}; - -static driver_t pmc_isa_driver = { - "pmc", - pmc_isa_methods, sizeof(struct pmc_isa_softc), -}; - -devclass_t pmc_devclass; - -DRIVER_MODULE(pmc, isa, pmc_isa_driver, pmc_devclass, 0, 0); diff --git a/sys/pc98/cbus/sc_machdep.h b/sys/pc98/cbus/sc_machdep.h deleted file mode 100644 index 5dbc94eb182c..000000000000 --- a/sys/pc98/cbus/sc_machdep.h +++ /dev/null @@ -1,52 +0,0 @@ -/*- - * Copyright (c) 1999 FreeBSD(98) Porting Team. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer as - * the first lines of this file unmodified. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _PC98_PC98_SC_MACHDEP_H_ -#define _PC98_PC98_SC_MACHDEP_H_ - -#undef SC_DFLT_FONT -#undef SC_MOUSE_CHAR -#undef SC_PIXEL_MODE -#undef SC_NO_FONT_LOADING -#define SC_NO_FONT_LOADING 1 -#undef SC_NO_PALETTE_LOADING -#define SC_NO_PALETTE_LOADING 1 - -#ifndef SC_KERNEL_CONS_ATTR -#define SC_KERNEL_CONS_ATTR (FG_LIGHTGREY | BG_BLACK) -#endif - -#define KANJI 1 - -#define UJIS 0 -#define SJIS 1 - -#define PRINTABLE(c) ((c) > 0x1b || ((c) > 0x0f && (c) < 0x1b) \ - || (c) < 0x07) - -#endif /* !_PC98_PC98_SC_MACHDEP_H_ */ diff --git a/sys/pc98/cbus/scgdcrndr.c b/sys/pc98/cbus/scgdcrndr.c deleted file mode 100644 index 53ff41ebc300..000000000000 --- a/sys/pc98/cbus/scgdcrndr.c +++ /dev/null @@ -1,208 +0,0 @@ -/*- - * Copyright (c) 1999 FreeBSD(98) Porting Team. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer as - * the first lines of this file unmodified. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include "opt_syscons.h" -#include "opt_gdc.h" - -#include -#include -#include -#include -#include -#include - -#include -#include - -#ifndef SC_RENDER_DEBUG -#define SC_RENDER_DEBUG 0 -#endif - -static vr_clear_t gdc_txtclear; -static vr_draw_border_t gdc_txtborder; -static vr_draw_t gdc_txtdraw; -static vr_set_cursor_t gdc_txtcursor_shape; -static vr_draw_cursor_t gdc_txtcursor; -#ifndef SC_NO_CUTPASTE -static vr_draw_mouse_t gdc_txtmouse; -#else -#define gdc_txtmouse (vr_draw_mouse_t *)gdc_nop -#endif - -#ifndef SC_NO_MODE_CHANGE -static vr_draw_border_t gdc_grborder; -#endif - -static void gdc_nop(scr_stat *scp, ...); - -static sc_rndr_sw_t txtrndrsw = { - (vr_init_t *)gdc_nop, - gdc_txtclear, - gdc_txtborder, - gdc_txtdraw, - gdc_txtcursor_shape, - gdc_txtcursor, - (vr_blink_cursor_t *)gdc_nop, - (vr_set_mouse_t *)gdc_nop, - gdc_txtmouse, -}; -RENDERER(gdc, 0, txtrndrsw, gdc_set); - -#ifndef SC_NO_MODE_CHANGE -static sc_rndr_sw_t grrndrsw = { - (vr_init_t *)gdc_nop, - (vr_clear_t *)gdc_nop, - gdc_grborder, - (vr_draw_t *)gdc_nop, - (vr_set_cursor_t *)gdc_nop, - (vr_draw_cursor_t *)gdc_nop, - (vr_blink_cursor_t *)gdc_nop, - (vr_set_mouse_t *)gdc_nop, - (vr_draw_mouse_t *)gdc_nop, -}; -RENDERER(gdc, GRAPHICS_MODE, grrndrsw, gdc_set); -#endif /* SC_NO_MODE_CHANGE */ - -RENDERER_MODULE(gdc, gdc_set); - -static void -gdc_nop(scr_stat *scp, ...) -{ -} - -/* text mode renderer */ - -static void -gdc_txtclear(scr_stat *scp, int c, int attr) -{ - sc_vtb_clear(&scp->scr, c, attr); -} - -static void -gdc_txtborder(scr_stat *scp, int color) -{ - vidd_set_border(scp->sc->adp, color); -} - -static void -gdc_txtdraw(scr_stat *scp, int from, int count, int flip) -{ - vm_offset_t p; - int c; - int a; - - if (from + count > scp->xsize*scp->ysize) - count = scp->xsize*scp->ysize - from; - - if (flip) { - for (p = sc_vtb_pointer(&scp->scr, from); count-- > 0; ++from) { - c = sc_vtb_getc(&scp->vtb, from); - a = sc_vtb_geta(&scp->vtb, from); -#if 0 - a ^= 0x0800; -#else - a = (a & 0x8800) | ((a & 0x7000) >> 4) - | ((a & 0x0700) << 4); -#endif - p = sc_vtb_putchar(&scp->scr, p, c, a); - } - } else { - sc_vtb_copy(&scp->vtb, from, &scp->scr, from, count); - } -} - -static void -gdc_txtcursor_shape(scr_stat *scp, int base, int height, int blink) -{ - if (base < 0 || base >= scp->font_size) - return; - /* the caller may set height <= 0 in order to disable the cursor */ - vidd_set_hw_cursor_shape(scp->sc->adp, base, height, scp->font_size, - blink); -} - -static void -gdc_txtcursor(scr_stat *scp, int at, int blink, int on, int flip) -{ - if (on) { - scp->status |= VR_CURSOR_ON; - vidd_set_hw_cursor(scp->sc->adp, at%scp->xsize, - at/scp->xsize); - } else { - if (scp->status & VR_CURSOR_ON) - vidd_set_hw_cursor(scp->sc->adp, -1, -1); - scp->status &= ~VR_CURSOR_ON; - } -} - -#ifndef SC_NO_CUTPASTE - -static void -draw_txtmouse(scr_stat *scp, int x, int y) -{ - int at; - int a; - - at = (y/scp->font_size - scp->yoff)*scp->xsize + x/8 - scp->xoff; - a = sc_vtb_geta(&scp->vtb, at); -#if 0 - a ^= 0x0800; -#else - a = (a & 0x8800) | ((a & 0x7000) >> 4) - | ((a & 0x0700) << 4); -#endif - sc_vtb_putc(&scp->scr, at, sc_vtb_getc(&scp->scr, at), a); -} - -static void -remove_txtmouse(scr_stat *scp, int x, int y) -{ -} - -static void -gdc_txtmouse(scr_stat *scp, int x, int y, int on) -{ - if (on) - draw_txtmouse(scp, x, y); - else - remove_txtmouse(scp, x, y); -} - -#endif /* SC_NO_CUTPASTE */ - -#ifndef SC_NO_MODE_CHANGE - -/* graphics mode renderer */ - -static void -gdc_grborder(scr_stat *scp, int color) -{ - vidd_set_border(scp->sc->adp, color); -} - -#endif /* SC_NO_MODE_CHANGE */ diff --git a/sys/pc98/cbus/scterm-sck.c b/sys/pc98/cbus/scterm-sck.c deleted file mode 100644 index a7615d6f5886..000000000000 --- a/sys/pc98/cbus/scterm-sck.c +++ /dev/null @@ -1,1229 +0,0 @@ -/*- - * Copyright (c) 1999 FreeBSD(98) Porting Team. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer as - * the first lines of this file unmodified. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include "opt_syscons.h" - -#include -#include -#include -#include -#include - -#include - -#include -#include - -#define MAX_ESC_PAR 5 - -#ifdef KANJI -#define IS_KTYPE_ASCII_or_HANKAKU(A) (!((A) & 0xee)) -#define IS_KTYPE_KANA(A) ((A) & 0x11) -#define KTYPE_MASK_CTRL(A) ((A) &= 0xF0) -#endif /* KANJI */ - -/* attribute flags */ -typedef struct { - u_short fg; /* foreground color */ - u_short bg; /* background color */ -} color_t; - -typedef struct { - int flags; -#define SCTERM_BUSY (1 << 0) - int esc; - int num_param; - int last_param; - int param[MAX_ESC_PAR]; - int saved_xpos; - int saved_ypos; - -#ifdef KANJI - u_char kanji_1st_char; - u_char kanji_type; -#define KTYPE_ASCII 0 /* ASCII */ -#define KTYPE_KANA 1 /* HANKAKU */ -#define KTYPE_JKANA 0x10 /* JIS HANKAKU */ -#define KTYPE_7JIS 0x20 /* JIS */ -#define KTYPE_SJIS 2 /* Shift JIS */ -#define KTYPE_UJIS 4 /* UJIS */ -#define KTYPE_SUKANA 3 /* Shift JIS or UJIS HANKAKU */ -#define KTYPE_SUJIS 6 /* SHift JIS or UJIS */ -#define KTYPE_KANIN 0x80 /* Kanji Invoke sequence */ -#define KTYPE_ASCIN 0x40 /* ASCII Invoke sequence */ -#endif /* KANJI */ - - int attr_mask; /* current logical attr mask */ -#define NORMAL_ATTR 0x00 -#define BLINK_ATTR 0x01 -#define BOLD_ATTR 0x02 -#define UNDERLINE_ATTR 0x04 -#define REVERSE_ATTR 0x08 -#define FG_CHANGED 0x10 -#define BG_CHANGED 0x20 - int cur_attr; /* current hardware attr word */ - color_t cur_color; /* current hardware color */ - color_t std_color; /* normal hardware color */ - color_t rev_color; /* reverse hardware color */ - color_t dflt_std_color; /* default normal color */ - color_t dflt_rev_color; /* default reverse color */ -} term_stat; - -static sc_term_init_t scterm_init; -static sc_term_term_t scterm_term; -static sc_term_puts_t scterm_puts; -static sc_term_ioctl_t scterm_ioctl; -static sc_term_reset_t scterm_reset; -static sc_term_default_attr_t scterm_default_attr; -static sc_term_clear_t scterm_clear; -static sc_term_notify_t scterm_notify; -static sc_term_input_t scterm_input; -static sc_term_fkeystr_t scterm_fkeystr; - -static sc_term_sw_t sc_term_sc = { - { NULL, NULL }, - "sck", /* emulator name */ - "syscons kanji terminal", /* description */ - "*", /* matching renderer, any :-) */ - sizeof(term_stat), /* softc size */ - 0, - scterm_init, - scterm_term, - scterm_puts, - scterm_ioctl, - scterm_reset, - scterm_default_attr, - scterm_clear, - scterm_notify, - scterm_input, - scterm_fkeystr, -}; - -SCTERM_MODULE(sc, sc_term_sc); - -static term_stat reserved_term_stat; -static int default_kanji = UJIS; -static void scterm_scan_esc(scr_stat *scp, term_stat *tcp, - u_char c); -static int mask2attr(term_stat *tcp); - -#ifdef KANJI -static inline u_char -iskanji1(u_char mode, u_char c) -{ - if (c > 0x80) { - if ((c >= 0xa1) && (c <= 0xdf)) { - if (default_kanji == UJIS) { - /* UJIS */ - return KTYPE_UJIS; - } - if (default_kanji == SJIS) { - /* SJIS HANKAKU */ - return KTYPE_KANA; - } - } - - if (c <= 0x9f) { - if (c == 0x8e) { - /* SJIS or UJIS HANKAKU */ - return KTYPE_SUKANA; - } - - /* SJIS */ - default_kanji = SJIS; - return KTYPE_SJIS; - } - - if ((c >= 0xe0) && (c <= 0xef)) { - /* SJIS or UJIS */ - return KTYPE_SUJIS; - } - - if ((c >= 0xf0) && (c <= 0xfe)) { - /* UJIS */ - default_kanji = UJIS; - return KTYPE_UJIS; - } - } else { - if ((mode == KTYPE_7JIS) && (c >= 0x21) && (c <= 0x7e)) { - /* JIS */ - default_kanji = UJIS; - return KTYPE_7JIS; - } - - if ((mode == KTYPE_JKANA) && (c >= 0x21) && (c <= 0x5f)) { - /* JIS HANKAKU */ - default_kanji = UJIS; - return KTYPE_JKANA; - } - } - - return KTYPE_ASCII; -} - -static inline u_char -iskanji2(u_char mode, u_char c) -{ - switch (mode) { - case KTYPE_7JIS: - if ((c >= 0x21) && (c <= 0x7e)) { - /* JIS */ - return KTYPE_7JIS; - } - break; - case KTYPE_SJIS: - if ((c >= 0x40) && (c <= 0xfc) && (c != 0x7f)) { - /* SJIS */ - return KTYPE_SJIS; - } - break; - case KTYPE_UJIS: - if ((c >= 0xa1) && (c <= 0xfe)) { - /* UJIS */ - return KTYPE_UJIS; - } - break; - case KTYPE_SUKANA: - if ((c >= 0xa1) && (c <= 0xdf) && (default_kanji == UJIS)) { - /* UJIS HANKAKU */ - return KTYPE_KANA; - } - if ((c >= 0x40) && (c <= 0xfc) && (c != 0x7f)) { - /* SJIS */ - default_kanji = SJIS; - return KTYPE_SJIS; - } - break; - case KTYPE_SUJIS: - if ((c >= 0x40) && (c <= 0xa0) && (c != 0x7f)) { - /* SJIS */ - default_kanji = SJIS; - return KTYPE_SJIS; - } - if ((c == 0xfd) || (c == 0xfe)) { - /* UJIS */ - default_kanji = UJIS; - return KTYPE_UJIS; - } - if ((c >= 0xa1) && (c <= 0xfc)) { - if (default_kanji == SJIS) - return KTYPE_SJIS; - if (default_kanji == UJIS) - return KTYPE_UJIS; - } - break; - } - - return KTYPE_ASCII; -} - -/* - * JIS X0208-83 keisen conversion table - */ -static u_short keiConv[32] = { - 0x240c, 0x260c, 0x300c, 0x340c, 0x3c0c, 0x380c, 0x400c, 0x500c, - 0x480c, 0x580c, 0x600c, 0x250c, 0x270c, 0x330c, 0x370c, 0x3f0c, - 0x3b0c, 0x470c, 0x570c, 0x4f0c, 0x5f0c, 0x6f0c, 0x440c, 0x530c, - 0x4c0c, 0x5b0c, 0x630c, 0x410c, 0x540c, 0x490c, 0x5c0c, 0x660c -}; - -static u_short -kanji_convert(u_char mode, u_char h, u_char l) -{ - u_short tmp, high, low, c; - - high = (u_short) h; - low = (u_short) l; - - switch (mode) { - case KTYPE_SJIS: /* SHIFT JIS */ - if (low >= 0xe0) { - low -= 0x40; - } - low = (low - 0x81) * 2 + 0x21; - if (high > 0x7f) { - high--; - } - if (high > 0x9d) { - low++; - high -= 0x9e - 0x21; - } else { - high -= 0x40 - 0x21; - } - high &= 0x7F; - low &= 0x7F; - tmp = ((high << 8) | low) - 0x20; - break; - case KTYPE_7JIS: /* JIS */ - case KTYPE_UJIS: /* UJIS */ - high &= 0x7F; - low &= 0x7F; - tmp = ((high << 8) | low) - 0x20; - break; - default: - tmp = 0; - break; - } - - /* keisen */ - c = ((tmp & 0xff) << 8) | (tmp >> 8); - /* 0x2821 .. 0x2840 */ - if (0x0821 <= c && c <= 0x0840) - tmp = keiConv[c - 0x0821]; - - return (tmp); -} -#endif /* KANJI */ - -static int -scterm_init(scr_stat *scp, void **softc, int code) -{ - term_stat *tcp; - - if (*softc == NULL) { - if (reserved_term_stat.flags & SCTERM_BUSY) - return EINVAL; - *softc = &reserved_term_stat; - } - tcp = *softc; - - switch (code) { - case SC_TE_COLD_INIT: - bzero(tcp, sizeof(*tcp)); - tcp->flags = SCTERM_BUSY; - tcp->esc = 0; - tcp->saved_xpos = -1; - tcp->saved_ypos = -1; -#ifdef KANJI - tcp->kanji_1st_char = 0; - tcp->kanji_type = KTYPE_ASCII; -#endif - tcp->attr_mask = NORMAL_ATTR; - /* XXX */ - tcp->dflt_std_color.fg = SC_NORM_ATTR & 0x0f; - tcp->dflt_std_color.bg = (SC_NORM_ATTR >> 4) & 0x0f; - tcp->dflt_rev_color.fg = SC_NORM_REV_ATTR & 0x0f; - tcp->dflt_rev_color.bg = (SC_NORM_REV_ATTR >> 4) & 0x0f; - tcp->std_color = tcp->dflt_std_color; - tcp->rev_color = tcp->dflt_rev_color; - tcp->cur_color = tcp->std_color; - tcp->cur_attr = mask2attr(tcp); - ++sc_term_sc.te_refcount; - break; - - case SC_TE_WARM_INIT: - tcp->esc = 0; - tcp->saved_xpos = -1; - tcp->saved_ypos = -1; -#if 0 - tcp->std_color = tcp->dflt_std_color; - tcp->rev_color = tcp->dflt_rev_color; -#endif - tcp->cur_color = tcp->std_color; - tcp->cur_attr = mask2attr(tcp); - break; - } - - return 0; -} - -static int -scterm_term(scr_stat *scp, void **softc) -{ - if (*softc == &reserved_term_stat) { - *softc = NULL; - bzero(&reserved_term_stat, sizeof(reserved_term_stat)); - } - --sc_term_sc.te_refcount; - return 0; -} - -static void -scterm_scan_esc(scr_stat *scp, term_stat *tcp, u_char c) -{ - static u_char ansi_col[16] = { - FG_BLACK, FG_RED, FG_GREEN, FG_BROWN, - FG_BLUE, FG_MAGENTA, FG_CYAN, FG_LIGHTGREY, - FG_DARKGREY, FG_LIGHTRED, FG_LIGHTGREEN, FG_YELLOW, - FG_LIGHTBLUE, FG_LIGHTMAGENTA, FG_LIGHTCYAN, FG_WHITE - }; - static int cattrs[] = { - 0, /* block */ - CONS_BLINK_CURSOR, /* blinking block */ - CONS_CHAR_CURSOR, /* underline */ - CONS_CHAR_CURSOR | CONS_BLINK_CURSOR, /* blinking underline */ - CONS_RESET_CURSOR, /* reset to default */ - CONS_HIDDEN_CURSOR, /* hide cursor */ - }; - static int tcattrs[] = { - CONS_RESET_CURSOR | CONS_LOCAL_CURSOR, /* normal */ - CONS_HIDDEN_CURSOR | CONS_LOCAL_CURSOR, /* invisible */ - CONS_BLINK_CURSOR | CONS_LOCAL_CURSOR, /* very visible */ - }; - sc_softc_t *sc; - int v0, v1, v2; - int i, n; - - i = n = 0; - sc = scp->sc; - if (tcp->esc == 1) { /* seen ESC */ -#ifdef KANJI - switch (tcp->kanji_type) { - case KTYPE_KANIN: /* Kanji Invoke sequence */ - switch (c) { - case 'B': - case '@': - tcp->kanji_type = KTYPE_7JIS; - tcp->esc = 0; - tcp->kanji_1st_char = 0; - return; - default: - tcp->kanji_type = KTYPE_ASCII; - tcp->esc = 0; - break; - } - break; - case KTYPE_ASCIN: /* Ascii Invoke sequence */ - switch (c) { - case 'J': - case 'B': - case 'H': - tcp->kanji_type = KTYPE_ASCII; - tcp->esc = 0; - tcp->kanji_1st_char = 0; - return; - case 'I': - tcp->kanji_type = KTYPE_JKANA; - tcp->esc = 0; - tcp->kanji_1st_char = 0; - return; - default: - tcp->kanji_type = KTYPE_ASCII; - tcp->esc = 0; - break; - } - break; - default: - break; - } -#endif - switch (c) { - - case '7': /* Save cursor position */ - tcp->saved_xpos = scp->xpos; - tcp->saved_ypos = scp->ypos; - break; - - case '8': /* Restore saved cursor position */ - if (tcp->saved_xpos >= 0 && tcp->saved_ypos >= 0) - sc_move_cursor(scp, tcp->saved_xpos, - tcp->saved_ypos); - break; - - case '[': /* Start ESC [ sequence */ - tcp->esc = 2; - tcp->last_param = -1; - for (i = tcp->num_param; i < MAX_ESC_PAR; i++) - tcp->param[i] = 1; - tcp->num_param = 0; - return; - -#ifdef KANJI - case '$': /* Kanji Invoke sequence */ - tcp->kanji_type = KTYPE_KANIN; - return; -#endif - - case 'M': /* Move cursor up 1 line, scroll if at top */ - sc_term_up_scroll(scp, 1, sc->scr_map[0x20], - tcp->cur_attr, 0, 0); - break; -#ifdef notyet - case 'Q': - tcp->esc = 4; - return; -#endif - case 'c': /* reset */ - tcp->attr_mask = NORMAL_ATTR; - tcp->cur_color = tcp->std_color - = tcp->dflt_std_color; - tcp->rev_color = tcp->dflt_rev_color; - tcp->cur_attr = mask2attr(tcp); - sc_change_cursor_shape(scp, - CONS_RESET_CURSOR | CONS_LOCAL_CURSOR, -1, -1); - sc_clear_screen(scp); - break; - - case '(': /* iso-2022: designate 94 character set to G0 */ -#ifdef KANJI - tcp->kanji_type = KTYPE_ASCIN; -#else - tcp->esc = 5; -#endif - return; - } - } else if (tcp->esc == 2) { /* seen ESC [ */ - if (c >= '0' && c <= '9') { - if (tcp->num_param < MAX_ESC_PAR) { - if (tcp->last_param != tcp->num_param) { - tcp->last_param = tcp->num_param; - tcp->param[tcp->num_param] = 0; - } else { - tcp->param[tcp->num_param] *= 10; - } - tcp->param[tcp->num_param] += c - '0'; - return; - } - } - tcp->num_param = tcp->last_param + 1; - switch (c) { - - case ';': - if (tcp->num_param < MAX_ESC_PAR) - return; - break; - - case '=': - tcp->esc = 3; - tcp->last_param = -1; - for (i = tcp->num_param; i < MAX_ESC_PAR; i++) - tcp->param[i] = 1; - tcp->num_param = 0; - return; - - case 'A': /* up n rows */ - sc_term_up(scp, tcp->param[0], 0); - break; - - case 'B': /* down n rows */ - sc_term_down(scp, tcp->param[0], 0); - break; - - case 'C': /* right n columns */ - sc_term_right(scp, tcp->param[0]); - break; - - case 'D': /* left n columns */ - sc_term_left(scp, tcp->param[0]); - break; - - case 'E': /* cursor to start of line n lines down */ - n = tcp->param[0]; - if (n < 1) - n = 1; - sc_move_cursor(scp, 0, scp->ypos + n); - break; - - case 'F': /* cursor to start of line n lines up */ - n = tcp->param[0]; - if (n < 1) - n = 1; - sc_move_cursor(scp, 0, scp->ypos - n); - break; - - case 'f': /* Cursor move */ - case 'H': - if (tcp->num_param == 0) - sc_move_cursor(scp, 0, 0); - else if (tcp->num_param == 2) - sc_move_cursor(scp, tcp->param[1] - 1, - tcp->param[0] - 1); - break; - - case 'J': /* Clear all or part of display */ - if (tcp->num_param == 0) - n = 0; - else - n = tcp->param[0]; - sc_term_clr_eos(scp, n, sc->scr_map[0x20], - tcp->cur_attr); - break; - - case 'K': /* Clear all or part of line */ - if (tcp->num_param == 0) - n = 0; - else - n = tcp->param[0]; - sc_term_clr_eol(scp, n, sc->scr_map[0x20], - tcp->cur_attr); - break; - - case 'L': /* Insert n lines */ - sc_term_ins_line(scp, scp->ypos, tcp->param[0], - sc->scr_map[0x20], tcp->cur_attr, 0); - break; - - case 'M': /* Delete n lines */ - sc_term_del_line(scp, scp->ypos, tcp->param[0], - sc->scr_map[0x20], tcp->cur_attr, 0); - break; - - case 'P': /* Delete n chars */ - sc_term_del_char(scp, tcp->param[0], - sc->scr_map[0x20], tcp->cur_attr); - break; - - case '@': /* Insert n chars */ - sc_term_ins_char(scp, tcp->param[0], - sc->scr_map[0x20], tcp->cur_attr); - break; - - case 'S': /* scroll up n lines */ - sc_term_del_line(scp, 0, tcp->param[0], - sc->scr_map[0x20], tcp->cur_attr, 0); - break; - - case 'T': /* scroll down n lines */ - sc_term_ins_line(scp, 0, tcp->param[0], - sc->scr_map[0x20], tcp->cur_attr, 0); - break; - - case 'X': /* erase n characters in line */ - n = tcp->param[0]; - if (n < 1) - n = 1; - if (n > scp->xsize - scp->xpos) - n = scp->xsize - scp->xpos; - sc_vtb_erase(&scp->vtb, scp->cursor_pos, n, - sc->scr_map[0x20], tcp->cur_attr); - mark_for_update(scp, scp->cursor_pos); - mark_for_update(scp, scp->cursor_pos + n - 1); - break; - - case 'Z': /* move n tabs backwards */ - sc_term_backtab(scp, tcp->param[0]); - break; - - case '`': /* move cursor to column n */ - sc_term_col(scp, tcp->param[0]); - break; - - case 'a': /* move cursor n columns to the right */ - sc_term_right(scp, tcp->param[0]); - break; - - case 'd': /* move cursor to row n */ - sc_term_row(scp, tcp->param[0]); - break; - - case 'e': /* move cursor n rows down */ - sc_term_down(scp, tcp->param[0], 0); - break; - - case 'm': /* change attribute */ - if (tcp->num_param == 0) { - tcp->attr_mask = NORMAL_ATTR; - tcp->cur_color = tcp->std_color; - tcp->cur_attr = mask2attr(tcp); - break; - } - for (i = 0; i < tcp->num_param; i++) { - switch (n = tcp->param[i]) { - case 0: /* back to normal */ - tcp->attr_mask = NORMAL_ATTR; - tcp->cur_color = tcp->std_color; - tcp->cur_attr = mask2attr(tcp); - break; - case 1: /* bold */ - tcp->attr_mask |= BOLD_ATTR; - tcp->cur_attr = mask2attr(tcp); - break; - case 4: /* underline */ - tcp->attr_mask |= UNDERLINE_ATTR; - tcp->cur_attr = mask2attr(tcp); - break; - case 5: /* blink */ - tcp->attr_mask |= BLINK_ATTR; - tcp->cur_attr = mask2attr(tcp); - break; - case 7: /* reverse */ - tcp->attr_mask |= REVERSE_ATTR; - tcp->cur_attr = mask2attr(tcp); - break; - case 22: /* remove bold (or dim) */ - tcp->attr_mask &= ~BOLD_ATTR; - tcp->cur_attr = mask2attr(tcp); - break; - case 24: /* remove underline */ - tcp->attr_mask &= ~UNDERLINE_ATTR; - tcp->cur_attr = mask2attr(tcp); - break; - case 25: /* remove blink */ - tcp->attr_mask &= ~BLINK_ATTR; - tcp->cur_attr = mask2attr(tcp); - break; - case 27: /* remove reverse */ - tcp->attr_mask &= ~REVERSE_ATTR; - tcp->cur_attr = mask2attr(tcp); - break; - case 30: case 31: /* set ansi fg color */ - case 32: case 33: case 34: - case 35: case 36: case 37: - tcp->attr_mask |= FG_CHANGED; - tcp->cur_color.fg = ansi_col[n - 30]; - tcp->cur_attr = mask2attr(tcp); - break; - case 39: /* restore fg color back to normal */ - tcp->attr_mask &= ~(FG_CHANGED|BOLD_ATTR); - tcp->cur_color.fg = tcp->std_color.fg; - tcp->cur_attr = mask2attr(tcp); - break; - case 40: case 41: /* set ansi bg color */ - case 42: case 43: case 44: - case 45: case 46: case 47: - tcp->attr_mask |= BG_CHANGED; - tcp->cur_color.bg = ansi_col[n - 40]; - tcp->cur_attr = mask2attr(tcp); - break; - case 49: /* restore bg color back to normal */ - tcp->attr_mask &= ~BG_CHANGED; - tcp->cur_color.bg = tcp->std_color.bg; - tcp->cur_attr = mask2attr(tcp); - break; - } - } - break; - - case 's': /* Save cursor position */ - tcp->saved_xpos = scp->xpos; - tcp->saved_ypos = scp->ypos; - break; - - case 'u': /* Restore saved cursor position */ - if (tcp->saved_xpos >= 0 && tcp->saved_ypos >= 0) - sc_move_cursor(scp, tcp->saved_xpos, - tcp->saved_ypos); - break; - - case 'x': - if (tcp->num_param == 0) - n = 0; - else - n = tcp->param[0]; - switch (n) { - case 0: /* reset colors and attributes back to normal */ - tcp->attr_mask = NORMAL_ATTR; - tcp->cur_color = tcp->std_color - = tcp->dflt_std_color; - tcp->rev_color = tcp->dflt_rev_color; - tcp->cur_attr = mask2attr(tcp); - break; - case 1: /* set ansi background */ - tcp->attr_mask &= ~BG_CHANGED; - tcp->cur_color.bg = tcp->std_color.bg - = ansi_col[tcp->param[1] & 0x0f]; - tcp->cur_attr = mask2attr(tcp); - break; - case 2: /* set ansi foreground */ - tcp->attr_mask &= ~FG_CHANGED; - tcp->cur_color.fg = tcp->std_color.fg - = ansi_col[tcp->param[1] & 0x0f]; - tcp->cur_attr = mask2attr(tcp); - break; - case 3: /* set adapter attribute directly */ - tcp->attr_mask &= ~(FG_CHANGED | BG_CHANGED); - tcp->cur_color.fg = tcp->std_color.fg - = tcp->param[1] & 0x0f; - tcp->cur_color.bg = tcp->std_color.bg - = (tcp->param[1] >> 4) & 0x0f; - tcp->cur_attr = mask2attr(tcp); - break; - case 5: /* set ansi reverse background */ - tcp->rev_color.bg = ansi_col[tcp->param[1] & 0x0f]; - tcp->cur_attr = mask2attr(tcp); - break; - case 6: /* set ansi reverse foreground */ - tcp->rev_color.fg = ansi_col[tcp->param[1] & 0x0f]; - tcp->cur_attr = mask2attr(tcp); - break; - case 7: /* set adapter reverse attribute directly */ - tcp->rev_color.fg = tcp->param[1] & 0x0f; - tcp->rev_color.bg = (tcp->param[1] >> 4) & 0x0f; - tcp->cur_attr = mask2attr(tcp); - break; - } - break; - - case 'z': /* switch to (virtual) console n */ - if (tcp->num_param == 1) - sc_switch_scr(sc, tcp->param[0]); - break; - } - } else if (tcp->esc == 3) { /* seen ESC [0-9]+ = */ - if (c >= '0' && c <= '9') { - if (tcp->num_param < MAX_ESC_PAR) { - if (tcp->last_param != tcp->num_param) { - tcp->last_param = tcp->num_param; - tcp->param[tcp->num_param] = 0; - } else { - tcp->param[tcp->num_param] *= 10; - } - tcp->param[tcp->num_param] += c - '0'; - return; - } - } - tcp->num_param = tcp->last_param + 1; - switch (c) { - - case ';': - if (tcp->num_param < MAX_ESC_PAR) - return; - break; - - case 'A': /* set display border color */ - if (tcp->num_param == 1) { - scp->border=tcp->param[0] & 0xff; - if (scp == sc->cur_scp) - sc_set_border(scp, scp->border); - } - break; - - case 'B': /* set bell pitch and duration */ - if (tcp->num_param == 2) { - scp->bell_pitch = tcp->param[0]; - scp->bell_duration = - (tcp->param[1] * hz + 99) / 100; - } - break; - - case 'C': /* set global/parmanent cursor type & shape */ - i = spltty(); - n = tcp->num_param; - v0 = tcp->param[0]; - v1 = tcp->param[1]; - v2 = tcp->param[2]; - switch (n) { - case 1: /* flags only */ - if (v0 < nitems(cattrs)) - v0 = cattrs[v0]; - else /* backward compatibility */ - v0 = cattrs[v0 & 0x3]; - sc_change_cursor_shape(scp, v0, -1, -1); - break; - case 2: - v2 = 0; - v0 &= 0x1f; /* backward compatibility */ - v1 &= 0x1f; - /* FALL THROUGH */ - case 3: /* base and height */ - if (v2 == 0) /* count from top */ - sc_change_cursor_shape(scp, -1, - scp->font_size - v1 - 1, - v1 - v0 + 1); - else if (v2 == 1) /* count from bottom */ - sc_change_cursor_shape(scp, -1, - v0, v1 - v0 + 1); - break; - } - splx(i); - break; - - case 'F': /* set adapter foreground */ - if (tcp->num_param == 1) { - tcp->attr_mask &= ~FG_CHANGED; - tcp->cur_color.fg = tcp->std_color.fg - = tcp->param[0] & 0x0f; - tcp->cur_attr = mask2attr(tcp); - } - break; - - case 'G': /* set adapter background */ - if (tcp->num_param == 1) { - tcp->attr_mask &= ~BG_CHANGED; - tcp->cur_color.bg = tcp->std_color.bg - = tcp->param[0] & 0x0f; - tcp->cur_attr = mask2attr(tcp); - } - break; - - case 'H': /* set adapter reverse foreground */ - if (tcp->num_param == 1) { - tcp->rev_color.fg = tcp->param[0] & 0x0f; - tcp->cur_attr = mask2attr(tcp); - } - break; - - case 'I': /* set adapter reverse background */ - if (tcp->num_param == 1) { - tcp->rev_color.bg = tcp->param[0] & 0x0f; - tcp->cur_attr = mask2attr(tcp); - } - break; - - case 'S': /* set local/temporary cursor type & shape */ - i = spltty(); - n = tcp->num_param; - v0 = tcp->param[0]; - switch (n) { - case 0: - v0 = 0; - /* FALL THROUGH */ - case 1: - if (v0 < nitems(tcattrs)) - sc_change_cursor_shape(scp, - tcattrs[v0], -1, -1); - break; - } - splx(i); - break; - } -#ifdef notyet - } else if (tcp->esc == 4) { /* seen ESC Q */ - /* to be filled */ -#endif - } else if (tcp->esc == 5) { /* seen ESC ( */ - switch (c) { - case 'B': /* iso-2022: desginate ASCII into G0 */ - break; - /* other items to be filled */ - default: - break; - } - } - tcp->esc = 0; -} - -static void -scterm_puts(scr_stat *scp, u_char *buf, int len, int kernel) -{ - term_stat *tcp; - u_char *ptr; -#ifdef KANJI - u_short kanji_code; -#endif - color_t backup; - - tcp = scp->ts; - ptr = buf; -outloop: - scp->sc->write_in_progress++; - backup = tcp->cur_color; - if (kernel) { - tcp->cur_color.fg = SC_KERNEL_CONS_ATTR & 0x0f; - tcp->cur_color.bg = (SC_KERNEL_CONS_ATTR >> 4) & 0x0f; - } - - if (tcp->esc) { - scterm_scan_esc(scp, tcp, *ptr++); - len--; - } else if (PRINTABLE(*ptr)) { /* Print only printables */ - vm_offset_t p; - u_char *map; - int attr; - int i; - int cnt; -#ifdef KANJI - u_char c; -#endif - - p = sc_vtb_pointer(&scp->vtb, scp->cursor_pos); - map = scp->sc->scr_map; - attr = tcp->cur_attr; - -#ifdef KANJI - c = *ptr; - if (tcp->kanji_1st_char == 0) { - tcp->kanji_type = iskanji1(tcp->kanji_type, c); - if (!IS_KTYPE_ASCII_or_HANKAKU(tcp->kanji_type)) { - /* not Ascii & not HANKAKU */ - tcp->kanji_1st_char = c; - goto kanji_end; - } else if (tcp->kanji_type == KTYPE_ASCII) { - cnt = imin(len, scp->xsize - scp->xpos); - i = cnt; - do { - p = sc_vtb_putchar(&scp->vtb, p, map[c], attr); - c = *++ptr; - --i; - } while (i > 0 && PRINTABLE(c) && - iskanji1(tcp->kanji_type, c) == KTYPE_ASCII); - - len -= cnt - i; - mark_for_update(scp, scp->cursor_pos); - scp->cursor_pos += cnt - i; - mark_for_update(scp, scp->cursor_pos - 1); - scp->xpos += cnt - i; - KTYPE_MASK_CTRL(tcp->kanji_type); - goto ascii_end; - } - } else { - if ((tcp->kanji_type = - iskanji2(tcp->kanji_type, c)) & 0xee) { - /* print kanji on TEXT VRAM */ - kanji_code = kanji_convert(tcp->kanji_type, c, - tcp->kanji_1st_char); - mark_for_update(scp, scp->cursor_pos); - for (i = 0; i < 2; i++) { - /* *cursor_pos = (kanji_code | (i*0x80)); */ - p = sc_vtb_putchar(&scp->vtb, p, - kanji_code | ((i == 0) ? 0x00 : 0x80), attr); - ++scp->cursor_pos; - if (++scp->xpos >= scp->xsize) { - scp->xpos = 0; - scp->ypos++; - } - } - mark_for_update(scp, scp->cursor_pos - 1); - KTYPE_MASK_CTRL(tcp->kanji_type); - tcp->kanji_1st_char = 0; - goto kanji_end; - } else { - tcp->kanji_1st_char = 0; - } - } - if (IS_KTYPE_KANA(tcp->kanji_type)) - c |= 0x80; - KTYPE_MASK_CTRL(tcp->kanji_type); - sc_vtb_putchar(&scp->vtb, p, map[c], attr); - mark_for_update(scp, scp->cursor_pos); - mark_for_update(scp, scp->cursor_pos); - ++scp->cursor_pos; - ++scp->xpos; -kanji_end: - ++ptr; - --len; -ascii_end: -#else /* !KANJI */ - cnt = imin(len, scp->xsize - scp->xpos); - i = cnt; - do { - /* - * gcc-2.6.3 generates poor (un)sign extension code. - * Casting the pointers in the following to volatile should - * have no effect, but in fact speeds up this inner loop - * from 26 to 18 cycles (+ cache misses) on i486's. - */ -#define UCVP(ucp) ((u_char volatile *)(ucp)) - p = sc_vtb_putchar(&scp->vtb, p, UCVP(map)[*UCVP(ptr)], - attr); - ++ptr; - --i; - } while (i > 0 && PRINTABLE(*ptr)); - - len -= cnt - i; - mark_for_update(scp, scp->cursor_pos); - scp->cursor_pos += cnt - i; - mark_for_update(scp, scp->cursor_pos - 1); - scp->xpos += cnt - i; -#endif /* !KANJI */ - - if (scp->xpos >= scp->xsize) { - scp->xpos = 0; - scp->ypos++; - } - } else { - switch (*ptr) { - case 0x07: - sc_bell(scp, scp->bell_pitch, scp->bell_duration); - break; - - case 0x08: /* non-destructive backspace */ - if (scp->cursor_pos > 0) { - mark_for_update(scp, scp->cursor_pos); - scp->cursor_pos--; - mark_for_update(scp, scp->cursor_pos); - if (scp->xpos > 0) - scp->xpos--; - else { - scp->xpos += scp->xsize - 1; - scp->ypos--; - } - } - break; - - case 0x09: /* non-destructive tab */ - mark_for_update(scp, scp->cursor_pos); - scp->cursor_pos += (8 - scp->xpos % 8u); - scp->xpos += (8 - scp->xpos % 8u); - if (scp->xpos >= scp->xsize) { - scp->xpos = 0; - scp->ypos++; - scp->cursor_pos = scp->xsize * scp->ypos; - } - mark_for_update(scp, scp->cursor_pos); - break; - - case 0x0a: /* newline, same pos */ - mark_for_update(scp, scp->cursor_pos); - scp->cursor_pos += scp->xsize; - mark_for_update(scp, scp->cursor_pos); - scp->ypos++; - break; - - case 0x0c: /* form feed, clears screen */ - sc_clear_screen(scp); - break; - - case 0x0d: /* return, return to pos 0 */ - mark_for_update(scp, scp->cursor_pos); - scp->cursor_pos -= scp->xpos; - mark_for_update(scp, scp->cursor_pos); - scp->xpos = 0; - break; - - case 0x0e: /* ^N */ - tcp->kanji_type = KTYPE_JKANA; - tcp->esc = 0; - tcp->kanji_1st_char = 0; - break; - - case 0x0f: /* ^O */ - tcp->kanji_type = KTYPE_ASCII; - tcp->esc = 0; - tcp->kanji_1st_char = 0; - break; - - case 0x1b: /* start escape sequence */ - tcp->esc = 1; - tcp->num_param = 0; - break; - } - ptr++; - len--; - } - - sc_term_gen_scroll(scp, scp->sc->scr_map[0x20], tcp->cur_attr); - - if (kernel) - tcp->cur_color = backup; - scp->sc->write_in_progress--; - if (len) - goto outloop; -} - -static int -scterm_ioctl(scr_stat *scp, struct tty *tp, u_long cmd, caddr_t data, - struct thread *td) -{ - term_stat *tcp = scp->ts; - vid_info_t *vi; - - switch (cmd) { - case GIO_ATTR: /* get current attributes */ - /* FIXME: */ - *(int*)data = (tcp->cur_attr >> 8) & 0xff; - return 0; - case CONS_GETINFO: /* get current (virtual) console info */ - vi = (vid_info_t *)data; - if (vi->size != sizeof(struct vid_info)) - return EINVAL; - vi->mv_norm.fore = tcp->std_color.fg; - vi->mv_norm.back = tcp->std_color.bg; - vi->mv_rev.fore = tcp->rev_color.fg; - vi->mv_rev.back = tcp->rev_color.bg; - /* - * The other fields are filled by the upper routine. XXX - */ - return ENOIOCTL; - } - return ENOIOCTL; -} - -static int -scterm_reset(scr_stat *scp, int code) -{ - /* FIXME */ - return 0; -} - -static void -scterm_default_attr(scr_stat *scp, int color, int rev_color) -{ - term_stat *tcp = scp->ts; - - tcp->dflt_std_color.fg = color & 0x0f; - tcp->dflt_std_color.bg = (color >> 4) & 0x0f; - tcp->dflt_rev_color.fg = rev_color & 0x0f; - tcp->dflt_rev_color.bg = (rev_color >> 4) & 0x0f; - tcp->std_color = tcp->dflt_std_color; - tcp->rev_color = tcp->dflt_rev_color; - tcp->cur_color = tcp->std_color; - tcp->cur_attr = mask2attr(tcp); -} - -static void -scterm_clear(scr_stat *scp) -{ - term_stat *tcp = scp->ts; - - sc_move_cursor(scp, 0, 0); - sc_vtb_clear(&scp->vtb, scp->sc->scr_map[0x20], tcp->cur_attr); - mark_all(scp); -} - -static void -scterm_notify(scr_stat *scp, int event) -{ - switch (event) { - case SC_TE_NOTIFY_VTSWITCH_IN: - break; - case SC_TE_NOTIFY_VTSWITCH_OUT: - break; - } -} - -static int -scterm_input(scr_stat *scp, int c, struct tty *tp) -{ - return FALSE; -} - -static const char * -scterm_fkeystr(scr_stat *scp, int c) -{ - - return (NULL); -} - -/* - * Calculate hardware attributes word using logical attributes mask and - * hardware colors - */ - -/* FIXME */ -static int -mask2attr(term_stat *tcp) -{ - int attr, mask = tcp->attr_mask; - - if (mask & REVERSE_ATTR) { - attr = ((mask & FG_CHANGED) ? - tcp->cur_color.bg : tcp->rev_color.fg) | - (((mask & BG_CHANGED) ? - tcp->cur_color.fg : tcp->rev_color.bg) << 4); - } else - attr = tcp->cur_color.fg | (tcp->cur_color.bg << 4); - - /* XXX: underline mapping for Hercules adapter can be better */ - if (mask & (BOLD_ATTR | UNDERLINE_ATTR)) - attr ^= 0x08; - if (mask & BLINK_ATTR) - attr ^= 0x80; - - return (attr << 8); -} diff --git a/sys/pc98/cbus/sctermvar.h b/sys/pc98/cbus/sctermvar.h deleted file mode 100644 index b1c01af1f800..000000000000 --- a/sys/pc98/cbus/sctermvar.h +++ /dev/null @@ -1,432 +0,0 @@ -/*- - * Copyright (c) 1999 Kazutaka YOKOTA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer as - * the first lines of this file unmodified. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _DEV_SYSCONS_SCTERMVAR_H_ -#define _DEV_SYSCONS_SCTERMVAR_H_ - -/* - * building blocks for terminal emulator modules. - */ - -static __inline void sc_term_ins_line(scr_stat *scp, int y, int n, int ch, - int attr, int tail); -static __inline void sc_term_del_line(scr_stat *scp, int y, int n, int ch, - int attr, int tail); -static __inline void sc_term_ins_char(scr_stat *scp, int n, int ch, - int attr); -static __inline void sc_term_del_char(scr_stat *scp, int n, int ch, - int attr); -static __inline void sc_term_col(scr_stat *scp, int n); -static __inline void sc_term_row(scr_stat *scp, int n); -static __inline void sc_term_up(scr_stat *scp, int n, int head); -static __inline void sc_term_down(scr_stat *scp, int n, int tail); -static __inline void sc_term_left(scr_stat *scp, int n); -static __inline void sc_term_right(scr_stat *scp, int n); -static __inline void sc_term_up_scroll(scr_stat *scp, int n, int ch, - int attr, int head, int tail); -static __inline void sc_term_down_scroll(scr_stat *scp, int n, int ch, - int attr, int head, int tail); -static __inline void sc_term_clr_eos(scr_stat *scp, int n, int ch, int attr); -static __inline void sc_term_clr_eol(scr_stat *scp, int n, int ch, int attr); -static __inline void sc_term_tab(scr_stat *scp, int n); -static __inline void sc_term_backtab(scr_stat *scp, int n); -static __inline void sc_term_respond(scr_stat *scp, u_char *s); -static __inline void sc_term_gen_print(scr_stat *scp, u_char **buf, int *len, - int attr); -static __inline void sc_term_gen_scroll(scr_stat *scp, int ch, int attr); - -static __inline void -sc_term_ins_line(scr_stat *scp, int y, int n, int ch, int attr, int tail) -{ - if (tail <= 0) - tail = scp->ysize; - if (n < 1) - n = 1; - if (n > tail - y) - n = tail - y; - sc_vtb_ins(&scp->vtb, y*scp->xsize, n*scp->xsize, ch, attr); - mark_for_update(scp, y*scp->xsize); - mark_for_update(scp, scp->xsize*tail - 1); -} - -static __inline void -sc_term_del_line(scr_stat *scp, int y, int n, int ch, int attr, int tail) -{ - if (tail <= 0) - tail = scp->ysize; - if (n < 1) - n = 1; - if (n > tail - y) - n = tail - y; - sc_vtb_delete(&scp->vtb, y*scp->xsize, n*scp->xsize, ch, attr); - mark_for_update(scp, y*scp->xsize); - mark_for_update(scp, scp->xsize*tail - 1); -} - -static __inline void -sc_term_ins_char(scr_stat *scp, int n, int ch, int attr) -{ - int count; - - if (n < 1) - n = 1; - if (n > scp->xsize - scp->xpos) - n = scp->xsize - scp->xpos; - count = scp->xsize - (scp->xpos + n); - sc_vtb_move(&scp->vtb, scp->cursor_pos, scp->cursor_pos + n, count); - sc_vtb_erase(&scp->vtb, scp->cursor_pos, n, ch, attr); - mark_for_update(scp, scp->cursor_pos); - mark_for_update(scp, scp->cursor_pos + n + count - 1); -} - -static __inline void -sc_term_del_char(scr_stat *scp, int n, int ch, int attr) -{ - int count; - - if (n < 1) - n = 1; - if (n > scp->xsize - scp->xpos) - n = scp->xsize - scp->xpos; - count = scp->xsize - (scp->xpos + n); - sc_vtb_move(&scp->vtb, scp->cursor_pos + n, scp->cursor_pos, count); - sc_vtb_erase(&scp->vtb, scp->cursor_pos + count, n, ch, attr); - mark_for_update(scp, scp->cursor_pos); - mark_for_update(scp, scp->cursor_pos + n + count - 1); -} - -static __inline void -sc_term_col(scr_stat *scp, int n) -{ - if (n < 1) - n = 1; - sc_move_cursor(scp, n - 1, scp->ypos); -} - -static __inline void -sc_term_row(scr_stat *scp, int n) -{ - if (n < 1) - n = 1; - sc_move_cursor(scp, scp->xpos, n - 1); -} - -static __inline void -sc_term_up(scr_stat *scp, int n, int head) -{ - if (n < 1) - n = 1; - n = imin(n, scp->ypos - head); - if (n <= 0) - return; - sc_move_cursor(scp, scp->xpos, scp->ypos - n); -} - -static __inline void -sc_term_down(scr_stat *scp, int n, int tail) -{ - if (tail <= 0) - tail = scp->ysize; - if (n < 1) - n = 1; - n = imin(n, tail - scp->ypos - 1); - if (n <= 0) - return; - sc_move_cursor(scp, scp->xpos, scp->ypos + n); -} - -static __inline void -sc_term_left(scr_stat *scp, int n) -{ - if (n < 1) - n = 1; - sc_move_cursor(scp, scp->xpos - n, scp->ypos); -} - -static __inline void -sc_term_right(scr_stat *scp, int n) -{ - if (n < 1) - n = 1; - sc_move_cursor(scp, scp->xpos + n, scp->ypos); -} - -static __inline void -sc_term_up_scroll(scr_stat *scp, int n, int ch, int attr, int head, int tail) -{ - if (tail <= 0) - tail = scp->ysize; - if (n < 1) - n = 1; - if (n <= scp->ypos - head) { - sc_move_cursor(scp, scp->xpos, scp->ypos - n); - } else { - sc_term_ins_line(scp, head, n - (scp->ypos - head), - ch, attr, tail); - sc_move_cursor(scp, scp->xpos, head); - } -} - -static __inline void -sc_term_down_scroll(scr_stat *scp, int n, int ch, int attr, int head, int tail) -{ - if (tail <= 0) - tail = scp->ysize; - if (n < 1) - n = 1; - if (n < tail - scp->ypos) { - sc_move_cursor(scp, scp->xpos, scp->ypos + n); - } else { - sc_term_del_line(scp, head, n - (tail - scp->ypos) + 1, - ch, attr, tail); - sc_move_cursor(scp, scp->xpos, tail - 1); - } -} - -static __inline void -sc_term_clr_eos(scr_stat *scp, int n, int ch, int attr) -{ - switch (n) { - case 0: /* clear form cursor to end of display */ - sc_vtb_erase(&scp->vtb, scp->cursor_pos, - scp->xsize*scp->ysize - scp->cursor_pos, - ch, attr); - mark_for_update(scp, scp->cursor_pos); - mark_for_update(scp, scp->xsize*scp->ysize - 1); - sc_remove_cutmarking(scp); - break; - case 1: /* clear from beginning of display to cursor */ - sc_vtb_erase(&scp->vtb, 0, scp->cursor_pos + 1, ch, attr); - mark_for_update(scp, 0); - mark_for_update(scp, scp->cursor_pos); - sc_remove_cutmarking(scp); - break; - case 2: /* clear entire display */ - sc_vtb_erase(&scp->vtb, 0, scp->xsize*scp->ysize, ch, attr); - mark_for_update(scp, 0); - mark_for_update(scp, scp->xsize*scp->ysize - 1); - sc_remove_cutmarking(scp); - break; - } -} - -static __inline void -sc_term_clr_eol(scr_stat *scp, int n, int ch, int attr) -{ - switch (n) { - case 0: /* clear form cursor to end of line */ - sc_vtb_erase(&scp->vtb, scp->cursor_pos, - scp->xsize - scp->xpos, ch, attr); - mark_for_update(scp, scp->cursor_pos); - mark_for_update(scp, scp->cursor_pos + - scp->xsize - 1 - scp->xpos); - break; - case 1: /* clear from beginning of line to cursor */ - sc_vtb_erase(&scp->vtb, scp->cursor_pos - scp->xpos, - scp->xpos + 1, ch, attr); - mark_for_update(scp, scp->ypos*scp->xsize); - mark_for_update(scp, scp->cursor_pos); - break; - case 2: /* clear entire line */ - sc_vtb_erase(&scp->vtb, scp->cursor_pos - scp->xpos, - scp->xsize, ch, attr); - mark_for_update(scp, scp->ypos*scp->xsize); - mark_for_update(scp, (scp->ypos + 1)*scp->xsize - 1); - break; - } -} - -static __inline void -sc_term_tab(scr_stat *scp, int n) -{ - int i; - - if (n < 1) - n = 1; - i = (scp->xpos & ~7) + 8*n; - if (i >= scp->xsize) { - if (scp->ypos >= scp->ysize - 1) { - scp->xpos = 0; - scp->ypos++; - scp->cursor_pos = scp->ypos*scp->xsize; - } else - sc_move_cursor(scp, 0, scp->ypos + 1); - } else - sc_move_cursor(scp, i, scp->ypos); -} - -static __inline void -sc_term_backtab(scr_stat *scp, int n) -{ - int i; - - if (n < 1) - n = 1; - if ((i = scp->xpos & ~7) == scp->xpos) - i -= 8*n; - else - i -= 8*(n - 1); - if (i < 0) - i = 0; - sc_move_cursor(scp, i, scp->ypos); -} - -static __inline void -sc_term_respond(scr_stat *scp, u_char *s) -{ - sc_paste(scp, s, strlen(s)); /* XXX: not correct, don't use rmap */ -} - -static __inline void -sc_term_gen_print(scr_stat *scp, u_char **buf, int *len, int attr) -{ - vm_offset_t p; - u_char *ptr; - u_char *map; - int cnt; - int l; - int i; - - ptr = *buf; - l = *len; - - if (PRINTABLE(*ptr)) { - p = sc_vtb_pointer(&scp->vtb, scp->cursor_pos); - map = scp->sc->scr_map; - - cnt = imin(l, scp->xsize - scp->xpos); - i = cnt; - do { - p = sc_vtb_putchar(&scp->vtb, p, map[*ptr], attr); - ++ptr; - --i; - } while ((i > 0) && PRINTABLE(*ptr)); - - l -= cnt - i; - mark_for_update(scp, scp->cursor_pos); - scp->cursor_pos += cnt - i; - mark_for_update(scp, scp->cursor_pos - 1); - scp->xpos += cnt - i; - - if (scp->xpos >= scp->xsize) { - scp->xpos = 0; - scp->ypos++; - /* we may have to scroll the screen */ - } - } else { - switch(*ptr) { - case 0x07: - sc_bell(scp, scp->bell_pitch, scp->bell_duration); - break; - - case 0x08: /* non-destructive backspace */ - /* XXX */ - if (scp->cursor_pos > 0) { -#if 0 - mark_for_update(scp, scp->cursor_pos); - scp->cursor_pos--; - mark_for_update(scp, scp->cursor_pos); -#else - scp->cursor_pos--; -#endif - if (scp->xpos > 0) { - scp->xpos--; - } else { - scp->xpos += scp->xsize - 1; - scp->ypos--; - } - } - break; - - case 0x09: /* non-destructive tab */ - sc_term_tab(scp, 1); - /* we may have to scroll the screen */ -#if 0 - mark_for_update(scp, scp->cursor_pos); - scp->cursor_pos += (8 - scp->xpos % 8u); - mark_for_update(scp, scp->cursor_pos); - scp->xpos += (8 - scp->xpos % 8u); - if (scp->xpos >= scp->xsize) { - scp->xpos = 0; - scp->ypos++; - } -#endif - break; - - case 0x0a: /* newline, same pos */ -#if 0 - mark_for_update(scp, scp->cursor_pos); - scp->cursor_pos += scp->xsize; - mark_for_update(scp, scp->cursor_pos); -#else - scp->cursor_pos += scp->xsize; - /* we may have to scroll the screen */ -#endif - scp->ypos++; - break; - - case 0x0c: /* form feed, clears screen */ - sc_clear_screen(scp); - break; - - case 0x0d: /* return, return to pos 0 */ -#if 0 - mark_for_update(scp, scp->cursor_pos); - scp->cursor_pos -= scp->xpos; - mark_for_update(scp, scp->cursor_pos); -#else - scp->cursor_pos -= scp->xpos; -#endif - scp->xpos = 0; - break; - } - ptr++; l--; - } - - *buf = ptr; - *len = l; -} - -static __inline void -sc_term_gen_scroll(scr_stat *scp, int ch, int attr) -{ - /* do we have to scroll ?? */ - if (scp->cursor_pos >= scp->ysize*scp->xsize) { - sc_remove_cutmarking(scp); /* XXX */ -#ifndef SC_NO_HISTORY - if (scp->history != NULL) - sc_hist_save_one_line(scp, 0); /* XXX */ -#endif - sc_vtb_delete(&scp->vtb, 0, scp->xsize, ch, attr); - scp->cursor_pos -= scp->xsize; - scp->ypos--; - mark_all(scp); - } -} - -#endif /* _DEV_SYSCONS_SCTERMVAR_H_ */ diff --git a/sys/pc98/cbus/scvtb.c b/sys/pc98/cbus/scvtb.c deleted file mode 100644 index c25ef14938f9..000000000000 --- a/sys/pc98/cbus/scvtb.c +++ /dev/null @@ -1,399 +0,0 @@ -/*- - * Copyright (c) 1999 FreeBSD(98) Porting Team. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer as - * the first lines of this file unmodified. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include "opt_syscons.h" - -#include -#include -#include -#include -#include - -#include - -#include -#include - -#define ATTR_OFFSET_FB 0x2000 -#define attr_offset(vtb) ((vtb)->vtb_size*sizeof(u_int16_t)) - -#define vtb_pointer(vtb, at) \ - ((vtb)->vtb_buffer + sizeof(u_int16_t)*(at)) - -#define vtb_wrap(vtb, at, offset) \ - (((at) + (offset) + (vtb)->vtb_size)%(vtb)->vtb_size) - -static u_int8_t ibmpc_to_pc98[256] = { - 0x01, 0x21, 0x81, 0xa1, 0x41, 0x61, 0xc1, 0xe1, - 0x09, 0x29, 0x89, 0xa9, 0x49, 0x69, 0xc9, 0xe9, - 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, - 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, - 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, - 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, - 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, - 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, - 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, - 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, - 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, - 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, - 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, - 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, - 0xe5, 0xe5, 0xe5, 0xe5, 0xe5, 0xe5, 0xe5, 0xe5, - 0xe5, 0xe5, 0xe5, 0xe5, 0xe5, 0xe5, 0xe5, 0xe5, - - 0x03, 0x23, 0x83, 0xa3, 0x43, 0x63, 0xc3, 0xe3, - 0x0b, 0x2b, 0x8b, 0xab, 0x4b, 0x6b, 0xcb, 0xeb, - 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, - 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, - 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, - 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, - 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, - 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, - 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, - 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, - 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, - 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, - 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, - 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, - 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, - 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, -}; -#define at2pc98(attr) ((attr) | ibmpc_to_pc98[(unsigned)(attr) >> 8]) - -void -sc_vtb_init(sc_vtb_t *vtb, int type, int cols, int rows, void *buf, int wait) -{ - vtb->vtb_flags = 0; - vtb->vtb_type = type; - vtb->vtb_cols = cols; - vtb->vtb_rows = rows; - vtb->vtb_size = cols*rows; - vtb->vtb_buffer = 0; - vtb->vtb_tail = 0; - - switch (type) { - case VTB_MEMORY: - case VTB_RINGBUFFER: - if ((buf == NULL) && (cols*rows != 0)) { - vtb->vtb_buffer = - (vm_offset_t)malloc(cols*rows*sizeof(u_int16_t)*2, - M_DEVBUF, - ((wait) ? M_WAITOK : M_NOWAIT) | M_ZERO); - if (vtb->vtb_buffer != 0) { - vtb->vtb_flags |= VTB_ALLOCED; - } - } else { - vtb->vtb_buffer = (vm_offset_t)buf; - } - vtb->vtb_flags |= VTB_VALID; - break; - case VTB_FRAMEBUFFER: - vtb->vtb_buffer = (vm_offset_t)buf; - vtb->vtb_flags |= VTB_VALID; - break; - default: - break; - } -} - -void -sc_vtb_destroy(sc_vtb_t *vtb) -{ - vm_offset_t p; - - vtb->vtb_cols = 0; - vtb->vtb_rows = 0; - vtb->vtb_size = 0; - vtb->vtb_tail = 0; - - p = vtb->vtb_buffer; - vtb->vtb_buffer = 0; - switch (vtb->vtb_type) { - case VTB_MEMORY: - case VTB_RINGBUFFER: - if ((vtb->vtb_flags & VTB_ALLOCED) && (p != 0)) - free((void *)p, M_DEVBUF); - break; - default: - break; - } - vtb->vtb_flags = 0; - vtb->vtb_type = VTB_INVALID; -} - -size_t -sc_vtb_size(int cols, int rows) -{ - return (size_t)(cols*rows*sizeof(u_int16_t)*2); -} - -int -sc_vtb_getc(sc_vtb_t *vtb, int at) -{ - vm_offset_t p = vtb_pointer(vtb, at); - - if (vtb->vtb_type == VTB_FRAMEBUFFER) - return (readw(p) & 0x00ff); - else - return (*(u_int16_t *)p & 0x00ff); -} - -int -sc_vtb_geta(sc_vtb_t *vtb, int at) -{ - vm_offset_t p = vtb_pointer(vtb, at); - - if (vtb->vtb_type == VTB_FRAMEBUFFER) - return (readw(p + ATTR_OFFSET_FB) & 0xff00); - else - return (*(u_int16_t *)(p + attr_offset(vtb)) & 0xff00); -} - -static inline void -vtb_putc(sc_vtb_t *vtb, vm_offset_t p, int c, int a) -{ - if (vtb->vtb_type == VTB_FRAMEBUFFER) { - writew(p, c); - writew(p + ATTR_OFFSET_FB, at2pc98(a)); - } else { - *(u_int16_t *)p = c; - *(u_int16_t *)(p + attr_offset(vtb)) = at2pc98(a); - } -} - -void -sc_vtb_putc(sc_vtb_t *vtb, int at, int c, int a) -{ - vtb_putc(vtb, vtb_pointer(vtb, at), c, a); -} - -vm_offset_t -sc_vtb_putchar(sc_vtb_t *vtb, vm_offset_t p, int c, int a) -{ - vtb_putc(vtb, p, c, a); - return (p + sizeof(u_int16_t)); -} - -vm_offset_t -sc_vtb_pointer(sc_vtb_t *vtb, int at) -{ - return (vtb_pointer(vtb, at)); -} - -int -sc_vtb_pos(sc_vtb_t *vtb, int pos, int offset) -{ - return ((pos + offset + vtb->vtb_size)%vtb->vtb_size); -} - -void -sc_vtb_clear(sc_vtb_t *vtb, int c, int attr) -{ - vm_offset_t p = vtb_pointer(vtb, 0); - - if (vtb->vtb_type == VTB_FRAMEBUFFER) { - fillw_io(c, p, vtb->vtb_size); - fillw_io(at2pc98(attr), p + ATTR_OFFSET_FB, vtb->vtb_size); - } else { - fillw(c, (void *)p, vtb->vtb_size); - fillw(at2pc98(attr), (void *)(p + attr_offset(vtb)), - vtb->vtb_size); - } -} - -void -sc_vtb_copy(sc_vtb_t *vtb1, int from, sc_vtb_t *vtb2, int to, int count) -{ - vm_offset_t p1, p2; - - p1 = vtb_pointer(vtb1, from); - p2 = vtb_pointer(vtb2, to); - if (vtb2->vtb_type == VTB_FRAMEBUFFER) { - bcopy_toio(p1, p2, count*sizeof(u_int16_t)); - bcopy_toio(p1 + attr_offset(vtb1), - p2 + ATTR_OFFSET_FB, - count*sizeof(u_int16_t)); - } else if (vtb1->vtb_type == VTB_FRAMEBUFFER) { - bcopy_fromio(p1, p2, count*sizeof(u_int16_t)); - bcopy_fromio(p1 + ATTR_OFFSET_FB, - p2 + attr_offset(vtb2), - count*sizeof(u_int16_t)); - } else { - bcopy((void *)p1, (void *)p2, count*sizeof(u_int16_t)); - bcopy((void *)(p1 + attr_offset(vtb1)), - (void *)(p2 + attr_offset(vtb2)), - count*sizeof(u_int16_t)); - } -} - -void -sc_vtb_append(sc_vtb_t *vtb1, int from, sc_vtb_t *vtb2, int count) -{ - int len; - vm_offset_t p1, p2; - - if (vtb2->vtb_type != VTB_RINGBUFFER) - return; - - while (count > 0) { - p1 = vtb_pointer(vtb1, from); - p2 = vtb_pointer(vtb2, vtb2->vtb_tail); - len = imin(count, vtb2->vtb_size - vtb2->vtb_tail); - if (vtb1->vtb_type == VTB_FRAMEBUFFER) { - bcopy_fromio(p1, p2, len*sizeof(u_int16_t)); - bcopy_fromio(p1 + ATTR_OFFSET_FB, - p2 + attr_offset(vtb2), - len*sizeof(u_int16_t)); - } else { - bcopy((void *)p1, (void *)p2, len*sizeof(u_int16_t)); - bcopy((void *)(p1 + attr_offset(vtb1)), - (void *)(p2 + attr_offset(vtb2)), - len*sizeof(u_int16_t)); - } - from += len; - count -= len; - vtb2->vtb_tail = vtb_wrap(vtb2, vtb2->vtb_tail, len); - } -} - -void -sc_vtb_seek(sc_vtb_t *vtb, int pos) -{ - vtb->vtb_tail = pos%vtb->vtb_size; -} - -void -sc_vtb_erase(sc_vtb_t *vtb, int at, int count, int c, int attr) -{ - vm_offset_t p; - - if (at + count > vtb->vtb_size) - count = vtb->vtb_size - at; - p = vtb_pointer(vtb, at); - if (vtb->vtb_type == VTB_FRAMEBUFFER) { - fillw_io(c, p, count); - fillw_io(at2pc98(attr), p + ATTR_OFFSET_FB, count); - } else { - fillw(c, (void *)p, count); - fillw(at2pc98(attr), (void *)(p + attr_offset(vtb)), count); - } -} - -void -sc_vtb_move(sc_vtb_t *vtb, int from, int to, int count) -{ - vm_offset_t p1, p2; - - if (from + count > vtb->vtb_size) - count = vtb->vtb_size - from; - if (to + count > vtb->vtb_size) - count = vtb->vtb_size - to; - if (count <= 0) - return; - - p1 = vtb_pointer(vtb, from); - p2 = vtb_pointer(vtb, to); - if (vtb->vtb_type == VTB_FRAMEBUFFER) { - bcopy_io(p1, p2, count*sizeof(u_int16_t)); - bcopy_io(p1 + ATTR_OFFSET_FB, - p2 + ATTR_OFFSET_FB, count*sizeof(u_int16_t)); - } else { - bcopy((void *)p1, (void *)p2, count*sizeof(u_int16_t)); - bcopy((void *)(p1 + attr_offset(vtb)), - (void *)(p2 + attr_offset(vtb)), count*sizeof(u_int16_t)); - } -} - -void -sc_vtb_delete(sc_vtb_t *vtb, int at, int count, int c, int attr) -{ - int len; - vm_offset_t p1, p2; - - if (at + count > vtb->vtb_size) - count = vtb->vtb_size - at; - len = vtb->vtb_size - at - count; - if (len > 0) { - p1 = vtb_pointer(vtb, at + count); - p2 = vtb_pointer(vtb, at); - if (vtb->vtb_type == VTB_FRAMEBUFFER) { - bcopy_io(p1, p2, len*sizeof(u_int16_t)); - bcopy_io(p1 + ATTR_OFFSET_FB, - p2 + ATTR_OFFSET_FB, - len*sizeof(u_int16_t)); - } else { - bcopy((void *)p1, (void *)p2, len*sizeof(u_int16_t)); - bcopy((void *)(p1 + attr_offset(vtb)), - (void *)(p2 + attr_offset(vtb)), - len*sizeof(u_int16_t)); - } - } - p1 = vtb_pointer(vtb, at + len); - if (vtb->vtb_type == VTB_FRAMEBUFFER) { - fillw_io(c, p1, vtb->vtb_size - at - len); - fillw_io(at2pc98(attr), p1 + ATTR_OFFSET_FB, - vtb->vtb_size - at - len); - } else { - fillw(c, (void *)p1, vtb->vtb_size - at - len); - fillw(at2pc98(attr), (void *)(p1 + attr_offset(vtb)), - vtb->vtb_size - at - len); - } -} - -void -sc_vtb_ins(sc_vtb_t *vtb, int at, int count, int c, int attr) -{ - vm_offset_t p1, p2; - - p1 = vtb_pointer(vtb, at); - if (at + count > vtb->vtb_size) { - count = vtb->vtb_size - at; - } else { - p2 = vtb_pointer(vtb, at + count); - if (vtb->vtb_type == VTB_FRAMEBUFFER) { - bcopy_io(p1, p2, - (vtb->vtb_size - at - count)*sizeof(u_int16_t)); - bcopy_io(p1 + ATTR_OFFSET_FB, - p2 + ATTR_OFFSET_FB, - (vtb->vtb_size - at - count)*sizeof(u_int16_t)); - } else { - bcopy((void *)p1, (void *)p2, - (vtb->vtb_size - at - count)*sizeof(u_int16_t)); - bcopy((void *)(p1 + attr_offset(vtb)), - (void *)(p2 + attr_offset(vtb)), - (vtb->vtb_size - at - count)*sizeof(u_int16_t)); - } - } - if (vtb->vtb_type == VTB_FRAMEBUFFER) { - fillw_io(c, p1, count); - fillw_io(at2pc98(attr), p1 + ATTR_OFFSET_FB, count); - } else { - fillw(c, (void *)p1, count); - fillw(at2pc98(attr), (void *)(p1 + attr_offset(vtb)), count); - } -} diff --git a/sys/pc98/cbus/sio.c b/sys/pc98/cbus/sio.c deleted file mode 100644 index 3e793680ea2b..000000000000 --- a/sys/pc98/cbus/sio.c +++ /dev/null @@ -1,4387 +0,0 @@ -/*- - * Copyright (c) 1991 The Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - * from: @(#)com.c 7.5 (Berkeley) 5/16/91 - * from: i386/isa sio.c,v 1.234 - */ - -#include "opt_compat.h" -#include "opt_gdb.h" -#include "opt_kdb.h" -#include "opt_sio.h" - -/* - * Serial driver, based on 386BSD-0.1 com driver. - * Mostly rewritten to use pseudo-DMA. - * Works for National Semiconductor NS8250-NS16550AF UARTs. - * COM driver, based on HP dca driver. - * - * Changes for PC Card integration: - * - Added PC Card driver table and handlers - */ -/*=============================================================== - * 386BSD(98),FreeBSD-1.1x(98) com driver. - * ----- - * modified for PC9801 by M.Ishii - * Kyoto University Microcomputer Club (KMC) - * Chou "TEFUTEFU" Hirotomi - * Kyoto Univ. the faculty of medicine - *=============================================================== - * FreeBSD-2.0.1(98) sio driver. - * ----- - * modified for pc98 Internal i8251 and MICRO CORE MC16550II - * T.Koike(hfc01340@niftyserve.or.jp) - * implement kernel device configuration - * aizu@orient.center.nitech.ac.jp - * - * Notes. - * ----- - * PC98 localization based on 386BSD(98) com driver. Using its PC98 local - * functions. - * This driver is under debugging,has bugs. - */ -/* - * modified for AIWA B98-01 - * by T.Hatanou last update: 15 Sep.1995 - */ -/* - * Modified by Y.Takahashi of Kogakuin University. - */ -/* - * modified for 8251(FIFO) by Seigo TANIMURA - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -#include -#include - -#ifdef PC98 -#include -#include -#endif - -#ifdef COM_ESP -#include -#endif -#include -#ifdef PC98 -#include -#include -#include -#endif - -#define LOTS_OF_EVENTS 64 /* helps separate urgent events from input */ - -/* - * Meaning of flags: - * - * 0x00000001 shared IRQs - * 0x00000002 disable FIFO - * 0x00000008 recover sooner from lost output interrupts - * 0x00000010 device is potential system console - * 0x00000020 device is forced to become system console - * 0x00000040 device is reserved for low-level IO - * 0x00000080 use this port for remote kernel debugging - * 0x0000??00 minor number of master port - * 0x00010000 PPS timestamping on CTS instead of DCD - * 0x00080000 IIR_TXRDY bug - * 0x00400000 If no comconsole found then mark as a comconsole - * 0x1?000000 interface type - */ - -#ifdef COM_MULTIPORT -/* checks in flags for multiport and which is multiport "master chip" - * for a given card - */ -#define COM_ISMULTIPORT(flags) ((flags) & 0x01) -#define COM_MPMASTER(flags) (((flags) >> 8) & 0x0ff) -#ifndef PC98 -#define COM_NOTAST4(flags) ((flags) & 0x04) -#endif -#else -#define COM_ISMULTIPORT(flags) (0) -#endif /* COM_MULTIPORT */ - -#define COM_C_IIR_TXRDYBUG 0x80000 -#define COM_CONSOLE(flags) ((flags) & 0x10) -#define COM_DEBUGGER(flags) ((flags) & 0x80) -#ifndef PC98 -#define COM_FIFOSIZE(flags) (((flags) & 0xff000000) >> 24) -#endif -#define COM_FORCECONSOLE(flags) ((flags) & 0x20) -#define COM_IIR_TXRDYBUG(flags) ((flags) & COM_C_IIR_TXRDYBUG) -#define COM_LLCONSOLE(flags) ((flags) & 0x40) -#define COM_LOSESOUTINTS(flags) ((flags) & 0x08) -#define COM_NOFIFO(flags) ((flags) & 0x02) -#ifndef PC98 -#define COM_NOSCR(flags) ((flags) & 0x100000) -#endif -#define COM_PPSCTS(flags) ((flags) & 0x10000) -#ifndef PC98 -#define COM_ST16650A(flags) ((flags) & 0x20000) -#define COM_TI16754(flags) ((flags) & 0x200000) -#endif - -#define sio_getreg(com, off) \ - (bus_space_read_1((com)->bst, (com)->bsh, (off))) -#define sio_setreg(com, off, value) \ - (bus_space_write_1((com)->bst, (com)->bsh, (off), (value))) - -/* - * com state bits. - * (CS_BUSY | CS_TTGO) and (CS_BUSY | CS_TTGO | CS_ODEVREADY) must be higher - * than the other bits so that they can be tested as a group without masking - * off the low bits. - * - * The following com and tty flags correspond closely: - * CS_BUSY = TS_BUSY (maintained by comstart(), siopoll() and - * comstop()) - * CS_TTGO = ~TS_TTSTOP (maintained by comparam() and comstart()) - * CS_CTS_OFLOW = CCTS_OFLOW (maintained by comparam()) - * CS_RTS_IFLOW = CRTS_IFLOW (maintained by comparam()) - * TS_FLUSH is not used. - * XXX I think TIOCSETA doesn't clear TS_TTSTOP when it clears IXON. - * XXX CS_*FLOW should be CF_*FLOW in com->flags (control flags not state). - */ -#define CS_BUSY 0x80 /* output in progress */ -#define CS_TTGO 0x40 /* output not stopped by XOFF */ -#define CS_ODEVREADY 0x20 /* external device h/w ready (CTS) */ -#define CS_CHECKMSR 1 /* check of MSR scheduled */ -#define CS_CTS_OFLOW 2 /* use CTS output flow control */ -#define CS_ODONE 4 /* output completed */ -#define CS_RTS_IFLOW 8 /* use RTS input flow control */ -#define CSE_BUSYCHECK 1 /* siobusycheck() scheduled */ - -static char const * const error_desc[] = { -#define CE_OVERRUN 0 - "silo overflow", -#define CE_INTERRUPT_BUF_OVERFLOW 1 - "interrupt-level buffer overflow", -#define CE_TTY_BUF_OVERFLOW 2 - "tty-level buffer overflow", -}; - -#define CE_NTYPES 3 -#define CE_RECORD(com, errnum) (++(com)->delta_error_counts[errnum]) - -/* types. XXX - should be elsewhere */ -typedef u_int Port_t; /* hardware port */ -typedef u_char bool_t; /* boolean */ - -/* queue of linear buffers */ -struct lbq { - u_char *l_head; /* next char to process */ - u_char *l_tail; /* one past the last char to process */ - struct lbq *l_next; /* next in queue */ - bool_t l_queued; /* nonzero if queued */ -}; - -/* com device structure */ -struct com_s { - u_char state; /* miscellaneous flag bits */ - u_char cfcr_image; /* copy of value written to CFCR */ -#ifdef COM_ESP - bool_t esp; /* is this unit a hayes esp board? */ -#endif - u_char extra_state; /* more flag bits, separate for order trick */ - u_char fifo_image; /* copy of value written to FIFO */ - bool_t hasfifo; /* nonzero for 16550 UARTs */ - bool_t loses_outints; /* nonzero if device loses output interrupts */ - u_char mcr_image; /* copy of value written to MCR */ -#ifdef COM_MULTIPORT - bool_t multiport; /* is this unit part of a multiport device? */ -#endif /* COM_MULTIPORT */ - bool_t no_irq; /* nonzero if irq is not attached */ - bool_t gone; /* hardware disappeared */ - bool_t poll; /* nonzero if polling is required */ - bool_t poll_output; /* nonzero if polling for output is required */ - bool_t st16650a; /* nonzero if Startech 16650A compatible */ - int unit; /* unit number */ - u_int flags; /* copy of device flags */ - u_int tx_fifo_size; - - /* - * The high level of the driver never reads status registers directly - * because there would be too many side effects to handle conveniently. - * Instead, it reads copies of the registers stored here by the - * interrupt handler. - */ - u_char last_modem_status; /* last MSR read by intr handler */ - u_char prev_modem_status; /* last MSR handled by high level */ - - u_char *ibuf; /* start of input buffer */ - u_char *ibufend; /* end of input buffer */ - u_char *ibufold; /* old input buffer, to be freed */ - u_char *ihighwater; /* threshold in input buffer */ - u_char *iptr; /* next free spot in input buffer */ - int ibufsize; /* size of ibuf (not include error bytes) */ - int ierroff; /* offset of error bytes in ibuf */ - - struct lbq obufq; /* head of queue of output buffers */ - struct lbq obufs[2]; /* output buffers */ - - bus_space_tag_t bst; - bus_space_handle_t bsh; - -#ifdef PC98 - Port_t cmd_port; - Port_t sts_port; - Port_t in_modem_port; - Port_t intr_ctrl_port; - Port_t rsabase; /* Iobase address of an I/O-DATA RSA board. */ - int intr_enable; - int pc98_prev_modem_status; - int pc98_modem_delta; - int modem_car_chg_timer; - int pc98_prev_siocmd; - int pc98_prev_siomod; - int modem_checking; - int pc98_if_type; - - bool_t pc98_8251fifo; - bool_t pc98_8251fifo_enable; -#endif /* PC98 */ - Port_t data_port; /* i/o ports */ -#ifdef COM_ESP - Port_t esp_port; -#endif - Port_t int_ctl_port; - Port_t int_id_port; - Port_t modem_ctl_port; - Port_t line_status_port; - Port_t modem_status_port; - - struct tty *tp; /* cross reference */ - - struct pps_state pps; - int pps_bit; -#ifdef KDB - int alt_brk_state; -#endif - - u_long bytes_in; /* statistics */ - u_long bytes_out; - u_int delta_error_counts[CE_NTYPES]; - u_long error_counts[CE_NTYPES]; - - u_long rclk; - - struct resource *irqres; - struct resource *ioportres; - int ioportrid; - void *cookie; - - /* - * Data area for output buffers. Someday we should build the output - * buffer queue without copying data. - */ -#ifdef PC98 - int obufsize; - u_char *obuf1; - u_char *obuf2; -#else - u_char obuf1[256]; - u_char obuf2[256]; -#endif -}; - -#ifdef COM_ESP -static int espattach(struct com_s *com, Port_t esp_port); -#endif - -static void combreak(struct tty *tp, int sig); -static timeout_t siobusycheck; -static u_int siodivisor(u_long rclk, speed_t speed); -static void comclose(struct tty *tp); -static int comopen(struct tty *tp, struct cdev *dev); -static void sioinput(struct com_s *com); -static void siointr1(struct com_s *com); -static int siointr(void *arg); -static int commodem(struct tty *tp, int sigon, int sigoff); -static int comparam(struct tty *tp, struct termios *t); -static void siopoll(void *); -static void siosettimeout(void); -static int siosetwater(struct com_s *com, speed_t speed); -static void comstart(struct tty *tp); -static void comstop(struct tty *tp, int rw); -static timeout_t comwakeup; - -char sio_driver_name[] = "sio"; -static struct mtx sio_lock; -static int sio_inited; - -/* table and macro for fast conversion from a unit number to its com struct */ -devclass_t sio_devclass; -#define com_addr(unit) ((struct com_s *) \ - devclass_get_softc(sio_devclass, unit)) /* XXX */ - -int comconsole = -1; -static volatile speed_t comdefaultrate = CONSPEED; -static u_long comdefaultrclk = DEFAULT_RCLK; -SYSCTL_ULONG(_machdep, OID_AUTO, conrclk, CTLFLAG_RW, &comdefaultrclk, 0, ""); -static speed_t gdbdefaultrate = GDBSPEED; -SYSCTL_UINT(_machdep, OID_AUTO, gdbspeed, CTLFLAG_RW, - &gdbdefaultrate, GDBSPEED, ""); -static u_int com_events; /* input chars + weighted output completions */ -static Port_t siocniobase; -static int siocnunit = -1; -static void *sio_slow_ih; -static void *sio_fast_ih; -static int sio_timeout; -static int sio_timeouts_until_log; -static struct callout_handle sio_timeout_handle - = CALLOUT_HANDLE_INITIALIZER(&sio_timeout_handle); -static int sio_numunits; - -#ifdef PC98 -struct siodev { - short if_type; - short irq; - Port_t cmd, sts, ctrl, mod; -}; -static int sysclock; - -#define COM_INT_DISABLE {int previpri; previpri=spltty(); -#define COM_INT_ENABLE splx(previpri);} -#define IEN_TxFLAG IEN_Tx - -#define COM_CARRIER_DETECT_EMULATE 0 -#define PC98_CHECK_MODEM_INTERVAL (hz/10) -#define DCD_OFF_TOLERANCE 2 -#define DCD_ON_RECOGNITION 2 -#define IS_8251(if_type) (!(if_type & 0x10)) -#define COM1_EXT_CLOCK 0x40000 - -static void commint(struct cdev *dev); -static void com_tiocm_bis(struct com_s *com, int msr); -static void com_tiocm_bic(struct com_s *com, int msr); -static int com_tiocm_get(struct com_s *com); -static int com_tiocm_get_delta(struct com_s *com); -static void pc98_msrint_start(struct cdev *dev); -static void com_cflag_and_speed_set(struct com_s *com, int cflag, int speed); -static int pc98_ttspeedtab(struct com_s *com, int speed, u_int *divisor); -static int pc98_get_modem_status(struct com_s *com); -static timeout_t pc98_check_msr; -static void pc98_set_baud_rate(struct com_s *com, u_int count); -static void pc98_i8251_reset(struct com_s *com, int mode, int command); -static void pc98_disable_i8251_interrupt(struct com_s *com, int mod); -static void pc98_enable_i8251_interrupt(struct com_s *com, int mod); -static int pc98_check_i8251_interrupt(struct com_s *com); -static int pc98_i8251_get_cmd(struct com_s *com); -static int pc98_i8251_get_mod(struct com_s *com); -static void pc98_i8251_set_cmd(struct com_s *com, int x); -static void pc98_i8251_or_cmd(struct com_s *com, int x); -static void pc98_i8251_clear_cmd(struct com_s *com, int x); -static void pc98_i8251_clear_or_cmd(struct com_s *com, int clr, int x); -static int pc98_check_if_type(device_t dev, struct siodev *iod); -static int pc98_check_8251vfast(void); -static int pc98_check_8251fifo(void); -static void pc98_check_sysclock(void); -static void pc98_set_ioport(struct com_s *com); - -#define com_int_Tx_disable(com) \ - pc98_disable_i8251_interrupt(com,IEN_Tx|IEN_TxEMP) -#define com_int_Tx_enable(com) \ - pc98_enable_i8251_interrupt(com,IEN_TxFLAG) -#define com_int_Rx_disable(com) \ - pc98_disable_i8251_interrupt(com,IEN_Rx) -#define com_int_Rx_enable(com) \ - pc98_enable_i8251_interrupt(com,IEN_Rx) -#define com_int_TxRx_disable(com) \ - pc98_disable_i8251_interrupt(com,IEN_Tx|IEN_TxEMP|IEN_Rx) -#define com_int_TxRx_enable(com) \ - pc98_enable_i8251_interrupt(com,IEN_TxFLAG|IEN_Rx) -#define com_send_break_on(com) \ - (IS_8251((com)->pc98_if_type) ? \ - pc98_i8251_or_cmd((com), CMD8251_SBRK) : \ - sio_setreg((com), com_cfcr, (com)->cfcr_image |= CFCR_SBREAK)) -#define com_send_break_off(com) \ - (IS_8251((com)->pc98_if_type) ? \ - pc98_i8251_clear_cmd((com), CMD8251_SBRK) : \ - sio_setreg((com), com_cfcr, (com)->cfcr_image &= ~CFCR_SBREAK)) - -static struct speedtab pc98speedtab[] = { /* internal RS232C interface */ - { 0, 0, }, - { 50, 50, }, - { 75, 75, }, - { 150, 150, }, - { 200, 200, }, - { 300, 300, }, - { 600, 600, }, - { 1200, 1200, }, - { 2400, 2400, }, - { 4800, 4800, }, - { 9600, 9600, }, - { 19200, 19200, }, - { 38400, 38400, }, - { 51200, 51200, }, - { 76800, 76800, }, - { 20800, 20800, }, - { 31200, 31200, }, - { 41600, 41600, }, - { 62400, 62400, }, - { -1, -1 } -}; -static struct speedtab pc98fast_speedtab[] = { - { 9600, 0x80 | (DEFAULT_RCLK / (16 * (9600))), }, - { 19200, 0x80 | (DEFAULT_RCLK / (16 * (19200))), }, - { 38400, 0x80 | (DEFAULT_RCLK / (16 * (38400))), }, - { 57600, 0x80 | (DEFAULT_RCLK / (16 * (57600))), }, - { 115200, 0x80 | (DEFAULT_RCLK / (16 * (115200))), }, - { -1, -1 } -}; -static struct speedtab comspeedtab_pio9032b[] = { - { 300, 6, }, - { 600, 5, }, - { 1200, 4, }, - { 2400, 3, }, - { 4800, 2, }, - { 9600, 1, }, - { 19200, 0, }, - { 38400, 7, }, - { -1, -1 } -}; -static struct speedtab comspeedtab_b98_01[] = { - { 75, 11, }, - { 150, 10, }, - { 300, 9, }, - { 600, 8, }, - { 1200, 7, }, - { 2400, 6, }, - { 4800, 5, }, - { 9600, 4, }, - { 19200, 3, }, - { 38400, 2, }, - { 76800, 1, }, - { 153600, 0, }, - { -1, -1 } -}; -static struct speedtab comspeedtab_ind[] = { - { 300, 1536, }, - { 600, 768, }, - { 1200, 384, }, - { 2400, 192, }, - { 4800, 96, }, - { 9600, 48, }, - { 19200, 24, }, - { 38400, 12, }, - { 57600, 8, }, - { 115200, 4, }, - { 153600, 3, }, - { 230400, 2, }, - { 460800, 1, }, - { -1, -1 } -}; - -struct { - char *name; - short port_table[7]; - short irr_mask; - struct speedtab *speedtab; - short check_irq; -} if_8251_type[] = { - /* COM_IF_INTERNAL */ - { " (internal)", {0x30, 0x32, 0x32, 0x33, 0x35, -1, -1}, - -1, pc98speedtab, 1 }, - /* COM_IF_PC9861K_1 */ - { " (PC9861K)", {0xb1, 0xb3, 0xb3, 0xb0, 0xb0, -1, -1}, - 3, NULL, 1 }, - /* COM_IF_PC9861K_2 */ - { " (PC9861K)", {0xb9, 0xbb, 0xbb, 0xb2, 0xb2, -1, -1}, - 3, NULL, 1 }, - /* COM_IF_IND_SS_1 */ - { " (IND-SS)", {0xb1, 0xb3, 0xb3, 0xb0, 0xb0, 0xb3, -1}, - 3, comspeedtab_ind, 1 }, - /* COM_IF_IND_SS_2 */ - { " (IND-SS)", {0xb9, 0xbb, 0xbb, 0xb2, 0xb2, 0xbb, -1}, - 3, comspeedtab_ind, 1 }, - /* COM_IF_PIO9032B_1 */ - { " (PIO9032B)", {0xb1, 0xb3, 0xb3, 0xb0, 0xb0, 0xb8, -1}, - 7, comspeedtab_pio9032b, 1 }, - /* COM_IF_PIO9032B_2 */ - { " (PIO9032B)", {0xb9, 0xbb, 0xbb, 0xb2, 0xb2, 0xba, -1}, - 7, comspeedtab_pio9032b, 1 }, - /* COM_IF_B98_01_1 */ - { " (B98-01)", {0xb1, 0xb3, 0xb3, 0xb0, 0xb0, 0xd1, 0xd3}, - 7, comspeedtab_b98_01, 0 }, - /* COM_IF_B98_01_2 */ - { " (B98-01)", {0xb9, 0xbb, 0xbb, 0xb2, 0xb2, 0xd5, 0xd7}, - 7, comspeedtab_b98_01, 0 }, -}; -#define PC98SIO_data_port(type) (if_8251_type[type].port_table[0]) -#define PC98SIO_cmd_port(type) (if_8251_type[type].port_table[1]) -#define PC98SIO_sts_port(type) (if_8251_type[type].port_table[2]) -#define PC98SIO_in_modem_port(type) (if_8251_type[type].port_table[3]) -#define PC98SIO_intr_ctrl_port(type) (if_8251_type[type].port_table[4]) -#define PC98SIO_baud_rate_port(type) (if_8251_type[type].port_table[5]) -#define PC98SIO_func_port(type) (if_8251_type[type].port_table[6]) - -#define I8251F_data 0x130 -#define I8251F_lsr 0x132 -#define I8251F_msr 0x134 -#define I8251F_iir 0x136 -#define I8251F_fcr 0x138 -#define I8251F_div 0x13a - - -static bus_addr_t port_table_0[] = - {0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007}; -static bus_addr_t port_table_1[] = - {0x000, 0x002, 0x004, 0x006, 0x008, 0x00a, 0x00c, 0x00e}; -static bus_addr_t port_table_8[] = - {0x000, 0x100, 0x200, 0x300, 0x400, 0x500, 0x600, 0x700}; -static bus_addr_t port_table_rsa[] = { - 0x008, 0x009, 0x00a, 0x00b, 0x00c, 0x00d, 0x00e, 0x00f, - 0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007 -}; - -struct { - char *name; - short irr_read; - short irr_write; - bus_addr_t *iat; - bus_size_t iatsz; - u_long rclk; -} if_16550a_type[] = { - /* COM_IF_RSA98 */ - {" (RSA-98)", -1, -1, port_table_0, IO_COMSIZE, DEFAULT_RCLK}, - /* COM_IF_NS16550 */ - {"", -1, -1, port_table_0, IO_COMSIZE, DEFAULT_RCLK}, - /* COM_IF_SECOND_CCU */ - {"", -1, -1, port_table_0, IO_COMSIZE, DEFAULT_RCLK}, - /* COM_IF_MC16550II */ - {" (MC16550II)", -1, 0x1000, port_table_8, IO_COMSIZE, - DEFAULT_RCLK * 4}, - /* COM_IF_MCRS98 */ - {" (MC-RS98)", -1, 0x1000, port_table_8, IO_COMSIZE, DEFAULT_RCLK * 4}, - /* COM_IF_RSB3000 */ - {" (RSB-3000)", 0xbf, -1, port_table_1, IO_COMSIZE, DEFAULT_RCLK * 10}, - /* COM_IF_RSB384 */ - {" (RSB-384)", 0xbf, -1, port_table_1, IO_COMSIZE, DEFAULT_RCLK * 10}, - /* COM_IF_MODEM_CARD */ - {"", -1, -1, port_table_0, IO_COMSIZE, DEFAULT_RCLK}, - /* COM_IF_RSA98III */ - {" (RSA-98III)", -1, -1, port_table_rsa, 16, DEFAULT_RCLK * 8}, - /* COM_IF_ESP98 */ - {" (ESP98)", -1, -1, port_table_1, IO_COMSIZE, DEFAULT_RCLK * 4}, -}; -#endif /* PC98 */ - -#ifdef GDB -static Port_t siogdbiobase = 0; -#endif - -#ifdef COM_ESP -#ifdef PC98 - -/* XXX configure this properly. */ -/* XXX quite broken for new-bus. */ -static Port_t likely_com_ports[] = { 0, 0xb0, 0xb1, 0 }; -static Port_t likely_esp_ports[] = { 0xc0d0, 0 }; - -#define ESP98_CMD1 (ESP_CMD1 * 0x100) -#define ESP98_CMD2 (ESP_CMD2 * 0x100) -#define ESP98_STATUS1 (ESP_STATUS1 * 0x100) -#define ESP98_STATUS2 (ESP_STATUS2 * 0x100) - -#else /* PC98 */ - -/* XXX configure this properly. */ -static Port_t likely_com_ports[] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, }; -static Port_t likely_esp_ports[] = { 0x140, 0x180, 0x280, 0 }; - -#endif /* PC98 */ -#endif - -/* - * handle sysctl read/write requests for console speed - * - * In addition to setting comdefaultrate for I/O through /dev/console, - * also set the initial and lock values for the /dev/ttyXX device - * if there is one associated with the console. Finally, if the /dev/tty - * device has already been open, change the speed on the open running port - * itself. - */ - -static int -sysctl_machdep_comdefaultrate(SYSCTL_HANDLER_ARGS) -{ - int error, s; - speed_t newspeed; - struct com_s *com; - struct tty *tp; - - newspeed = comdefaultrate; - - error = sysctl_handle_opaque(oidp, &newspeed, sizeof newspeed, req); - if (error || !req->newptr) - return (error); - - comdefaultrate = newspeed; - - if (comconsole < 0) /* serial console not selected? */ - return (0); - - com = com_addr(comconsole); - if (com == NULL) - return (ENXIO); - - tp = com->tp; - if (tp == NULL) - return (ENXIO); - - /* - * set the initial and lock rates for /dev/ttydXX and /dev/cuaXX - * (note, the lock rates really are boolean -- if non-zero, disallow - * speed changes) - */ - tp->t_init_in.c_ispeed = tp->t_init_in.c_ospeed = - tp->t_lock_in.c_ispeed = tp->t_lock_in.c_ospeed = - tp->t_init_out.c_ispeed = tp->t_init_out.c_ospeed = - tp->t_lock_out.c_ispeed = tp->t_lock_out.c_ospeed = comdefaultrate; - - if (tp->t_state & TS_ISOPEN) { - tp->t_termios.c_ispeed = - tp->t_termios.c_ospeed = comdefaultrate; - s = spltty(); - error = comparam(tp, &tp->t_termios); - splx(s); - } - return error; -} - -SYSCTL_PROC(_machdep, OID_AUTO, conspeed, CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NOFETCH, - 0, 0, sysctl_machdep_comdefaultrate, "I", ""); -TUNABLE_INT("machdep.conspeed", __DEVOLATILE(int *, &comdefaultrate)); - -/* - * Unload the driver and clear the table. - * XXX this is mostly wrong. - * XXX TODO: - * This is usually called when the card is ejected, but - * can be caused by a kldunload of a controller driver. - * The idea is to reset the driver's view of the device - * and ensure that any driver entry points such as - * read and write do not hang. - */ -int -siodetach(device_t dev) -{ - struct com_s *com; - - com = (struct com_s *) device_get_softc(dev); - if (com == NULL) { - device_printf(dev, "NULL com in siounload\n"); - return (0); - } - com->gone = TRUE; - if (com->tp) - ttyfree(com->tp); - if (com->irqres) { - bus_teardown_intr(dev, com->irqres, com->cookie); - bus_release_resource(dev, SYS_RES_IRQ, 0, com->irqres); - } - if (com->ioportres) - bus_release_resource(dev, SYS_RES_IOPORT, com->ioportrid, - com->ioportres); - if (com->ibuf != NULL) - free(com->ibuf, M_DEVBUF); -#ifdef PC98 - if (com->obuf1 != NULL) - free(com->obuf1, M_DEVBUF); -#endif - - device_set_softc(dev, NULL); - free(com, M_DEVBUF); - return (0); -} - -int -sioprobe(dev, xrid, rclk, noprobe) - device_t dev; - int xrid; - u_long rclk; - int noprobe; -{ -#if 0 - static bool_t already_init; - device_t xdev; -#endif - struct com_s *com; - u_int divisor; - bool_t failures[10]; - int fn; - device_t idev; - Port_t iobase; - intrmask_t irqmap[4]; - intrmask_t irqs; - u_char mcr_image; - int result; - u_long xirq; - u_int flags = device_get_flags(dev); - int rid; - struct resource *port; -#ifdef PC98 - int tmp; - struct siodev iod; -#endif - -#ifdef PC98 - iod.if_type = GET_IFTYPE(flags); - if ((iod.if_type < 0 || iod.if_type > COM_IF_END1) && - (iod.if_type < 0x10 || iod.if_type > COM_IF_END2)) - return ENXIO; -#endif - - rid = xrid; -#ifdef PC98 - if (IS_8251(iod.if_type)) { - port = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, - RF_ACTIVE); - } else if (iod.if_type == COM_IF_MODEM_CARD || - iod.if_type == COM_IF_RSA98III || - isa_get_vendorid(dev)) { - port = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, - if_16550a_type[iod.if_type & 0x0f].iatsz, RF_ACTIVE); - } else { - port = isa_alloc_resourcev(dev, SYS_RES_IOPORT, &rid, - if_16550a_type[iod.if_type & 0x0f].iat, - if_16550a_type[iod.if_type & 0x0f].iatsz, RF_ACTIVE); - } -#else - port = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, - IO_COMSIZE, RF_ACTIVE); -#endif - if (!port) - return (ENXIO); -#ifdef PC98 - if (!IS_8251(iod.if_type)) { - if (isa_load_resourcev(port, - if_16550a_type[iod.if_type & 0x0f].iat, - if_16550a_type[iod.if_type & 0x0f].iatsz) != 0) { - bus_release_resource(dev, SYS_RES_IOPORT, rid, port); - return ENXIO; - } - } -#endif - - com = malloc(sizeof(*com), M_DEVBUF, M_NOWAIT | M_ZERO); - if (com == NULL) { - bus_release_resource(dev, SYS_RES_IOPORT, rid, port); - return (ENOMEM); - } - device_set_softc(dev, com); - com->bst = rman_get_bustag(port); - com->bsh = rman_get_bushandle(port); -#ifdef PC98 - if (!IS_8251(iod.if_type) && rclk == 0) - rclk = if_16550a_type[iod.if_type & 0x0f].rclk; -#else - if (rclk == 0) - rclk = DEFAULT_RCLK; -#endif - com->rclk = rclk; - - while (sio_inited != 2) - if (atomic_cmpset_int(&sio_inited, 0, 1)) { - mtx_init(&sio_lock, sio_driver_name, NULL, - (comconsole != -1) ? - MTX_SPIN | MTX_QUIET : MTX_SPIN); - atomic_store_rel_int(&sio_inited, 2); - } - -#if 0 - /* - * XXX this is broken - when we are first called, there are no - * previously configured IO ports. We could hard code - * 0x3f8, 0x2f8, 0x3e8, 0x2e8 etc but that's probably worse. - * This code has been doing nothing since the conversion since - * "count" is zero the first time around. - */ - if (!already_init) { - /* - * Turn off MCR_IENABLE for all likely serial ports. An unused - * port with its MCR_IENABLE gate open will inhibit interrupts - * from any used port that shares the interrupt vector. - * XXX the gate enable is elsewhere for some multiports. - */ - device_t *devs; - int count, i, xioport; -#ifdef PC98 - int xiftype; -#endif - - devclass_get_devices(sio_devclass, &devs, &count); -#ifdef PC98 - for (i = 0; i < count; i++) { - xdev = devs[i]; - xioport = bus_get_resource_start(xdev, SYS_RES_IOPORT, 0); - xiftype = GET_IFTYPE(device_get_flags(xdev)); - if (device_is_enabled(xdev) && xioport > 0) { - if (IS_8251(xiftype)) - outb((xioport & 0xff00) | PC98SIO_cmd_port(xiftype & 0x0f), 0xf2); - else - outb(xioport + if_16550a_type[xiftype & 0x0f].iat[com_mcr], 0); - } - } -#else - for (i = 0; i < count; i++) { - xdev = devs[i]; - if (device_is_enabled(xdev) && - bus_get_resource(xdev, SYS_RES_IOPORT, 0, &xioport, - NULL) == 0) - outb(xioport + com_mcr, 0); - } -#endif - free(devs, M_TEMP); - already_init = TRUE; - } -#endif - - if (COM_LLCONSOLE(flags)) { - printf("sio%d: reserved for low-level i/o\n", - device_get_unit(dev)); - bus_release_resource(dev, SYS_RES_IOPORT, rid, port); - device_set_softc(dev, NULL); - free(com, M_DEVBUF); - return (ENXIO); - } - -#ifdef PC98 - DELAY(10); - - /* - * If the port is i8251 UART (internal, B98_01) - */ - if (pc98_check_if_type(dev, &iod) == -1) { - bus_release_resource(dev, SYS_RES_IOPORT, rid, port); - device_set_softc(dev, NULL); - free(com, M_DEVBUF); - return (ENXIO); - } - if (iod.irq > 0) - bus_set_resource(dev, SYS_RES_IRQ, 0, iod.irq, 1); - if (IS_8251(iod.if_type)) { - outb(iod.cmd, 0); - DELAY(10); - outb(iod.cmd, 0); - DELAY(10); - outb(iod.cmd, 0); - DELAY(10); - outb(iod.cmd, CMD8251_RESET); - DELAY(1000); /* for a while...*/ - outb(iod.cmd, 0xf2); /* MODE (dummy) */ - DELAY(10); - outb(iod.cmd, 0x01); /* CMD (dummy) */ - DELAY(1000); /* for a while...*/ - if (( inb(iod.sts) & STS8251_TxEMP ) == 0 ) { - result = (ENXIO); - } - if (if_8251_type[iod.if_type & 0x0f].check_irq) { - COM_INT_DISABLE - tmp = ( inb( iod.ctrl ) & ~(IEN_Rx|IEN_TxEMP|IEN_Tx)); - outb( iod.ctrl, tmp|IEN_TxEMP ); - DELAY(10); - result = isa_irq_pending() ? 0 : ENXIO; - outb( iod.ctrl, tmp ); - COM_INT_ENABLE - } else { - /* - * B98_01 doesn't activate TxEMP interrupt line - * when being reset, so we can't check irq pending. - */ - result = 0; - } - bus_release_resource(dev, SYS_RES_IOPORT, rid, port); - if (result) { - device_set_softc(dev, NULL); - free(com, M_DEVBUF); - } - return result; - } -#endif /* PC98 */ - /* - * If the device is on a multiport card and has an AST/4 - * compatible interrupt control register, initialize this - * register and prepare to leave MCR_IENABLE clear in the mcr. - * Otherwise, prepare to set MCR_IENABLE in the mcr. - * Point idev to the device struct giving the correct id_irq. - * This is the struct for the master device if there is one. - */ - idev = dev; - mcr_image = MCR_IENABLE; -#ifdef COM_MULTIPORT - if (COM_ISMULTIPORT(flags)) { -#ifndef PC98 - Port_t xiobase; - u_long io; -#endif - - idev = devclass_get_device(sio_devclass, COM_MPMASTER(flags)); - if (idev == NULL) { - printf("sio%d: master device %d not configured\n", - device_get_unit(dev), COM_MPMASTER(flags)); - idev = dev; - } -#ifndef PC98 - if (!COM_NOTAST4(flags)) { - if (bus_get_resource(idev, SYS_RES_IOPORT, 0, &io, - NULL) == 0) { - xiobase = io; - if (bus_get_resource(idev, SYS_RES_IRQ, 0, - NULL, NULL) == 0) - outb(xiobase + com_scr, 0x80); - else - outb(xiobase + com_scr, 0); - } - mcr_image = 0; - } -#endif - } -#endif /* COM_MULTIPORT */ - if (bus_get_resource(idev, SYS_RES_IRQ, 0, NULL, NULL) != 0) - mcr_image = 0; - - bzero(failures, sizeof failures); - iobase = rman_get_start(port); - -#ifdef PC98 - if (iod.if_type == COM_IF_RSA98III) { - mcr_image = 0; - - outb(iobase + rsa_msr, 0x04); - outb(iobase + rsa_frr, 0x00); - if ((inb(iobase + rsa_srr) & 0x36) != 0x36) { - bus_release_resource(dev, SYS_RES_IOPORT, rid, port); - device_set_softc(dev, NULL); - free(com, M_DEVBUF); - return (ENXIO); - } - outb(iobase + rsa_ier, 0x00); - outb(iobase + rsa_frr, 0x00); - outb(iobase + rsa_tivsr, 0x00); - outb(iobase + rsa_tcr, 0x00); - } - - tmp = if_16550a_type[iod.if_type & 0x0f].irr_write; - if (tmp != -1) { - /* MC16550II */ - int irqout; - switch (isa_get_irq(idev)) { - case 3: irqout = 4; break; - case 5: irqout = 5; break; - case 6: irqout = 6; break; - case 12: irqout = 7; break; - default: - printf("sio%d: irq configuration error\n", - device_get_unit(dev)); - bus_release_resource(dev, SYS_RES_IOPORT, rid, port); - device_set_softc(dev, NULL); - free(com, M_DEVBUF); - return (ENXIO); - } - outb((iobase & 0x00ff) | tmp, irqout); - } -#endif - - /* - * We don't want to get actual interrupts, just masked ones. - * Interrupts from this line should already be masked in the ICU, - * but mask them in the processor as well in case there are some - * (misconfigured) shared interrupts. - */ - mtx_lock_spin(&sio_lock); -/* EXTRA DELAY? */ - - /* - * Initialize the speed and the word size and wait long enough to - * drain the maximum of 16 bytes of junk in device output queues. - * The speed is undefined after a master reset and must be set - * before relying on anything related to output. There may be - * junk after a (very fast) soft reboot and (apparently) after - * master reset. - * XXX what about the UART bug avoided by waiting in comparam()? - * We don't want to to wait long enough to drain at 2 bps. - */ - if (iobase == siocniobase) - DELAY((16 + 1) * 1000000 / (comdefaultrate / 10)); - else { - sio_setreg(com, com_cfcr, CFCR_DLAB | CFCR_8BITS); - divisor = siodivisor(rclk, SIO_TEST_SPEED); - sio_setreg(com, com_dlbl, divisor & 0xff); - sio_setreg(com, com_dlbh, divisor >> 8); - sio_setreg(com, com_cfcr, CFCR_8BITS); - DELAY((16 + 1) * 1000000 / (SIO_TEST_SPEED / 10)); - } - - /* - * Enable the interrupt gate and disable device interrupts. This - * should leave the device driving the interrupt line low and - * guarantee an edge trigger if an interrupt can be generated. - */ -/* EXTRA DELAY? */ - sio_setreg(com, com_mcr, mcr_image); - sio_setreg(com, com_ier, 0); - DELAY(1000); /* XXX */ - irqmap[0] = isa_irq_pending(); - - /* - * Attempt to set loopback mode so that we can send a null byte - * without annoying any external device. - */ -/* EXTRA DELAY? */ - sio_setreg(com, com_mcr, mcr_image | MCR_LOOPBACK); - - /* - * Attempt to generate an output interrupt. On 8250's, setting - * IER_ETXRDY generates an interrupt independent of the current - * setting and independent of whether the THR is empty. On 16450's, - * setting IER_ETXRDY generates an interrupt independent of the - * current setting. On 16550A's, setting IER_ETXRDY only - * generates an interrupt when IER_ETXRDY is not already set. - */ - sio_setreg(com, com_ier, IER_ETXRDY); -#ifdef PC98 - if (iod.if_type == COM_IF_RSA98III) - outb(iobase + rsa_ier, 0x04); -#endif - - /* - * On some 16x50 incompatibles, setting IER_ETXRDY doesn't generate - * an interrupt. They'd better generate one for actually doing - * output. Loopback may be broken on the same incompatibles but - * it's unlikely to do more than allow the null byte out. - */ - sio_setreg(com, com_data, 0); - if (iobase == siocniobase) - DELAY((1 + 2) * 1000000 / (comdefaultrate / 10)); - else - DELAY((1 + 2) * 1000000 / (SIO_TEST_SPEED / 10)); - - /* - * Turn off loopback mode so that the interrupt gate works again - * (MCR_IENABLE was hidden). This should leave the device driving - * an interrupt line high. It doesn't matter if the interrupt - * line oscillates while we are not looking at it, since interrupts - * are disabled. - */ -/* EXTRA DELAY? */ - sio_setreg(com, com_mcr, mcr_image); - - /* - * It seems my Xircom CBEM56G Cardbus modem wants to be reset - * to 8 bits *again*, or else probe test 0 will fail. - * gwk@sgi.com, 4/19/2001 - */ - sio_setreg(com, com_cfcr, CFCR_8BITS); - - /* - * Some PCMCIA cards (Palido 321s, DC-1S, ...) have the "TXRDY bug", - * so we probe for a buggy IIR_TXRDY implementation even in the - * noprobe case. We don't probe for it in the !noprobe case because - * noprobe is always set for PCMCIA cards and the problem is not - * known to affect any other cards. - */ - if (noprobe) { - /* Read IIR a few times. */ - for (fn = 0; fn < 2; fn ++) { - DELAY(10000); - failures[6] = sio_getreg(com, com_iir); - } - - /* IIR_TXRDY should be clear. Is it? */ - result = 0; - if (failures[6] & IIR_TXRDY) { - /* - * No. We seem to have the bug. Does our fix for - * it work? - */ - sio_setreg(com, com_ier, 0); - if (sio_getreg(com, com_iir) & IIR_NOPEND) { - /* Yes. We discovered the TXRDY bug! */ - SET_FLAG(dev, COM_C_IIR_TXRDYBUG); - } else { - /* No. Just fail. XXX */ - result = ENXIO; - sio_setreg(com, com_mcr, 0); - } - } else { - /* Yes. No bug. */ - CLR_FLAG(dev, COM_C_IIR_TXRDYBUG); - } - sio_setreg(com, com_ier, 0); - sio_setreg(com, com_cfcr, CFCR_8BITS); - mtx_unlock_spin(&sio_lock); - bus_release_resource(dev, SYS_RES_IOPORT, rid, port); - if (iobase == siocniobase) - result = 0; - if (result != 0) { - device_set_softc(dev, NULL); - free(com, M_DEVBUF); - } - return (result); - } - - /* - * Check that - * o the CFCR, IER and MCR in UART hold the values written to them - * (the values happen to be all distinct - this is good for - * avoiding false positive tests from bus echoes). - * o an output interrupt is generated and its vector is correct. - * o the interrupt goes away when the IIR in the UART is read. - */ -/* EXTRA DELAY? */ - failures[0] = sio_getreg(com, com_cfcr) - CFCR_8BITS; - failures[1] = sio_getreg(com, com_ier) - IER_ETXRDY; - failures[2] = sio_getreg(com, com_mcr) - mcr_image; - DELAY(10000); /* Some internal modems need this time */ - irqmap[1] = isa_irq_pending(); - failures[4] = (sio_getreg(com, com_iir) & IIR_IMASK) - IIR_TXRDY; -#ifdef PC98 - if (iod.if_type == COM_IF_RSA98III) - inb(iobase + rsa_srr); -#endif - DELAY(1000); /* XXX */ - irqmap[2] = isa_irq_pending(); - failures[6] = (sio_getreg(com, com_iir) & IIR_IMASK) - IIR_NOPEND; -#ifdef PC98 - if (iod.if_type == COM_IF_RSA98III) - inb(iobase + rsa_srr); -#endif - - /* - * Turn off all device interrupts and check that they go off properly. - * Leave MCR_IENABLE alone. For ports without a master port, it gates - * the OUT2 output of the UART to - * the ICU input. Closing the gate would give a floating ICU input - * (unless there is another device driving it) and spurious interrupts. - * (On the system that this was first tested on, the input floats high - * and gives a (masked) interrupt as soon as the gate is closed.) - */ - sio_setreg(com, com_ier, 0); - sio_setreg(com, com_cfcr, CFCR_8BITS); /* dummy to avoid bus echo */ - failures[7] = sio_getreg(com, com_ier); -#ifdef PC98 - if (iod.if_type == COM_IF_RSA98III) - outb(iobase + rsa_ier, 0x00); -#endif - DELAY(1000); /* XXX */ - irqmap[3] = isa_irq_pending(); - failures[9] = (sio_getreg(com, com_iir) & IIR_IMASK) - IIR_NOPEND; -#ifdef PC98 - if (iod.if_type == COM_IF_RSA98III) { - inb(iobase + rsa_srr); - outb(iobase + rsa_frr, 0x00); - } -#endif - - mtx_unlock_spin(&sio_lock); - - irqs = irqmap[1] & ~irqmap[0]; - if (bus_get_resource(idev, SYS_RES_IRQ, 0, &xirq, NULL) == 0 && - ((1 << xirq) & irqs) == 0) { - printf( - "sio%d: configured irq %ld not in bitmap of probed irqs %#x\n", - device_get_unit(dev), xirq, irqs); - printf( - "sio%d: port may not be enabled\n", - device_get_unit(dev)); - } - if (bootverbose) - printf("sio%d: irq maps: %#x %#x %#x %#x\n", - device_get_unit(dev), - irqmap[0], irqmap[1], irqmap[2], irqmap[3]); - - result = 0; - for (fn = 0; fn < sizeof failures; ++fn) - if (failures[fn]) { - sio_setreg(com, com_mcr, 0); - result = ENXIO; - if (bootverbose) { - printf("sio%d: probe failed test(s):", - device_get_unit(dev)); - for (fn = 0; fn < sizeof failures; ++fn) - if (failures[fn]) - printf(" %d", fn); - printf("\n"); - } - break; - } - bus_release_resource(dev, SYS_RES_IOPORT, rid, port); - if (iobase == siocniobase) - result = 0; - if (result != 0) { - device_set_softc(dev, NULL); - free(com, M_DEVBUF); - } - return (result); -} - -#ifdef COM_ESP -static int -espattach(com, esp_port) - struct com_s *com; - Port_t esp_port; -{ - u_char dips; - u_char val; - - /* - * Check the ESP-specific I/O port to see if we're an ESP - * card. If not, return failure immediately. - */ - if ((inb(esp_port) & 0xf3) == 0) { - printf(" port 0x%x is not an ESP board?\n", esp_port); - return (0); - } - - /* - * We've got something that claims to be a Hayes ESP card. - * Let's hope so. - */ - - /* Get the dip-switch configuration */ -#ifdef PC98 - outb(esp_port + ESP98_CMD1, ESP_GETDIPS); - dips = inb(esp_port + ESP98_STATUS1); -#else - outb(esp_port + ESP_CMD1, ESP_GETDIPS); - dips = inb(esp_port + ESP_STATUS1); -#endif - - /* - * Bits 0,1 of dips say which COM port we are. - */ -#ifdef PC98 - if ((rman_get_start(com->ioportres) & 0xff) == - likely_com_ports[dips & 0x03]) -#else - if (rman_get_start(com->ioportres) == likely_com_ports[dips & 0x03]) -#endif - printf(" : ESP"); - else { - printf(" esp_port has com %d\n", dips & 0x03); - return (0); - } - - /* - * Check for ESP version 2.0 or later: bits 4,5,6 = 010. - */ -#ifdef PC98 - outb(esp_port + ESP98_CMD1, ESP_GETTEST); - val = inb(esp_port + ESP98_STATUS1); /* clear reg 1 */ - val = inb(esp_port + ESP98_STATUS2); -#else - outb(esp_port + ESP_CMD1, ESP_GETTEST); - val = inb(esp_port + ESP_STATUS1); /* clear reg 1 */ - val = inb(esp_port + ESP_STATUS2); -#endif - if ((val & 0x70) < 0x20) { - printf("-old (%o)", val & 0x70); - return (0); - } - - /* - * Check for ability to emulate 16550: bit 7 == 1 - */ - if ((dips & 0x80) == 0) { - printf(" slave"); - return (0); - } - - /* - * Okay, we seem to be a Hayes ESP card. Whee. - */ - com->esp = TRUE; - com->esp_port = esp_port; - return (1); -} -#endif /* COM_ESP */ - -int -sioattach(dev, xrid, rclk) - device_t dev; - int xrid; - u_long rclk; -{ - struct com_s *com; -#ifdef COM_ESP - Port_t *espp; -#endif - Port_t iobase; - int unit; - u_int flags; - int rid; - struct resource *port; - int ret; - int error; - struct tty *tp; -#ifdef PC98 - u_char *obuf; - u_long obufsize; - int if_type = GET_IFTYPE(device_get_flags(dev)); -#endif - - rid = xrid; -#ifdef PC98 - if (IS_8251(if_type)) { - port = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, - RF_ACTIVE); - } else if (if_type == COM_IF_MODEM_CARD || - if_type == COM_IF_RSA98III || - isa_get_vendorid(dev)) { - port = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, - if_16550a_type[if_type & 0x0f].iatsz, RF_ACTIVE); - } else { - port = isa_alloc_resourcev(dev, SYS_RES_IOPORT, &rid, - if_16550a_type[if_type & 0x0f].iat, - if_16550a_type[if_type & 0x0f].iatsz, RF_ACTIVE); - } -#else - port = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, &rid, - IO_COMSIZE, RF_ACTIVE); -#endif - if (!port) - return (ENXIO); -#ifdef PC98 - if (!IS_8251(if_type)) { - if (isa_load_resourcev(port, - if_16550a_type[if_type & 0x0f].iat, - if_16550a_type[if_type & 0x0f].iatsz) != 0) { - bus_release_resource(dev, SYS_RES_IOPORT, rid, port); - return ENXIO; - } - } -#endif - - iobase = rman_get_start(port); - unit = device_get_unit(dev); - com = device_get_softc(dev); - flags = device_get_flags(dev); - - if (unit >= sio_numunits) - sio_numunits = unit + 1; - -#ifdef PC98 - obufsize = 256; - if (if_type == COM_IF_RSA98III) - obufsize = 2048; - if ((obuf = malloc(obufsize * 2, M_DEVBUF, M_NOWAIT)) == NULL) { - bus_release_resource(dev, SYS_RES_IOPORT, rid, port); - return ENXIO; - } - bzero(obuf, obufsize * 2); -#endif - - /* - * sioprobe() has initialized the device registers as follows: - * o cfcr = CFCR_8BITS. - * It is most important that CFCR_DLAB is off, so that the - * data port is not hidden when we enable interrupts. - * o ier = 0. - * Interrupts are only enabled when the line is open. - * o mcr = MCR_IENABLE, or 0 if the port has AST/4 compatible - * interrupt control register or the config specifies no irq. - * Keeping MCR_DTR and MCR_RTS off might stop the external - * device from sending before we are ready. - */ - bzero(com, sizeof *com); - com->unit = unit; - com->ioportres = port; - com->ioportrid = rid; - com->bst = rman_get_bustag(port); - com->bsh = rman_get_bushandle(port); - com->cfcr_image = CFCR_8BITS; - com->loses_outints = COM_LOSESOUTINTS(flags) != 0; - com->no_irq = bus_get_resource(dev, SYS_RES_IRQ, 0, NULL, NULL) != 0; - com->tx_fifo_size = 1; -#ifdef PC98 - com->obufsize = obufsize; - com->obuf1 = obuf; - com->obuf2 = obuf + obufsize; -#endif - com->obufs[0].l_head = com->obuf1; - com->obufs[1].l_head = com->obuf2; - -#ifdef PC98 - com->pc98_if_type = if_type; - - if (IS_8251(if_type)) { - pc98_set_ioport(com); - - if (if_type == COM_IF_INTERNAL && pc98_check_8251fifo()) { - com->pc98_8251fifo = 1; - com->pc98_8251fifo_enable = 0; - } - } else { - bus_addr_t *iat = if_16550a_type[if_type & 0x0f].iat; - - com->data_port = iobase + iat[com_data]; - com->int_ctl_port = iobase + iat[com_ier]; - com->int_id_port = iobase + iat[com_iir]; - com->modem_ctl_port = iobase + iat[com_mcr]; - com->mcr_image = inb(com->modem_ctl_port); - com->line_status_port = iobase + iat[com_lsr]; - com->modem_status_port = iobase + iat[com_msr]; - } -#else /* not PC98 */ - com->data_port = iobase + com_data; - com->int_ctl_port = iobase + com_ier; - com->int_id_port = iobase + com_iir; - com->modem_ctl_port = iobase + com_mcr; - com->mcr_image = inb(com->modem_ctl_port); - com->line_status_port = iobase + com_lsr; - com->modem_status_port = iobase + com_msr; -#endif - - tp = com->tp = ttyalloc(); - tp->t_oproc = comstart; - tp->t_param = comparam; - tp->t_stop = comstop; - tp->t_modem = commodem; - tp->t_break = combreak; - tp->t_close = comclose; - tp->t_open = comopen; - tp->t_sc = com; - -#ifdef PC98 - if (!IS_8251(if_type) && rclk == 0) - rclk = if_16550a_type[if_type & 0x0f].rclk; -#else - if (rclk == 0) - rclk = DEFAULT_RCLK; -#endif - com->rclk = rclk; - - if (unit == comconsole) - ttyconsolemode(tp, comdefaultrate); - error = siosetwater(com, tp->t_init_in.c_ispeed); - mtx_unlock_spin(&sio_lock); - if (error) { - /* - * Leave i/o resources allocated if this is a `cn'-level - * console, so that other devices can't snarf them. - */ - if (iobase != siocniobase) - bus_release_resource(dev, SYS_RES_IOPORT, rid, port); - return (ENOMEM); - } - - /* attempt to determine UART type */ - printf("sio%d: type", unit); - -#ifndef PC98 - if (!COM_ISMULTIPORT(flags) && - !COM_IIR_TXRDYBUG(flags) && !COM_NOSCR(flags)) { - u_char scr; - u_char scr1; - u_char scr2; - - scr = sio_getreg(com, com_scr); - sio_setreg(com, com_scr, 0xa5); - scr1 = sio_getreg(com, com_scr); - sio_setreg(com, com_scr, 0x5a); - scr2 = sio_getreg(com, com_scr); - sio_setreg(com, com_scr, scr); - if (scr1 != 0xa5 || scr2 != 0x5a) { - printf(" 8250 or not responding"); - goto determined_type; - } - } -#endif /* !PC98 */ -#ifdef PC98 - if (IS_8251(com->pc98_if_type)) { - if (com->pc98_8251fifo && !COM_NOFIFO(flags)) - com->tx_fifo_size = 16; - com_int_TxRx_disable( com ); - com_cflag_and_speed_set( com, tp->t_init_in.c_cflag, comdefaultrate ); - com_tiocm_bic( com, TIOCM_DTR|TIOCM_RTS|TIOCM_LE ); - com_send_break_off( com ); - - if (com->pc98_if_type == COM_IF_INTERNAL) { - printf(" (internal%s%s)", - com->pc98_8251fifo ? " fifo" : "", - PC98SIO_baud_rate_port(com->pc98_if_type) != -1 ? - " v-fast" : ""); - } else { - printf(" 8251%s", if_8251_type[com->pc98_if_type & 0x0f].name); - } - } else { -#endif /* PC98 */ - sio_setreg(com, com_fifo, FIFO_ENABLE | FIFO_RX_HIGH); - DELAY(100); - switch (inb(com->int_id_port) & IIR_FIFO_MASK) { - case FIFO_RX_LOW: - printf(" 16450"); - break; - case FIFO_RX_MEDL: - printf(" 16450?"); - break; - case FIFO_RX_MEDH: - printf(" 16550?"); - break; - case FIFO_RX_HIGH: - if (COM_NOFIFO(flags)) { - printf(" 16550A fifo disabled"); - break; - } - com->hasfifo = TRUE; -#ifdef PC98 - if (com->pc98_if_type == COM_IF_RSA98III) { - com->tx_fifo_size = 2048; - com->rsabase = iobase; - outb(com->rsabase + rsa_ier, 0x00); - outb(com->rsabase + rsa_frr, 0x00); - } -#else - if (COM_ST16650A(flags)) { - printf(" ST16650A"); - com->st16650a = TRUE; - com->tx_fifo_size = 32; - break; - } - if (COM_TI16754(flags)) { - printf(" TI16754"); - com->tx_fifo_size = 64; - break; - } -#endif - printf(" 16550A"); -#ifdef COM_ESP -#ifdef PC98 - if (com->pc98_if_type == COM_IF_ESP98) -#endif - for (espp = likely_esp_ports; *espp != 0; espp++) - if (espattach(com, *espp)) { - com->tx_fifo_size = 1024; - break; - } - if (com->esp) - break; -#endif -#ifdef PC98 - com->tx_fifo_size = 16; -#else - com->tx_fifo_size = COM_FIFOSIZE(flags); - if (com->tx_fifo_size == 0) - com->tx_fifo_size = 16; - else - printf(" lookalike with %u bytes FIFO", - com->tx_fifo_size); -#endif - break; - } - -#ifdef PC98 - if (com->pc98_if_type == COM_IF_RSB3000) { - /* Set RSB-2000/3000 Extended Buffer mode. */ - u_char lcr; - lcr = sio_getreg(com, com_cfcr); - sio_setreg(com, com_cfcr, lcr | CFCR_DLAB); - sio_setreg(com, com_emr, EMR_EXBUFF | EMR_EFMODE); - sio_setreg(com, com_cfcr, lcr); - } -#endif - -#ifdef COM_ESP - if (com->esp) { - /* - * Set 16550 compatibility mode. - * We don't use the ESP_MODE_SCALE bit to increase the - * fifo trigger levels because we can't handle large - * bursts of input. - * XXX flow control should be set in comparam(), not here. - */ -#ifdef PC98 - outb(com->esp_port + ESP98_CMD1, ESP_SETMODE); - outb(com->esp_port + ESP98_CMD2, ESP_MODE_RTS | ESP_MODE_FIFO); -#else - outb(com->esp_port + ESP_CMD1, ESP_SETMODE); - outb(com->esp_port + ESP_CMD2, ESP_MODE_RTS | ESP_MODE_FIFO); -#endif - - /* Set RTS/CTS flow control. */ -#ifdef PC98 - outb(com->esp_port + ESP98_CMD1, ESP_SETFLOWTYPE); - outb(com->esp_port + ESP98_CMD2, ESP_FLOW_RTS); - outb(com->esp_port + ESP98_CMD2, ESP_FLOW_CTS); -#else - outb(com->esp_port + ESP_CMD1, ESP_SETFLOWTYPE); - outb(com->esp_port + ESP_CMD2, ESP_FLOW_RTS); - outb(com->esp_port + ESP_CMD2, ESP_FLOW_CTS); -#endif - - /* Set flow-control levels. */ -#ifdef PC98 - outb(com->esp_port + ESP98_CMD1, ESP_SETRXFLOW); - outb(com->esp_port + ESP98_CMD2, HIBYTE(768)); - outb(com->esp_port + ESP98_CMD2, LOBYTE(768)); - outb(com->esp_port + ESP98_CMD2, HIBYTE(512)); - outb(com->esp_port + ESP98_CMD2, LOBYTE(512)); -#else - outb(com->esp_port + ESP_CMD1, ESP_SETRXFLOW); - outb(com->esp_port + ESP_CMD2, HIBYTE(768)); - outb(com->esp_port + ESP_CMD2, LOBYTE(768)); - outb(com->esp_port + ESP_CMD2, HIBYTE(512)); - outb(com->esp_port + ESP_CMD2, LOBYTE(512)); -#endif - -#ifdef PC98 - /* Set UART clock prescaler. */ - outb(com->esp_port + ESP98_CMD1, ESP_SETCLOCK); - outb(com->esp_port + ESP98_CMD2, 2); /* 4 times */ -#endif - } -#endif /* COM_ESP */ - sio_setreg(com, com_fifo, 0); -#ifdef PC98 - printf("%s", if_16550a_type[com->pc98_if_type & 0x0f].name); -#else -determined_type: ; -#endif - -#ifdef COM_MULTIPORT - if (COM_ISMULTIPORT(flags)) { - device_t masterdev; - - com->multiport = TRUE; - printf(" (multiport"); - if (unit == COM_MPMASTER(flags)) - printf(" master"); - printf(")"); - masterdev = devclass_get_device(sio_devclass, - COM_MPMASTER(flags)); - com->no_irq = (masterdev == NULL || bus_get_resource(masterdev, - SYS_RES_IRQ, 0, NULL, NULL) != 0); - } -#endif /* COM_MULTIPORT */ -#ifdef PC98 - } -#endif - if (unit == comconsole) - printf(", console"); - if (COM_IIR_TXRDYBUG(flags)) - printf(" with a buggy IIR_TXRDY implementation"); - printf("\n"); - - if (sio_fast_ih == NULL) { - swi_add(&tty_intr_event, "sio", siopoll, NULL, SWI_TTY, 0, - &sio_fast_ih); - swi_add(&clk_intr_event, "sio", siopoll, NULL, SWI_CLOCK, 0, - &sio_slow_ih); - } - - com->flags = flags; - com->pps.ppscap = PPS_CAPTUREASSERT | PPS_CAPTURECLEAR; - tp->t_pps = &com->pps; - - if (COM_PPSCTS(flags)) - com->pps_bit = MSR_CTS; - else - com->pps_bit = MSR_DCD; - pps_init(&com->pps); - - rid = 0; - com->irqres = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE); - if (com->irqres) { - ret = bus_setup_intr(dev, com->irqres, - INTR_TYPE_TTY, - siointr, NULL, com, &com->cookie); - if (ret) { - ret = bus_setup_intr(dev, - com->irqres, INTR_TYPE_TTY, - NULL, (driver_intr_t *)siointr, - com, &com->cookie); - if (ret == 0) - device_printf(dev, "unable to activate interrupt in fast mode - using normal mode\n"); - } - if (ret) - device_printf(dev, "could not activate interrupt\n"); -#if defined(KDB) - /* - * Enable interrupts for early break-to-debugger support - * on the console. - */ - if (ret == 0 && unit == comconsole) - outb(siocniobase + com_ier, IER_ERXRDY | IER_ERLS | - IER_EMSC); -#endif - } - - /* We're ready, open the doors... */ - ttycreate(tp, TS_CALLOUT, "d%r", unit); - - return (0); -} - -static int -comopen(struct tty *tp, struct cdev *dev) -{ - struct com_s *com; - int i; - - com = tp->t_sc; - com->poll = com->no_irq; - com->poll_output = com->loses_outints; -#ifdef PC98 - if (IS_8251(com->pc98_if_type)) { - com_tiocm_bis(com, TIOCM_DTR|TIOCM_RTS); - pc98_msrint_start(dev); - if (com->pc98_8251fifo) { - com->pc98_8251fifo_enable = 1; - outb(I8251F_fcr, - FIFO_ENABLE | FIFO_XMT_RST | FIFO_RCV_RST); - } - } -#endif - if (com->hasfifo) { - /* - * (Re)enable and drain fifos. - * - * Certain SMC chips cause problems if the fifos - * are enabled while input is ready. Turn off the - * fifo if necessary to clear the input. We test - * the input ready bit after enabling the fifos - * since we've already enabled them in comparam() - * and to handle races between enabling and fresh - * input. - */ - for (i = 0; i < 500; i++) { - sio_setreg(com, com_fifo, - FIFO_RCV_RST | FIFO_XMT_RST | com->fifo_image); -#ifdef PC98 - if (com->pc98_if_type == COM_IF_RSA98III) - outb(com->rsabase + rsa_frr , 0x00); -#endif - /* - * XXX the delays are for superstitious - * historical reasons. It must be less than - * the character time at the maximum - * supported speed (87 usec at 115200 bps - * 8N1). Otherwise we might loop endlessly - * if data is streaming in. We used to use - * delays of 100. That usually worked - * because DELAY(100) used to usually delay - * for about 85 usec instead of 100. - */ - DELAY(50); -#ifdef PC98 - if (com->pc98_if_type == COM_IF_RSA98III ? - !(inb(com->rsabase + rsa_srr) & 0x08) : - !(inb(com->line_status_port) & LSR_RXRDY)) - break; -#else - if (!(inb(com->line_status_port) & LSR_RXRDY)) - break; -#endif - sio_setreg(com, com_fifo, 0); - DELAY(50); - (void) inb(com->data_port); - } - if (i == 500) - return (EIO); - } - - mtx_lock_spin(&sio_lock); -#ifdef PC98 - if (IS_8251(com->pc98_if_type)) { - com_tiocm_bis(com, TIOCM_LE); - com->pc98_prev_modem_status = pc98_get_modem_status(com); - com_int_Rx_enable(com); - } else { -#endif - (void) inb(com->line_status_port); - (void) inb(com->data_port); - com->prev_modem_status = com->last_modem_status - = inb(com->modem_status_port); - outb(com->int_ctl_port, - IER_ERXRDY | IER_ERLS | IER_EMSC - | (COM_IIR_TXRDYBUG(com->flags) ? 0 : IER_ETXRDY)); -#ifdef PC98 - if (com->pc98_if_type == COM_IF_RSA98III) { - outb(com->rsabase + rsa_ier, 0x1d); - outb(com->int_ctl_port, IER_ERLS | IER_EMSC); - } -#endif -#ifdef PC98 - } -#endif - mtx_unlock_spin(&sio_lock); - siosettimeout(); - /* XXX: should be generic ? */ -#ifdef PC98 - if ((IS_8251(com->pc98_if_type) && - (pc98_get_modem_status(com) & TIOCM_CAR)) || - (!IS_8251(com->pc98_if_type) && - (com->prev_modem_status & MSR_DCD)) || - ISCALLOUT(dev)) - ttyld_modem(tp, 1); -#else - if (com->prev_modem_status & MSR_DCD || ISCALLOUT(dev)) - ttyld_modem(tp, 1); -#endif - return (0); -} - -static void -comclose(tp) - struct tty *tp; -{ - int s; - struct com_s *com; - - s = spltty(); - com = tp->t_sc; - com->poll = FALSE; - com->poll_output = FALSE; -#ifdef PC98 - com_send_break_off(com); -#else - sio_setreg(com, com_cfcr, com->cfcr_image &= ~CFCR_SBREAK); -#endif - -#if defined(KDB) - /* - * Leave interrupts enabled and don't clear DTR if this is the - * console. This allows us to detect break-to-debugger events - * while the console device is closed. - */ - if (com->unit != comconsole) -#endif - { -#ifdef PC98 - int tmp; - if (IS_8251(com->pc98_if_type)) - com_int_TxRx_disable(com); - else - sio_setreg(com, com_ier, 0); - if (com->pc98_if_type == COM_IF_RSA98III) - outb(com->rsabase + rsa_ier, 0x00); - if (IS_8251(com->pc98_if_type)) - tmp = pc98_get_modem_status(com) & TIOCM_CAR; - else - tmp = com->prev_modem_status & MSR_DCD; -#else - sio_setreg(com, com_ier, 0); -#endif - if (tp->t_cflag & HUPCL - /* - * XXX we will miss any carrier drop between here and the - * next open. Perhaps we should watch DCD even when the - * port is closed; it is not sufficient to check it at - * the next open because it might go up and down while - * we're not watching. - */ - || (!tp->t_actout -#ifdef PC98 - && !(tmp) -#else - && !(com->prev_modem_status & MSR_DCD) -#endif - && !(tp->t_init_in.c_cflag & CLOCAL)) - || !(tp->t_state & TS_ISOPEN)) { -#ifdef PC98 - if (IS_8251(com->pc98_if_type)) - com_tiocm_bic(com, TIOCM_DTR|TIOCM_RTS|TIOCM_LE); - else -#endif - (void)commodem(tp, 0, SER_DTR); - ttydtrwaitstart(tp); - } -#ifdef PC98 - else { - if (IS_8251(com->pc98_if_type)) - com_tiocm_bic(com, TIOCM_LE); - } -#endif - } -#ifdef PC98 - if (com->pc98_8251fifo) { - if (com->pc98_8251fifo_enable) - outb(I8251F_fcr, FIFO_XMT_RST | FIFO_RCV_RST); - com->pc98_8251fifo_enable = 0; - } -#endif - if (com->hasfifo) { - /* - * Disable fifos so that they are off after controlled - * reboots. Some BIOSes fail to detect 16550s when the - * fifos are enabled. - */ - sio_setreg(com, com_fifo, 0); - } - tp->t_actout = FALSE; - wakeup(&tp->t_actout); - wakeup(TSA_CARR_ON(tp)); /* restart any wopeners */ - siosettimeout(); - splx(s); -} - -static void -siobusycheck(chan) - void *chan; -{ - struct com_s *com; - int s; - - com = (struct com_s *)chan; - - /* - * Clear TS_BUSY if low-level output is complete. - * spl locking is sufficient because siointr1() does not set CS_BUSY. - * If siointr1() clears CS_BUSY after we look at it, then we'll get - * called again. Reading the line status port outside of siointr1() - * is safe because CS_BUSY is clear so there are no output interrupts - * to lose. - */ - s = spltty(); - if (com->state & CS_BUSY) - com->extra_state &= ~CSE_BUSYCHECK; /* False alarm. */ -#ifdef PC98 - else if ((IS_8251(com->pc98_if_type) && - ((com->pc98_8251fifo_enable && - (inb(I8251F_lsr) & (FLSR_TxRDY | FLSR_TxEMP)) - == (FLSR_TxRDY | FLSR_TxEMP)) || - (!com->pc98_8251fifo_enable && - (inb(com->sts_port) & (STS8251_TxRDY | STS8251_TxEMP)) - == (STS8251_TxRDY | STS8251_TxEMP)))) || - ((inb(com->line_status_port) & (LSR_TSRE | LSR_TXRDY)) - == (LSR_TSRE | LSR_TXRDY))) { -#else - else if ((inb(com->line_status_port) & (LSR_TSRE | LSR_TXRDY)) - == (LSR_TSRE | LSR_TXRDY)) { -#endif - com->tp->t_state &= ~TS_BUSY; - ttwwakeup(com->tp); - com->extra_state &= ~CSE_BUSYCHECK; - } else - timeout(siobusycheck, com, hz / 100); - splx(s); -} - -static u_int -siodivisor(rclk, speed) - u_long rclk; - speed_t speed; -{ - long actual_speed; - u_int divisor; - int error; - - if (speed == 0) - return (0); -#if UINT_MAX > (ULONG_MAX - 1) / 8 - if (speed > (ULONG_MAX - 1) / 8) - return (0); -#endif - divisor = (rclk / (8UL * speed) + 1) / 2; - if (divisor == 0 || divisor >= 65536) - return (0); - actual_speed = rclk / (16UL * divisor); - - /* 10 times error in percent: */ - error = ((actual_speed - (long)speed) * 2000 / (long)speed + 1) / 2; - - /* 3.0% maximum error tolerance: */ - if (error < -30 || error > 30) - return (0); - - return (divisor); -} - -/* - * Call this function with the sio_lock mutex held. It will return with the - * lock still held. - */ -static void -sioinput(com) - struct com_s *com; -{ - u_char *buf; - int incc; - u_char line_status; - int recv_data; - struct tty *tp; - - buf = com->ibuf; - tp = com->tp; - if (!(tp->t_state & TS_ISOPEN) || !(tp->t_cflag & CREAD)) { - com_events -= (com->iptr - com->ibuf); - com->iptr = com->ibuf; - return; - } - if (tp->t_state & TS_CAN_BYPASS_L_RINT) { - /* - * Avoid the grotesquely inefficient lineswitch routine - * (ttyinput) in "raw" mode. It usually takes about 450 - * instructions (that's without canonical processing or echo!). - * slinput is reasonably fast (usually 40 instructions plus - * call overhead). - */ - do { - /* - * This may look odd, but it is using save-and-enable - * semantics instead of the save-and-disable semantics - * that are used everywhere else. - */ - mtx_unlock_spin(&sio_lock); - incc = com->iptr - buf; - if (tp->t_rawq.c_cc + incc > tp->t_ihiwat - && (com->state & CS_RTS_IFLOW - || tp->t_iflag & IXOFF) - && !(tp->t_state & TS_TBLOCK)) - ttyblock(tp); - com->delta_error_counts[CE_TTY_BUF_OVERFLOW] - += b_to_q((char *)buf, incc, &tp->t_rawq); - buf += incc; - tk_nin += incc; - tk_rawcc += incc; - tp->t_rawcc += incc; - ttwakeup(tp); - if (tp->t_state & TS_TTSTOP - && (tp->t_iflag & IXANY - || tp->t_cc[VSTART] == tp->t_cc[VSTOP])) { - tp->t_state &= ~TS_TTSTOP; - tp->t_lflag &= ~FLUSHO; - comstart(tp); - } - mtx_lock_spin(&sio_lock); - } while (buf < com->iptr); - } else { - do { - /* - * This may look odd, but it is using save-and-enable - * semantics instead of the save-and-disable semantics - * that are used everywhere else. - */ - mtx_unlock_spin(&sio_lock); - line_status = buf[com->ierroff]; - recv_data = *buf++; - if (line_status - & (LSR_BI | LSR_FE | LSR_OE | LSR_PE)) { - if (line_status & LSR_BI) - recv_data |= TTY_BI; - if (line_status & LSR_FE) - recv_data |= TTY_FE; - if (line_status & LSR_OE) - recv_data |= TTY_OE; - if (line_status & LSR_PE) - recv_data |= TTY_PE; - } - ttyld_rint(tp, recv_data); - mtx_lock_spin(&sio_lock); - } while (buf < com->iptr); - } - com_events -= (com->iptr - com->ibuf); - com->iptr = com->ibuf; - - /* - * There is now room for another low-level buffer full of input, - * so enable RTS if it is now disabled and there is room in the - * high-level buffer. - */ -#ifdef PC98 - if (IS_8251(com->pc98_if_type)) { - if ((com->state & CS_RTS_IFLOW) && - !(com_tiocm_get(com) & TIOCM_RTS) && - !(tp->t_state & TS_TBLOCK)) - com_tiocm_bis(com, TIOCM_RTS); - } else { - if ((com->state & CS_RTS_IFLOW) && - !(com->mcr_image & MCR_RTS) && - !(tp->t_state & TS_TBLOCK)) - outb(com->modem_ctl_port, com->mcr_image |= MCR_RTS); - } -#else - if ((com->state & CS_RTS_IFLOW) && !(com->mcr_image & MCR_RTS) && - !(tp->t_state & TS_TBLOCK)) - outb(com->modem_ctl_port, com->mcr_image |= MCR_RTS); -#endif -} - -static int -siointr(arg) - void *arg; -{ - struct com_s *com; -#if defined(PC98) && defined(COM_MULTIPORT) - u_char rsa_buf_status; -#endif - -#ifndef COM_MULTIPORT - com = (struct com_s *)arg; - - mtx_lock_spin(&sio_lock); - siointr1(com); - mtx_unlock_spin(&sio_lock); -#else /* COM_MULTIPORT */ - bool_t possibly_more_intrs; - int unit; - - /* - * Loop until there is no activity on any port. This is necessary - * to get an interrupt edge more than to avoid another interrupt. - * If the IRQ signal is just an OR of the IRQ signals from several - * devices, then the edge from one may be lost because another is - * on. - */ - mtx_lock_spin(&sio_lock); - do { - possibly_more_intrs = FALSE; - for (unit = 0; unit < sio_numunits; ++unit) { - com = com_addr(unit); - /* - * XXX COM_LOCK(); - * would it work here, or be counter-productive? - */ -#ifdef PC98 - if (com != NULL - && !com->gone - && IS_8251(com->pc98_if_type)) { - siointr1(com); - } else if (com != NULL - && !com->gone - && com->pc98_if_type == COM_IF_RSA98III) { - rsa_buf_status = - inb(com->rsabase + rsa_srr) & 0xc9; - if ((rsa_buf_status & 0xc8) - || !(rsa_buf_status & 0x01)) { - siointr1(com); - if (rsa_buf_status != - (inb(com->rsabase + rsa_srr) & 0xc9)) - possibly_more_intrs = TRUE; - } - } else -#endif - if (com != NULL - && !com->gone - && (inb(com->int_id_port) & IIR_IMASK) - != IIR_NOPEND) { - siointr1(com); - possibly_more_intrs = TRUE; - } - /* XXX COM_UNLOCK(); */ - } - } while (possibly_more_intrs); - mtx_unlock_spin(&sio_lock); -#endif /* COM_MULTIPORT */ - return (FILTER_HANDLED); -} - -static struct timespec siots[8]; -static int siotso; -static int volatile siotsunit = -1; - -static int -sysctl_siots(SYSCTL_HANDLER_ARGS) -{ - char buf[128]; - long long delta; - size_t len; - int error, i, tso; - - for (i = 1, tso = siotso; i < tso; i++) { - delta = (long long)(siots[i].tv_sec - siots[i - 1].tv_sec) * - 1000000000 + - (siots[i].tv_nsec - siots[i - 1].tv_nsec); - len = sprintf(buf, "%lld\n", delta); - if (delta >= 110000) - len += sprintf(buf + len - 1, ": *** %ld.%09ld\n", - (long)siots[i].tv_sec, siots[i].tv_nsec) - 1; - if (i == tso - 1) - buf[len - 1] = '\0'; - error = SYSCTL_OUT(req, buf, len); - if (error != 0) - return (error); - } - return (0); -} - -SYSCTL_PROC(_machdep, OID_AUTO, siots, CTLTYPE_STRING | CTLFLAG_RD, - 0, 0, sysctl_siots, "A", "sio timestamps"); - -static void -siointr1(com) - struct com_s *com; -{ - u_char int_ctl; - u_char int_ctl_new; - u_char line_status; - u_char modem_status; - u_char *ioptr; - u_char recv_data; -#ifdef PC98 - u_char tmp = 0; - u_char rsa_buf_status = 0; - int rsa_tx_fifo_size = 0; -#endif /* PC98 */ -#if defined(KDB) - int kdb_brk; - -again: -#endif - - if (COM_IIR_TXRDYBUG(com->flags)) { - int_ctl = inb(com->int_ctl_port); - int_ctl_new = int_ctl; - } else { - int_ctl = 0; - int_ctl_new = 0; - } - - while (!com->gone) { -#ifdef PC98 -status_read:; - if (IS_8251(com->pc98_if_type)) { - if (com->pc98_8251fifo_enable) - tmp = inb(I8251F_lsr); - else - tmp = inb(com->sts_port); -more_intr: - line_status = 0; - if (com->pc98_8251fifo_enable) { - if (tmp & FLSR_TxRDY) line_status |= LSR_TXRDY; - if (tmp & FLSR_RxRDY) line_status |= LSR_RXRDY; - if (tmp & FLSR_TxEMP) line_status |= LSR_TSRE; - if (tmp & FLSR_PE) line_status |= LSR_PE; - if (tmp & FLSR_OE) line_status |= LSR_OE; - if (tmp & FLSR_BI) line_status |= LSR_BI; - } else { - if (tmp & STS8251_TxRDY) line_status |= LSR_TXRDY; - if (tmp & STS8251_RxRDY) line_status |= LSR_RXRDY; - if (tmp & STS8251_TxEMP) line_status |= LSR_TSRE; - if (tmp & STS8251_PE) line_status |= LSR_PE; - if (tmp & STS8251_OE) line_status |= LSR_OE; - if (tmp & STS8251_FE) line_status |= LSR_FE; - if (tmp & STS8251_BI) line_status |= LSR_BI; - } - } else { -#endif /* PC98 */ - if (com->pps.ppsparam.mode & PPS_CAPTUREBOTH) { - modem_status = inb(com->modem_status_port); - if ((modem_status ^ com->last_modem_status) & - com->pps_bit) { - pps_capture(&com->pps); - pps_event(&com->pps, - (modem_status & com->pps_bit) ? - PPS_CAPTUREASSERT : PPS_CAPTURECLEAR); - } - } - line_status = inb(com->line_status_port); -#ifdef PC98 - } - if (com->pc98_if_type == COM_IF_RSA98III) - rsa_buf_status = inb(com->rsabase + rsa_srr); -#endif /* PC98 */ - - /* input event? (check first to help avoid overruns) */ -#ifndef PC98 - while (line_status & LSR_RCV_MASK) { -#else - while ((line_status & LSR_RCV_MASK) - || (com->pc98_if_type == COM_IF_RSA98III - && (rsa_buf_status & 0x08))) { -#endif /* PC98 */ - /* break/unnattached error bits or real input? */ -#ifdef PC98 - if (IS_8251(com->pc98_if_type)) { - if (com->pc98_8251fifo_enable) { - recv_data = inb(I8251F_data); - if (tmp & - (FLSR_PE | FLSR_OE | FLSR_BI)) { - pc98_i8251_or_cmd(com, CMD8251_ER); - recv_data = 0; - } - } else { - recv_data = inb(com->data_port); - if (tmp & (STS8251_PE | STS8251_OE | - STS8251_FE | STS8251_BI)) { - pc98_i8251_or_cmd(com, CMD8251_ER); - recv_data = 0; - } - } - } else if (com->pc98_if_type == COM_IF_RSA98III) { - if (!(rsa_buf_status & 0x08)) - recv_data = 0; - else - recv_data = inb(com->data_port); - } else -#endif - if (!(line_status & LSR_RXRDY)) - recv_data = 0; - else - recv_data = inb(com->data_port); -#ifdef KDB - if (com->unit == comconsole && - (kdb_brk = kdb_alt_break(recv_data, - &com->alt_brk_state)) != 0) { - goto again; - } -#endif /* KDB */ - if (line_status & (LSR_BI | LSR_FE | LSR_PE)) { - /* - * Don't store BI if IGNBRK or FE/PE if IGNPAR. - * Otherwise, push the work to a higher level - * (to handle PARMRK) if we're bypassing. - * Otherwise, convert BI/FE and PE+INPCK to 0. - * - * This makes bypassing work right in the - * usual "raw" case (IGNBRK set, and IGNPAR - * and INPCK clear). - * - * Note: BI together with FE/PE means just BI. - */ - if (line_status & LSR_BI) { -#if defined(KDB) - if (com->unit == comconsole) { - kdb_enter(KDB_WHY_BREAK, - "Line break on console"); - goto cont; - } -#endif - if (com->tp == NULL - || com->tp->t_iflag & IGNBRK) - goto cont; - } else { - if (com->tp == NULL - || com->tp->t_iflag & IGNPAR) - goto cont; - } - if (com->tp->t_state & TS_CAN_BYPASS_L_RINT - && (line_status & (LSR_BI | LSR_FE) - || com->tp->t_iflag & INPCK)) - recv_data = 0; - } - ++com->bytes_in; - if (com->tp != NULL && - com->tp->t_hotchar != 0 && recv_data == com->tp->t_hotchar) - swi_sched(sio_fast_ih, 0); - ioptr = com->iptr; - if (ioptr >= com->ibufend) - CE_RECORD(com, CE_INTERRUPT_BUF_OVERFLOW); - else { - if (com->tp != NULL && com->tp->t_do_timestamp) - microtime(&com->tp->t_timestamp); - ++com_events; - swi_sched(sio_slow_ih, SWI_DELAY); -#if 0 /* for testing input latency vs efficiency */ -if (com->iptr - com->ibuf == 8) - swi_sched(sio_fast_ih, 0); -#endif - ioptr[0] = recv_data; - ioptr[com->ierroff] = line_status; - com->iptr = ++ioptr; - if (ioptr == com->ihighwater - && com->state & CS_RTS_IFLOW) -#ifdef PC98 - IS_8251(com->pc98_if_type) ? - com_tiocm_bic(com, TIOCM_RTS) : -#endif - outb(com->modem_ctl_port, - com->mcr_image &= ~MCR_RTS); - if (line_status & LSR_OE) - CE_RECORD(com, CE_OVERRUN); - } -cont: - if (line_status & LSR_TXRDY - && com->state >= (CS_BUSY | CS_TTGO | CS_ODEVREADY)) - goto txrdy; - - /* - * "& 0x7F" is to avoid the gcc-1.40 generating a slow - * jump from the top of the loop to here - */ -#ifdef PC98 - if (IS_8251(com->pc98_if_type)) - goto status_read; - else -#endif - line_status = inb(com->line_status_port) & 0x7F; -#ifdef PC98 - if (com->pc98_if_type == COM_IF_RSA98III) - rsa_buf_status = inb(com->rsabase + rsa_srr); -#endif /* PC98 */ - } - - /* modem status change? (always check before doing output) */ -#ifdef PC98 - if (!IS_8251(com->pc98_if_type)) { -#endif - modem_status = inb(com->modem_status_port); - if (modem_status != com->last_modem_status) { - /* - * Schedule high level to handle DCD changes. Note - * that we don't use the delta bits anywhere. Some - * UARTs mess them up, and it's easy to remember the - * previous bits and calculate the delta. - */ - com->last_modem_status = modem_status; - if (!(com->state & CS_CHECKMSR)) { - com_events += LOTS_OF_EVENTS; - com->state |= CS_CHECKMSR; - swi_sched(sio_fast_ih, 0); - } - - /* handle CTS change immediately for crisp flow ctl */ - if (com->state & CS_CTS_OFLOW) { - if (modem_status & MSR_CTS) - com->state |= CS_ODEVREADY; - else - com->state &= ~CS_ODEVREADY; - } - } -#ifdef PC98 - } -#endif - -txrdy: - /* output queued and everything ready? */ -#ifndef PC98 - if (line_status & LSR_TXRDY - && com->state >= (CS_BUSY | CS_TTGO | CS_ODEVREADY)) { -#else - if (((com->pc98_if_type == COM_IF_RSA98III) - ? (rsa_buf_status & 0x02) - : (line_status & LSR_TXRDY)) - && com->state >= (CS_BUSY | CS_TTGO | CS_ODEVREADY)) { -#endif -#ifdef PC98 - Port_t tmp_data_port; - - if (IS_8251(com->pc98_if_type) && - com->pc98_8251fifo_enable) - tmp_data_port = I8251F_data; - else - tmp_data_port = com->data_port; -#endif - - ioptr = com->obufq.l_head; - if (com->tx_fifo_size > 1 && com->unit != siotsunit) { - u_int ocount; - - ocount = com->obufq.l_tail - ioptr; -#ifdef PC98 - if (com->pc98_if_type == COM_IF_RSA98III) { - rsa_buf_status = inb(com->rsabase + rsa_srr); - rsa_tx_fifo_size = 1024; - if (!(rsa_buf_status & 0x01)) - rsa_tx_fifo_size = 2048; - if (ocount > rsa_tx_fifo_size) - ocount = rsa_tx_fifo_size; - } else -#endif - if (ocount > com->tx_fifo_size) - ocount = com->tx_fifo_size; - com->bytes_out += ocount; - do -#ifdef PC98 - outb(tmp_data_port, *ioptr++); -#else - outb(com->data_port, *ioptr++); -#endif - while (--ocount != 0); - } else { -#ifdef PC98 - outb(tmp_data_port, *ioptr++); -#else - outb(com->data_port, *ioptr++); -#endif - ++com->bytes_out; - if (com->unit == siotsunit - && siotso < sizeof siots / sizeof siots[0]) - nanouptime(&siots[siotso++]); - } -#ifdef PC98 - if (IS_8251(com->pc98_if_type)) - if (!(pc98_check_i8251_interrupt(com) & IEN_TxFLAG)) - com_int_Tx_enable(com); -#endif - com->obufq.l_head = ioptr; - if (COM_IIR_TXRDYBUG(com->flags)) - int_ctl_new = int_ctl | IER_ETXRDY; - if (ioptr >= com->obufq.l_tail) { - struct lbq *qp; - - qp = com->obufq.l_next; - qp->l_queued = FALSE; - qp = qp->l_next; - if (qp != NULL) { - com->obufq.l_head = qp->l_head; - com->obufq.l_tail = qp->l_tail; - com->obufq.l_next = qp; - } else { - /* output just completed */ - if (COM_IIR_TXRDYBUG(com->flags)) - int_ctl_new = int_ctl - & ~IER_ETXRDY; - com->state &= ~CS_BUSY; -#if defined(PC98) - if (IS_8251(com->pc98_if_type) && - pc98_check_i8251_interrupt(com) & IEN_TxFLAG) - com_int_Tx_disable(com); -#endif - } - if (!(com->state & CS_ODONE)) { - com_events += LOTS_OF_EVENTS; - com->state |= CS_ODONE; - /* handle at high level ASAP */ - swi_sched(sio_fast_ih, 0); - } - } -#ifdef PC98 - if (COM_IIR_TXRDYBUG(com->flags) - && int_ctl != int_ctl_new) { - if (com->pc98_if_type == COM_IF_RSA98III) { - int_ctl_new &= ~(IER_ETXRDY | IER_ERXRDY); - outb(com->int_ctl_port, int_ctl_new); - outb(com->rsabase + rsa_ier, 0x1d); - } else - outb(com->int_ctl_port, int_ctl_new); - } -#else - if (COM_IIR_TXRDYBUG(com->flags) - && int_ctl != int_ctl_new) - outb(com->int_ctl_port, int_ctl_new); -#endif - } -#ifdef PC98 - else if (line_status & LSR_TXRDY) { - if (IS_8251(com->pc98_if_type)) - if (pc98_check_i8251_interrupt(com) & IEN_TxFLAG) - com_int_Tx_disable(com); - } - if (IS_8251(com->pc98_if_type)) { - if (com->pc98_8251fifo_enable) { - if ((tmp = inb(I8251F_lsr)) & FLSR_RxRDY) - goto more_intr; - } else { - if ((tmp = inb(com->sts_port)) & STS8251_RxRDY) - goto more_intr; - } - } -#endif - - /* finished? */ -#ifndef COM_MULTIPORT -#ifdef PC98 - if (IS_8251(com->pc98_if_type)) - return; -#endif - if ((inb(com->int_id_port) & IIR_IMASK) == IIR_NOPEND) -#endif /* COM_MULTIPORT */ - return; - } -} - -/* software interrupt handler for SWI_TTY */ -static void -siopoll(void *dummy) -{ - int unit; - - if (com_events == 0) - return; -repeat: - for (unit = 0; unit < sio_numunits; ++unit) { - struct com_s *com; - int incc; - struct tty *tp; - - com = com_addr(unit); - if (com == NULL) - continue; - tp = com->tp; - if (tp == NULL || com->gone) { - /* - * Discard any events related to never-opened or - * going-away devices. - */ - mtx_lock_spin(&sio_lock); - incc = com->iptr - com->ibuf; - com->iptr = com->ibuf; - if (com->state & CS_CHECKMSR) { - incc += LOTS_OF_EVENTS; - com->state &= ~CS_CHECKMSR; - } - com_events -= incc; - mtx_unlock_spin(&sio_lock); - continue; - } - if (com->iptr != com->ibuf) { - mtx_lock_spin(&sio_lock); - sioinput(com); - mtx_unlock_spin(&sio_lock); - } - if (com->state & CS_CHECKMSR) { - u_char delta_modem_status; - -#ifdef PC98 - if (!IS_8251(com->pc98_if_type)) { -#endif - mtx_lock_spin(&sio_lock); - delta_modem_status = com->last_modem_status - ^ com->prev_modem_status; - com->prev_modem_status = com->last_modem_status; - com_events -= LOTS_OF_EVENTS; - com->state &= ~CS_CHECKMSR; - mtx_unlock_spin(&sio_lock); - if (delta_modem_status & MSR_DCD) - ttyld_modem(tp, - com->prev_modem_status & MSR_DCD); -#ifdef PC98 - } -#endif - } - if (com->state & CS_ODONE) { - mtx_lock_spin(&sio_lock); - com_events -= LOTS_OF_EVENTS; - com->state &= ~CS_ODONE; - mtx_unlock_spin(&sio_lock); - if (!(com->state & CS_BUSY) - && !(com->extra_state & CSE_BUSYCHECK)) { - timeout(siobusycheck, com, hz / 100); - com->extra_state |= CSE_BUSYCHECK; - } - ttyld_start(tp); - } - if (com_events == 0) - break; - } - if (com_events >= LOTS_OF_EVENTS) - goto repeat; -} - -static void -combreak(tp, sig) - struct tty *tp; - int sig; -{ - struct com_s *com; - - com = tp->t_sc; - -#ifdef PC98 - if (sig) - com_send_break_on(com); - else - com_send_break_off(com); -#else - if (sig) - sio_setreg(com, com_cfcr, com->cfcr_image |= CFCR_SBREAK); - else - sio_setreg(com, com_cfcr, com->cfcr_image &= ~CFCR_SBREAK); -#endif -} - -static int -comparam(tp, t) - struct tty *tp; - struct termios *t; -{ - u_int cfcr; - int cflag; - struct com_s *com; - u_int divisor; - u_char dlbh; - u_char dlbl; - u_char efr_flowbits; - int s; -#ifdef PC98 - u_char param = 0; -#endif - - com = tp->t_sc; - if (com == NULL) - return (ENODEV); - -#ifdef PC98 - cfcr = 0; - - if (IS_8251(com->pc98_if_type)) { - if (pc98_ttspeedtab(com, t->c_ospeed, &divisor) != 0) - return (EINVAL); - } else { -#endif - /* check requested parameters */ - if (t->c_ispeed != (t->c_ospeed != 0 ? t->c_ospeed : tp->t_ospeed)) - return (EINVAL); - divisor = siodivisor(com->rclk, t->c_ispeed); - if (divisor == 0) - return (EINVAL); -#ifdef PC98 - } -#endif - - /* parameters are OK, convert them to the com struct and the device */ - s = spltty(); -#ifdef PC98 - if (IS_8251(com->pc98_if_type)) { - if (t->c_ospeed == 0) - com_tiocm_bic(com, TIOCM_DTR|TIOCM_RTS|TIOCM_LE); - else - com_tiocm_bis(com, TIOCM_DTR|TIOCM_RTS|TIOCM_LE); - } else -#endif - if (t->c_ospeed == 0) - (void)commodem(tp, 0, SER_DTR); /* hang up line */ - else - (void)commodem(tp, SER_DTR, 0); - cflag = t->c_cflag; -#ifdef PC98 - if (!IS_8251(com->pc98_if_type)) { -#endif - switch (cflag & CSIZE) { - case CS5: - cfcr = CFCR_5BITS; - break; - case CS6: - cfcr = CFCR_6BITS; - break; - case CS7: - cfcr = CFCR_7BITS; - break; - default: - cfcr = CFCR_8BITS; - break; - } - if (cflag & PARENB) { - cfcr |= CFCR_PENAB; - if (!(cflag & PARODD)) - cfcr |= CFCR_PEVEN; - } - if (cflag & CSTOPB) - cfcr |= CFCR_STOPB; - - if (com->hasfifo) { - /* - * Use a fifo trigger level low enough so that the input - * latency from the fifo is less than about 16 msec and - * the total latency is less than about 30 msec. These - * latencies are reasonable for humans. Serial comms - * protocols shouldn't expect anything better since modem - * latencies are larger. - * - * The fifo trigger level cannot be set at RX_HIGH for high - * speed connections without further work on reducing - * interrupt disablement times in other parts of the system, - * without producing silo overflow errors. - */ - com->fifo_image = com->unit == siotsunit ? 0 - : t->c_ispeed <= 4800 - ? FIFO_ENABLE : FIFO_ENABLE | FIFO_RX_MEDH; -#ifdef COM_ESP - /* - * The Hayes ESP card needs the fifo DMA mode bit set - * in compatibility mode. If not, it will interrupt - * for each character received. - */ - if (com->esp) - com->fifo_image |= FIFO_DMA_MODE; -#endif - sio_setreg(com, com_fifo, com->fifo_image); - } -#ifdef PC98 - } -#endif - - /* - * This returns with interrupts disabled so that we can complete - * the speed change atomically. Keeping interrupts disabled is - * especially important while com_data is hidden. - */ - (void) siosetwater(com, t->c_ispeed); - -#ifdef PC98 - if (IS_8251(com->pc98_if_type)) - com_cflag_and_speed_set(com, cflag, t->c_ospeed); - else { -#endif - sio_setreg(com, com_cfcr, cfcr | CFCR_DLAB); - /* - * Only set the divisor registers if they would change, since on - * some 16550 incompatibles (UMC8669F), setting them while input - * is arriving loses sync until data stops arriving. - */ - dlbl = divisor & 0xFF; - if (sio_getreg(com, com_dlbl) != dlbl) - sio_setreg(com, com_dlbl, dlbl); - dlbh = divisor >> 8; - if (sio_getreg(com, com_dlbh) != dlbh) - sio_setreg(com, com_dlbh, dlbh); -#ifdef PC98 - } -#endif - - efr_flowbits = 0; - - if (cflag & CRTS_IFLOW) { - com->state |= CS_RTS_IFLOW; - efr_flowbits |= EFR_AUTORTS; - /* - * If CS_RTS_IFLOW just changed from off to on, the change - * needs to be propagated to MCR_RTS. This isn't urgent, - * so do it later by calling comstart() instead of repeating - * a lot of code from comstart() here. - */ - } else if (com->state & CS_RTS_IFLOW) { - com->state &= ~CS_RTS_IFLOW; - /* - * CS_RTS_IFLOW just changed from on to off. Force MCR_RTS - * on here, since comstart() won't do it later. - */ -#ifdef PC98 - if (IS_8251(com->pc98_if_type)) - com_tiocm_bis(com, TIOCM_RTS); - else - outb(com->modem_ctl_port, com->mcr_image |= MCR_RTS); -#else - outb(com->modem_ctl_port, com->mcr_image |= MCR_RTS); -#endif - } - - /* - * Set up state to handle output flow control. - * XXX - worth handling MDMBUF (DCD) flow control at the lowest level? - * Now has 10+ msec latency, while CTS flow has 50- usec latency. - */ - com->state |= CS_ODEVREADY; - com->state &= ~CS_CTS_OFLOW; -#ifdef PC98 - if (com->pc98_if_type == COM_IF_RSA98III) { - param = inb(com->rsabase + rsa_msr); - outb(com->rsabase + rsa_msr, param & 0x14); - } -#endif - if (cflag & CCTS_OFLOW) { - com->state |= CS_CTS_OFLOW; - efr_flowbits |= EFR_AUTOCTS; -#ifdef PC98 - if (IS_8251(com->pc98_if_type)) { - if (!(pc98_get_modem_status(com) & TIOCM_CTS)) - com->state &= ~CS_ODEVREADY; - } else if (com->pc98_if_type == COM_IF_RSA98III) { - /* Set automatic flow control mode */ - outb(com->rsabase + rsa_msr, param | 0x08); - } else -#endif - if (!(com->last_modem_status & MSR_CTS)) - com->state &= ~CS_ODEVREADY; - } - -#ifdef PC98 - if (!IS_8251(com->pc98_if_type)) - sio_setreg(com, com_cfcr, com->cfcr_image = cfcr); -#else - if (com->st16650a) { - sio_setreg(com, com_lcr, LCR_EFR_ENABLE); - sio_setreg(com, com_efr, - (sio_getreg(com, com_efr) - & ~(EFR_AUTOCTS | EFR_AUTORTS)) | efr_flowbits); - } - sio_setreg(com, com_cfcr, com->cfcr_image = cfcr); -#endif - - /* XXX shouldn't call functions while intrs are disabled. */ - ttyldoptim(tp); - - mtx_unlock_spin(&sio_lock); - splx(s); - comstart(tp); - if (com->ibufold != NULL) { - free(com->ibufold, M_DEVBUF); - com->ibufold = NULL; - } - return (0); -} - -/* - * This function must be called with the sio_lock mutex released and will - * return with it obtained. - */ -static int -siosetwater(com, speed) - struct com_s *com; - speed_t speed; -{ - int cp4ticks; - u_char *ibuf; - int ibufsize; - struct tty *tp; - - /* - * Make the buffer size large enough to handle a softtty interrupt - * latency of about 2 ticks without loss of throughput or data - * (about 3 ticks if input flow control is not used or not honoured, - * but a bit less for CS5-CS7 modes). - */ - cp4ticks = speed / 10 / hz * 4; - for (ibufsize = 128; ibufsize < cp4ticks;) - ibufsize <<= 1; -#ifdef PC98 - if (com->pc98_if_type == COM_IF_RSA98III) - ibufsize = 2048; -#endif - if (ibufsize == com->ibufsize) { - mtx_lock_spin(&sio_lock); - return (0); - } - - /* - * Allocate input buffer. The extra factor of 2 in the size is - * to allow for an error byte for each input byte. - */ - ibuf = malloc(2 * ibufsize, M_DEVBUF, M_NOWAIT); - if (ibuf == NULL) { - mtx_lock_spin(&sio_lock); - return (ENOMEM); - } - - /* Initialize non-critical variables. */ - com->ibufold = com->ibuf; - com->ibufsize = ibufsize; - tp = com->tp; - if (tp != NULL) { - tp->t_ififosize = 2 * ibufsize; - tp->t_ispeedwat = (speed_t)-1; - tp->t_ospeedwat = (speed_t)-1; - } - - /* - * Read current input buffer, if any. Continue with interrupts - * disabled. - */ - mtx_lock_spin(&sio_lock); - if (com->iptr != com->ibuf) - sioinput(com); - - /*- - * Initialize critical variables, including input buffer watermarks. - * The external device is asked to stop sending when the buffer - * exactly reaches high water, or when the high level requests it. - * The high level is notified immediately (rather than at a later - * clock tick) when this watermark is reached. - * The buffer size is chosen so the watermark should almost never - * be reached. - * The low watermark is invisibly 0 since the buffer is always - * emptied all at once. - */ - com->iptr = com->ibuf = ibuf; - com->ibufend = ibuf + ibufsize; - com->ierroff = ibufsize; - com->ihighwater = ibuf + 3 * ibufsize / 4; - return (0); -} - -static void -comstart(tp) - struct tty *tp; -{ - struct com_s *com; - int s; - - com = tp->t_sc; - if (com == NULL) - return; - s = spltty(); - mtx_lock_spin(&sio_lock); - if (tp->t_state & TS_TTSTOP) - com->state &= ~CS_TTGO; - else - com->state |= CS_TTGO; - if (tp->t_state & TS_TBLOCK) { -#ifdef PC98 - if (IS_8251(com->pc98_if_type)) { - if ((com_tiocm_get(com) & TIOCM_RTS) && - (com->state & CS_RTS_IFLOW)) - com_tiocm_bic(com, TIOCM_RTS); - } else { - if ((com->mcr_image & MCR_RTS) && - (com->state & CS_RTS_IFLOW)) - outb(com->modem_ctl_port, com->mcr_image &= ~MCR_RTS); - } -#else - if (com->mcr_image & MCR_RTS && com->state & CS_RTS_IFLOW) - outb(com->modem_ctl_port, com->mcr_image &= ~MCR_RTS); -#endif - } else { -#ifdef PC98 - if (IS_8251(com->pc98_if_type)) { - if (!(com_tiocm_get(com) & TIOCM_RTS) && - com->iptr < com->ihighwater && - com->state & CS_RTS_IFLOW) - com_tiocm_bis(com, TIOCM_RTS); - } else { - if (!(com->mcr_image & MCR_RTS) && - com->iptr < com->ihighwater && - com->state & CS_RTS_IFLOW) - outb(com->modem_ctl_port, com->mcr_image |= MCR_RTS); - } -#else - if (!(com->mcr_image & MCR_RTS) && com->iptr < com->ihighwater - && com->state & CS_RTS_IFLOW) - outb(com->modem_ctl_port, com->mcr_image |= MCR_RTS); -#endif - } - mtx_unlock_spin(&sio_lock); - if (tp->t_state & (TS_TIMEOUT | TS_TTSTOP)) { - ttwwakeup(tp); - splx(s); - return; - } - if (tp->t_outq.c_cc != 0) { - struct lbq *qp; - struct lbq *next; - - if (!com->obufs[0].l_queued) { - com->obufs[0].l_tail - = com->obuf1 + q_to_b(&tp->t_outq, com->obuf1, -#ifdef PC98 - com->obufsize); -#else - sizeof com->obuf1); -#endif - com->obufs[0].l_next = NULL; - com->obufs[0].l_queued = TRUE; - mtx_lock_spin(&sio_lock); - if (com->state & CS_BUSY) { - qp = com->obufq.l_next; - while ((next = qp->l_next) != NULL) - qp = next; - qp->l_next = &com->obufs[0]; - } else { - com->obufq.l_head = com->obufs[0].l_head; - com->obufq.l_tail = com->obufs[0].l_tail; - com->obufq.l_next = &com->obufs[0]; - com->state |= CS_BUSY; - } - mtx_unlock_spin(&sio_lock); - } - if (tp->t_outq.c_cc != 0 && !com->obufs[1].l_queued) { - com->obufs[1].l_tail - = com->obuf2 + q_to_b(&tp->t_outq, com->obuf2, -#ifdef PC98 - com->obufsize); -#else - sizeof com->obuf2); -#endif - com->obufs[1].l_next = NULL; - com->obufs[1].l_queued = TRUE; - mtx_lock_spin(&sio_lock); - if (com->state & CS_BUSY) { - qp = com->obufq.l_next; - while ((next = qp->l_next) != NULL) - qp = next; - qp->l_next = &com->obufs[1]; - } else { - com->obufq.l_head = com->obufs[1].l_head; - com->obufq.l_tail = com->obufs[1].l_tail; - com->obufq.l_next = &com->obufs[1]; - com->state |= CS_BUSY; - } - mtx_unlock_spin(&sio_lock); - } - tp->t_state |= TS_BUSY; - } - mtx_lock_spin(&sio_lock); - if (com->state >= (CS_BUSY | CS_TTGO)) - siointr1(com); /* fake interrupt to start output */ - mtx_unlock_spin(&sio_lock); - ttwwakeup(tp); - splx(s); -} - -static void -comstop(tp, rw) - struct tty *tp; - int rw; -{ - struct com_s *com; -#ifdef PC98 - int rsa98_tmp = 0; -#endif - - com = tp->t_sc; - if (com == NULL || com->gone) - return; - mtx_lock_spin(&sio_lock); - if (rw & FWRITE) { -#ifdef PC98 - if (!IS_8251(com->pc98_if_type)) { -#endif - if (com->hasfifo) -#ifdef COM_ESP - /* XXX avoid h/w bug. */ - if (!com->esp) -#endif - sio_setreg(com, com_fifo, - FIFO_XMT_RST | com->fifo_image); -#ifdef PC98 - if (com->pc98_if_type == COM_IF_RSA98III) - for (rsa98_tmp = 0; rsa98_tmp < 2048; rsa98_tmp++) - sio_setreg(com, com_fifo, - FIFO_XMT_RST | com->fifo_image); - } -#endif - com->obufs[0].l_queued = FALSE; - com->obufs[1].l_queued = FALSE; - if (com->state & CS_ODONE) - com_events -= LOTS_OF_EVENTS; - com->state &= ~(CS_ODONE | CS_BUSY); - com->tp->t_state &= ~TS_BUSY; - } - if (rw & FREAD) { -#ifdef PC98 - if (!IS_8251(com->pc98_if_type)) { - if (com->pc98_if_type == COM_IF_RSA98III) - for (rsa98_tmp = 0; rsa98_tmp < 2048; rsa98_tmp++) - sio_getreg(com, com_data); -#endif - if (com->hasfifo) -#ifdef COM_ESP - /* XXX avoid h/w bug. */ - if (!com->esp) -#endif - sio_setreg(com, com_fifo, - FIFO_RCV_RST | com->fifo_image); -#ifdef PC98 - } -#endif - com_events -= (com->iptr - com->ibuf); - com->iptr = com->ibuf; - } - mtx_unlock_spin(&sio_lock); - comstart(tp); -} - -static int -commodem(struct tty *tp, int sigon, int sigoff) -{ - struct com_s *com; - int bitand, bitor, msr; -#ifdef PC98 - int clr, set; -#endif - - com = tp->t_sc; - if (com->gone) - return(0); - if (sigon != 0 || sigoff != 0) { -#ifdef PC98 - if (IS_8251(com->pc98_if_type)) { - bitand = bitor = 0; - clr = set = 0; - if (sigoff & SER_DTR) { - bitand |= TIOCM_DTR; - clr |= CMD8251_DTR; - } - if (sigoff & SER_RTS) { - bitand |= TIOCM_RTS; - clr |= CMD8251_RxEN | CMD8251_RTS; - } - if (sigon & SER_DTR) { - bitor |= TIOCM_DTR; - set |= CMD8251_TxEN | CMD8251_RxEN | - CMD8251_DTR; - } - if (sigon & SER_RTS) { - bitor |= TIOCM_RTS; - set |= CMD8251_TxEN | CMD8251_RxEN | - CMD8251_RTS; - } - bitand = ~bitand; - mtx_lock_spin(&sio_lock); - com->pc98_prev_modem_status &= bitand; - com->pc98_prev_modem_status |= bitor; - pc98_i8251_clear_or_cmd(com, clr, set); - mtx_unlock_spin(&sio_lock); - return (0); - } else { -#endif - bitand = bitor = 0; - if (sigoff & SER_DTR) - bitand |= MCR_DTR; - if (sigoff & SER_RTS) - bitand |= MCR_RTS; - if (sigon & SER_DTR) - bitor |= MCR_DTR; - if (sigon & SER_RTS) - bitor |= MCR_RTS; - bitand = ~bitand; - mtx_lock_spin(&sio_lock); - com->mcr_image &= bitand; - com->mcr_image |= bitor; - outb(com->modem_ctl_port, com->mcr_image); - mtx_unlock_spin(&sio_lock); - return (0); -#ifdef PC98 - } -#endif - } else { -#ifdef PC98 - if (IS_8251(com->pc98_if_type)) - return (com_tiocm_get(com)); - else { -#endif - bitor = 0; - if (com->mcr_image & MCR_DTR) - bitor |= SER_DTR; - if (com->mcr_image & MCR_RTS) - bitor |= SER_RTS; - msr = com->prev_modem_status; - if (msr & MSR_CTS) - bitor |= SER_CTS; - if (msr & MSR_DCD) - bitor |= SER_DCD; - if (msr & MSR_DSR) - bitor |= SER_DSR; - if (msr & MSR_DSR) - bitor |= SER_DSR; - if (msr & (MSR_RI | MSR_TERI)) - bitor |= SER_RI; - return (bitor); -#ifdef PC98 - } -#endif - } -} - -static void -siosettimeout() -{ - struct com_s *com; - bool_t someopen; - int unit; - - /* - * Set our timeout period to 1 second if no polled devices are open. - * Otherwise set it to max(1/200, 1/hz). - * Enable timeouts iff some device is open. - */ - untimeout(comwakeup, (void *)NULL, sio_timeout_handle); - sio_timeout = hz; - someopen = FALSE; - for (unit = 0; unit < sio_numunits; ++unit) { - com = com_addr(unit); - if (com != NULL && com->tp != NULL - && com->tp->t_state & TS_ISOPEN && !com->gone) { - someopen = TRUE; - if (com->poll || com->poll_output) { - sio_timeout = hz > 200 ? hz / 200 : 1; - break; - } - } - } - if (someopen) { - sio_timeouts_until_log = hz / sio_timeout; - sio_timeout_handle = timeout(comwakeup, (void *)NULL, - sio_timeout); - } else { - /* Flush error messages, if any. */ - sio_timeouts_until_log = 1; - comwakeup((void *)NULL); - untimeout(comwakeup, (void *)NULL, sio_timeout_handle); - } -} - -static void -comwakeup(chan) - void *chan; -{ - struct com_s *com; - int unit; - - sio_timeout_handle = timeout(comwakeup, (void *)NULL, sio_timeout); - - /* - * Recover from lost output interrupts. - * Poll any lines that don't use interrupts. - */ - for (unit = 0; unit < sio_numunits; ++unit) { - com = com_addr(unit); - if (com != NULL && !com->gone - && (com->state >= (CS_BUSY | CS_TTGO) || com->poll)) { - mtx_lock_spin(&sio_lock); - siointr1(com); - mtx_unlock_spin(&sio_lock); - } - } - - /* - * Check for and log errors, but not too often. - */ - if (--sio_timeouts_until_log > 0) - return; - sio_timeouts_until_log = hz / sio_timeout; - for (unit = 0; unit < sio_numunits; ++unit) { - int errnum; - - com = com_addr(unit); - if (com == NULL) - continue; - if (com->gone) - continue; - for (errnum = 0; errnum < CE_NTYPES; ++errnum) { - u_int delta; - u_long total; - - mtx_lock_spin(&sio_lock); - delta = com->delta_error_counts[errnum]; - com->delta_error_counts[errnum] = 0; - mtx_unlock_spin(&sio_lock); - if (delta == 0) - continue; - total = com->error_counts[errnum] += delta; - log(LOG_ERR, "sio%d: %u more %s%s (total %lu)\n", - unit, delta, error_desc[errnum], - delta == 1 ? "" : "s", total); - } - } -} - -#ifdef PC98 -/* commint is called when modem control line changes */ -static void -commint(struct cdev *dev) -{ - register struct tty *tp; - int stat,delta; - struct com_s *com; - - com = dev->si_drv1; - tp = com->tp; - - stat = com_tiocm_get(com); - delta = com_tiocm_get_delta(com); - - if (com->state & CS_CTS_OFLOW) { - if (stat & TIOCM_CTS) - com->state |= CS_ODEVREADY; - else - com->state &= ~CS_ODEVREADY; - } - if ((delta & TIOCM_CAR) && (ISCALLOUT(dev)) == 0) { - if (stat & TIOCM_CAR ) - (void)ttyld_modem(tp, 1); - else if (ttyld_modem(tp, 0) == 0) { - /* negate DTR, RTS */ - com_tiocm_bic(com, (tp->t_cflag & HUPCL) ? - TIOCM_DTR|TIOCM_RTS|TIOCM_LE : TIOCM_LE ); - /* disable IENABLE */ - com_int_TxRx_disable( com ); - } - } -} -#endif - -/* - * Following are all routines needed for SIO to act as console - */ -struct siocnstate { - u_char dlbl; - u_char dlbh; - u_char ier; - u_char cfcr; - u_char mcr; -}; - -/* - * This is a function in order to not replicate "ttyd%d" more - * places than absolutely necessary. - */ -static void -siocnset(struct consdev *cd, int unit) -{ - - cd->cn_unit = unit; - sprintf(cd->cn_name, "ttyd%d", unit); -} - -static speed_t siocngetspeed(Port_t, u_long rclk); -static void siocnclose(struct siocnstate *sp, Port_t iobase); -static void siocnopen(struct siocnstate *sp, Port_t iobase, int speed); -static void siocntxwait(Port_t iobase); - -static cn_probe_t sio_cnprobe; -static cn_init_t sio_cninit; -static cn_term_t sio_cnterm; -static cn_getc_t sio_cngetc; -static cn_putc_t sio_cnputc; -static cn_grab_t sio_cngrab; -static cn_ungrab_t sio_cnungrab; - -CONSOLE_DRIVER(sio); - -static void -siocntxwait(iobase) - Port_t iobase; -{ - int timo; - - /* - * Wait for any pending transmission to finish. Required to avoid - * the UART lockup bug when the speed is changed, and for normal - * transmits. - */ - timo = 100000; - while ((inb(iobase + com_lsr) & (LSR_TSRE | LSR_TXRDY)) - != (LSR_TSRE | LSR_TXRDY) && --timo != 0) - ; -} - -/* - * Read the serial port specified and try to figure out what speed - * it's currently running at. We're assuming the serial port has - * been initialized and is basicly idle. This routine is only intended - * to be run at system startup. - * - * If the value read from the serial port doesn't make sense, return 0. - */ - -static speed_t -siocngetspeed(iobase, rclk) - Port_t iobase; - u_long rclk; -{ - u_int divisor; - u_char dlbh; - u_char dlbl; - u_char cfcr; - - cfcr = inb(iobase + com_cfcr); - outb(iobase + com_cfcr, CFCR_DLAB | cfcr); - - dlbl = inb(iobase + com_dlbl); - dlbh = inb(iobase + com_dlbh); - - outb(iobase + com_cfcr, cfcr); - - divisor = dlbh << 8 | dlbl; - - /* XXX there should be more sanity checking. */ - if (divisor == 0) - return (CONSPEED); - return (rclk / (16UL * divisor)); -} - -static void -siocnopen(sp, iobase, speed) - struct siocnstate *sp; - Port_t iobase; - int speed; -{ - u_int divisor; - u_char dlbh; - u_char dlbl; - - /* - * Save all the device control registers except the fifo register - * and set our default ones (cs8 -parenb speed=comdefaultrate). - * We can't save the fifo register since it is read-only. - */ - sp->ier = inb(iobase + com_ier); - outb(iobase + com_ier, 0); /* spltty() doesn't stop siointr() */ - siocntxwait(iobase); - sp->cfcr = inb(iobase + com_cfcr); - outb(iobase + com_cfcr, CFCR_DLAB | CFCR_8BITS); - sp->dlbl = inb(iobase + com_dlbl); - sp->dlbh = inb(iobase + com_dlbh); - /* - * Only set the divisor registers if they would change, since on - * some 16550 incompatibles (Startech), setting them clears the - * data input register. This also reduces the effects of the - * UMC8669F bug. - */ - divisor = siodivisor(comdefaultrclk, speed); - dlbl = divisor & 0xFF; - if (sp->dlbl != dlbl) - outb(iobase + com_dlbl, dlbl); - dlbh = divisor >> 8; - if (sp->dlbh != dlbh) - outb(iobase + com_dlbh, dlbh); - outb(iobase + com_cfcr, CFCR_8BITS); - sp->mcr = inb(iobase + com_mcr); - /* - * We don't want interrupts, but must be careful not to "disable" - * them by clearing the MCR_IENABLE bit, since that might cause - * an interrupt by floating the IRQ line. - */ - outb(iobase + com_mcr, (sp->mcr & MCR_IENABLE) | MCR_DTR | MCR_RTS); -} - -static void -siocnclose(sp, iobase) - struct siocnstate *sp; - Port_t iobase; -{ - /* - * Restore the device control registers. - */ - siocntxwait(iobase); - outb(iobase + com_cfcr, CFCR_DLAB | CFCR_8BITS); - if (sp->dlbl != inb(iobase + com_dlbl)) - outb(iobase + com_dlbl, sp->dlbl); - if (sp->dlbh != inb(iobase + com_dlbh)) - outb(iobase + com_dlbh, sp->dlbh); - outb(iobase + com_cfcr, sp->cfcr); - /* - * XXX damp oscillations of MCR_DTR and MCR_RTS by not restoring them. - */ - outb(iobase + com_mcr, sp->mcr | MCR_DTR | MCR_RTS); - outb(iobase + com_ier, sp->ier); -} - -static void -sio_cnprobe(cp) - struct consdev *cp; -{ - speed_t boot_speed; - u_char cfcr; - u_int divisor; - int s, unit; - struct siocnstate sp; - - /* - * Find our first enabled console, if any. If it is a high-level - * console device, then initialize it and return successfully. - * If it is a low-level console device, then initialize it and - * return unsuccessfully. It must be initialized in both cases - * for early use by console drivers and debuggers. Initializing - * the hardware is not necessary in all cases, since the i/o - * routines initialize it on the fly, but it is necessary if - * input might arrive while the hardware is switched back to an - * uninitialized state. We can't handle multiple console devices - * yet because our low-level routines don't take a device arg. - * We trust the user to set the console flags properly so that we - * don't need to probe. - */ - cp->cn_pri = CN_DEAD; - - for (unit = 0; unit < 16; unit++) { /* XXX need to know how many */ - int flags; - - if (resource_disabled("sio", unit)) - continue; - if (resource_int_value("sio", unit, "flags", &flags)) - continue; - if (COM_CONSOLE(flags) || COM_DEBUGGER(flags)) { - int port; - Port_t iobase; - - if (resource_int_value("sio", unit, "port", &port)) - continue; - iobase = port; - s = spltty(); - if ((boothowto & RB_SERIAL) && COM_CONSOLE(flags)) { - boot_speed = - siocngetspeed(iobase, comdefaultrclk); - if (boot_speed) - comdefaultrate = boot_speed; - } - - /* - * Initialize the divisor latch. We can't rely on - * siocnopen() to do this the first time, since it - * avoids writing to the latch if the latch appears - * to have the correct value. Also, if we didn't - * just read the speed from the hardware, then we - * need to set the speed in hardware so that - * switching it later is null. - */ - cfcr = inb(iobase + com_cfcr); - outb(iobase + com_cfcr, CFCR_DLAB | cfcr); - divisor = siodivisor(comdefaultrclk, comdefaultrate); - outb(iobase + com_dlbl, divisor & 0xff); - outb(iobase + com_dlbh, divisor >> 8); - outb(iobase + com_cfcr, cfcr); - - siocnopen(&sp, iobase, comdefaultrate); - - splx(s); - if (COM_CONSOLE(flags) && !COM_LLCONSOLE(flags)) { - siocnset(cp, unit); - cp->cn_pri = COM_FORCECONSOLE(flags) - || boothowto & RB_SERIAL - ? CN_REMOTE : CN_NORMAL; - siocniobase = iobase; - siocnunit = unit; - } -#ifdef GDB - if (COM_DEBUGGER(flags)) - siogdbiobase = iobase; -#endif - } - } -} - -static void -sio_cninit(cp) - struct consdev *cp; -{ - comconsole = cp->cn_unit; -} - -static void -sio_cnterm(cp) - struct consdev *cp; -{ - comconsole = -1; -} - -static void -sio_cngrab(struct consdev *cp) -{ -} - -static void -sio_cnungrab(struct consdev *cp) -{ -} - -static int -sio_cngetc(struct consdev *cd) -{ - int c; - Port_t iobase; - int s; - struct siocnstate sp; - speed_t speed; - - if (cd != NULL && cd->cn_unit == siocnunit) { - iobase = siocniobase; - speed = comdefaultrate; - } else { -#ifdef GDB - iobase = siogdbiobase; - speed = gdbdefaultrate; -#else - return (-1); -#endif - } - s = spltty(); - siocnopen(&sp, iobase, speed); - if (inb(iobase + com_lsr) & LSR_RXRDY) - c = inb(iobase + com_data); - else - c = -1; - siocnclose(&sp, iobase); - splx(s); - return (c); -} - -static void -sio_cnputc(struct consdev *cd, int c) -{ - int need_unlock; - int s; - struct siocnstate sp; - Port_t iobase; - speed_t speed; - - if (cd != NULL && cd->cn_unit == siocnunit) { - iobase = siocniobase; - speed = comdefaultrate; - } else { -#ifdef GDB - iobase = siogdbiobase; - speed = gdbdefaultrate; -#else - return; -#endif - } - s = spltty(); - need_unlock = 0; - if (!kdb_active && sio_inited == 2 && !mtx_owned(&sio_lock)) { - mtx_lock_spin(&sio_lock); - need_unlock = 1; - } - siocnopen(&sp, iobase, speed); - siocntxwait(iobase); - outb(iobase + com_data, c); - siocnclose(&sp, iobase); - if (need_unlock) - mtx_unlock_spin(&sio_lock); - splx(s); -} - -/* - * Remote gdb(1) support. - */ - -#if defined(GDB) - -#include - -static gdb_probe_f siogdbprobe; -static gdb_init_f siogdbinit; -static gdb_term_f siogdbterm; -static gdb_getc_f siogdbgetc; -static gdb_putc_f siogdbputc; - -GDB_DBGPORT(sio, siogdbprobe, siogdbinit, siogdbterm, siogdbgetc, siogdbputc); - -static int -siogdbprobe(void) -{ - return ((siogdbiobase != 0) ? 0 : -1); -} - -static void -siogdbinit(void) -{ -} - -static void -siogdbterm(void) -{ -} - -static void -siogdbputc(int c) -{ - sio_cnputc(NULL, c); -} - -static int -siogdbgetc(void) -{ - return (sio_cngetc(NULL)); -} - -#endif - -#ifdef PC98 -/* - * pc98 local function - */ -static void -com_tiocm_bis(struct com_s *com, int msr) -{ - int s; - int tmp = 0; - - s=spltty(); - com->pc98_prev_modem_status |= ( msr & (TIOCM_LE|TIOCM_DTR|TIOCM_RTS) ); - tmp |= CMD8251_TxEN|CMD8251_RxEN; - if ( msr & TIOCM_DTR ) tmp |= CMD8251_DTR; - if ( msr & TIOCM_RTS ) tmp |= CMD8251_RTS; - - pc98_i8251_or_cmd( com, tmp ); - splx(s); -} - -static void -com_tiocm_bic(struct com_s *com, int msr) -{ - int s; - int tmp = msr; - - s=spltty(); - com->pc98_prev_modem_status &= ~( msr & (TIOCM_LE|TIOCM_DTR|TIOCM_RTS) ); - if ( msr & TIOCM_DTR ) tmp |= CMD8251_DTR; - if ( msr & TIOCM_RTS ) tmp |= CMD8251_RTS; - - pc98_i8251_clear_cmd( com, tmp ); - splx(s); -} - -static int -com_tiocm_get(struct com_s *com) -{ - return( com->pc98_prev_modem_status ); -} - -static int -com_tiocm_get_delta(struct com_s *com) -{ - int tmp; - - tmp = com->pc98_modem_delta; - com->pc98_modem_delta = 0; - return( tmp ); -} - -/* convert to TIOCM_?? ( ioctl.h ) */ -static int -pc98_get_modem_status(struct com_s *com) -{ - register int msr; - - msr = com->pc98_prev_modem_status - & ~(TIOCM_CAR|TIOCM_RI|TIOCM_DSR|TIOCM_CTS); - if (com->pc98_8251fifo_enable) { - int stat2; - - stat2 = inb(I8251F_msr); - if ( stat2 & MSR_DCD ) msr |= TIOCM_CAR; - if ( stat2 & MSR_RI ) msr |= TIOCM_RI; - if ( stat2 & MSR_DSR ) msr |= TIOCM_DSR; - if ( stat2 & MSR_CTS ) msr |= TIOCM_CTS; -#if COM_CARRIER_DETECT_EMULATE - if ( msr & (TIOCM_DSR|TIOCM_CTS) ) { - msr |= TIOCM_CAR; - } -#endif - } else { - int stat, stat2; - - stat = inb(com->sts_port); - stat2 = inb(com->in_modem_port); - if ( !(stat2 & CICSCD_CD) ) msr |= TIOCM_CAR; - if ( !(stat2 & CICSCD_CI) ) msr |= TIOCM_RI; - if ( stat & STS8251_DSR ) msr |= TIOCM_DSR; - if ( !(stat2 & CICSCD_CS) ) msr |= TIOCM_CTS; -#if COM_CARRIER_DETECT_EMULATE - if ( msr & (TIOCM_DSR|TIOCM_CTS) ) { - msr |= TIOCM_CAR; - } -#endif - } - return(msr); -} - -static void -pc98_check_msr(void* chan) -{ - int msr, delta; - int s; - register struct tty *tp; - struct com_s *com; - struct cdev *dev; - - dev=(struct cdev *)chan; - com = dev->si_drv1; - tp = dev->si_tty; - - s = spltty(); - msr = pc98_get_modem_status(com); - /* make change flag */ - delta = msr ^ com->pc98_prev_modem_status; - if ( delta & TIOCM_CAR ) { - if ( com->modem_car_chg_timer ) { - if ( -- com->modem_car_chg_timer ) - msr ^= TIOCM_CAR; - } else { - if ((com->modem_car_chg_timer = (msr & TIOCM_CAR) ? - DCD_ON_RECOGNITION : DCD_OFF_TOLERANCE) != 0) - msr ^= TIOCM_CAR; - } - } else - com->modem_car_chg_timer = 0; - delta = ( msr ^ com->pc98_prev_modem_status ) & - (TIOCM_CAR|TIOCM_RI|TIOCM_DSR|TIOCM_CTS); - com->pc98_prev_modem_status = msr; - delta = ( com->pc98_modem_delta |= delta ); - splx(s); - if ( com->modem_checking || (tp->t_state & (TS_ISOPEN)) ) { - if ( delta ) { - commint(dev); - } - timeout(pc98_check_msr, (caddr_t)dev, - PC98_CHECK_MODEM_INTERVAL); - } else { - com->modem_checking = 0; - } -} - -static void -pc98_msrint_start(struct cdev *dev) -{ - struct com_s *com; - int s = spltty(); - - com = dev->si_drv1; - /* modem control line check routine envoke interval is 1/10 sec */ - if ( com->modem_checking == 0 ) { - com->pc98_prev_modem_status = pc98_get_modem_status(com); - com->pc98_modem_delta = 0; - timeout(pc98_check_msr, (caddr_t)dev, - PC98_CHECK_MODEM_INTERVAL); - com->modem_checking = 1; - } - splx(s); -} - -static void -pc98_disable_i8251_interrupt(struct com_s *com, int mod) -{ - /* disable interrupt */ - register int tmp; - - mod |= ~(IEN_Tx|IEN_TxEMP|IEN_Rx); - COM_INT_DISABLE - tmp = inb( com->intr_ctrl_port ) & ~(IEN_Tx|IEN_TxEMP|IEN_Rx); - outb( com->intr_ctrl_port, (com->intr_enable&=~mod) | tmp ); - COM_INT_ENABLE -} - -static void -pc98_enable_i8251_interrupt(struct com_s *com, int mod) -{ - register int tmp; - - COM_INT_DISABLE - tmp = inb( com->intr_ctrl_port ) & ~(IEN_Tx|IEN_TxEMP|IEN_Rx); - outb( com->intr_ctrl_port, (com->intr_enable|=mod) | tmp ); - COM_INT_ENABLE -} - -static int -pc98_check_i8251_interrupt(struct com_s *com) -{ - return ( com->intr_enable & 0x07 ); -} - -static void -pc98_i8251_clear_cmd(struct com_s *com, int x) -{ - int tmp; - - COM_INT_DISABLE - tmp = com->pc98_prev_siocmd & ~(x); - if (com->pc98_8251fifo_enable) - outb(I8251F_fcr, 0); - outb(com->cmd_port, tmp); - com->pc98_prev_siocmd = tmp & ~(CMD8251_ER|CMD8251_RESET|CMD8251_EH); - if (com->pc98_8251fifo_enable) - outb(I8251F_fcr, FIFO_ENABLE); - COM_INT_ENABLE -} - -static void -pc98_i8251_or_cmd(struct com_s *com, int x) -{ - int tmp; - - COM_INT_DISABLE - if (com->pc98_8251fifo_enable) - outb(I8251F_fcr, 0); - tmp = com->pc98_prev_siocmd | (x); - outb(com->cmd_port, tmp); - com->pc98_prev_siocmd = tmp & ~(CMD8251_ER|CMD8251_RESET|CMD8251_EH); - if (com->pc98_8251fifo_enable) - outb(I8251F_fcr, FIFO_ENABLE); - COM_INT_ENABLE -} - -static void -pc98_i8251_set_cmd(struct com_s *com, int x) -{ - int tmp; - - COM_INT_DISABLE - if (com->pc98_8251fifo_enable) - outb(I8251F_fcr, 0); - tmp = (x); - outb(com->cmd_port, tmp); - com->pc98_prev_siocmd = tmp & ~(CMD8251_ER|CMD8251_RESET|CMD8251_EH); - if (com->pc98_8251fifo_enable) - outb(I8251F_fcr, FIFO_ENABLE); - COM_INT_ENABLE -} - -static void -pc98_i8251_clear_or_cmd(struct com_s *com, int clr, int x) -{ - int tmp; - COM_INT_DISABLE - if (com->pc98_8251fifo_enable) - outb(I8251F_fcr, 0); - tmp = com->pc98_prev_siocmd & ~(clr); - tmp |= (x); - outb(com->cmd_port, tmp); - com->pc98_prev_siocmd = tmp & ~(CMD8251_ER|CMD8251_RESET|CMD8251_EH); - if (com->pc98_8251fifo_enable) - outb(I8251F_fcr, FIFO_ENABLE); - COM_INT_ENABLE -} - -static int -pc98_i8251_get_cmd(struct com_s *com) -{ - return com->pc98_prev_siocmd; -} - -static int -pc98_i8251_get_mod(struct com_s *com) -{ - return com->pc98_prev_siomod; -} - -static void -pc98_i8251_reset(struct com_s *com, int mode, int command) -{ - if (com->pc98_8251fifo_enable) - outb(I8251F_fcr, 0); - outb(com->cmd_port, 0); /* dummy */ - DELAY(2); - outb(com->cmd_port, 0); /* dummy */ - DELAY(2); - outb(com->cmd_port, 0); /* dummy */ - DELAY(2); - outb(com->cmd_port, CMD8251_RESET); /* internal reset */ - DELAY(2); - outb(com->cmd_port, mode ); /* mode register */ - com->pc98_prev_siomod = mode; - DELAY(2); - pc98_i8251_set_cmd( com, (command|CMD8251_ER) ); - DELAY(10); - if (com->pc98_8251fifo_enable) - outb(I8251F_fcr, FIFO_ENABLE | FIFO_XMT_RST | FIFO_RCV_RST); -} - -static void -pc98_check_sysclock(void) -{ - /* get system clock from port */ - if ( pc98_machine_type & M_8M ) { - /* 8 MHz system & H98 */ - sysclock = 8; - } else { - /* 5 MHz system */ - sysclock = 5; - } -} - -static void -com_cflag_and_speed_set( struct com_s *com, int cflag, int speed) -{ - int cfcr=0; - int previnterrupt; - int tmp; - u_int count; - - if (pc98_ttspeedtab(com, speed, &count) != 0) - return; - - previnterrupt = pc98_check_i8251_interrupt(com); - pc98_disable_i8251_interrupt( com, IEN_Tx|IEN_TxEMP|IEN_Rx ); - - switch ( cflag&CSIZE ) { - case CS5: - cfcr = MOD8251_5BITS; break; - case CS6: - cfcr = MOD8251_6BITS; break; - case CS7: - cfcr = MOD8251_7BITS; break; - case CS8: - cfcr = MOD8251_8BITS; break; - } - if ( cflag&PARENB ) { - if ( cflag&PARODD ) - cfcr |= MOD8251_PENAB; - else - cfcr |= MOD8251_PENAB | MOD8251_PEVEN; - } - - if ( cflag&CSTOPB ) - cfcr |= MOD8251_STOP2; - else - cfcr |= MOD8251_STOP1; - - if ( count & 0x10000 ) - cfcr |= MOD8251_CLKx1; - else - cfcr |= MOD8251_CLKx16; - - while (!((tmp = inb(com->sts_port)) & STS8251_TxEMP)) - ; - - /* set baud rate from ospeed */ - pc98_set_baud_rate( com, count ); - - if ( cfcr != pc98_i8251_get_mod(com) ) - pc98_i8251_reset(com, cfcr, pc98_i8251_get_cmd(com) ); - - pc98_enable_i8251_interrupt( com, previnterrupt ); -} - -static int -pc98_ttspeedtab(struct com_s *com, int speed, u_int *divisor) -{ - int if_type, effect_sp, count = -1, mod; - - if_type = com->pc98_if_type & 0x0f; - - switch (com->pc98_if_type) { - case COM_IF_INTERNAL: - if (PC98SIO_baud_rate_port(if_type) != -1) { - count = ttspeedtab(speed, if_8251_type[if_type].speedtab); - if (count > 0) { - count |= COM1_EXT_CLOCK; - break; - } - } - - /* for *1CLK asynchronous! mode, TEFUTEFU */ - mod = (sysclock == 5) ? 2457600 : 1996800; - effect_sp = ttspeedtab( speed, pc98speedtab ); - if ( effect_sp < 0 ) /* XXX */ - effect_sp = ttspeedtab( (speed - 1), pc98speedtab ); - if ( effect_sp <= 0 ) - return effect_sp; - if ( effect_sp == speed ) - mod /= 16; - if ( mod % effect_sp ) - return(-1); - count = mod / effect_sp; - if ( count > 65535 ) - return(-1); - if ( effect_sp != speed ) - count |= 0x10000; - break; - case COM_IF_PC9861K_1: - case COM_IF_PC9861K_2: - count = 1; - break; - case COM_IF_IND_SS_1: - case COM_IF_IND_SS_2: - case COM_IF_PIO9032B_1: - case COM_IF_PIO9032B_2: - count = ttspeedtab( speed, if_8251_type[if_type].speedtab ); - break; - case COM_IF_B98_01_1: - case COM_IF_B98_01_2: - count = ttspeedtab( speed, if_8251_type[if_type].speedtab ); -#ifdef B98_01_OLD - if (count == 0 || count == 1) { - count += 4; - count |= 0x20000; /* x1 mode for 76800 and 153600 */ - } -#endif - break; - } - - if (count < 0) - return count; - - *divisor = (u_int) count; - return 0; -} - -static void -pc98_set_baud_rate( struct com_s *com, u_int count ) -{ - int if_type, io, s; - - if_type = com->pc98_if_type & 0x0f; - io = rman_get_start(com->ioportres) & 0xff00; - - switch (com->pc98_if_type) { - case COM_IF_INTERNAL: - if (PC98SIO_baud_rate_port(if_type) != -1) { - if (count & COM1_EXT_CLOCK) { - outb((Port_t)PC98SIO_baud_rate_port(if_type), count & 0xff); - break; - } else { - outb((Port_t)PC98SIO_baud_rate_port(if_type), 0x09); - } - } - - if (count == 0) - return; - - /* set i8253 */ - s = splclock(); - if (count != 3) - outb( 0x77, 0xb6 ); - else - outb( 0x77, 0xb4 ); - outb( 0x5f, 0); - outb( 0x75, count & 0xff ); - outb( 0x5f, 0); - outb( 0x75, (count >> 8) & 0xff ); - splx(s); - break; - case COM_IF_IND_SS_1: - case COM_IF_IND_SS_2: - outb(io | PC98SIO_intr_ctrl_port(if_type), 0); - outb(io | PC98SIO_baud_rate_port(if_type), 0); - outb(io | PC98SIO_baud_rate_port(if_type), 0xc0); - outb(io | PC98SIO_baud_rate_port(if_type), (count >> 8) | 0x80); - outb(io | PC98SIO_baud_rate_port(if_type), count & 0xff); - break; - case COM_IF_PIO9032B_1: - case COM_IF_PIO9032B_2: - outb(io | PC98SIO_baud_rate_port(if_type), count); - break; - case COM_IF_B98_01_1: - case COM_IF_B98_01_2: - outb(io | PC98SIO_baud_rate_port(if_type), count & 0x0f); -#ifdef B98_01_OLD - /* - * Some old B98_01 board should be controlled - * in different way, but this hasn't been tested yet. - */ - outb(io | PC98SIO_func_port(if_type), - (count & 0x20000) ? 0xf0 : 0xf2); -#endif - break; - } -} -static int -pc98_check_if_type(device_t dev, struct siodev *iod) -{ - int irr, io, if_type, tmp; - static short irq_tab[2][8] = { - { 3, 5, 6, 9, 10, 12, 13, -1}, - { 3, 10, 12, 13, 5, 6, 9, -1} - }; - - if_type = iod->if_type & 0x0f; - iod->irq = 0; - io = isa_get_port(dev) & 0xff00; - - if (IS_8251(iod->if_type)) { - if (PC98SIO_func_port(if_type) != -1) { - outb(io | PC98SIO_func_port(if_type), 0xf2); - tmp = ttspeedtab(9600, if_8251_type[if_type].speedtab); - if (tmp != -1 && PC98SIO_baud_rate_port(if_type) != -1) - outb(io | PC98SIO_baud_rate_port(if_type), tmp); - } - - iod->cmd = io | PC98SIO_cmd_port(if_type); - iod->sts = io | PC98SIO_sts_port(if_type); - iod->mod = io | PC98SIO_in_modem_port(if_type); - iod->ctrl = io | PC98SIO_intr_ctrl_port(if_type); - - if (iod->if_type == COM_IF_INTERNAL) { - iod->irq = 4; - - if (pc98_check_8251vfast()) { - PC98SIO_baud_rate_port(if_type) = I8251F_div; - if_8251_type[if_type].speedtab = pc98fast_speedtab; - } - } else { - tmp = inb( iod->mod ) & if_8251_type[if_type].irr_mask; - if ((isa_get_port(dev) & 0xff) == IO_COM2) - iod->irq = irq_tab[0][tmp]; - else - iod->irq = irq_tab[1][tmp]; - } - } else { - irr = if_16550a_type[if_type].irr_read; -#ifdef COM_MULTIPORT - if (!COM_ISMULTIPORT(device_get_flags(dev)) || - device_get_unit(dev) == COM_MPMASTER(device_get_flags(dev))) -#endif - if (irr != -1) { - tmp = inb(io | irr); - if (isa_get_port(dev) & 0x01) /* XXX depend on RSB-384 */ - iod->irq = irq_tab[1][tmp >> 3]; - else - iod->irq = irq_tab[0][tmp & 0x07]; - } - iod->cmd = 0; - iod->sts = 0; - iod->mod = 0; - iod->ctrl = 0; - } - if ( iod->irq == -1 ) return -1; - - return 0; -} -static void -pc98_set_ioport(struct com_s *com) -{ - int if_type = com->pc98_if_type & 0x0f; - Port_t io = rman_get_start(com->ioportres) & 0xff00; - - pc98_check_sysclock(); - com->data_port = io | PC98SIO_data_port(if_type); - com->cmd_port = io | PC98SIO_cmd_port(if_type); - com->sts_port = io | PC98SIO_sts_port(if_type); - com->in_modem_port = io | PC98SIO_in_modem_port(if_type); - com->intr_ctrl_port = io | PC98SIO_intr_ctrl_port(if_type); -} -static int -pc98_check_8251vfast(void) -{ - int i; - - outb(I8251F_div, 0x8c); - DELAY(10); - for (i = 0; i < 100; i++) { - if ((inb(I8251F_div) & 0x80) != 0) { - i = 0; - break; - } - DELAY(1); - } - outb(I8251F_div, 0); - DELAY(10); - for (; i < 100; i++) { - if ((inb(I8251F_div) & 0x80) == 0) - return 1; - DELAY(1); - } - - return 0; -} -static int -pc98_check_8251fifo(void) -{ - u_char tmp1, tmp2; - - tmp1 = inb(I8251F_iir); - DELAY(10); - tmp2 = inb(I8251F_iir); - if (((tmp1 ^ tmp2) & 0x40) != 0 && ((tmp1 | tmp2) & 0x20) == 0) - return 1; - - return 0; -} -#endif /* PC98 defined */ diff --git a/sys/pc98/cbus/sio_cbus.c b/sys/pc98/cbus/sio_cbus.c deleted file mode 100644 index 2df560cd90cd..000000000000 --- a/sys/pc98/cbus/sio_cbus.c +++ /dev/null @@ -1,119 +0,0 @@ -/*- - * Copyright (c) 2001 TAKAHASHI Yoshihiro - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -static int sio_isa_attach(device_t dev); -static int sio_isa_probe(device_t dev); - -static device_method_t sio_isa_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, sio_isa_probe), - DEVMETHOD(device_attach, sio_isa_attach), - DEVMETHOD(device_detach, siodetach), - - { 0, 0 } -}; - -static driver_t sio_isa_driver = { - sio_driver_name, - sio_isa_methods, - 0, -}; - -static struct isa_pnp_id sio_ids[] = { - {0x0100e4a5, "RSA-98III"}, - {0x4180a3b8, NULL}, /* NEC8041 - PC-9821CB-B04 */ - {0x0181a3b8, NULL}, /* NEC8101 - PC-9821CB2-B04 */ - {0x5181a3b8, NULL}, /* NEC8151 - Internal FAX/Modem for Cx3, Cb3 */ - {0x9181a3b8, NULL}, /* NEC8191 - NEC PC-9801-120 */ - {0xe181a3b8, NULL}, /* NEC81E1 - Internal FAX/Modem */ - {0x1182a3b8, NULL}, /* NEC8211 - PC-9801-123 */ - {0x3182a3b8, NULL}, /* NEC8231 - Internal FAX/Modem(Voice) */ - {0x4182a3b8, NULL}, /* NEC8241 - NEC PC-9821NR-B05 */ - {0x5182a3b8, NULL}, /* NEC8251 - Internel FAX/Modem */ - {0x7182a3b8, NULL}, /* NEC8271 - NEC PC-9801-125 */ - {0x11802fbf, NULL}, /* OYO8011 - Internal FAX/Modem for ValueStar(Ring) */ - {0} -}; - -static int -sio_isa_probe(dev) - device_t dev; -{ - int logical_id; - - /* Check isapnp ids */ - if (ISA_PNP_PROBE(device_get_parent(dev), dev, sio_ids) == ENXIO) - return (ENXIO); - - logical_id = isa_get_logicalid(dev); - switch (logical_id) { - case 0x0100e4a5: /* RSA-98III */ - SET_FLAG(dev, SET_IFTYPE(COM_IF_RSA98III)); - break; - case 0x4180a3b8: /* PC-9821CB-B04 */ - case 0x0181a3b8: /* PC-9821CB2-B04 */ - case 0x5181a3b8: /* for Cx3, Cb3 internal */ - case 0x9181a3b8: /* PC-9801-120 */ - case 0xe181a3b8: /* Internal FAX/Modem */ - case 0x1182a3b8: /* PC-9801-123 */ - case 0x3182a3b8: /* FAX/Voice/Modem internal */ - case 0x4182a3b8: /* PC-9821NR-B05 */ - case 0x5182a3b8: /* FAX/Modem internal */ - case 0x7182a3b8: /* PC-9801-125 */ - case 0x11802fbf: /* for ValueStar internal */ - SET_FLAG(dev, SET_IFTYPE(COM_IF_NS16550)); - break; - } - - return (sioprobe(dev, 0, 0UL, 0)); -} - -static int -sio_isa_attach(dev) - device_t dev; -{ - return (sioattach(dev, 0, 0UL)); -} - -DRIVER_MODULE(sio, isa, sio_isa_driver, sio_devclass, 0, 0); diff --git a/sys/pc98/cbus/syscons_cbus.c b/sys/pc98/cbus/syscons_cbus.c deleted file mode 100644 index e5c29795ee2a..000000000000 --- a/sys/pc98/cbus/syscons_cbus.c +++ /dev/null @@ -1,202 +0,0 @@ -/*- - * Copyright (c) 1999 FreeBSD(98) Porting Team. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer as - * the first lines of this file unmodified. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_syscons.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -#include - -#include - -static devclass_t sc_devclass; - -static sc_softc_t main_softc; - -static void -scidentify(driver_t *driver, device_t parent) -{ - - BUS_ADD_CHILD(parent, ISA_ORDER_SPECULATIVE, "sc", 0); -} - -static int -scprobe(device_t dev) -{ - - /* No pnp support */ - if (isa_get_vendorid(dev)) - return (ENXIO); - - device_set_desc(dev, "System console"); - return (sc_probe_unit(device_get_unit(dev), device_get_flags(dev))); -} - -static int -scattach(device_t dev) -{ - - return sc_attach_unit(device_get_unit(dev), device_get_flags(dev)); -} - -int -sc_max_unit(void) -{ - - return (devclass_get_maxunit(sc_devclass)); -} - -sc_softc_t -*sc_get_softc(int unit, int flags) -{ - sc_softc_t *sc; - - if (unit < 0) - return (NULL); - if ((flags & SC_KERNEL_CONSOLE) != 0) { - /* FIXME: clear if it is wired to another unit! */ - sc = &main_softc; - } else { - sc = device_get_softc(devclass_get_device(sc_devclass, unit)); - if (sc == NULL) - return (NULL); - } - sc->unit = unit; - if ((sc->flags & SC_INIT_DONE) == 0) { - sc->keyboard = -1; - sc->adapter = -1; - sc->mouse_char = SC_MOUSE_CHAR; - } - return (sc); -} - -sc_softc_t -*sc_find_softc(struct video_adapter *adp, struct keyboard *kbd) -{ - sc_softc_t *sc; - int i; - int units; - - sc = &main_softc; - if ((adp == NULL || adp == sc->adp) && - (kbd == NULL || kbd == sc->kbd)) - return (sc); - units = devclass_get_maxunit(sc_devclass); - for (i = 0; i < units; ++i) { - sc = device_get_softc(devclass_get_device(sc_devclass, i)); - if (sc == NULL) - continue; - if ((adp == NULL || adp == sc->adp) && - (kbd == NULL || kbd == sc->kbd)) - return (sc); - } - return (NULL); -} - -int -sc_get_cons_priority(int *unit, int *flags) -{ - const char *at; - int f, u; - - *unit = -1; - for (u = 0; u < 16; u++) { - if (resource_disabled(SC_DRIVER_NAME, u)) - continue; - if (resource_string_value(SC_DRIVER_NAME, u, "at", &at) != 0) - continue; - if (resource_int_value(SC_DRIVER_NAME, u, "flags", &f) != 0) - f = 0; - if (f & SC_KERNEL_CONSOLE) { - /* the user designates this unit to be the console */ - *unit = u; - *flags = f; - break; - } - if (*unit < 0) { - /* ...otherwise remember the first found unit */ - *unit = u; - *flags = f; - } - } - if (*unit < 0) { - *unit = 0; - *flags = 0; - } - return (CN_INTERNAL); -} - -void -sc_get_bios_values(bios_values_t *values) -{ - values->cursor_start = 15; - values->cursor_end = 16; - values->shift_state = 0; - values->bell_pitch = BELL_PITCH; -} - -int -sc_tone(int herz) -{ - - if (herz) { - if (timer_spkr_acquire()) - return (EBUSY); - timer_spkr_setfreq(herz); - } else - timer_spkr_release(); - - return (0); -} - -static device_method_t sc_methods[] = { - DEVMETHOD(device_identify, scidentify), - DEVMETHOD(device_probe, scprobe), - DEVMETHOD(device_attach, scattach), - { 0, 0 } -}; - -static driver_t sc_driver = { - SC_DRIVER_NAME, - sc_methods, - sizeof(sc_softc_t), -}; - -DRIVER_MODULE(sc, isa, sc_driver, sc_devclass, 0, 0); diff --git a/sys/pc98/conf/DEFAULTS b/sys/pc98/conf/DEFAULTS deleted file mode 100644 index 6c8b561841aa..000000000000 --- a/sys/pc98/conf/DEFAULTS +++ /dev/null @@ -1,31 +0,0 @@ -# -# DEFAULTS -- Default kernel configuration file for FreeBSD/pc98 -# -# $FreeBSD$ - -machine pc98 i386 -options PC98 - -# Bus support. -device isa -options ISAPNP - -# Floating point support. -device npx - -# Pseudo devices. -device mem # Memory and kernel memory devices -device io # I/O device - -# UART chips on this platform -device uart_ns8250 -#device uart_i8251 - -# Default partitioning schemes -options GEOM_PART_BSD -options GEOM_PART_PC98 - -# enable support for native hardware -device atpic - -options NEW_PCIB diff --git a/sys/pc98/conf/GENERIC b/sys/pc98/conf/GENERIC deleted file mode 100644 index 3f9364cf30ef..000000000000 --- a/sys/pc98/conf/GENERIC +++ /dev/null @@ -1,262 +0,0 @@ -# -# GENERIC -- Generic kernel configuration file for FreeBSD/pc98 -# -# For more information on this file, please read the config(5) manual page, -# and/or the handbook section on Kernel Configuration Files: -# -# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html -# -# The handbook is also available locally in /usr/share/doc/handbook -# if you've installed the doc distribution, otherwise always see the -# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the -# latest information. -# -# An exhaustive list of options and more detailed explanations of the -# device lines is also present in the ../../conf/NOTES and NOTES files. -# If you are in doubt as to the purpose or necessity of a line, check first -# in NOTES. -# -# $FreeBSD$ - -cpu I486_CPU -cpu I586_CPU -cpu I686_CPU -ident GENERIC - -makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols - -options SCHED_4BSD # 4BSD scheduler -#options PREEMPTION # Enable kernel thread preemption -options INET # InterNETworking -options INET6 # IPv6 communications protocols -options IPSEC # IP (v4/v6) security -options TCP_HHOOK # hhook(9) framework for TCP -options SCTP # Stream Control Transmission Protocol -options FFS # Berkeley Fast Filesystem -options SOFTUPDATES # Enable FFS soft updates support -options UFS_ACL # Support for access control lists -options UFS_DIRHASH # Improve performance on big directories -options UFS_GJOURNAL # Enable gjournal-based UFS journaling -options QUOTA # Enable disk quotas for UFS -options MD_ROOT # MD is a potential root device -options NFSCL # Network Filesystem Client -options NFSD # Network Filesystem Server -options NFSLOCKD # Network Lock Manager -options NFS_ROOT # NFS usable as /, requires NFSCL -options MSDOSFS # MSDOS Filesystem -options CD9660 # ISO 9660 Filesystem -options PROCFS # Process filesystem (requires PSEUDOFS) -options PSEUDOFS # Pseudo-filesystem framework -options GEOM_PART_GPT # GUID Partition Tables. -options GEOM_LABEL # Provides labelization -options COMPAT_FREEBSD4 # Compatible with FreeBSD4 -options COMPAT_FREEBSD5 # Compatible with FreeBSD5 -options COMPAT_FREEBSD6 # Compatible with FreeBSD6 -options COMPAT_FREEBSD7 # Compatible with FreeBSD7 -options COMPAT_FREEBSD9 # Compatible with FreeBSD9 -options COMPAT_FREEBSD10 # Compatible with FreeBSD10 -options COMPAT_FREEBSD11 # Compatible with FreeBSD11 -options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI -options EPSON_BOUNCEDMA # use bounce buffer for 15-16M -#options EPSON_MEMWIN # EPSON memory window support -#options LINE30 -options KTRACE # ktrace(1) support -options STACK # stack(9) support -options SYSVSHM # SYSV-style shared memory -options SYSVMSG # SYSV-style message queues -options SYSVSEM # SYSV-style semaphores -options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions -options PRINTF_BUFR_SIZE=128 # Prevent printf output being interspersed. -options KBD_INSTALL_CDEV # install a CDEV entry in /dev -options HWPMC_HOOKS # Necessary kernel hooks for hwpmc(4) -options AUDIT # Security event auditing -options CAPABILITY_MODE # Capsicum capability mode -options CAPABILITIES # Capsicum capabilities -options MAC # TrustedBSD MAC Framework -options INCLUDE_CONFIG_FILE # Include this file in kernel -options RACCT # Resource accounting framework -options RACCT_DEFAULT_TO_DISABLED # Set kern.racct.enable=0 by default -options RCTL # Resource limits - -# Debugging support. Always need this: -options KDB # Enable kernel debugger support. -options KDB_TRACE # Print a stack trace for a panic. - -# To make an SMP kernel, the next two lines are needed -#options SMP # Symmetric MultiProcessor Kernel -#device apic # I/O APIC - -# Bus support. -device pci - -# Floppy drives -device fdc - -# ATA controllers -device ahci # AHCI-compatible SATA controllers -device ata # Legacy ATA/SATA controllers -device mvs # Marvell 88SX50XX/88SX60XX/88SX70XX/SoC SATA -device siis # SiliconImage SiI3124/SiI3132/SiI3531 SATA - -# SCSI Controllers -device ahc # AHA2940 and onboard AIC7xxx devices -device esp # AMD Am53C974 (Tekram DC-390(T)) -device isp # Qlogic family -#device ncr # NCR/Symbios Logic -device sym # NCR/Symbios Logic (newer chipsets + those of `ncr') - -device adv # Advansys SCSI adapters -device aic # PC-9801-100 -device ct # host adapter using WD33C93[ABC] chip - -device ncv # NCR 53C500 -device nsp # Workbit Ninja SCSI-3 -device stg # TMC 18C30/18C50 - -# ATA/SCSI peripherals -device scbus # SCSI bus (required for ATA/SCSI) -device ch # SCSI media changers -device da # Direct Access (disks) -device sa # Sequential Access (tape etc) -device cd # CD -device pass # Passthrough device (direct ATA/SCSI access) -device ses # Enclosure Services (SES and SAF-TE) -#device ctl # CAM Target Layer - -# keyboard driver -device pckbd # PC98 keyboard - -device gdc # GDC screen - -device splash # Splash screen and screen saver support - -# syscons is the default console driver, resembling an SCO console -device sc - -#device agp # support several AGP chipsets - -# Power management support (see NOTES for more options) -#device apm -#device pmc -#device canbus -#device canbepm -# Add suspend/resume support for the i8254. -#device pmtimer - -# PCCARD (PCMCIA) support -# PCMCIA and cardbus bridge support -device cbb # cardbus (yenta) bridge -device pccard # PC Card (16-bit) bus -device cardbus # CardBus (32-bit) bus - -# Serial (COM) ports -#options COM_MULTIPORT -#options COM_ESP # ESP98 -#device sio # 8250, 16[45]50, 8251 based serial ports -device uart # Generic UART driver - -device mse -#device joy - -# Parallel port -device ppc -device ppbus # Parallel port bus (required) -device lpt # Printer -device ppi # Parallel port interface device -#device vpo # Requires scbus and da -# OLD Parallel port -#device olpt - -device puc # Multi I/O cards and multi-channel UARTs - -# PCI Ethernet NICs. -device de # DEC/Intel DC21x4x (``Tulip'') -#device em # Intel PRO/1000 Gigabit Ethernet Family -device le # AMD Am7900 LANCE and Am79C9xx PCnet -#device ti # Alteon Networks Tigon I/II gigabit Ethernet -device txp # 3Com 3cR990 (``Typhoon'') -device vx # 3Com 3c590, 3c595 (``Vortex'') - -# PCI Ethernet NICs that use the common MII bus controller code. -# NOTE: Be sure to keep the 'device miibus' line in order to use these NICs! -device miibus # MII bus support -device bfe # Broadcom BCM440x 10/100 Ethernet -#device bge # Broadcom BCM570xx Gigabit Ethernet -device dc # DEC/Intel 21143 and various workalikes -device fxp # Intel EtherExpress PRO/100B (82557, 82558) -#device lge # Level 1 LXT1001 gigabit Ethernet -#device nge # NatSemi DP83820 gigabit Ethernet -device pcn # AMD Am79C97x PCI 10/100 (precedence over 'le') -device re # RealTek 8139C+/8169/8169S/8110S -device rl # RealTek 8129/8139 -device sf # Adaptec AIC-6915 (``Starfire'') -device sis # Silicon Integrated Systems SiS 900/SiS 7016 -#device sk # SysKonnect SK-984x & SK-982x gigabit Ethernet -device ste # Sundance ST201 (D-Link DFE-550TX) -device tl # Texas Instruments ThunderLAN -device tx # SMC EtherPower II (83c170 ``EPIC'') -#device vge # VIA VT612x gigabit Ethernet -device vr # VIA Rhine, Rhine II -device wb # Winbond W89C840F -device xl # 3Com 3c90x (``Boomerang'', ``Cyclone'') - -# ISA Ethernet NICs. pccard NICs included. -# 'device ed' requires 'device miibus' -device ed # NE[12]000, SMC Ultra, 3c503, DS8390 cards -device ep # Etherlink III based cards -device fe # Fujitsu MB8696x based cards -device sn # SMC's 9000 series of Ethernet chips -device snc -device xe # Xircom pccard Ethernet - -# Wireless NIC cards -#device wlan # 802.11 support -#options IEEE80211_DEBUG # enable debug msgs -#options IEEE80211_AMPDU_AGE # age frames in AMPDU reorder q's -options IEEE80211_SUPPORT_MESH # enable 802.11s draft support -#device wlan_wep # 802.11 WEP support -#device wlan_ccmp # 802.11 CCMP support -#device wlan_tkip # 802.11 TKIP support -#device wlan_amrr # AMRR transmit rate control algorithm -#device an # Aironet 4500/4800 802.11 wireless NICs. -#device ath # Atheros NICs -#device ath_pci # Atheros pci/cardbus glue -#device ath_hal # pci/cardbus chip support -options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors -#device ath_rate_sample # SampleRate tx rate control for ath -#device ral # Ralink Technology RT2500 wireless NICs. -#device wi # WaveLAN/Intersil/Symbol 802.11 wireless NICs. -#device wl # Older non 802.11 Wavelan wireless NIC. - -# Pseudo devices. -device loop # Network loopback -device random # Entropy device -device ether # Ethernet support -device vlan # 802.1Q VLAN support -device tun # Packet tunnel. -device md # Memory "disks" -device gif # IPv6 and IPv4 tunneling -device firmware # firmware assist module - -# The `bpf' device enables the Berkeley Packet Filter. -# Be aware of the administrative consequences of enabling this! -# Note that 'bpf' is required for DHCP. -device bpf # Berkeley packet filter - -# USB support -#options USB_DEBUG # enable debug msgs -#device uhci # UHCI PCI->USB interface -#device ohci # OHCI PCI->USB interface -#device ehci # EHCI PCI->USB interface (USB 2.0) -#device usb # USB Bus (required) -#device ukbd # Keyboard -#device umass # Disks/Mass storage - Requires scbus and da - -# Sound support -#device sound # Generic sound driver (required) -#device snd_mss # Microsoft Sound System -#device "snd_sb16" # Sound Blaster 16 -#device snd_sbc # Sound Blaster - -# The crypto framework is required by IPSEC -device crypto # Required by IPSEC diff --git a/sys/pc98/conf/GENERIC-NODEBUG b/sys/pc98/conf/GENERIC-NODEBUG deleted file mode 100644 index 7863b44f1db0..000000000000 --- a/sys/pc98/conf/GENERIC-NODEBUG +++ /dev/null @@ -1,38 +0,0 @@ -# -# GENERIC-NODEBUG -- WITNESS and INVARIANTS free kernel configuration file -# for FreeBSD/pc98 -# -# This configuration file removes several debugging options, including -# WITNESS and INVARIANTS checking, which are known to have significant -# performance impact on running systems. When benchmarking new features -# this kernel should be used instead of the standard GENERIC. -# This kernel configuration should never appear outside of the HEAD -# of the FreeBSD tree. -# -# For more information on this file, please read the config(5) manual page, -# and/or the handbook section on Kernel Configuration Files: -# -# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html -# -# The handbook is also available locally in /usr/share/doc/handbook -# if you've installed the doc distribution, otherwise always see the -# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the -# latest information. -# -# An exhaustive list of options and more detailed explanations of the -# device lines is also present in the ../../conf/NOTES and NOTES files. -# If you are in doubt as to the purpose or necessity of a line, check first -# in NOTES. -# -# $FreeBSD$ - -include GENERIC - -ident GENERIC-NODEBUG - -nooptions INVARIANTS -nooptions INVARIANT_SUPPORT -nooptions WITNESS -nooptions WITNESS_SKIPSPIN -nooptions DEADLKRES - diff --git a/sys/pc98/conf/GENERIC.hints b/sys/pc98/conf/GENERIC.hints deleted file mode 100644 index 171c11b543bd..000000000000 --- a/sys/pc98/conf/GENERIC.hints +++ /dev/null @@ -1,294 +0,0 @@ -# $FreeBSD$ - -hint.atacbus.0.at="isa" -hint.atacbus.0.port="0x640" -hint.atacbus.0.irq="9" - -hint.fdc.0.at="isa" -hint.fdc.0.port="0x090" -hint.fdc.0.irq="11" -hint.fdc.0.drq="2" -hint.fd.0.at="fdc0" -hint.fd.0.drive="0" -hint.fd.1.at="fdc0" -hint.fd.1.drive="1" -hint.fd.2.at="fdc0" -hint.fd.2.drive="2" -hint.fd.3.at="fdc0" -hint.fd.3.drive="3" - -# PC-9801-100 -hint.aic.0.at="isa" -hint.aic.0.port="0x1840" -hint.aic.0.irq="5" -hint.aic.0.flags="0x10000" - -# GENERIC -hint.ct.0.at="isa" -# SC98 -#hint.ct.0.at="isa" -#hint.ct.0.flags="0x10000" -# TEXA -#hint.ct.0.at="isa" -#hint.ct.0.flags="0x20000" -# ELECOM -#hint.ct.0.at="isa" -#hint.ct.0.flags="0x30000" -# SMIT -#hint.ct.0.at="isa" -#hint.ct.0.maddr="0xdc000" -#hint.ct.0.flags="0x40000" -# LOGITEC -#hint.ct.0.at="isa" -#hint.ct.0.flags="0x50000" - -hint.attimer.0.at="isa" -hint.attimer.0.port="0x71" -hint.attimer.0.irq="0" - -hint.pcrtc.0.at="isa" - -hint.pckbd.0.at="isa" -hint.pckbd.0.port="0x041" -hint.pckbd.0.irq="1" -hint.gdc.0.at="isa" -hint.sc.0.at="isa" - -#hint.apm.0.disabled="1" -#hint.apm.0.flags="0x20" -#hint.pmc.0.at="isa" -#hint.pmc.0.port="0x8f0" - -# Microsoft Sound System -#hint.pcm.0.at="isa" -#hint.pcm.0.port="0xf40" -#hint.pcm.0.irq="12" -#hint.pcm.0.drq="1" -#hint.pcm.0.flags="0x10000" -# Sound Blaster 16 -#hint.sbc.0.at="isa" -#hint.sbc.0.port="0x20d2" -#hint.sbc.0.irq="10" -#hint.sbc.0.drq="3" - -# COM1 -hint.sio.0.at="isa" -hint.sio.0.port="0x030" -hint.sio.0.irq="4" -# COM2 (2nd CCU) -hint.sio.1.at="isa" -hint.sio.1.port="0x238" -hint.sio.1.irq="5" -hint.sio.1.flags="0x12000000" -# PC-9861K, PC-9801-101, MDC-926Rs -#hint.sio.1.at="isa" -#hint.sio.1.port="0x0B1" -#hint.sio.1.irq="5" -#hint.sio.1.flags="0x01000000" -#hint.sio.2.at="isa" -#hint.sio.2.port="0x0B9" -#hint.sio.2.irq="6" -#hint.sio.2.flags="0x02000000" -# PC-9801-120 (PnP off) -#hint.sio.1.at="isa" -#hint.sio.1.port="0x8b0" -#hint.sio.1.irq="5" -#hint.sio.1.flags="0x11000000" -# MC-16550II, MC-RS98 -#hint.sio.1.at="isa" -#hint.sio.1.port="0xd2" -#hint.sio.1.irq="5" -#hint.sio.1.flags="0x14000101" -#hint.sio.2.at="isa" -#hint.sio.2.port="0x8d2" -#hint.sio.2.flags="0x14000101" -# RSB-2000, RSB-3000, B98-02 -#hint.sio.1.at="isa" -#hint.sio.1.port="0xb0" -#hint.sio.1.flags="0x15000101" -#hint.sio.2.at="isa" -#hint.sio.2.port="0xb1" -#hint.sio.2.flags="0x15000101" -# RSB-384 -#hint.sio.1.at="isa" -#hint.sio.1.port="0xb0" -#hint.sio.1.flags="0x16000000" -#hint.sio.2.at="isa" -#hint.sio.2.port="0xb1" -#hint.sio.2.flags="0x16000000" -# RSA-98III -#hint.sio.1.at="isa" -#hint.sio.1.port="0x50e0" -#hint.sio.1.irq="5" -#hint.sio.1.flags="0x18000101" -#hint.sio.2.at="isa" -#hint.sio.2.port="0x51e0" -#hint.sio.2.flags="0x18000101" -# ESP98 -#hint.sio.1.at="isa" -#hint.sio.1.port="0x18b0" -#hint.sio.1.irq="5" -#hint.sio.1.flags="0x19000000" - -# COM2 (2nd CCU) -hint.uart.1.at="isa" -hint.uart.1.port="0x238" -hint.uart.1.irq="5" - -hint.mse.0.at="isa" -hint.mse.0.port="0x7FD9" -hint.mse.0.irq="13" - -#hint.joy.0.at="isa" -#hint.joy.0.port="0x04d2" - -hint.ppc.0.at="isa" -hint.ppc.0.irq="14" -hint.olpt.0.at="isa" -hint.olpt.0.port="0x040" - -# -# ed0: generic driver/EtherEZ98 -# ed1: LANEED LD-BDN -# ed2: EGY-98 -# ed3: LGY-98 -# ed4: ICM-IF-2766/EN-2298-T -# ed5: SIC-98 -# ed6: PC-9801-108 -# ed7: LA-98 -# ed8: C-NET(98) -# ed9: C-NET(98)E/L -# ed10: EC/EP-98X -# ed11: SB-9801 -# ed12: NC5098 -# -hint.ed.0.at="isa" -hint.ed.0.port="0x00d0" -hint.ed.0.irq="6" -# EtherEZ98 -#hint.ed.0.at="isa" -#hint.ed.0.port="0x10d0" -#hint.ed.0.irq="6" -#hint.ed.0.maddr="0xc8000" -# SIC-98 -hint.ed.5.at="isa" -hint.ed.5.port="0x00d0" -hint.ed.5.irq="6" -hint.ed.5.maddr="0xd0000" -hint.ed.5.msize="16384" -hint.ed.5.flags="0x600000" -hint.ed.5.disabled="1" -# SIU-98-E -#hint.ed.5.at="isa" -#hint.ed.5.port="0x00d0" -#hint.ed.5.irq="6" -#hint.ed.5.maddr="0xd0000" -#hint.ed.5.msize="32768" -#hint.ed.5.flags="0x610000" -# LANEED LD-BDN -hint.ed.1.at="isa" -hint.ed.1.port="0x00d8" -hint.ed.1.irq="6" -hint.ed.1.flags="0x200000" -hint.ed.1.disabled="1" -# LGY-98 -hint.ed.3.at="isa" -hint.ed.3.port="0x00d0" -hint.ed.3.irq="6" -hint.ed.3.flags="0x400000" -hint.ed.3.disabled="1" -# ICM-IF-2766/EN-2298-T -hint.ed.4.at="isa" -hint.ed.4.port="0x56d0" -hint.ed.4.irq="5" -hint.ed.4.flags="0x500000" -hint.ed.4.disabled="1" -# EGY-98 -hint.ed.2.at="isa" -hint.ed.2.port="0x00d8" -hint.ed.2.irq="6" -hint.ed.2.flags="0x300000" -hint.ed.2.disabled="1" -# LA-98 -hint.ed.7.at="isa" -hint.ed.7.port="0x00d0" -hint.ed.7.irq="6" -hint.ed.7.flags="0x900000" -hint.ed.7.disabled="1" -# PC-9801-77 -#hint.ed.7.at="isa" -#hint.ed.7.port="0x00d0" -#hint.ed.7.irq="6" -#hint.ed.7.flags="0x910000" -# PC-9801-108 -hint.ed.6.at="isa" -hint.ed.6.port="0x0770" -hint.ed.6.irq="6" -hint.ed.6.flags="0x800000" -hint.ed.6.disabled="1" -# C-NET(98)E/L -hint.ed.9.at="isa" -hint.ed.9.port="0x03d0" -hint.ed.9.irq="6" -hint.ed.9.flags="0xb00000" -hint.ed.9.disabled="1" -# C-NET(98)E/L(0x55ED) -#hint.ed.9.at="isa" -#hint.ed.9.port="0x03d0" -#hint.ed.9.irq="6" -#hint.ed.9.flags="0xb10000" -# C-NET(98) -hint.ed.8.at="isa" -hint.ed.8.port="0xa3d0" -hint.ed.8.irq="6" -hint.ed.8.maddr="0xd0000" -hint.ed.8.msize="16384" -hint.ed.8.flags="0xa00000" -hint.ed.8.disabled="1" -# EN1646 -#hint.ed.10.at="isa" -#hint.ed.10.port="0x00d0" -#hint.ed.10.irq="3" -#hint.ed.10.flags="0xd00000" -# EC/EP-98X -hint.ed.10.at="isa" -hint.ed.10.port="0x00d0" -hint.ed.10.irq="3" -hint.ed.10.flags="0xd10000" -hint.ed.10.disabled="1" -# SB-9801 -hint.ed.11.at="isa" -hint.ed.11.port="0x00d0" -hint.ed.11.irq="3" -hint.ed.11.flags="0xe00000" -hint.ed.11.disabled="1" -# SN-9801-2 -#hint.ed.11.at="isa" -#hint.ed.11.port="0x00d0" -#hint.ed.11.irq="3" -#hint.ed.11.flags="0xe00001" -# NC5098 -hint.ed.12.at="isa" -hint.ed.12.port="0x20d0" -hint.ed.12.irq="3" -hint.ed.12.flags="0xf00000" -hint.ed.12.disabled="1" - -# fe0: RE1000/1000Plus/AccessPC N98C+/LAC-98 -hint.fe.0.at="isa" -hint.fe.0.port="0x00d0" -hint.fe.0.irq="3" -# fe1: C-NET(98)P2/C-NET(9N)E -hint.fe.1.at="isa" -hint.fe.1.port="0x73d0" -hint.fe.1.irq="5" - -# C-NET(98)S -hint.le.0.at="isa" -hint.le.0.port="0x03d0" -hint.le.0.irq="6" - -hint.snc.0.at="isa" -hint.snc.0.port="0x888" -hint.snc.0.irq="6" -hint.snc.0.maddr="0xc0000" diff --git a/sys/pc98/conf/Makefile b/sys/pc98/conf/Makefile deleted file mode 100644 index dabcd9a48a54..000000000000 --- a/sys/pc98/conf/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD$ - -TARGET=pc98 - -.include "${.CURDIR}/../../conf/makeLINT.mk" diff --git a/sys/pc98/conf/NOTES b/sys/pc98/conf/NOTES deleted file mode 100644 index b8cdc6a1fc39..000000000000 --- a/sys/pc98/conf/NOTES +++ /dev/null @@ -1,628 +0,0 @@ -# -# NOTES -- Lines that can be cut/pasted into kernel and hints configs. -# -# This file contains machine dependent kernel configuration notes. For -# machine independent notes, look in /sys/conf/NOTES. -# -# $FreeBSD$ -# - -# -# We want LINT to cover profiling as well. -profile 2 - - -##################################################################### -# SMP OPTIONS: -# -# The apic device enables the use of the I/O APIC for interrupt delivery. -# The apic device can be used in both UP and SMP kernels, but is required -# for SMP kernels. Thus, the apic device is not strictly an SMP option, -# but it is a prerequisite for SMP. -# - -# Mandatory: -device apic # I/O apic - -# -# Watchdog routines. -# -options MP_WATCHDOG - - - -##################################################################### -# CPU OPTIONS - -# -# You must specify at least one CPU (the one you intend to run on); -# deleting the specification for CPUs you don't need to use may make -# parts of the system run faster. -# -cpu I486_CPU -cpu I586_CPU # aka Pentium(tm) -cpu I686_CPU # aka Pentium Pro(tm) - -# -# Options for CPU features. -# -# CPU_BLUELIGHTNING_3X enables triple-clock mode on IBM Blue Lightning -# CPU if CPU supports it. The default is double-clock mode on -# BlueLightning CPU box. -# -# CPU_BLUELIGHTNING_FPU_OP_CACHE enables FPU operand cache on IBM -# BlueLightning CPU. It works only with Cyrix FPU, and this option -# should not be used with Intel FPU. -# -# CPU_BTB_EN enables branch target buffer on Cyrix 5x86 (NOTE 1). -# -# CPU_CYRIX_NO_LOCK enables weak locking for the entire address space -# of Cyrix 6x86 and 6x86MX CPUs by setting the NO_LOCK bit of CCR1. -# Otherwise, the NO_LOCK bit of CCR1 is cleared. (NOTE 3) -# -# CPU_DIRECT_MAPPED_CACHE sets L1 cache of Cyrix 486DLC CPU in direct -# mapped mode. Default is 2-way set associative mode. -# -# CPU_DISABLE_5X86_LSSER disables load store serialize (i.e., enables -# reorder). This option should not be used if you use memory mapped -# I/O device(s). -# -# CPU_DISABLE_CMPXCHG disables the CMPXCHG instruction on > i386 IA32 -# machines. VmWare 3.x seems to emulate this instruction poorly, causing -# the guest OS to run very slowly. This problem appears to be fixed in -# VmWare 4.x, at least in version 4.5.2, so that enabling this option with -# VmWare 4.x will result in locking operations to be 20-30 times slower. -# Enabling this with an SMP kernel will cause the kernel to be unusable. -# -# CPU_DISABLE_SSE explicitly prevents I686_CPU from turning on SSE. -# -# CPU_FASTER_5X86_FPU enables faster FPU exception handler. -# -# CPU_I486_ON_386 enables CPU cache on i486 based CPU upgrade products -# for i386 machines. -# -# CPU_IORT defines I/O clock delay time (NOTE 1). Default values of -# I/O clock delay time on Cyrix 5x86 and 6x86 are 0 and 7,respectively -# (no clock delay). -# -# CPU_L2_LATENCY specifies the L2 cache latency value. This option is used -# only when CPU_PPRO2CELERON is defined and Mendocino Celeron is detected. -# The default value is 5. -# -# CPU_LOOP_EN prevents flushing the prefetch buffer if the destination -# of a jump is already present in the prefetch buffer on Cyrix 5x86(NOTE -# 1). -# -# CPU_PPRO2CELERON enables L2 cache of Mendocino Celeron CPUs. This option -# is useful when you use Socket 8 to Socket 370 converter, because most Pentium -# Pro BIOSs do not enable L2 cache of Mendocino Celeron CPUs. -# -# CPU_RSTK_EN enables return stack on Cyrix 5x86 (NOTE 1). -# -# CPU_SUSP_HLT enables suspend on HALT. If this option is set, CPU -# enters suspend mode following execution of HALT instruction. -# -# CPU_UPGRADE_HW_CACHE eliminates unneeded cache flush instruction(s). -# -# CPU_WT_ALLOC enables write allocation on Cyrix 6x86/6x86MX and AMD -# K5/K6/K6-2 CPUs. -# -# CYRIX_CACHE_WORKS enables CPU cache on Cyrix 486 CPUs with cache -# flush at hold state. -# -# CYRIX_CACHE_REALLY_WORKS enables (1) CPU cache on Cyrix 486 CPUs -# without cache flush at hold state, and (2) write-back CPU cache on -# Cyrix 6x86 whose revision < 2.7 (NOTE 2). -# -# NO_F00F_HACK disables the hack that prevents Pentiums (and ONLY -# Pentiums) from locking up when a LOCK CMPXCHG8B instruction is -# executed. This option is only needed if I586_CPU is also defined, -# and should be included for any non-Pentium CPU that defines it. -# -# NO_MEMORY_HOLE is an optimisation for systems with AMD K6 processors -# which indicates that the 15-16MB range is *definitely* not being -# occupied by an ISA memory hole. -# -# NOTE 1: The options, CPU_BTB_EN, CPU_LOOP_EN, CPU_IORT, -# CPU_LOOP_EN and CPU_RSTK_EN should not be used because of CPU bugs. -# These options may crash your system. -# -# NOTE 2: If CYRIX_CACHE_REALLY_WORKS is not set, CPU cache is enabled -# in write-through mode when revision < 2.7. If revision of Cyrix -# 6x86 >= 2.7, CPU cache is always enabled in write-back mode. -# -# NOTE 3: This option may cause failures for software that requires -# locked cycles in order to operate correctly. -# -options CPU_BLUELIGHTNING_3X -options CPU_BLUELIGHTNING_FPU_OP_CACHE -options CPU_BTB_EN -options CPU_DIRECT_MAPPED_CACHE -options CPU_DISABLE_5X86_LSSER -options CPU_DISABLE_CMPXCHG -#options CPU_DISABLE_SSE -options CPU_FASTER_5X86_FPU -options CPU_I486_ON_386 -options CPU_IORT -options CPU_L2_LATENCY=5 -options CPU_LOOP_EN -options CPU_PPRO2CELERON -options CPU_RSTK_EN -options CPU_SUSP_HLT -options CPU_UPGRADE_HW_CACHE -options CPU_WT_ALLOC -options CYRIX_CACHE_WORKS -options CYRIX_CACHE_REALLY_WORKS -#options NO_F00F_HACK - -# Debug options -options NPX_DEBUG # enable npx debugging - -# -# PERFMON causes the driver for Pentium/Pentium Pro performance counters -# to be compiled. See perfmon(4) for more information. -# -options PERFMON - - -##################################################################### -# NETWORKING OPTIONS - -# -# DEVICE_POLLING adds support for mixed interrupt-polling handling -# of network device drivers, which has significant benefits in terms -# of robustness to overloads and responsivity, as well as permitting -# accurate scheduling of the CPU time between kernel network processing -# and other activities. The drawback is a moderate (up to 1/HZ seconds) -# potential increase in response times. -# It is strongly recommended to use HZ=1000 or 2000 with DEVICE_POLLING -# to achieve smoother behaviour. -# Additionally, you can enable/disable polling at runtime with help of -# the ifconfig(8) utility, and select the CPU fraction reserved to -# userland with the sysctl variable kern.polling.user_frac -# (default 50, range 0..100). -# -# Not all device drivers support this mode of operation at the time of -# this writing. See polling(4) for more details. - -options DEVICE_POLLING - -# BPF_JITTER adds support for BPF just-in-time compiler. - -options BPF_JITTER - - -##################################################################### -# MISCELLANEOUS DEVICES AND OPTIONS - -# -# sio: serial ports (see sio(4)), including support for various -# PC Card devices, such as Modem and NICs -# -#device sio -hint.sio.0.at="isa" -hint.sio.0.port="0x3F8" -hint.sio.0.flags="0x10" -hint.sio.0.irq="4" - -# `flags' specific to sio(4). -# 0x10 enable console support for this unit. Other console flags -# (if applicable) are ignored unless this is set. Enabling -# console support does not make the unit the preferred console. -# Boot with -h or set boot_serial=YES in the loader. For sio(4) -# specifically, the 0x20 flag can also be set (see above). -# Currently, at most one unit can have console support; the -# first one (in config file order) with this flag set is -# preferred. Setting this flag for sio0 gives the old behaviour. -# 0x20 force this unit to be the console (unless there is another -# higher priority console). This replaces the COMCONSOLE option. -# 0x40 reserve this unit for low level console operations. Do not -# access the device in any normal way. -# 0x80 use this port for serial line gdb support in ddb. Also known -# as debug port. -# PnP `flags' -# 0x1 disable probing of this device. Used to prevent your modem -# from being attached as a PnP modem. -# Other flags for sio that aren't documented in the man page. -# 0x20000 enable hardware RTS/CTS and larger FIFOs. Only works for -# ST16650A-compatible UARTs. - -# Options for sio: -options COM_ESP # Code for Hayes ESP. -options COM_MULTIPORT # Code for some cards with shared IRQs. -options CONSPEED=115200 # Speed for serial console - # (default 9600). - -device speaker #Play IBM BASIC-style noises out your speaker -hint.speaker.0.at="isa" -hint.speaker.0.port="0x35" -device gzip #Exec gzipped a.out's. REQUIRES COMPAT_AOUT! -device apm_saver # Requires APM - - -##################################################################### -# HARDWARE BUS CONFIGURATION - -# -# ISA bus -# -device isa - -# -# Options for `isa': -# -# AUTO_EOI_1 enables the `automatic EOI' feature for the master 8259A -# interrupt controller. This saves about 0.7-1.25 usec for each interrupt. -# This option breaks suspend/resume on some portables. -# -# MAXMEM specifies the amount of RAM on the machine; if this is not -# specified, FreeBSD will first read the amount of memory from the CMOS -# RAM, so the amount of memory will initially be limited to 64MB or 16MB -# depending on the BIOS. If the BIOS reports 64MB, a memory probe will -# then attempt to detect the installed amount of RAM. If this probe -# fails to detect >64MB RAM you will have to use the MAXMEM option. -# The amount is in kilobytes, so for a machine with 128MB of RAM, it would -# be 131072 (128 * 1024). -# -# BROKEN_KEYBOARD_RESET disables the use of the keyboard controller to -# reset the CPU for reboot. This is needed on some systems with broken -# keyboard controllers. -# -# EPSON_BOUNCEDMA was to use a bounce buffer to upper 15MB, but it's -# broken now. -# -# EPSON_MEMWIN disables 15-16MB chunk, and enables EPSON memory window. -# - -options AUTO_EOI_1 - -options MAXMEM=(128*1024) -#options BROKEN_KEYBOARD_RESET -options EPSON_BOUNCEDMA -options EPSON_MEMWIN - -# -# AGP GART support -device agp - -# AGP debugging. -options AGP_DEBUG - - -##################################################################### -# HARDWARE DEVICE CONFIGURATION - -# PC98 keyboard -device pckbd -hint.pckbd.0.at="isa" -hint.pckbd.0.port="0x041" -hint.pckbd.0.irq="1" - -# GDC screen -device gdc -hint.gdc.0.at="isa" -options LINE30 - -# -# The Numeric Processing eXtension driver. This is non-optional. -device npx - -# -# `flags' for npx0: -# 0x01 don't use the npx registers to optimize bcopy. -# 0x02 don't use the npx registers to optimize bzero. -# 0x04 don't use the npx registers to optimize copyin or copyout. -# The npx registers are normally used to optimize copying and zeroing when -# all of the following conditions are satisfied: -# I586_CPU is an option -# the cpu is an i586 (perhaps not a Pentium) -# the probe for npx0 succeeds -# INT 16 exception handling works. -# Then copying and zeroing using the npx registers is normally 30-100% faster. -# The flags can be used to control cases where it doesn't work or is slower. -# Setting them at boot time using hints works right (the optimizations -# are not used until later in the bootstrap when npx0 is attached). -# Flag 0x08 automatically disables the i586 optimized routines. -# - -# -# Optional devices: -# - -# 3Dfx Voodoo Graphics, Voodoo II /dev/3dfx CDEV support. This will create -# the /dev/3dfx0 device to work with glide implementations. This should get -# linked to /dev/3dfx and /dev/voodoo. Note that this is not the same as -# the tdfx DRI module from XFree86 and is completely unrelated. -# -# To enable Linuxulator support, one must also include COMPAT_LINUX in the -# config as well. The other option is to load both as modules. - -device tdfx # Enable 3Dfx Voodoo support -device tdfx_linux # Enable Linuxulator support - -# Direct Rendering modules for 3D acceleration. -device drm # DRM core module required by DRM drivers -device mach64drm # ATI Rage Pro, Rage Mobility P/M, Rage XL -device mgadrm # AGP Matrox G200, G400, G450, G550 -device r128drm # ATI Rage 128 -device radeondrm # ATI Radeon -device savagedrm # S3 Savage3D, Savage4 -device sisdrm # SiS 300/305, 540, 630 -device tdfxdrm # 3dfx Voodoo 3/4/5 and Banshee -options DRM_DEBUG # Include debug printfs (slow) - -# -# Bus mouse -# -device mse -hint.mse.0.at="isa" -hint.mse.0.port="0x7fd9" -hint.mse.0.irq="13" - -# -# Network interfaces: -# - -# ce: Cronyx Tau-PCI/32 sync single/dual port G.703/E1 serial adaptor -# with 32 HDLC subchannels (requires sppp (default), or NETGRAPH if -# NETGRAPH_CRONYX is configured) -# cp: Cronyx Tau-PCI sync single/dual/four port -# V.35/RS-232/RS-530/RS-449/X.21/G.703/E1/E3/T3/STS-1 -# serial adaptor (requires sppp (default), or NETGRAPH if -# NETGRAPH_CRONYX is configured) -# cs: IBM Etherjet and other Crystal Semi CS89x0-based adapters and pccard -# ed: Western Digital and SMC 80xx; Novell NE1000 and NE2000; 3Com 3C503 -# HP PC Lan+, various PC Card devices -# (requires miibus) -# ie: AT&T StarLAN 10 and EN100; 3Com 3C507; unknown NI5210; -# Intel EtherExpress -# le: AMD Am7900 LANCE and Am79C9xx ILACC/PCnet Ethernet interface driver -# sbni: Granch SBNI12-xx ISA and PCI adapters -# snc: National Semiconductor DP8393X SONIC Ethernet adapter driver - -# Order for ISA/EISA devices is important here - -device ce -device cp -device cs -device ed -hint.ed.0.at="isa" -hint.ed.0.port="0x280" -hint.ed.0.irq="5" -hint.ed.0.maddr="0xd8000" -#device le -# Hint for the PC98-only C-NET(98)S C-bus front-end of le(4). -hint.le.0.at="isa" -hint.le.0.port="0x03d0" -hint.le.0.irq="6" -device sbni -hint.sbni.0.at="isa" -hint.sbni.0.port="0x210" -hint.sbni.0.irq="0xefdead" -hint.sbni.0.flags="0" -device snc -hint.snc.0.at="isa" -hint.snc.0.port="0x888" -hint.snc.0.irq="6" -hint.snc.0.maddr="0xc0000" - -# -# SCSI host adapters: -# -# ct: WD33C93[ABC] based SCSI host adapters. -# ncv: NCR 53C500 based SCSI host adapters. -# nsp: Workbit Ninja SCSI-3 based PC Card SCSI host adapters. -# stg: TMC 18C30, 18C50 based SCSI host adapters. - -device ct -hint.ct.0.at="isa" -device ncv -device nsp -device stg - -# -# SafeNet crypto driver: can be moved to the MI NOTES as soon as -# it's tested on a big-endian machine -# -device safe # SafeNet 1141 -options SAFE_DEBUG # enable debugging support: hw.safe.debug -options SAFE_RNDTEST # enable rndtest support - -##################################################################### - -# -# Miscellaneous hardware: -# -# apm: Laptop Advanced Power Management (experimental) -# canbus: CanBe I/O Bus -# canbepm: CanBe Power Management Controller -# olpt: XXX -# pmc: Power Management Controller of NEC PC-98Note -# pmtimer: Timer device driver for power management events (APM or ACPI) -# Adjusts system timer at wakeup time -# -# Notes on APM -# The flags takes the following meaning for apm0: -# 0x0020 Statclock is broken. - -device apm -hint.apm.0.flags="0x20" -device canbus -device canbepm -device olpt -hint.olpt.0.at="isa" -hint.olpt.0.port="0x040" -device pmc -hint.pmc.0.at="isa" -hint.pmc.0.port="0x8f0" -device pmtimer - -# -# Laptop/Notebook options: -# -# See also: -# apm under `Miscellaneous hardware' -# above. - -# For older notebooks that signal a powerfail condition (external -# power supply dropped, or battery state low) by issuing an NMI: - -options POWERFAIL_NMI # make it beep instead of panicing - -# -# Set the number of PV entries per process. Increasing this can -# stop panics related to heavy use of shared memory. However, that can -# (combined with large amounts of physical memory) cause panics at -# boot time due the kernel running out of VM space. -# -# If you're tweaking this, you might also want to increase the sysctls -# "vm.v_free_min", "vm.v_free_reserved", and "vm.v_free_target". -# -# The value below is the one more than the default. -# -options PMAP_SHPGPERPROC=201 - -# -# Change the size of the kernel virtual address space. Due to -# constraints in loader(8) on i386, this must be a multiple of 4. -# 256 = 1 GB of kernel address space. Increasing this also causes -# a reduction of the address space in user processes. 512 splits -# the 4GB cpu address space in half (2GB user, 2GB kernel). -# -options KVA_PAGES=260 - - -##################################################################### -# ABI Emulation - -# Enable iBCS2 runtime support for SCO and ISC binaries -#options IBCS2 - -# Emulate spx device for client side of SVR3 local X interface -options SPX_HACK - -# Enable Linux ABI emulation -options COMPAT_LINUX - -# Enable i386 a.out binary support -options COMPAT_AOUT - -# Enable the linux-like proc filesystem support (requires COMPAT_LINUX -# and PSEUDOFS) -options LINPROCFS - -# Enable the linux-like sys filesystem support (requires COMPAT_LINUX -# and PSEUDOFS) -options LINSYSFS - -# -# SysVR4 ABI emulation -# -# The svr4 ABI emulator can be statically compiled into the kernel or loaded as -# a KLD module. -# The STREAMS network emulation code can also be compiled statically or as a -# module. If loaded as a module, it must be loaded before the svr4 module -# (the /usr/sbin/svr4 script does this for you). If compiling statically, -# the `streams' device must be configured into any kernel which also -# specifies COMPAT_SVR4. It is possible to have a statically-configured -# STREAMS device and a dynamically loadable svr4 emulator; the /usr/sbin/svr4 -# script understands that it doesn't need to load the `streams' module under -# those circumstances. -# Caveat: At this time, `options KTRACE' is required for the svr4 emulator -# (whether static or dynamic). -# -options COMPAT_SVR4 # build emulator statically -options DEBUG_SVR4 # enable verbose debugging -device streams # STREAMS network driver (required for svr4). - - -##################################################################### -# VM OPTIONS - -# Disable the 4 MByte page PSE CPU feature. The PSE feature allows the -# kernel to use 4 MByte pages to map the kernel instead of 4k pages. -# This saves on the amount of memory needed for page tables needed to -# map the kernel. You should only disable this feature as a temporary -# workaround if you are having problems with it enabled. -# -#options DISABLE_PSE - -# Disable the global pages PGE CPU feature. The PGE feature allows pages -# to be marked with the PG_G bit. TLB entries for these pages are not -# flushed from the cache when %cr3 is reloaded. This can make context -# switches less expensive. You should only disable this feature as a -# temporary workaround if you are having problems with it enabled. -# -#options DISABLE_PG_G - -# KSTACK_PAGES is the number of memory pages to assign to the kernel -# stack of each thread. - -options KSTACK_PAGES=3 - -##################################################################### - -# More undocumented options for linting. -# Note that documenting these are not considered an affront. - -options FB_INSTALL_CDEV # install a CDEV entry in /dev - -options I586_PMC_GUPROF=0x70000 -options KBDIO_DEBUG=2 -options KBD_MAXRETRY=4 -options KBD_MAXWAIT=6 -options KBD_RESETDELAY=201 - -options TIMER_FREQ=((14318182+6)/12) - -options VM_KMEM_SIZE -options VM_KMEM_SIZE_MAX -options VM_KMEM_SIZE_SCALE - - -##################################################################### -# Devices we don't want to deal with - -nodevice bt -nodevice adw -nodevice aha -nodevice ahb -nodevice ahd -nodevice mpt -nodevice trm -nodevice dpt -nodevice ciss -nodevice iir -nodevice mly -nodevice ida # Compaq Smart RAID -nodevice mlx # Mylex DAC960 -nodevice amr # AMI MegaRAID -nodevice twe # 3ware ATA RAID -nodevice cm -nodevice ex -nodevice fea -nodevice intpm -nodevice alpm -nodevice ichsmb -nodevice viapm -nodevice amdpm -nodevice amdsmb -nodevice nfpm -nodevice nfsmb - - -##################################################################### -# Options we don't want to deal with - -nooption AHD_DEBUG -nooption AHD_DEBUG_OPTS -nooption AHD_REG_PRETTY_PRINT -nooption ADW_ALLOW_MEMIO -nooption DPT_LOST_IRQ -nooption DPT_RESET_HBA -nooption DPT_TIMEOUT_FACTOR -nooption AAC_DEBUG - - -##################################################################### -# Make options we don't want to deal with diff --git a/sys/pc98/include/_align.h b/sys/pc98/include/_align.h deleted file mode 100644 index 28c4669ad258..000000000000 --- a/sys/pc98/include/_align.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/_bus.h b/sys/pc98/include/_bus.h deleted file mode 100644 index 8070792dffc9..000000000000 --- a/sys/pc98/include/_bus.h +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * Copyright (c) 2005 M. Warner Losh. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions, and the following disclaimer, - * without modification, immediately at the beginning of the file. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef PC98_INCLUDE__BUS_H -#define PC98_INCLUDE__BUS_H - -/* - * Bus address and size types - */ -typedef u_int bus_addr_t; -typedef u_int bus_size_t; - -typedef struct bus_space_tag *bus_space_tag_t; -typedef struct bus_space_handle *bus_space_handle_t; - -#endif /* PC98_INCLUDE__BUS_H */ diff --git a/sys/pc98/include/_inttypes.h b/sys/pc98/include/_inttypes.h deleted file mode 100644 index 40107cd74a71..000000000000 --- a/sys/pc98/include/_inttypes.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/_limits.h b/sys/pc98/include/_limits.h deleted file mode 100644 index 3c7365bb4ed1..000000000000 --- a/sys/pc98/include/_limits.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/_stdint.h b/sys/pc98/include/_stdint.h deleted file mode 100644 index db1affc0770c..000000000000 --- a/sys/pc98/include/_stdint.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/_types.h b/sys/pc98/include/_types.h deleted file mode 100644 index 26803672ff6f..000000000000 --- a/sys/pc98/include/_types.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/apm_bios.h b/sys/pc98/include/apm_bios.h deleted file mode 100644 index 77d99c19bf40..000000000000 --- a/sys/pc98/include/apm_bios.h +++ /dev/null @@ -1,55 +0,0 @@ -/*- - * Copyright (C) 2005 M. Warner Losh. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _PC98_INCLUDE_APM_BIOS_H_ -#define _PC98_INCLUDE_APM_BIOS_H_ - -/* - * PC98 machines implement APM bios in nearly the same was as i386 machines, - * so include the i386 version and note the changes here. - */ -#include - -/* - * APM BIOS and interrupt are different on pc98 - */ -#undef APM_BIOS -#undef APM_INT -#define APM_BIOS 0x9a -#define APM_INT 0x1f - - -/* - * PC98 also has different GETPWSTATUS and DRVVERSION calls. I believe that - * these only work on newer APM BIOSes, but haven't confirmed that recently - */ -#undef APM_GETPWSTATUS -#undef APM_DRVVERSION -#define APM_GETPWSTATUS 0x3a -#define APM_DRVVERSION 0x3e - -#endif /* ! _PC98_INCLUDE_APM_BIOS_H_ */ diff --git a/sys/pc98/include/apm_segments.h b/sys/pc98/include/apm_segments.h deleted file mode 100644 index fac544b04273..000000000000 --- a/sys/pc98/include/apm_segments.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/asm.h b/sys/pc98/include/asm.h deleted file mode 100644 index aa141634f7de..000000000000 --- a/sys/pc98/include/asm.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/asmacros.h b/sys/pc98/include/asmacros.h deleted file mode 100644 index 98f3839356bf..000000000000 --- a/sys/pc98/include/asmacros.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/atomic.h b/sys/pc98/include/atomic.h deleted file mode 100644 index e6550e4bc6ec..000000000000 --- a/sys/pc98/include/atomic.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/bootinfo.h b/sys/pc98/include/bootinfo.h deleted file mode 100644 index c627e432227a..000000000000 --- a/sys/pc98/include/bootinfo.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/bus.h b/sys/pc98/include/bus.h deleted file mode 100644 index 206041410f75..000000000000 --- a/sys/pc98/include/bus.h +++ /dev/null @@ -1,648 +0,0 @@ -/*- - * Copyright (c) KATO Takenori, 1999. - * - * All rights reserved. Unpublished rights reserved under the copyright - * laws of Japan. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer as - * the first lines of this file unmodified. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -/* $NecBSD: busio.h,v 3.25.4.2.2.1 2000/06/12 03:53:08 honda Exp $ */ -/* $NetBSD: bus.h,v 1.12 1997/10/01 08:25:15 fvdl Exp $ */ - -/*- - * [NetBSD for NEC PC-98 series] - * Copyright (c) 1997, 1998 - * NetBSD/pc98 porting staff. All rights reserved. - * - * [Ported for FreeBSD] - * Copyright (c) 2001 - * TAKAHASHI Yoshihiro. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Copyright (c) 1997, 1998 - * Naofumi HONDA. All rights reserved. - * - * This module support generic bus address relocation mechanism. - * To reduce a function call overhead, we employ pascal call methods. - */ - -#ifndef _PC98_BUS_H_ -#define _PC98_BUS_H_ - -#ifdef _KERNEL -#include -#endif /* _KERNEL */ - -#include -#include - -#define BUS_SPACE_MAXSIZE_24BIT 0xFFFFFF -#define BUS_SPACE_MAXSIZE_32BIT 0xFFFFFFFF -#define BUS_SPACE_MAXSIZE 0xFFFFFFFF -#define BUS_SPACE_MAXADDR_24BIT 0xFFFFFF -#define BUS_SPACE_MAXADDR_32BIT 0xFFFFFFFF -#define BUS_SPACE_MAXADDR 0xFFFFFFFF - -#define BUS_SPACE_UNRESTRICTED (~0) - -#ifdef _KERNEL - -/* - * address relocation table - */ -#define BUS_SPACE_IAT_MAXSIZE 33 -typedef bus_addr_t *bus_space_iat_t; - -#define BUS_SPACE_IAT_SZ(IOTARRAY) (sizeof(IOTARRAY)/sizeof(bus_addr_t)) - -/* - * Access methods for bus resources and address space. - */ -struct resource; - -/* - * bus space tag - */ -#define _PASCAL_CALL (void) - -#define _BUS_SPACE_CALL_FUNCS_TAB(NAME,TYPE,BWN) \ - NAME##_space_read_##BWN, \ - NAME##_space_read_multi_##BWN, \ - NAME##_space_read_region_##BWN, \ - NAME##_space_write_##BWN, \ - NAME##_space_write_multi_##BWN, \ - NAME##_space_write_region_##BWN, \ - NAME##_space_set_multi_##BWN, \ - NAME##_space_set_region_##BWN, \ - NAME##_space_copy_region_##BWN - -#define _BUS_SPACE_CALL_FUNCS_PROTO(NAME,TYPE,BWN) \ - TYPE NAME##_space_read_##BWN _PASCAL_CALL; \ - void NAME##_space_read_multi_##BWN _PASCAL_CALL; \ - void NAME##_space_read_region_##BWN _PASCAL_CALL; \ - void NAME##_space_write_##BWN _PASCAL_CALL; \ - void NAME##_space_write_multi_##BWN _PASCAL_CALL; \ - void NAME##_space_write_region_##BWN _PASCAL_CALL; \ - void NAME##_space_set_multi_##BWN _PASCAL_CALL; \ - void NAME##_space_set_region_##BWN _PASCAL_CALL; \ - void NAME##_space_copy_region_##BWN _PASCAL_CALL; - -#define _BUS_SPACE_CALL_FUNCS(NAME,TYPE,BWN) \ - TYPE (* NAME##_read_##BWN) _PASCAL_CALL; \ - void (* NAME##_read_multi_##BWN) _PASCAL_CALL; \ - void (* NAME##_read_region_##BWN) _PASCAL_CALL; \ - void (* NAME##_write_##BWN) _PASCAL_CALL; \ - void (* NAME##_write_multi_##BWN) _PASCAL_CALL; \ - void (* NAME##_write_region_##BWN) _PASCAL_CALL; \ - void (* NAME##_set_multi_##BWN) _PASCAL_CALL; \ - void (* NAME##_set_region_##BWN) _PASCAL_CALL; \ - void (* NAME##_copy_region_##BWN) _PASCAL_CALL; - -struct bus_space_access_methods { - /* 8 bits access methods */ - _BUS_SPACE_CALL_FUNCS(bs,u_int8_t,1) - - /* 16 bits access methods */ - _BUS_SPACE_CALL_FUNCS(bs,u_int16_t,2) - - /* 32 bits access methods */ - _BUS_SPACE_CALL_FUNCS(bs,u_int32_t,4) -}; - -/* - * Access methods for bus resources and address space. - */ -struct bus_space_tag { -#define BUS_SPACE_TAG_IO 0 -#define BUS_SPACE_TAG_MEM 1 - u_int bs_tag; /* bus space flags */ - - struct bus_space_access_methods bs_da; /* direct access */ - struct bus_space_access_methods bs_ra; /* relocate access */ -#if 0 - struct bus_space_access_methods bs_ida; /* indexed direct access */ -#endif -}; - -/* - * bus space handle - */ -struct bus_space_handle { - bus_addr_t bsh_base; - size_t bsh_sz; - - bus_addr_t bsh_iat[BUS_SPACE_IAT_MAXSIZE]; - size_t bsh_maxiatsz; - size_t bsh_iatsz; - - struct resource **bsh_res; - size_t bsh_ressz; - - struct bus_space_access_methods bsh_bam; -}; - -/* - * Values for the pc98 bus space tag, not to be used directly by MI code. - */ -extern struct bus_space_tag SBUS_io_space_tag; -extern struct bus_space_tag SBUS_mem_space_tag; - -#define X86_BUS_SPACE_IO (&SBUS_io_space_tag) -#define X86_BUS_SPACE_MEM (&SBUS_mem_space_tag) - -/* - * Allocate/Free bus_space_handle - */ -int i386_bus_space_handle_alloc(bus_space_tag_t t, bus_addr_t bpa, - bus_size_t size, bus_space_handle_t *bshp); -void i386_bus_space_handle_free(bus_space_tag_t t, bus_space_handle_t bsh, - size_t size); - -/* - * int bus_space_map (bus_space_tag_t t, bus_addr_t addr, - * bus_size_t size, int flag, bus_space_handle_t *bshp); - * - * Map a region of bus space. - */ - -int i386_memio_map(bus_space_tag_t t, bus_addr_t addr, bus_size_t size, - int flag, bus_space_handle_t *bshp); - -#define bus_space_map(t, a, s, f, hp) \ - i386_memio_map((t), (a), (s), (f), (hp)) - -/* - * int bus_space_unmap (bus_space_tag_t t, - * bus_space_handle_t bsh, bus_size_t size); - * - * Unmap a region of bus space. - */ - -void i386_memio_unmap(bus_space_tag_t t, bus_space_handle_t bsh, - bus_size_t size); - -#define bus_space_unmap(t, h, s) \ - i386_memio_unmap((t), (h), (s)) - -/* - * int bus_space_map_load (bus_space_tag_t t, bus_space_handle_t bsh, - * bus_size_t size, bus_space_iat_t iat, u_int flags); - * - * Load I/O address table of bus space. - */ - -int i386_memio_map_load(bus_space_tag_t t, bus_space_handle_t bsh, - bus_size_t size, bus_space_iat_t iat, u_int flags); - -#define bus_space_map_load(t, h, s, iat, f) \ - i386_memio_map_load((t), (h), (s), (iat), (f)) - -/* - * int bus_space_subregion (bus_space_tag_t t, - * bus_space_handle_t bsh, bus_size_t offset, bus_size_t size, - * bus_space_handle_t *nbshp); - * - * Get a new handle for a subregion of an already-mapped area of bus space. - */ - -int i386_memio_subregion(bus_space_tag_t t, bus_space_handle_t bsh, - bus_size_t offset, bus_size_t size, - bus_space_handle_t *nbshp); - -#define bus_space_subregion(t, h, o, s, nhp) \ - i386_memio_subregion((t), (h), (o), (s), (nhp)) - -/* - * int bus_space_free (bus_space_tag_t t, - * bus_space_handle_t bsh, bus_size_t size); - * - * Free a region of bus space. - */ - -void i386_memio_free(bus_space_tag_t t, bus_space_handle_t bsh, - bus_size_t size); - -#define bus_space_free(t, h, s) \ - i386_memio_free((t), (h), (s)) - -/* - * int bus_space_compare (bus_space_tag_t t1, bus_space_handle_t bsh1, - * bus_space_tag_t t2, bus_space_handle_t bsh2); - * - * Compare two resources. - */ -int i386_memio_compare(bus_space_tag_t t1, bus_space_handle_t bsh1, - bus_space_tag_t t2, bus_space_handle_t bsh2); - -#define bus_space_compare(t1, h1, t2, h2) \ - i386_memio_compare((t1), (h1), (t2), (h2)) - -/* - * Access methods for bus resources and address space. - */ -#define _BUS_ACCESS_METHODS_PROTO(TYPE,BWN) \ - static __inline TYPE bus_space_read_##BWN \ - (bus_space_tag_t, bus_space_handle_t, bus_size_t offset); \ - static __inline void bus_space_read_multi_##BWN \ - (bus_space_tag_t, bus_space_handle_t, \ - bus_size_t, TYPE *, size_t); \ - static __inline void bus_space_read_region_##BWN \ - (bus_space_tag_t, bus_space_handle_t, \ - bus_size_t, TYPE *, size_t); \ - static __inline void bus_space_write_##BWN \ - (bus_space_tag_t, bus_space_handle_t, bus_size_t, TYPE); \ - static __inline void bus_space_write_multi_##BWN \ - (bus_space_tag_t, bus_space_handle_t, \ - bus_size_t, const TYPE *, size_t); \ - static __inline void bus_space_write_region_##BWN \ - (bus_space_tag_t, bus_space_handle_t, \ - bus_size_t, const TYPE *, size_t); \ - static __inline void bus_space_set_multi_##BWN \ - (bus_space_tag_t, bus_space_handle_t, bus_size_t, TYPE, size_t);\ - static __inline void bus_space_set_region_##BWN \ - (bus_space_tag_t, bus_space_handle_t, bus_size_t, TYPE, size_t);\ - static __inline void bus_space_copy_region_##BWN \ - (bus_space_tag_t, bus_space_handle_t, bus_size_t, \ - bus_space_handle_t, bus_size_t, size_t); - -_BUS_ACCESS_METHODS_PROTO(u_int8_t,1) -_BUS_ACCESS_METHODS_PROTO(u_int16_t,2) -_BUS_ACCESS_METHODS_PROTO(u_int32_t,4) - -/* - * read methods - */ -#define _BUS_SPACE_READ(TYPE,BWN) \ -static __inline TYPE \ -bus_space_read_##BWN (bus_space_tag_t tag, bus_space_handle_t bsh, \ - bus_size_t offset) \ -{ \ - register TYPE result; \ - \ - __asm __volatile("call *%2" \ - :"=a" (result), \ - "=d" (offset) \ - :"o" (bsh->bsh_bam.bs_read_##BWN), \ - "b" (bsh), \ - "1" (offset) \ - ); \ - \ - return result; \ -} - -_BUS_SPACE_READ(u_int8_t,1) -_BUS_SPACE_READ(u_int16_t,2) -_BUS_SPACE_READ(u_int32_t,4) - -/* - * write methods - */ -#define _BUS_SPACE_WRITE(TYPE,BWN) \ -static __inline void \ -bus_space_write_##BWN (bus_space_tag_t tag, bus_space_handle_t bsh, \ - bus_size_t offset, TYPE val) \ -{ \ - \ - __asm __volatile("call *%1" \ - :"=d" (offset) \ - :"o" (bsh->bsh_bam.bs_write_##BWN), \ - "a" (val), \ - "b" (bsh), \ - "0" (offset) \ - ); \ -} - -_BUS_SPACE_WRITE(u_int8_t,1) -_BUS_SPACE_WRITE(u_int16_t,2) -_BUS_SPACE_WRITE(u_int32_t,4) - -/* - * multi read - */ -#define _BUS_SPACE_READ_MULTI(TYPE,BWN) \ -static __inline void \ -bus_space_read_multi_##BWN (bus_space_tag_t tag, bus_space_handle_t bsh, \ - bus_size_t offset, TYPE *buf, size_t cnt) \ -{ \ - \ - __asm __volatile("call *%3" \ - :"=c" (cnt), \ - "=d" (offset), \ - "=D" (buf) \ - :"o" (bsh->bsh_bam.bs_read_multi_##BWN), \ - "b" (bsh), \ - "0" (cnt), \ - "1" (offset), \ - "2" (buf) \ - :"memory"); \ -} - -_BUS_SPACE_READ_MULTI(u_int8_t,1) -_BUS_SPACE_READ_MULTI(u_int16_t,2) -_BUS_SPACE_READ_MULTI(u_int32_t,4) - -/* - * multi write - */ -#define _BUS_SPACE_WRITE_MULTI(TYPE,BWN) \ -static __inline void \ -bus_space_write_multi_##BWN (bus_space_tag_t tag, bus_space_handle_t bsh, \ - bus_size_t offset, const TYPE *buf, size_t cnt) \ -{ \ - \ - __asm __volatile("call *%3" \ - :"=c" (cnt), \ - "=d" (offset), \ - "=S" (buf) \ - :"o" (bsh->bsh_bam.bs_write_multi_##BWN), \ - "b" (bsh), \ - "0" (cnt), \ - "1" (offset), \ - "2" (buf) \ - ); \ -} - -_BUS_SPACE_WRITE_MULTI(u_int8_t,1) -_BUS_SPACE_WRITE_MULTI(u_int16_t,2) -_BUS_SPACE_WRITE_MULTI(u_int32_t,4) - -/* - * region read - */ -#define _BUS_SPACE_READ_REGION(TYPE,BWN) \ -static __inline void \ -bus_space_read_region_##BWN (bus_space_tag_t tag, bus_space_handle_t bsh, \ - bus_size_t offset, TYPE *buf, size_t cnt) \ -{ \ - \ - __asm __volatile("call *%3" \ - :"=c" (cnt), \ - "=d" (offset), \ - "=D" (buf) \ - :"o" (bsh->bsh_bam.bs_read_region_##BWN), \ - "b" (bsh), \ - "0" (cnt), \ - "1" (offset), \ - "2" (buf) \ - :"memory"); \ -} - -_BUS_SPACE_READ_REGION(u_int8_t,1) -_BUS_SPACE_READ_REGION(u_int16_t,2) -_BUS_SPACE_READ_REGION(u_int32_t,4) - -/* - * region write - */ -#define _BUS_SPACE_WRITE_REGION(TYPE,BWN) \ -static __inline void \ -bus_space_write_region_##BWN (bus_space_tag_t tag, bus_space_handle_t bsh, \ - bus_size_t offset, const TYPE *buf, size_t cnt) \ -{ \ - \ - __asm __volatile("call *%3" \ - :"=c" (cnt), \ - "=d" (offset), \ - "=S" (buf) \ - :"o" (bsh->bsh_bam.bs_write_region_##BWN), \ - "b" (bsh), \ - "0" (cnt), \ - "1" (offset), \ - "2" (buf) \ - ); \ -} - -_BUS_SPACE_WRITE_REGION(u_int8_t,1) -_BUS_SPACE_WRITE_REGION(u_int16_t,2) -_BUS_SPACE_WRITE_REGION(u_int32_t,4) - -/* - * multi set - */ -#define _BUS_SPACE_SET_MULTI(TYPE,BWN) \ -static __inline void \ -bus_space_set_multi_##BWN (bus_space_tag_t tag, bus_space_handle_t bsh, \ - bus_size_t offset, TYPE val, size_t cnt) \ -{ \ - \ - __asm __volatile("call *%2" \ - :"=c" (cnt), \ - "=d" (offset) \ - :"o" (bsh->bsh_bam.bs_set_multi_##BWN), \ - "a" (val), \ - "b" (bsh), \ - "0" (cnt), \ - "1" (offset) \ - ); \ -} - -_BUS_SPACE_SET_MULTI(u_int8_t,1) -_BUS_SPACE_SET_MULTI(u_int16_t,2) -_BUS_SPACE_SET_MULTI(u_int32_t,4) - -/* - * region set - */ -#define _BUS_SPACE_SET_REGION(TYPE,BWN) \ -static __inline void \ -bus_space_set_region_##BWN (bus_space_tag_t tag, bus_space_handle_t bsh, \ - bus_size_t offset, TYPE val, size_t cnt) \ -{ \ - \ - __asm __volatile("call *%2" \ - :"=c" (cnt), \ - "=d" (offset) \ - :"o" (bsh->bsh_bam.bs_set_region_##BWN), \ - "a" (val), \ - "b" (bsh), \ - "0" (cnt), \ - "1" (offset) \ - ); \ -} - -_BUS_SPACE_SET_REGION(u_int8_t,1) -_BUS_SPACE_SET_REGION(u_int16_t,2) -_BUS_SPACE_SET_REGION(u_int32_t,4) - -/* - * copy - */ -#define _BUS_SPACE_COPY_REGION(BWN) \ -static __inline void \ -bus_space_copy_region_##BWN (bus_space_tag_t tag, bus_space_handle_t sbsh, \ - bus_size_t src, bus_space_handle_t dbsh, bus_size_t dst, size_t cnt) \ -{ \ - \ - if (dbsh->bsh_bam.bs_copy_region_1 != sbsh->bsh_bam.bs_copy_region_1) \ - panic("bus_space_copy_region: funcs mismatch (ENOSUPPORT)");\ - \ - __asm __volatile("call *%3" \ - :"=c" (cnt), \ - "=S" (src), \ - "=D" (dst) \ - :"o" (dbsh->bsh_bam.bs_copy_region_##BWN), \ - "a" (sbsh), \ - "b" (dbsh), \ - "0" (cnt), \ - "1" (src), \ - "2" (dst) \ - ); \ -} - -_BUS_SPACE_COPY_REGION(1) -_BUS_SPACE_COPY_REGION(2) -_BUS_SPACE_COPY_REGION(4) - -/* - * Bus read/write barrier methods. - * - * void bus_space_barrier(bus_space_tag_t tag, bus_space_handle_t bsh, - * bus_size_t offset, bus_size_t len, int flags); - * - * - * Note that BUS_SPACE_BARRIER_WRITE doesn't do anything other than - * prevent reordering by the compiler; all Intel x86 processors currently - * retire operations outside the CPU in program order. - */ -#define BUS_SPACE_BARRIER_READ 0x01 /* force read barrier */ -#define BUS_SPACE_BARRIER_WRITE 0x02 /* force write barrier */ - -static __inline void -bus_space_barrier(bus_space_tag_t tag, bus_space_handle_t bsh, - bus_size_t offset, bus_size_t len, int flags) -{ - if (flags & BUS_SPACE_BARRIER_READ) - __asm __volatile("lock; addl $0,0(%%esp)" : : : "memory"); - else - __compiler_membar(); -} - -#ifdef BUS_SPACE_NO_LEGACY -#undef inb -#undef outb -#define inb(a) compiler_error -#define inw(a) compiler_error -#define inl(a) compiler_error -#define outb(a, b) compiler_error -#define outw(a, b) compiler_error -#define outl(a, b) compiler_error -#endif - -#include - -/* - * Stream accesses are the same as normal accesses on i386/pc98; there are no - * supported bus systems with an endianess different from the host one. - */ -#define bus_space_read_stream_1(t, h, o) bus_space_read_1((t), (h), (o)) -#define bus_space_read_stream_2(t, h, o) bus_space_read_2((t), (h), (o)) -#define bus_space_read_stream_4(t, h, o) bus_space_read_4((t), (h), (o)) - -#define bus_space_read_multi_stream_1(t, h, o, a, c) \ - bus_space_read_multi_1((t), (h), (o), (a), (c)) -#define bus_space_read_multi_stream_2(t, h, o, a, c) \ - bus_space_read_multi_2((t), (h), (o), (a), (c)) -#define bus_space_read_multi_stream_4(t, h, o, a, c) \ - bus_space_read_multi_4((t), (h), (o), (a), (c)) - -#define bus_space_write_stream_1(t, h, o, v) \ - bus_space_write_1((t), (h), (o), (v)) -#define bus_space_write_stream_2(t, h, o, v) \ - bus_space_write_2((t), (h), (o), (v)) -#define bus_space_write_stream_4(t, h, o, v) \ - bus_space_write_4((t), (h), (o), (v)) - -#define bus_space_write_multi_stream_1(t, h, o, a, c) \ - bus_space_write_multi_1((t), (h), (o), (a), (c)) -#define bus_space_write_multi_stream_2(t, h, o, a, c) \ - bus_space_write_multi_2((t), (h), (o), (a), (c)) -#define bus_space_write_multi_stream_4(t, h, o, a, c) \ - bus_space_write_multi_4((t), (h), (o), (a), (c)) - -#define bus_space_set_multi_stream_1(t, h, o, v, c) \ - bus_space_set_multi_1((t), (h), (o), (v), (c)) -#define bus_space_set_multi_stream_2(t, h, o, v, c) \ - bus_space_set_multi_2((t), (h), (o), (v), (c)) -#define bus_space_set_multi_stream_4(t, h, o, v, c) \ - bus_space_set_multi_4((t), (h), (o), (v), (c)) - -#define bus_space_read_region_stream_1(t, h, o, a, c) \ - bus_space_read_region_1((t), (h), (o), (a), (c)) -#define bus_space_read_region_stream_2(t, h, o, a, c) \ - bus_space_read_region_2((t), (h), (o), (a), (c)) -#define bus_space_read_region_stream_4(t, h, o, a, c) \ - bus_space_read_region_4((t), (h), (o), (a), (c)) - -#define bus_space_write_region_stream_1(t, h, o, a, c) \ - bus_space_write_region_1((t), (h), (o), (a), (c)) -#define bus_space_write_region_stream_2(t, h, o, a, c) \ - bus_space_write_region_2((t), (h), (o), (a), (c)) -#define bus_space_write_region_stream_4(t, h, o, a, c) \ - bus_space_write_region_4((t), (h), (o), (a), (c)) - -#define bus_space_set_region_stream_1(t, h, o, v, c) \ - bus_space_set_region_1((t), (h), (o), (v), (c)) -#define bus_space_set_region_stream_2(t, h, o, v, c) \ - bus_space_set_region_2((t), (h), (o), (v), (c)) -#define bus_space_set_region_stream_4(t, h, o, v, c) \ - bus_space_set_region_4((t), (h), (o), (v), (c)) - -#define bus_space_copy_region_stream_1(t, h1, o1, h2, o2, c) \ - bus_space_copy_region_1((t), (h1), (o1), (h2), (o2), (c)) -#define bus_space_copy_region_stream_2(t, h1, o1, h2, o2, c) \ - bus_space_copy_region_2((t), (h1), (o1), (h2), (o2), (c)) -#define bus_space_copy_region_stream_4(t, h1, o1, h2, o2, c) \ - bus_space_copy_region_4((t), (h1), (o1), (h2), (o2), (c)) - -#endif /* _KERNEL */ - -#endif /* _PC98_BUS_H_ */ diff --git a/sys/pc98/include/bus_dma.h b/sys/pc98/include/bus_dma.h deleted file mode 100644 index 4fdad3f5a787..000000000000 --- a/sys/pc98/include/bus_dma.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/clock.h b/sys/pc98/include/clock.h deleted file mode 100644 index 9c9ff18a384f..000000000000 --- a/sys/pc98/include/clock.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/counter.h b/sys/pc98/include/counter.h deleted file mode 100644 index 7b2bbad168c2..000000000000 --- a/sys/pc98/include/counter.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/cpu.h b/sys/pc98/include/cpu.h deleted file mode 100644 index 6da74edee9a6..000000000000 --- a/sys/pc98/include/cpu.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/cpufunc.h b/sys/pc98/include/cpufunc.h deleted file mode 100644 index deb0c39b3800..000000000000 --- a/sys/pc98/include/cpufunc.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/cputypes.h b/sys/pc98/include/cputypes.h deleted file mode 100644 index dbea880f7064..000000000000 --- a/sys/pc98/include/cputypes.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/cserial.h b/sys/pc98/include/cserial.h deleted file mode 100644 index c7fc61094299..000000000000 --- a/sys/pc98/include/cserial.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/db_machdep.h b/sys/pc98/include/db_machdep.h deleted file mode 100644 index a1b0c147664f..000000000000 --- a/sys/pc98/include/db_machdep.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/dump.h b/sys/pc98/include/dump.h deleted file mode 100644 index 815942d0d967..000000000000 --- a/sys/pc98/include/dump.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/efi.h b/sys/pc98/include/efi.h deleted file mode 100644 index 71d5728e7a85..000000000000 --- a/sys/pc98/include/efi.h +++ /dev/null @@ -1,14 +0,0 @@ -/*- - * This file is in the public domain since it's just boilerplate. - * - * $FreeBSD$ - */ - -#ifndef __PC98_INCLUDE_EFI_H_ -#define __PC98_INCLUDE_EFI_H_ - -#define EFIABI_ATTR - -/* Note: we don't actually support this on pc98 */ - -#endif /* __PC98_INCLUDE_EFI_H_ */ diff --git a/sys/pc98/include/elf.h b/sys/pc98/include/elf.h deleted file mode 100644 index 39937596f169..000000000000 --- a/sys/pc98/include/elf.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/endian.h b/sys/pc98/include/endian.h deleted file mode 100644 index 2ad27a9069b9..000000000000 --- a/sys/pc98/include/endian.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/exec.h b/sys/pc98/include/exec.h deleted file mode 100644 index e86bada4aaa0..000000000000 --- a/sys/pc98/include/exec.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/float.h b/sys/pc98/include/float.h deleted file mode 100644 index 4759963566ab..000000000000 --- a/sys/pc98/include/float.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/floatingpoint.h b/sys/pc98/include/floatingpoint.h deleted file mode 100644 index c61de43cd1ae..000000000000 --- a/sys/pc98/include/floatingpoint.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/frame.h b/sys/pc98/include/frame.h deleted file mode 100644 index 89d90c053215..000000000000 --- a/sys/pc98/include/frame.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/gdb_machdep.h b/sys/pc98/include/gdb_machdep.h deleted file mode 100644 index dcb25bb3faff..000000000000 --- a/sys/pc98/include/gdb_machdep.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/ieeefp.h b/sys/pc98/include/ieeefp.h deleted file mode 100644 index 67f0c099406e..000000000000 --- a/sys/pc98/include/ieeefp.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/in_cksum.h b/sys/pc98/include/in_cksum.h deleted file mode 100644 index e7227d4479df..000000000000 --- a/sys/pc98/include/in_cksum.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/intr_machdep.h b/sys/pc98/include/intr_machdep.h deleted file mode 100644 index 9fccf8af6742..000000000000 --- a/sys/pc98/include/intr_machdep.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/ioctl_bt848.h b/sys/pc98/include/ioctl_bt848.h deleted file mode 100644 index 668fd4a3a6c1..000000000000 --- a/sys/pc98/include/ioctl_bt848.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/ioctl_meteor.h b/sys/pc98/include/ioctl_meteor.h deleted file mode 100644 index 1a750bdd7215..000000000000 --- a/sys/pc98/include/ioctl_meteor.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/iodev.h b/sys/pc98/include/iodev.h deleted file mode 100644 index 683ea7929264..000000000000 --- a/sys/pc98/include/iodev.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/kdb.h b/sys/pc98/include/kdb.h deleted file mode 100644 index 9d412d45d261..000000000000 --- a/sys/pc98/include/kdb.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/limits.h b/sys/pc98/include/limits.h deleted file mode 100644 index b51a993d7933..000000000000 --- a/sys/pc98/include/limits.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/md_var.h b/sys/pc98/include/md_var.h deleted file mode 100644 index fe881bae0235..000000000000 --- a/sys/pc98/include/md_var.h +++ /dev/null @@ -1,51 +0,0 @@ -/*- - * Copyright (C) 2005 M. Warner Losh. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _PC98_INCLUDE_MD_VAR_H_ -#define _PC98_INCLUDE_MD_VAR_H_ - -#include - -/* - * PC98 machines are based on Intel CPUs. Some add-in boards offer - * different CPUs than came with the processor. These CPUs sometimes - * require additional flushing before and/or after DMAs. - */ -extern int need_pre_dma_flush; -extern int need_post_dma_flush; - -/* - * The geometry of disks might need adjustment on PC98 machines. - */ -struct ccb_calc_geometry; -int scsi_da_bios_params(struct ccb_calc_geometry *); -struct disk; -void pc98_ata_disk_firmware_geom_adjust(struct disk *); -#define ata_disk_firmware_geom_adjust(disk) \ - pc98_ata_disk_firmware_geom_adjust(disk) - -#endif /* !_PC98_INCLUDE_MD_VAR_H_ */ diff --git a/sys/pc98/include/memdev.h b/sys/pc98/include/memdev.h deleted file mode 100644 index 46e230161712..000000000000 --- a/sys/pc98/include/memdev.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/metadata.h b/sys/pc98/include/metadata.h deleted file mode 100644 index 1d783ec90591..000000000000 --- a/sys/pc98/include/metadata.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/minidump.h b/sys/pc98/include/minidump.h deleted file mode 100644 index 55c9b3176e1a..000000000000 --- a/sys/pc98/include/minidump.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/mp_watchdog.h b/sys/pc98/include/mp_watchdog.h deleted file mode 100644 index f0b91c00c4ad..000000000000 --- a/sys/pc98/include/mp_watchdog.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/nexusvar.h b/sys/pc98/include/nexusvar.h deleted file mode 100644 index 7ff6098e2352..000000000000 --- a/sys/pc98/include/nexusvar.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/npx.h b/sys/pc98/include/npx.h deleted file mode 100644 index 67c64027c08c..000000000000 --- a/sys/pc98/include/npx.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/ofw_machdep.h b/sys/pc98/include/ofw_machdep.h deleted file mode 100644 index 196a3961471f..000000000000 --- a/sys/pc98/include/ofw_machdep.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/param.h b/sys/pc98/include/param.h deleted file mode 100644 index 2e44cf22cc5b..000000000000 --- a/sys/pc98/include/param.h +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * Copyright (c) 2005 TAKAHASHI Yoshihiro. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#define MACHINE "pc98" - -#include - -#undef __HAVE_ACPI diff --git a/sys/pc98/include/pc/bios.h b/sys/pc98/include/pc/bios.h deleted file mode 100644 index d804fdec3618..000000000000 --- a/sys/pc98/include/pc/bios.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/pc/display.h b/sys/pc98/include/pc/display.h deleted file mode 100644 index 0a906c885d8c..000000000000 --- a/sys/pc98/include/pc/display.h +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * Copyright (C) 2005 TAKAHASHI Yoshihiro. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _PC98_INCLUDE_PC_DISPLAY_H_ -#define _PC98_INCLUDE_PC_DISPLAY_H_ - -#include - -/* - * PC-98 attributes for foreground text. - */ -#undef FG_UNDERLINE -#define FG_UNDERLINE 0x08 - -#endif /* !_PC98_INCLUDE_PC_DISPLAY_H_ */ diff --git a/sys/pc98/include/pcaudioio.h b/sys/pc98/include/pcaudioio.h deleted file mode 100644 index 1e9eee52265f..000000000000 --- a/sys/pc98/include/pcaudioio.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/pcb.h b/sys/pc98/include/pcb.h deleted file mode 100644 index 20b7d1843664..000000000000 --- a/sys/pc98/include/pcb.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/pcb_ext.h b/sys/pc98/include/pcb_ext.h deleted file mode 100644 index 81f25f63ebfd..000000000000 --- a/sys/pc98/include/pcb_ext.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/pci_cfgreg.h b/sys/pc98/include/pci_cfgreg.h deleted file mode 100644 index dc9207deb23a..000000000000 --- a/sys/pc98/include/pci_cfgreg.h +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * Copyright (C) 2005 M. Warner Losh. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _PC98_INCLUDE_PCI_CFGREG_H_ -#define _PC98_INCLUDE_PCI_CFGREG_H_ - -#include - -/* - * PC98 uses a non-standard CONF2_FORWARD port, so redefine it here. - */ -#undef CONF2_FORWARD_PORT -#define CONF2_FORWARD_PORT 0x0cf9 - -#endif /* !_PC98_INCLUDE_PCI_CFGREG_H_ */ diff --git a/sys/pc98/include/pcpu.h b/sys/pc98/include/pcpu.h deleted file mode 100644 index 9edf432c2d49..000000000000 --- a/sys/pc98/include/pcpu.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/perfmon.h b/sys/pc98/include/perfmon.h deleted file mode 100644 index c4e13f5189a4..000000000000 --- a/sys/pc98/include/perfmon.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/pmap.h b/sys/pc98/include/pmap.h deleted file mode 100644 index f17c14e4c476..000000000000 --- a/sys/pc98/include/pmap.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/pmc_mdep.h b/sys/pc98/include/pmc_mdep.h deleted file mode 100644 index 5ad152e6ee98..000000000000 --- a/sys/pc98/include/pmc_mdep.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/ppireg.h b/sys/pc98/include/ppireg.h deleted file mode 100644 index e2f914655741..000000000000 --- a/sys/pc98/include/ppireg.h +++ /dev/null @@ -1,48 +0,0 @@ -/*- - * Copyright (C) 2005 TAKAHASHI Yoshihiro. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_PPIREG_H_ -#define _MACHINE_PPIREG_H_ - -#ifdef _KERNEL - -#define IO_PPI 0x35 /* Programmable Peripheral Interface */ - -/* - * PPI speaker control values - */ - -#define PIT_ENABLETMR1 0x08 /* Enable timer/counter 1 */ - -#define PIT_SPKR (PIT_ENABLETMR1) - -#define ppi_spkr_on() outb(IO_PPI, inb(IO_PPI) & ~PIT_SPKR) -#define ppi_spkr_off() outb(IO_PPI, inb(IO_PPI) | PIT_SPKR) - -#endif /* _KERNEL */ - -#endif /* _MACHINE_PPIREG_H_ */ diff --git a/sys/pc98/include/proc.h b/sys/pc98/include/proc.h deleted file mode 100644 index 77c2355a7500..000000000000 --- a/sys/pc98/include/proc.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/profile.h b/sys/pc98/include/profile.h deleted file mode 100644 index 791bffbf73f5..000000000000 --- a/sys/pc98/include/profile.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/psl.h b/sys/pc98/include/psl.h deleted file mode 100644 index 4d945a1ebbaf..000000000000 --- a/sys/pc98/include/psl.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/ptrace.h b/sys/pc98/include/ptrace.h deleted file mode 100644 index bf86754d8f45..000000000000 --- a/sys/pc98/include/ptrace.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/reg.h b/sys/pc98/include/reg.h deleted file mode 100644 index f6fb2bc6578f..000000000000 --- a/sys/pc98/include/reg.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/reloc.h b/sys/pc98/include/reloc.h deleted file mode 100644 index 3666ec106817..000000000000 --- a/sys/pc98/include/reloc.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/resource.h b/sys/pc98/include/resource.h deleted file mode 100644 index 43349bfa2a8f..000000000000 --- a/sys/pc98/include/resource.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/runq.h b/sys/pc98/include/runq.h deleted file mode 100644 index f6b60cf932cd..000000000000 --- a/sys/pc98/include/runq.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/segments.h b/sys/pc98/include/segments.h deleted file mode 100644 index 062c3df6d18d..000000000000 --- a/sys/pc98/include/segments.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/setjmp.h b/sys/pc98/include/setjmp.h deleted file mode 100644 index c4101a77fd64..000000000000 --- a/sys/pc98/include/setjmp.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/sf_buf.h b/sys/pc98/include/sf_buf.h deleted file mode 100644 index ee9d94623c83..000000000000 --- a/sys/pc98/include/sf_buf.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/sigframe.h b/sys/pc98/include/sigframe.h deleted file mode 100644 index 6d7a9c5c9c96..000000000000 --- a/sys/pc98/include/sigframe.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/signal.h b/sys/pc98/include/signal.h deleted file mode 100644 index 0c5f6dd9a62c..000000000000 --- a/sys/pc98/include/signal.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/smapi.h b/sys/pc98/include/smapi.h deleted file mode 100644 index 0d83e8467aa5..000000000000 --- a/sys/pc98/include/smapi.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/smp.h b/sys/pc98/include/smp.h deleted file mode 100644 index 28d98e8d44a4..000000000000 --- a/sys/pc98/include/smp.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/speaker.h b/sys/pc98/include/speaker.h deleted file mode 100644 index 31eb9b6e98c3..000000000000 --- a/sys/pc98/include/speaker.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/specialreg.h b/sys/pc98/include/specialreg.h deleted file mode 100644 index aace4bfd62e9..000000000000 --- a/sys/pc98/include/specialreg.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/stack.h b/sys/pc98/include/stack.h deleted file mode 100644 index 2f854615f31c..000000000000 --- a/sys/pc98/include/stack.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/stdarg.h b/sys/pc98/include/stdarg.h deleted file mode 100644 index 1f80090356a9..000000000000 --- a/sys/pc98/include/stdarg.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/sysarch.h b/sys/pc98/include/sysarch.h deleted file mode 100644 index cd380d43b074..000000000000 --- a/sys/pc98/include/sysarch.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/timerreg.h b/sys/pc98/include/timerreg.h deleted file mode 100644 index f232581a84ca..000000000000 --- a/sys/pc98/include/timerreg.h +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * Copyright (C) 2005 TAKAHASHI Yoshihiro. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -/* - * The outputs of the three timers are connected as follows: - * - * timer 0 -> irq 0 - * timer 1 -> speaker (via keyboard controller) - * timer 2 -> RS-232C - * - * Timer 0 is used to call hardclock. - * Timer 1 is used to generate console beeps. - */ - -#ifndef _MACHINE_TIMERREG_H_ -#define _MACHINE_TIMERREG_H_ - -#ifdef _KERNEL - -#include - -#define IO_TIMER1 0x71 /* 8253C Timer */ -#define TIMER_CNTR0 (IO_TIMER1 + TIMER_REG_CNTR0 * 2) -#define TIMER_CNTR1 0x3fdb -#define TIMER_CNTR2 (IO_TIMER1 + TIMER_REG_CNTR2 * 2) -#define TIMER_MODE (IO_TIMER1 + TIMER_REG_MODE * 2) - -#endif /* _KERNEL */ - -#endif /* _MACHINE_TIMERREG_H_ */ diff --git a/sys/pc98/include/trap.h b/sys/pc98/include/trap.h deleted file mode 100644 index 4d950771dcc1..000000000000 --- a/sys/pc98/include/trap.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/tss.h b/sys/pc98/include/tss.h deleted file mode 100644 index e97ed51e8de2..000000000000 --- a/sys/pc98/include/tss.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/ucontext.h b/sys/pc98/include/ucontext.h deleted file mode 100644 index 83422140243c..000000000000 --- a/sys/pc98/include/ucontext.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/varargs.h b/sys/pc98/include/varargs.h deleted file mode 100644 index 21f5ce3c1c98..000000000000 --- a/sys/pc98/include/varargs.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/vdso.h b/sys/pc98/include/vdso.h deleted file mode 100644 index b81c455a92a5..000000000000 --- a/sys/pc98/include/vdso.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/vm.h b/sys/pc98/include/vm.h deleted file mode 100644 index 42451238104e..000000000000 --- a/sys/pc98/include/vm.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/vm86.h b/sys/pc98/include/vm86.h deleted file mode 100644 index 5dfa21858fc0..000000000000 --- a/sys/pc98/include/vm86.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/include/vmparam.h b/sys/pc98/include/vmparam.h deleted file mode 100644 index 2004749c42c4..000000000000 --- a/sys/pc98/include/vmparam.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/linux/linux.h b/sys/pc98/linux/linux.h deleted file mode 100644 index d330a96f7c95..000000000000 --- a/sys/pc98/linux/linux.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/linux/linux_ipc64.h b/sys/pc98/linux/linux_ipc64.h deleted file mode 100644 index 4fcdb641693f..000000000000 --- a/sys/pc98/linux/linux_ipc64.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/linux/linux_proto.h b/sys/pc98/linux/linux_proto.h deleted file mode 100644 index f5ccdd18f567..000000000000 --- a/sys/pc98/linux/linux_proto.h +++ /dev/null @@ -1,6 +0,0 @@ -/*- - * This file is in the public domain. - */ -/* $FreeBSD$ */ - -#include diff --git a/sys/pc98/pc98/busio.s b/sys/pc98/pc98/busio.s deleted file mode 100644 index 915dcae21bf0..000000000000 --- a/sys/pc98/pc98/busio.s +++ /dev/null @@ -1,1774 +0,0 @@ -/* $FreeBSD$ */ -/* $NecBSD: busio.s,v 1.16.4.1 1999/08/16 09:06:08 kmatsuda Exp $ */ -/* $NetBSD$ */ - -/*- - * [NetBSD for NEC PC-98 series] - * Copyright (c) 1996, 1997, 1998 - * NetBSD/pc98 porting staff. All rights reserved. - * - * [Ported for FreeBSD] - * Copyright (c) 2001 - * TAKAHASHI Yoshihiro. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Copyright (c) 1997, 1998 - * Naofumi HONDA. All rights reserved. - */ - -#include - -#include "assym.s" - -/*********************************************************** - * Bus IO access methods (Direct Access) - ***********************************************************/ -#define BUS_ACCESS_ADDR(BSHREG,ADDRREG) \ - addl BUS_SPACE_HANDLE_BASE/**/(%/**/BSHREG/**/),%/**/ADDRREG - -/* - * read_N - * IN: edx port - * OUT: eax data - */ -ENTRY(SBUS_DA_io_space_read_1) - BUS_ACCESS_ADDR(ebx,edx) - inb %dx,%al - ret - -ENTRY(SBUS_DA_io_space_read_2) - BUS_ACCESS_ADDR(ebx,edx) - inw %dx,%ax - ret - -ENTRY(SBUS_DA_io_space_read_4) - BUS_ACCESS_ADDR(ebx,edx) - inl %dx,%eax - ret - -/* - * write_N - * IN:eax DATA - * edx PORT - */ -ENTRY(SBUS_DA_io_space_write_1) - BUS_ACCESS_ADDR(ebx,edx) - outb %al,%dx - ret - -ENTRY(SBUS_DA_io_space_write_2) - BUS_ACCESS_ADDR(ebx,edx) - outw %ax,%dx - ret - -ENTRY(SBUS_DA_io_space_write_4) - BUS_ACCESS_ADDR(ebx,edx) - outl %eax,%dx - ret - -/* - * read_multi_N - * IN: ecx COUNT - * edx PORT - * edi BUFP - */ -ENTRY(SBUS_DA_io_space_read_multi_1) - BUS_ACCESS_ADDR(ebx,edx) - cld - rep - insb - ret - -ENTRY(SBUS_DA_io_space_read_multi_2) - BUS_ACCESS_ADDR(ebx,edx) - cld - rep - insw - ret - -ENTRY(SBUS_DA_io_space_read_multi_4) - BUS_ACCESS_ADDR(ebx,edx) - cld - rep - insl - ret - -/* - * write_multi_N - * IN: ecx COUNT - * edx PORT - * esi BUFP - */ -ENTRY(SBUS_DA_io_space_write_multi_1) - BUS_ACCESS_ADDR(ebx,edx) - cld - rep - outsb - ret - -ENTRY(SBUS_DA_io_space_write_multi_2) - BUS_ACCESS_ADDR(ebx,edx) - cld - rep - outsw - ret - -ENTRY(SBUS_DA_io_space_write_multi_4) - BUS_ACCESS_ADDR(ebx,edx) - cld - rep - outsl - ret - -/* - * read_region_N - * IN: ecx COUNT - * edx PORT - * edi BUFP - */ -ENTRY(SBUS_DA_io_space_read_region_1) - BUS_ACCESS_ADDR(ebx,edx) - cld - pushl %eax - orl %ecx,%ecx - jz 2f -1: - inb %dx,%al - stosb - incl %edx - decl %ecx - jnz 1b -2: - popl %eax - ret - -ENTRY(SBUS_DA_io_space_read_region_2) - BUS_ACCESS_ADDR(ebx,edx) - cld - pushl %eax - orl %ecx,%ecx - jz 2f -1: - inw %dx,%ax - stosw - addl $2,%edx - decl %ecx - jnz 1b -2: - popl %eax - ret - -ENTRY(SBUS_DA_io_space_read_region_4) - BUS_ACCESS_ADDR(ebx,edx) - cld - pushl %eax - orl %ecx,%ecx - jz 2f -1: - inl %dx,%eax - stosl - addl $4,%edx - decl %ecx - jnz 1b -2: - popl %eax - ret - -/* - * write_region_N - * IN: ecx COUNT - * edx PORT - * esi BUFP - */ -ENTRY(SBUS_DA_io_space_write_region_1) - BUS_ACCESS_ADDR(ebx,edx) - cld - pushl %eax - orl %ecx,%ecx - jz 2f -1: - lodsb - outb %al,%dx - incl %edx - decl %ecx - jnz 1b -2: - popl %eax - ret - -ENTRY(SBUS_DA_io_space_write_region_2) - BUS_ACCESS_ADDR(ebx,edx) - cld - pushl %eax - orl %ecx,%ecx - jz 2f -1: - lodsw - outw %ax,%dx - addl $2,%edx - decl %ecx - jnz 1b -2: - popl %eax - ret - -ENTRY(SBUS_DA_io_space_write_region_4) - BUS_ACCESS_ADDR(ebx,edx) - cld - pushl %eax - orl %ecx,%ecx - jz 2f -1: - lodsl - outl %eax,%dx - addl $4,%edx - decl %ecx - jnz 1b -2: - popl %eax - ret - -/* - * set_multi_N - * IN: eax DATA - * ecx COUNT - * edx PORT - */ -ENTRY(SBUS_DA_io_space_set_multi_1) - BUS_ACCESS_ADDR(ebx,edx) - orl %ecx,%ecx - jz 2f -1: - outb %al,%dx - decl %ecx - jnz 1b -2: - ret - -ENTRY(SBUS_DA_io_space_set_multi_2) - BUS_ACCESS_ADDR(ebx,edx) - orl %ecx,%ecx - jz 2f -1: - outw %ax,%dx - decl %ecx - jnz 1b -2: - ret - -ENTRY(SBUS_DA_io_space_set_multi_4) - BUS_ACCESS_ADDR(ebx,edx) - orl %ecx,%ecx - jz 2f -1: - outl %eax,%dx - decl %ecx - jnz 1b -2: - ret - -/* - * set_region_N - * IN: eax DATA - * ecx COUNT - * edx PORT - */ -ENTRY(SBUS_DA_io_space_set_region_1) - BUS_ACCESS_ADDR(ebx,edx) - orl %ecx,%ecx - jz 2f -1: - outb %al,%dx - incl %edx - decl %ecx - jnz 1b -2: - ret - -ENTRY(SBUS_DA_io_space_set_region_2) - BUS_ACCESS_ADDR(ebx,edx) - orl %ecx,%ecx - jz 2f -1: - outw %ax,%dx - addl $2,%edx - decl %ecx - jnz 1b -2: - ret - -ENTRY(SBUS_DA_io_space_set_region_4) - BUS_ACCESS_ADDR(ebx,edx) - orl %ecx,%ecx - jz 2f -1: - outl %eax,%dx - addl $4,%edx - decl %ecx - jnz 1b -2: - ret - -/* - * copy_region_N - * IN: ecx COUNT - * esi SPORT - * edi DPORT - */ -ENTRY(SBUS_DA_io_space_copy_region_1) - BUS_ACCESS_ADDR(eax,esi) - BUS_ACCESS_ADDR(ebx,edi) - pushl %eax - pushl %edx - orl %ecx,%ecx - jz 2f -1: - movl %esi,%edx - inb %dx,%al - incl %esi - - movl %edi,%edx - outb %al,%dx - incl %edi - - decl %ecx - jnz 1b -2: - popl %edx - popl %eax - ret - -ENTRY(SBUS_DA_io_space_copy_region_2) - BUS_ACCESS_ADDR(eax,esi) - BUS_ACCESS_ADDR(ebx,edi) - pushl %eax - pushl %edx - orl %ecx,%ecx - jz 2f -1: - movl %esi,%edx - inw %dx,%ax - addl $2,%esi - - movl %edi,%edx - outw %ax,%dx - addl $2,%edi - - decl %ecx - jnz 1b -2: - popl %edx - popl %eax - ret - -ENTRY(SBUS_DA_io_space_copy_region_4) - BUS_ACCESS_ADDR(eax,esi) - BUS_ACCESS_ADDR(ebx,edi) - pushl %eax - pushl %edx - orl %ecx,%ecx - jz 2f -1: - movl %esi,%edx - inl %dx,%eax - addl $4,%esi - - movl %edi,%edx - outl %eax,%dx - addl $4,%edi - - decl %ecx - jnz 1b -2: - popl %edx - popl %eax - ret - -/*********************************************************** - * Bus Memory access methods (Direct Access) - ***********************************************************/ -/* - * read_N - */ -ENTRY(SBUS_DA_mem_space_read_1) - BUS_ACCESS_ADDR(ebx,edx) - movb (%edx),%al - ret - -ENTRY(SBUS_DA_mem_space_read_2) - BUS_ACCESS_ADDR(ebx,edx) - movw (%edx),%ax - ret - -ENTRY(SBUS_DA_mem_space_read_4) - BUS_ACCESS_ADDR(ebx,edx) - movl (%edx),%eax - ret - -/* - * write_N - */ -ENTRY(SBUS_DA_mem_space_write_1) - BUS_ACCESS_ADDR(ebx,edx) - movb %al,(%edx) - ret - -ENTRY(SBUS_DA_mem_space_write_2) - BUS_ACCESS_ADDR(ebx,edx) - movw %ax,(%edx) - ret - -ENTRY(SBUS_DA_mem_space_write_4) - BUS_ACCESS_ADDR(ebx,edx) - movl %eax,(%edx) - ret - -/* - * read_multi_N - */ -ENTRY(SBUS_DA_mem_space_read_multi_1) - BUS_ACCESS_ADDR(ebx,edx) - cld - pushl %eax - orl %ecx,%ecx - jz 2f -1: - movb (%edx),%al - stosb - decl %ecx - jnz 1b -2: - popl %eax - ret - -ENTRY(SBUS_DA_mem_space_read_multi_2) - BUS_ACCESS_ADDR(ebx,edx) - cld - pushl %eax - orl %ecx,%ecx - jz 2f -1: - movw (%edx),%ax - stosw - decl %ecx - jnz 1b -2: - popl %eax - ret - -ENTRY(SBUS_DA_mem_space_read_multi_4) - BUS_ACCESS_ADDR(ebx,edx) - cld - pushl %eax - orl %ecx,%ecx - jz 2f -1: - movl (%edx),%eax - stosl - decl %ecx - jnz 1b -2: - popl %eax - ret - -/* - * write_multi_N - */ -ENTRY(SBUS_DA_mem_space_write_multi_1) - BUS_ACCESS_ADDR(ebx,edx) - cld - pushl %eax - orl %ecx,%ecx - jz 2f -1: - lodsb - movb %al,(%edx) - decl %ecx - jnz 1b -2: - popl %eax - ret - -ENTRY(SBUS_DA_mem_space_write_multi_2) - BUS_ACCESS_ADDR(ebx,edx) - cld - pushl %eax - orl %ecx,%ecx - jz 2f -1: - lodsw - movw %ax,(%edx) - decl %ecx - jnz 1b -2: - popl %eax - ret - -ENTRY(SBUS_DA_mem_space_write_multi_4) - BUS_ACCESS_ADDR(ebx,edx) - cld - pushl %eax - orl %ecx,%ecx - jz 2f -1: - lodsl - movl %eax,(%edx) - decl %ecx - jnz 1b -2: - popl %eax - ret - -/* - * read_region_N - */ -ENTRY(SBUS_DA_mem_space_read_region_1) - BUS_ACCESS_ADDR(ebx,edx) - cld - pushl %esi - movl %edx,%esi - rep - movsb - popl %esi - ret - -ENTRY(SBUS_DA_mem_space_read_region_2) - BUS_ACCESS_ADDR(ebx,edx) - cld - pushl %esi - movl %edx,%esi - rep - movsw - popl %esi - ret - -ENTRY(SBUS_DA_mem_space_read_region_4) - BUS_ACCESS_ADDR(ebx,edx) - cld - pushl %esi - movl %edx,%esi - rep - movsl - popl %esi - ret - -/* - * write_region_N - */ -ENTRY(SBUS_DA_mem_space_write_region_1) - BUS_ACCESS_ADDR(ebx,edx) - cld - pushl %edi - movl %edx,%edi - rep - movsb - popl %edi - ret - -ENTRY(SBUS_DA_mem_space_write_region_2) - BUS_ACCESS_ADDR(ebx,edx) - cld - pushl %edi - movl %edx,%edi - rep - movsw - popl %edi - ret - -ENTRY(SBUS_DA_mem_space_write_region_4) - BUS_ACCESS_ADDR(ebx,edx) - cld - pushl %edi - movl %edx,%edi - rep - movsl - popl %edi - ret - -/* - * set_multi_N - */ -ENTRY(SBUS_DA_mem_space_set_multi_1) - BUS_ACCESS_ADDR(ebx,edx) - orl %ecx,%ecx - jz 2f -1: - movb %al,(%edx) - decl %ecx - jnz 1b -2: - ret - -ENTRY(SBUS_DA_mem_space_set_multi_2) - BUS_ACCESS_ADDR(ebx,edx) - orl %ecx,%ecx - jz 2f -1: - movw %ax,(%edx) - decl %ecx - jnz 1b -2: - ret - -ENTRY(SBUS_DA_mem_space_set_multi_4) - BUS_ACCESS_ADDR(ebx,edx) - orl %ecx,%ecx - jz 2f -1: - movl %eax,(%edx) - decl %ecx - jnz 1b -2: - ret - -/* - * set_region_N - */ -ENTRY(SBUS_DA_mem_space_set_region_1) - BUS_ACCESS_ADDR(ebx,edx) - cld - pushl %edi - movl %edx,%edi - rep - stosb - popl %edi - ret - -ENTRY(SBUS_DA_mem_space_set_region_2) - BUS_ACCESS_ADDR(ebx,edx) - cld - pushl %edi - movl %edx,%edi - rep - stosw - popl %edi - ret - -ENTRY(SBUS_DA_mem_space_set_region_4) - BUS_ACCESS_ADDR(ebx,edx) - cld - pushl %edi - movl %edx,%edi - rep - stosl - popl %edi - ret - -/* - * copy_region_N - */ -ENTRY(SBUS_DA_mem_space_copy_region_1) - BUS_ACCESS_ADDR(eax,esi) - BUS_ACCESS_ADDR(ebx,edi) - cld - rep - movsb - ret - -ENTRY(SBUS_DA_mem_space_copy_region_2) - BUS_ACCESS_ADDR(eax,esi) - BUS_ACCESS_ADDR(ebx,edi) - cld - rep - movsw - ret - -ENTRY(SBUS_DA_mem_space_copy_region_4) - BUS_ACCESS_ADDR(eax,esi) - BUS_ACCESS_ADDR(ebx,edi) - cld - rep - movsl - ret - -#undef BUS_ACCESS_ADDR - -/*********************************************************** - * Bus IO access methods (Relocate Access) - ***********************************************************/ -#define BUS_ACCESS_ADDR(BSHREG,ADDRREG) \ - movl BUS_SPACE_HANDLE_IAT/**/(%/**/BSHREG/**/, %/**/ADDRREG/**/, 4), \ - %/**/ADDRREG -#define BUS_ACCESS_ADDR2(BSHREG,ADDRREG,DSTREG) \ - movl BUS_SPACE_HANDLE_IAT/**/(%/**/BSHREG/**/, %/**/ADDRREG/**/, 4), \ - %/**/DSTREG -/* - * read_N - * IN: edx port - * OUT: eax data - */ -ENTRY(SBUS_RA_io_space_read_1) - BUS_ACCESS_ADDR(ebx,edx) - inb %dx,%al - ret - -ENTRY(SBUS_RA_io_space_read_2) - BUS_ACCESS_ADDR(ebx,edx) - inw %dx,%ax - ret - -ENTRY(SBUS_RA_io_space_read_4) - BUS_ACCESS_ADDR(ebx,edx) - inl %dx,%eax - ret - -/* - * write_N - * IN:eax DATA - * edx PORT - */ -ENTRY(SBUS_RA_io_space_write_1) - BUS_ACCESS_ADDR(ebx,edx) - outb %al,%dx - ret - -ENTRY(SBUS_RA_io_space_write_2) - BUS_ACCESS_ADDR(ebx,edx) - outw %ax,%dx - ret - -ENTRY(SBUS_RA_io_space_write_4) - BUS_ACCESS_ADDR(ebx,edx) - outl %eax,%dx - ret - -/* - * read_multi_N - * IN: ecx COUNT - * edx PORT - * edi BUFP - */ -ENTRY(SBUS_RA_io_space_read_multi_1) - BUS_ACCESS_ADDR(ebx,edx) - cld - rep - insb - ret - -ENTRY(SBUS_RA_io_space_read_multi_2) - BUS_ACCESS_ADDR(ebx,edx) - cld - rep - insw - ret - -ENTRY(SBUS_RA_io_space_read_multi_4) - BUS_ACCESS_ADDR(ebx,edx) - cld - rep - insl - ret - -/* - * write_multi_N - * IN: ecx COUNT - * edx PORT - * esi BUFP - */ -ENTRY(SBUS_RA_io_space_write_multi_1) - BUS_ACCESS_ADDR(ebx,edx) - cld - rep - outsb - ret - -ENTRY(SBUS_RA_io_space_write_multi_2) - BUS_ACCESS_ADDR(ebx,edx) - cld - rep - outsw - ret - -ENTRY(SBUS_RA_io_space_write_multi_4) - BUS_ACCESS_ADDR(ebx,edx) - cld - rep - outsl - ret - -/* - * read_region_N - * IN: ecx COUNT - * edx PORT - * edi BUFP - */ -ENTRY(SBUS_RA_io_space_read_region_1) - cld - pushl %eax - pushl %esi - orl %ecx,%ecx - jz 2f - movl %edx,%esi -1: - BUS_ACCESS_ADDR2(ebx,esi,edx) - inb %dx,%al - stosb - incl %esi - decl %ecx - jnz 1b -2: - popl %esi - popl %eax - ret - -ENTRY(SBUS_RA_io_space_read_region_2) - cld - pushl %eax - pushl %esi - orl %ecx,%ecx - jz 2f - movl %edx,%esi -1: - BUS_ACCESS_ADDR2(ebx,esi,edx) - inw %dx,%ax - stosw - addl $2,%esi - decl %ecx - jnz 1b -2: - popl %esi - popl %eax - ret - -ENTRY(SBUS_RA_io_space_read_region_4) - cld - pushl %eax - pushl %esi - orl %ecx,%ecx - jz 2f - movl %edx,%esi -1: - BUS_ACCESS_ADDR2(ebx,esi,edx) - inl %dx,%eax - stosl - addl $4,%esi - decl %ecx - jnz 1b -2: - popl %esi - popl %eax - ret - -/* - * write_region_N - * IN: ecx COUNT - * edx PORT - * esi BUFP - */ -ENTRY(SBUS_RA_io_space_write_region_1) - cld - pushl %eax - pushl %edi - orl %ecx,%ecx - jz 2f - movl %edx,%edi -1: - BUS_ACCESS_ADDR2(ebx,edi,edx) - lodsb - outb %al,%dx - incl %edi - decl %ecx - jnz 1b -2: - popl %edi - popl %eax - ret - -ENTRY(SBUS_RA_io_space_write_region_2) - cld - pushl %eax - pushl %edi - orl %ecx,%ecx - jz 2f - movl %edx,%edi -1: - BUS_ACCESS_ADDR2(ebx,edi,edx) - lodsw - outw %ax,%dx - addl $2,%edi - decl %ecx - jnz 1b -2: - popl %edi - popl %eax - ret - -ENTRY(SBUS_RA_io_space_write_region_4) - cld - pushl %eax - pushl %edi - orl %ecx,%ecx - jz 2f - movl %edx,%edi -1: - BUS_ACCESS_ADDR2(ebx,edi,edx) - lodsl - outl %eax,%dx - addl $4,%edi - decl %ecx - jnz 1b -2: - popl %edi - popl %eax - ret - -/* - * set_multi_N - * IN: eax DATA - * ecx COUNT - * edx PORT - */ -ENTRY(SBUS_RA_io_space_set_multi_1) - BUS_ACCESS_ADDR(ebx,edx) - orl %ecx,%ecx - jz 2f -1: - outb %al,%dx - decl %ecx - jnz 1b -2: - ret - -ENTRY(SBUS_RA_io_space_set_multi_2) - BUS_ACCESS_ADDR(ebx,edx) - orl %ecx,%ecx - jz 2f -1: - outw %ax,%dx - decl %ecx - jnz 1b -2: - ret - -ENTRY(SBUS_RA_io_space_set_multi_4) - BUS_ACCESS_ADDR(ebx,edx) - orl %ecx,%ecx - jz 2f -1: - outl %eax,%dx - decl %ecx - jnz 1b -2: - ret - -/* - * set_region_N - * IN: eax DATA - * ecx COUNT - * edx PORT - */ -ENTRY(SBUS_RA_io_space_set_region_1) - pushl %edi - orl %ecx,%ecx - jz 2f - movl %edx,%edi -1: - BUS_ACCESS_ADDR2(ebx,edi,edx) - outb %al,%dx - incl %edi - decl %ecx - jnz 1b -2: - popl %edi - ret - -ENTRY(SBUS_RA_io_space_set_region_2) - pushl %edi - orl %ecx,%ecx - jz 2f - movl %edx,%edi -1: - BUS_ACCESS_ADDR2(ebx,edi,edx) - outw %ax,%dx - addl $2,%edi - decl %ecx - jnz 1b -2: - popl %edi - ret - -ENTRY(SBUS_RA_io_space_set_region_4) - pushl %edi - orl %ecx,%ecx - jz 2f - movl %edx,%edi -1: - BUS_ACCESS_ADDR2(ebx,edi,edx) - outl %eax,%dx - addl $4,%edi - decl %ecx - jnz 1b -2: - popl %edi - ret - -/* - * copy_region_N - * IN: ecx COUNT - * esi SPORT - * edi DPORT - */ -ENTRY(SBUS_RA_io_space_copy_region_1) - pushl %eax - pushl %edx - orl %ecx,%ecx - jz 2f -1: - BUS_ACCESS_ADDR2(ebx,esi,edx) - inb %dx,%al - incl %esi - - BUS_ACCESS_ADDR2(ebx,edi,edx) - outb %al,%dx - incl %edi - - decl %ecx - jnz 1b -2: - popl %edx - popl %eax - ret - -ENTRY(SBUS_RA_io_space_copy_region_2) - pushl %eax - pushl %edx - orl %ecx,%ecx - jz 2f -1: - BUS_ACCESS_ADDR2(ebx,esi,edx) - inw %dx,%ax - addl $2,%esi - - BUS_ACCESS_ADDR2(ebx,edi,edx) - outw %ax,%dx - addl $2,%edi - - decl %ecx - jnz 1b -2: - popl %edx - popl %eax - ret - -ENTRY(SBUS_RA_io_space_copy_region_4) - pushl %eax - pushl %edx - orl %ecx,%ecx - jz 2f -1: - BUS_ACCESS_ADDR2(ebx,esi,edx) - inl %dx,%eax - addl $4,%esi - - BUS_ACCESS_ADDR2(ebx,edi,edx) - outl %eax,%dx - addl $4,%edi - - decl %ecx - jnz 1b -2: - popl %edx - popl %eax - ret - -/*********************************************************** - * Bus Memory access methods - ***********************************************************/ -/* - * read_N - */ -ENTRY(SBUS_RA_mem_space_read_1) - BUS_ACCESS_ADDR(ebx,edx) - movb (%edx),%al - ret - -ENTRY(SBUS_RA_mem_space_read_2) - BUS_ACCESS_ADDR(ebx,edx) - movw (%edx),%ax - ret - -ENTRY(SBUS_RA_mem_space_read_4) - BUS_ACCESS_ADDR(ebx,edx) - movl (%edx),%eax - ret - -/* - * write_N - */ -ENTRY(SBUS_RA_mem_space_write_1) - BUS_ACCESS_ADDR(ebx,edx) - movb %al,(%edx) - ret - -ENTRY(SBUS_RA_mem_space_write_2) - BUS_ACCESS_ADDR(ebx,edx) - movw %ax,(%edx) - ret - -ENTRY(SBUS_RA_mem_space_write_4) - BUS_ACCESS_ADDR(ebx,edx) - movl %eax,(%edx) - ret - -/* - * read_multi_N - */ -ENTRY(SBUS_RA_mem_space_read_multi_1) - BUS_ACCESS_ADDR(ebx,edx) - cld - pushl %eax - orl %ecx,%ecx - jz 2f -1: - movb (%edx),%al - stosb - decl %ecx - jnz 1b -2: - popl %eax - ret - -ENTRY(SBUS_RA_mem_space_read_multi_2) - BUS_ACCESS_ADDR(ebx,edx) - cld - pushl %eax - orl %ecx,%ecx - jz 2f -1: - movw (%edx),%ax - stosw - decl %ecx - jnz 1b -2: - popl %eax - ret - -ENTRY(SBUS_RA_mem_space_read_multi_4) - BUS_ACCESS_ADDR(ebx,edx) - cld - pushl %eax - orl %ecx,%ecx - jz 2f -1: - movl (%edx),%eax - stosl - decl %ecx - jnz 1b -2: - popl %eax - ret - -/* - * write_multi_N - */ -ENTRY(SBUS_RA_mem_space_write_multi_1) - BUS_ACCESS_ADDR(ebx,edx) - cld - pushl %eax - orl %ecx,%ecx - jz 2f -1: - lodsb - movb %al,(%edx) - decl %ecx - jnz 1b -2: - popl %eax - ret - -ENTRY(SBUS_RA_mem_space_write_multi_2) - BUS_ACCESS_ADDR(ebx,edx) - cld - pushl %eax - orl %ecx,%ecx - jz 2f -1: - lodsw - movw %ax,(%edx) - decl %ecx - jnz 1b -2: - popl %eax - ret - -ENTRY(SBUS_RA_mem_space_write_multi_4) - BUS_ACCESS_ADDR(ebx,edx) - cld - pushl %eax - orl %ecx,%ecx - jz 2f -1: - lodsl - movl %eax,(%edx) - decl %ecx - jnz 1b -2: - popl %eax - ret - -/* - * read_region_N - */ -ENTRY(SBUS_RA_mem_space_read_region_1) - cld - pushl %esi - orl %ecx,%ecx - jz 2f -1: - BUS_ACCESS_ADDR2(ebx,edx,esi) - movsb - incl %edx - decl %ecx - jnz 1b -2: - popl %esi - ret - -ENTRY(SBUS_RA_mem_space_read_region_2) - cld - pushl %esi - orl %ecx,%ecx - jz 2f -1: - BUS_ACCESS_ADDR2(ebx,edx,esi) - movsw - addl $2,%edx - decl %ecx - jnz 1b -2: - popl %esi - ret - -ENTRY(SBUS_RA_mem_space_read_region_4) - cld - pushl %esi - orl %ecx,%ecx - jz 2f -1: - BUS_ACCESS_ADDR2(ebx,edx,esi) - movsl - addl $4,%edx - decl %ecx - jnz 1b -2: - popl %esi - ret - -/* - * write_region_N - */ -ENTRY(SBUS_RA_mem_space_write_region_1) - cld - pushl %edi - orl %ecx,%ecx - jz 2f -1: - BUS_ACCESS_ADDR2(ebx,edx,edi) - movsb - incl %edx - decl %ecx - jnz 1b -2: - popl %edi - ret - -ENTRY(SBUS_RA_mem_space_write_region_2) - cld - pushl %edi - orl %ecx,%ecx - jz 2f -1: - BUS_ACCESS_ADDR2(ebx,edx,edi) - movsw - addl $2,%edx - decl %ecx - jnz 1b -2: - popl %edi - ret - -ENTRY(SBUS_RA_mem_space_write_region_4) - cld - pushl %edi - orl %ecx,%ecx - jz 2f -1: - BUS_ACCESS_ADDR2(ebx,edx,edi) - movsl - addl $4,%edx - decl %ecx - jnz 1b -2: - popl %edi - ret - -/* - * set_multi_N - */ -ENTRY(SBUS_RA_mem_space_set_multi_1) - BUS_ACCESS_ADDR(ebx,edx) - orl %ecx,%ecx - jz 2f -1: - movb %al,(%edx) - decl %ecx - jnz 1b -2: - ret - -ENTRY(SBUS_RA_mem_space_set_multi_2) - BUS_ACCESS_ADDR(ebx,edx) - orl %ecx,%ecx - jz 2f -1: - movw %ax,(%edx) - decl %ecx - jnz 1b -2: - ret - -ENTRY(SBUS_RA_mem_space_set_multi_4) - BUS_ACCESS_ADDR(ebx,edx) - orl %ecx,%ecx - jz 2f -1: - movl %eax,(%edx) - decl %ecx - jnz 1b -2: - ret - -/* - * set_region_N - */ -ENTRY(SBUS_RA_mem_space_set_region_1) - cld - pushl %edi - orl %ecx,%ecx - jz 2f -1: - BUS_ACCESS_ADDR2(ebx,edx,edi) - stosb - incl %edx - decl %ecx - jnz 1b -2: - popl %edi - ret - -ENTRY(SBUS_RA_mem_space_set_region_2) - cld - pushl %edi - orl %ecx,%ecx - jz 2f -1: - BUS_ACCESS_ADDR2(ebx,edx,edi) - stosw - addl $2,%edx - decl %ecx - jnz 1b -2: - popl %edi - ret - -ENTRY(SBUS_RA_mem_space_set_region_4) - cld - pushl %edi - orl %ecx,%ecx - jz 2f -1: - BUS_ACCESS_ADDR2(ebx,edx,edi) - stosl - addl $4,%edx - decl %ecx - jnz 1b -2: - popl %edi - ret - -/* - * copy_region_N - */ -ENTRY(SBUS_RA_mem_space_copy_region_1) - cld - orl %ecx,%ecx - jz 2f -1: - pushl %esi - pushl %edi - BUS_ACCESS_ADDR(eax,esi) - BUS_ACCESS_ADDR(ebx,edi) - movsb - popl %edi - popl %esi - incl %esi - incl %edi - decl %ecx - jnz 1b -2: - ret - -ENTRY(SBUS_RA_mem_space_copy_region_2) - cld - orl %ecx,%ecx - jz 2f -1: - pushl %esi - pushl %edi - BUS_ACCESS_ADDR(eax,esi) - BUS_ACCESS_ADDR(ebx,edi) - movsw - popl %edi - popl %esi - addl $2,%esi - addl $2,%edi - decl %ecx - jnz 1b -2: - ret - -ENTRY(SBUS_RA_mem_space_copy_region_4) - cld - orl %ecx,%ecx - jz 2f -1: - pushl %esi - pushl %edi - BUS_ACCESS_ADDR(eax,esi) - BUS_ACCESS_ADDR(ebx,edi) - movsl - popl %edi - popl %esi - addl $4,%esi - addl $4,%edi - decl %ecx - jnz 1b -2: - ret - -#undef BUS_ACCESS_ADDR -#undef BUS_ACCESS_ADDR2 - - -#include "opt_mecia.h" -#ifdef DEV_MECIA - -/*********************************************************** - * NEPC pcmcia 16 bits bus access - ***********************************************************/ -#define NEPC_SWITCH_BUS16 \ - pushl %ebp ;\ - pushl %eax ;\ - pushl %edx ;\ - movl $0x2a8e,%edx ;\ - inb %dx,%al ;\ - movl %eax,%ebp ;\ - andl $~0x20,%eax ;\ - outb %al,%dx ;\ - popl %edx ;\ - popl %eax - -#define NEPC_BUS_RESTORE \ - pushl %eax ;\ - movl %ebp,%eax ;\ - xchgl %edx,%ebp ;\ - movl $0x2a8e,%edx ;\ - outb %al,%dx ;\ - xchgl %ebp,%edx ;\ - popl %eax ;\ - popl %ebp - -/*********************************************************** - * NEPC pcmcia 16 bits bus acces (Direct Access) - ***********************************************************/ -#define BUS_ACCESS_ADDR(BSHREG,ADDRREG) \ - addl BUS_SPACE_HANDLE_BASE/**/(%/**/BSHREG/**/),%/**/ADDRREG - -ENTRY(NEPC_DA_io_space_read_2) - BUS_ACCESS_ADDR(ebx,edx) - NEPC_SWITCH_BUS16 - inw %dx,%ax - NEPC_BUS_RESTORE - ret - - -ENTRY(NEPC_DA_io_space_write_2) - BUS_ACCESS_ADDR(ebx,edx) - NEPC_SWITCH_BUS16 - outw %ax,%dx - NEPC_BUS_RESTORE - ret - -ENTRY(NEPC_DA_io_space_read_multi_2) - BUS_ACCESS_ADDR(ebx,edx) - NEPC_SWITCH_BUS16 - cld - rep - insw - NEPC_BUS_RESTORE - ret - -ENTRY(NEPC_DA_io_space_write_multi_2) - BUS_ACCESS_ADDR(ebx,edx) - NEPC_SWITCH_BUS16 - cld - rep - outsw - NEPC_BUS_RESTORE - ret - -ENTRY(NEPC_DA_io_space_read_region_2) - NEPC_SWITCH_BUS16 - call SBUS_DA_io_space_read_region_2 - NEPC_BUS_RESTORE - ret - -ENTRY(NEPC_DA_io_space_write_region_2) - NEPC_SWITCH_BUS16 - call SBUS_DA_io_space_write_region_2 - NEPC_BUS_RESTORE - ret - -ENTRY(NEPC_DA_io_space_set_multi_2) - NEPC_SWITCH_BUS16 - call SBUS_DA_io_space_set_multi_2 - NEPC_BUS_RESTORE - ret - - -ENTRY(NEPC_DA_io_space_set_region_2) - NEPC_SWITCH_BUS16 - call SBUS_DA_io_space_set_region_2 - NEPC_BUS_RESTORE - ret - -ENTRY(NEPC_DA_io_space_copy_region_2) - NEPC_SWITCH_BUS16 - call SBUS_DA_io_space_copy_region_2 - NEPC_BUS_RESTORE - ret - -ENTRY(NEPC_DA_io_space_read_4) - BUS_ACCESS_ADDR(ebx,edx) - NEPC_SWITCH_BUS16 - inl %dx,%eax - NEPC_BUS_RESTORE - ret - -ENTRY(NEPC_DA_io_space_write_4) - BUS_ACCESS_ADDR(ebx,edx) - NEPC_SWITCH_BUS16 - outl %eax,%dx - NEPC_BUS_RESTORE - ret - -ENTRY(NEPC_DA_io_space_read_multi_4) - BUS_ACCESS_ADDR(ebx,edx) - NEPC_SWITCH_BUS16 - cld - rep - insl - NEPC_BUS_RESTORE - ret - -ENTRY(NEPC_DA_io_space_write_multi_4) - BUS_ACCESS_ADDR(ebx,edx) - NEPC_SWITCH_BUS16 - cld - rep - outsl - NEPC_BUS_RESTORE - ret - -ENTRY(NEPC_DA_io_space_read_region_4) - NEPC_SWITCH_BUS16 - call SBUS_DA_io_space_read_region_4 - NEPC_BUS_RESTORE - ret - -ENTRY(NEPC_DA_io_space_write_region_4) - NEPC_SWITCH_BUS16 - call SBUS_DA_io_space_write_region_4 - NEPC_BUS_RESTORE - ret - -ENTRY(NEPC_DA_io_space_set_multi_4) - NEPC_SWITCH_BUS16 - call SBUS_DA_io_space_set_multi_4 - NEPC_BUS_RESTORE - ret - - -ENTRY(NEPC_DA_io_space_set_region_4) - NEPC_SWITCH_BUS16 - call SBUS_DA_io_space_set_region_4 - NEPC_BUS_RESTORE - ret - -ENTRY(NEPC_DA_io_space_copy_region_4) - NEPC_SWITCH_BUS16 - call SBUS_DA_io_space_copy_region_4 - NEPC_BUS_RESTORE - ret - -#undef BUS_ACCESS_ADDR - -/*********************************************************** - * NEPC pcmcia 16 bits bus acces (Relocate Access) - ***********************************************************/ -#define BUS_ACCESS_ADDR(BSHREG,ADDRREG) \ - movl BUS_SPACE_HANDLE_IAT/**/(%/**/BSHREG/**/, %/**/ADDRREG/**/, 4), \ - %/**/ADDRREG - -ENTRY(NEPC_RA_io_space_read_2) - BUS_ACCESS_ADDR(ebx,edx) - NEPC_SWITCH_BUS16 - inw %dx,%ax - NEPC_BUS_RESTORE - ret - - -ENTRY(NEPC_RA_io_space_write_2) - BUS_ACCESS_ADDR(ebx,edx) - NEPC_SWITCH_BUS16 - outw %ax,%dx - NEPC_BUS_RESTORE - ret - -ENTRY(NEPC_RA_io_space_read_multi_2) - BUS_ACCESS_ADDR(ebx,edx) - NEPC_SWITCH_BUS16 - cld - rep - insw - NEPC_BUS_RESTORE - ret - -ENTRY(NEPC_RA_io_space_write_multi_2) - BUS_ACCESS_ADDR(ebx,edx) - NEPC_SWITCH_BUS16 - cld - rep - outsw - NEPC_BUS_RESTORE - ret - -ENTRY(NEPC_RA_io_space_read_region_2) - NEPC_SWITCH_BUS16 - call SBUS_RA_io_space_read_region_2 - NEPC_BUS_RESTORE - ret - -ENTRY(NEPC_RA_io_space_write_region_2) - NEPC_SWITCH_BUS16 - call SBUS_RA_io_space_write_region_2 - NEPC_BUS_RESTORE - ret - -ENTRY(NEPC_RA_io_space_set_multi_2) - NEPC_SWITCH_BUS16 - call SBUS_RA_io_space_set_multi_2 - NEPC_BUS_RESTORE - ret - - -ENTRY(NEPC_RA_io_space_set_region_2) - NEPC_SWITCH_BUS16 - call SBUS_RA_io_space_set_region_2 - NEPC_BUS_RESTORE - ret - -ENTRY(NEPC_RA_io_space_copy_region_2) - NEPC_SWITCH_BUS16 - call SBUS_RA_io_space_copy_region_2 - NEPC_BUS_RESTORE - ret - -ENTRY(NEPC_RA_io_space_read_4) - BUS_ACCESS_ADDR(ebx,edx) - NEPC_SWITCH_BUS16 - inl %dx,%eax - NEPC_BUS_RESTORE - ret - -ENTRY(NEPC_RA_io_space_write_4) - BUS_ACCESS_ADDR(ebx,edx) - NEPC_SWITCH_BUS16 - outl %eax,%dx - NEPC_BUS_RESTORE - ret - -ENTRY(NEPC_RA_io_space_read_multi_4) - BUS_ACCESS_ADDR(ebx,edx) - NEPC_SWITCH_BUS16 - cld - rep - insl - NEPC_BUS_RESTORE - ret - -ENTRY(NEPC_RA_io_space_write_multi_4) - BUS_ACCESS_ADDR(ebx,edx) - NEPC_SWITCH_BUS16 - cld - rep - outsl - NEPC_BUS_RESTORE - ret - -ENTRY(NEPC_RA_io_space_read_region_4) - NEPC_SWITCH_BUS16 - call SBUS_RA_io_space_read_region_4 - NEPC_BUS_RESTORE - ret - -ENTRY(NEPC_RA_io_space_write_region_4) - NEPC_SWITCH_BUS16 - call SBUS_RA_io_space_write_region_4 - NEPC_BUS_RESTORE - ret - -ENTRY(NEPC_RA_io_space_set_multi_4) - NEPC_SWITCH_BUS16 - call SBUS_RA_io_space_set_multi_4 - NEPC_BUS_RESTORE - ret - - -ENTRY(NEPC_RA_io_space_set_region_4) - NEPC_SWITCH_BUS16 - call SBUS_RA_io_space_set_region_4 - NEPC_BUS_RESTORE - ret - -ENTRY(NEPC_RA_io_space_copy_region_4) - NEPC_SWITCH_BUS16 - call SBUS_RA_io_space_copy_region_4 - NEPC_BUS_RESTORE - ret - -#endif /* DEV_MECIA */ diff --git a/sys/pc98/pc98/busiosubr.c b/sys/pc98/pc98/busiosubr.c deleted file mode 100644 index 926c1ce88e85..000000000000 --- a/sys/pc98/pc98/busiosubr.c +++ /dev/null @@ -1,331 +0,0 @@ -/* $FreeBSD$ */ -/* $NecBSD: busiosubr.c,v 1.30.4.4 1999/08/28 02:25:35 honda Exp $ */ -/* $NetBSD$ */ - -/*- - * [NetBSD for NEC PC-98 series] - * Copyright (c) 1996, 1997, 1998 - * NetBSD/pc98 porting staff. All rights reserved. - * - * [Ported for FreeBSD] - * Copyright (c) 2001 - * TAKAHASHI Yoshihiro. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Copyright (c) 1997, 1998 - * Naofumi HONDA. All rights reserved. - */ - -#include -#include -#include -#include -#include - -static MALLOC_DEFINE(M_BUSSPACEHANDLE, "busspacehandle", "Bus space handle"); - -_BUS_SPACE_CALL_FUNCS_PROTO(SBUS_DA_io,u_int8_t,1) -_BUS_SPACE_CALL_FUNCS_PROTO(SBUS_DA_io,u_int16_t,2) -_BUS_SPACE_CALL_FUNCS_PROTO(SBUS_DA_io,u_int32_t,4) -_BUS_SPACE_CALL_FUNCS_PROTO(SBUS_DA_mem,u_int8_t,1) -_BUS_SPACE_CALL_FUNCS_PROTO(SBUS_DA_mem,u_int16_t,2) -_BUS_SPACE_CALL_FUNCS_PROTO(SBUS_DA_mem,u_int32_t,4) - -_BUS_SPACE_CALL_FUNCS_PROTO(SBUS_RA_io,u_int8_t,1) -_BUS_SPACE_CALL_FUNCS_PROTO(SBUS_RA_io,u_int16_t,2) -_BUS_SPACE_CALL_FUNCS_PROTO(SBUS_RA_io,u_int32_t,4) -_BUS_SPACE_CALL_FUNCS_PROTO(SBUS_RA_mem,u_int8_t,1) -_BUS_SPACE_CALL_FUNCS_PROTO(SBUS_RA_mem,u_int16_t,2) -_BUS_SPACE_CALL_FUNCS_PROTO(SBUS_RA_mem,u_int32_t,4) - -struct bus_space_tag SBUS_io_space_tag = { - BUS_SPACE_TAG_IO, - - /* direct bus access methods */ - { - _BUS_SPACE_CALL_FUNCS_TAB(SBUS_DA_io,u_int8_t,1), - _BUS_SPACE_CALL_FUNCS_TAB(SBUS_DA_io,u_int16_t,2), - _BUS_SPACE_CALL_FUNCS_TAB(SBUS_DA_io,u_int32_t,4), - }, - - /* relocate bus access methods */ - { - _BUS_SPACE_CALL_FUNCS_TAB(SBUS_RA_io,u_int8_t,1), - _BUS_SPACE_CALL_FUNCS_TAB(SBUS_RA_io,u_int16_t,2), - _BUS_SPACE_CALL_FUNCS_TAB(SBUS_RA_io,u_int32_t,4), - } -}; - -struct bus_space_tag SBUS_mem_space_tag = { - BUS_SPACE_TAG_MEM, - - /* direct bus access methods */ - { - _BUS_SPACE_CALL_FUNCS_TAB(SBUS_DA_mem,u_int8_t,1), - _BUS_SPACE_CALL_FUNCS_TAB(SBUS_DA_mem,u_int16_t,2), - _BUS_SPACE_CALL_FUNCS_TAB(SBUS_DA_mem,u_int32_t,4), - }, - - /* relocate bus access methods */ - { - _BUS_SPACE_CALL_FUNCS_TAB(SBUS_RA_mem,u_int8_t,1), - _BUS_SPACE_CALL_FUNCS_TAB(SBUS_RA_mem,u_int16_t,2), - _BUS_SPACE_CALL_FUNCS_TAB(SBUS_RA_mem,u_int32_t,4), - } -}; - - -#include "opt_mecia.h" -#ifdef DEV_MECIA - -_BUS_SPACE_CALL_FUNCS_PROTO(NEPC_DA_io,u_int16_t,2) -_BUS_SPACE_CALL_FUNCS_PROTO(NEPC_DA_io,u_int32_t,4) - -_BUS_SPACE_CALL_FUNCS_PROTO(NEPC_RA_io,u_int16_t,2) -_BUS_SPACE_CALL_FUNCS_PROTO(NEPC_RA_io,u_int32_t,4) - -struct bus_space_tag NEPC_io_space_tag = { - BUS_SPACE_TAG_IO, - - /* direct bus access methods */ - { - _BUS_SPACE_CALL_FUNCS_TAB(SBUS_DA_io,u_int8_t,1), - _BUS_SPACE_CALL_FUNCS_TAB(NEPC_DA_io,u_int16_t,2), - _BUS_SPACE_CALL_FUNCS_TAB(NEPC_DA_io,u_int32_t,4), - }, - - /* relocate bus access methods */ - { - _BUS_SPACE_CALL_FUNCS_TAB(SBUS_RA_io,u_int8_t,1), - _BUS_SPACE_CALL_FUNCS_TAB(NEPC_RA_io,u_int16_t,2), - _BUS_SPACE_CALL_FUNCS_TAB(NEPC_RA_io,u_int32_t,4), - } -}; - -struct bus_space_tag NEPC_mem_space_tag = { - BUS_SPACE_TAG_MEM, - - /* direct bus access methods */ - { - _BUS_SPACE_CALL_FUNCS_TAB(SBUS_DA_mem,u_int8_t,1), - _BUS_SPACE_CALL_FUNCS_TAB(SBUS_DA_mem,u_int16_t,2), - _BUS_SPACE_CALL_FUNCS_TAB(SBUS_DA_mem,u_int32_t,4), - }, - - /* relocate bus access methods */ - { - _BUS_SPACE_CALL_FUNCS_TAB(SBUS_RA_mem,u_int8_t,1), - _BUS_SPACE_CALL_FUNCS_TAB(SBUS_RA_mem,u_int16_t,2), - _BUS_SPACE_CALL_FUNCS_TAB(SBUS_RA_mem,u_int32_t,4), - } -}; - -#endif /* DEV_MECIA */ - -/************************************************************************* - * map init - *************************************************************************/ -static __inline void -bus_space_iat_init(bus_space_handle_t bsh) -{ - int i; - - for (i = 0; i < bsh->bsh_maxiatsz; i++) - bsh->bsh_iat[i] = bsh->bsh_base + i; -} - -/************************************************************************* - * handle allocation - *************************************************************************/ -int -i386_bus_space_handle_alloc(bus_space_tag_t t, bus_addr_t bpa, bus_size_t size, - bus_space_handle_t *bshp) -{ - bus_space_handle_t bsh; - - bsh = (bus_space_handle_t) malloc(sizeof (*bsh), M_BUSSPACEHANDLE, - M_NOWAIT | M_ZERO); - if (bsh == NULL) - return ENOMEM; - - bsh->bsh_maxiatsz = BUS_SPACE_IAT_MAXSIZE; - bsh->bsh_iatsz = 0; - bsh->bsh_base = bpa; - bsh->bsh_sz = size; - bsh->bsh_res = NULL; - bsh->bsh_ressz = 0; - bus_space_iat_init(bsh); - - bsh->bsh_bam = t->bs_da; /* default: direct access */ - - *bshp = bsh; - return 0; -} - -void -i386_bus_space_handle_free(bus_space_tag_t t, bus_space_handle_t bsh, - size_t size) -{ - - free(bsh, M_BUSSPACEHANDLE); -} - -/************************************************************************* - * map - *************************************************************************/ -int -i386_memio_map(bus_space_tag_t t, bus_addr_t bpa, bus_size_t size, int flags, - bus_space_handle_t *bshp) -{ - - return i386_bus_space_handle_alloc(t, bpa, size, bshp); -} - -void -i386_memio_unmap(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size) -{ - - i386_bus_space_handle_free(t, bsh, bsh->bsh_sz); -} - -void -i386_memio_free(bus_space_tag_t t, bus_space_handle_t bsh, bus_size_t size) -{ - - /* i386_memio_unmap() does all that we need to do. */ - i386_memio_unmap(t, bsh, bsh->bsh_sz); -} - -int -i386_memio_map_load(bus_space_tag_t t, bus_space_handle_t bsh, - bus_size_t size, bus_space_iat_t iat, u_int flags __unused) -{ - int i; - - if (size > bsh->bsh_maxiatsz) { - printf("i386_memio_map_load: map size too large\n"); - return EINVAL; - } - - for (i = 0; i < bsh->bsh_maxiatsz; i++) { - if (i < size) - bsh->bsh_iat[i] = iat[i]; - else - bsh->bsh_iat[i] = 0; - bsh->bsh_iat[i] += bsh->bsh_base; - } - - bsh->bsh_iatsz = size; - bsh->bsh_bam = t->bs_ra; /* relocate access */ - - return 0; -} - -int -i386_memio_subregion(bus_space_tag_t t, bus_space_handle_t pbsh, - bus_size_t offset, bus_size_t size, - bus_space_handle_t *tbshp) -{ - int i, error = 0; - bus_space_handle_t bsh; - bus_addr_t pbase; - - pbase = pbsh->bsh_base + offset; - switch (t->bs_tag) { - case BUS_SPACE_TAG_IO: - if (pbsh->bsh_iatsz > 0) { - if (offset >= pbsh->bsh_iatsz || - offset + size > pbsh->bsh_iatsz) - return EINVAL; - pbase = pbsh->bsh_base; - } - break; - - case BUS_SPACE_TAG_MEM: - if (pbsh->bsh_iatsz > 0) - return EINVAL; - if (offset > pbsh->bsh_sz || offset + size > pbsh->bsh_sz) - return EINVAL; - break; - - default: - panic("i386_memio_subregion: bad bus space tag"); - break; - } - - error = i386_bus_space_handle_alloc(t, pbase, size, &bsh); - if (error != 0) - return error; - - switch (t->bs_tag) { - case BUS_SPACE_TAG_IO: - if (pbsh->bsh_iatsz > 0) { - for (i = 0; i < size; i ++) - bsh->bsh_iat[i] = pbsh->bsh_iat[i + offset]; - bsh->bsh_iatsz = size; - } else if (pbsh->bsh_base > bsh->bsh_base || - pbsh->bsh_base + pbsh->bsh_sz < - bsh->bsh_base + bsh->bsh_sz) { - i386_bus_space_handle_free(t, bsh, size); - return EINVAL; - } - break; - - case BUS_SPACE_TAG_MEM: - break; - } - - if (pbsh->bsh_iatsz > 0) - bsh->bsh_bam = t->bs_ra; /* relocate access */ - *tbshp = bsh; - return error; -} - -int -i386_memio_compare(bus_space_tag_t t1, bus_space_handle_t bsh1, - bus_space_tag_t t2, bus_space_handle_t bsh2) -{ - int i; - - if (t1->bs_tag != t2->bs_tag) - return (1); - if (bsh1->bsh_base != bsh2->bsh_base) - return (1); - if (bsh1->bsh_sz != bsh2->bsh_sz) - return (1); - if (bsh1->bsh_bam.bs_read_1 != bsh2->bsh_bam.bs_read_1) /* XXX */ - return (1); - - if (bsh1->bsh_iatsz != bsh2->bsh_iatsz) - return (1); - for (i = 0; i < bsh1->bsh_iatsz; i++) { - if (bsh1->bsh_iat[i] != bsh2->bsh_iat[i]) - return (1); - } - - return (0); -} diff --git a/sys/pc98/pc98/canbepm.c b/sys/pc98/pc98/canbepm.c deleted file mode 100644 index 5c347a07e187..000000000000 --- a/sys/pc98/pc98/canbepm.c +++ /dev/null @@ -1,137 +0,0 @@ -/*- - * Copyright (c) 2000 KIYOHARA Takashi - * Copyright (c) 2000 Takanori Watanabe - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include "canbus_if.h" - - -/* canbepm softc */ -struct canbepm_softc { - device_t canbepm_dev; /* canbepm device */ - - eventhandler_tag canbepm_tag; /* event handler tag */ -}; - - -static void canbepm_soft_off (void *, int); -static void canbepm_identify (driver_t *, device_t); -static int canbepm_probe (device_t); -static int canbepm_attach (device_t); -static int canbepm_detach (device_t); - - -static device_method_t canbepm_methods[] = { - DEVMETHOD(device_identify, canbepm_identify), - DEVMETHOD(device_probe, canbepm_probe), - DEVMETHOD(device_attach, canbepm_attach), - DEVMETHOD(device_detach, canbepm_detach), - {0, 0} -}; - -static driver_t canbepm_driver = { - "canbepm", - canbepm_methods, - sizeof(struct canbepm_softc), -}; - -devclass_t canbepm_devclass; -DRIVER_MODULE(canbepm, canbus, canbepm_driver, canbepm_devclass, 0, 0); -MODULE_DEPEND(canbepm, canbus, 1, 1, 1); - - -static void -canbepm_soft_off (void *data, int howto) -{ - struct canbepm_softc *sc = data; - u_int8_t poweroff_data[] = CANBE_POWEROFF_DATA; - - if (!(howto & RB_POWEROFF)) - return; - - CANBUS_WRITE_MULTI(device_get_parent(sc->canbepm_dev), sc->canbepm_dev, - CANBE_POWER_CTRL, sizeof (poweroff_data), poweroff_data); -} - - -static void -canbepm_identify(driver_t *drv, device_t parent) -{ - if (device_find_child(parent, "canbepm", 0) == NULL) { - if (BUS_ADD_CHILD(parent, 33, "canbepm", 0) == NULL) - device_printf(parent, "canbepm cannot attach\n"); - } -} - - -static int -canbepm_probe(device_t dev) -{ - device_set_desc(dev, "CanBe Power Management Controller"); - - return (0); -} - -static int -canbepm_attach(device_t dev) -{ - struct canbepm_softc *sc = device_get_softc(dev); - - /* eventhandler regist */ - sc->canbepm_tag = EVENTHANDLER_REGISTER( - shutdown_final, canbepm_soft_off, sc, SHUTDOWN_PRI_LAST); - - sc->canbepm_dev = dev; - - return (0); -} - - -static int -canbepm_detach(device_t dev) -{ - struct canbepm_softc *sc = device_get_softc(dev); - - /* eventhandler deregist */ - EVENTHANDLER_DEREGISTER(shutdown_final, sc->canbepm_tag); - BUS_CHILD_DETACHED(device_get_parent(dev), dev); - - return (0); -} diff --git a/sys/pc98/pc98/canbus.c b/sys/pc98/pc98/canbus.c deleted file mode 100644 index 0c54ceb66a94..000000000000 --- a/sys/pc98/pc98/canbus.c +++ /dev/null @@ -1,441 +0,0 @@ -/*- - * Copyright (c) 2000 KIYOHARA Takashi - * Copyright (c) 2000 Takanori Watanabe - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include -#include -#include -#include -#include -#include -#include - - -#include -#include -#include - -#include -#include -#include "canbus_if.h" - - -#define CANBE_IO_DELAY_TIME 5000 - - -static MALLOC_DEFINE(M_CANBUSDEV, "canbusdev", "CanBe device"); -struct canbus_device { - struct resource_list cbdev_resources; -}; - -/* canbus softc */ -struct canbus_softc { - int io_delay_time; /* CanBe I/O delay time */ - - struct sysctl_ctx_list canbus_sysctl_ctx; - /* dynamic sysctl tree */ - - /* index register */ - int index_id; /* index ID */ - struct resource *index_res; /* index resource */ - bus_space_tag_t index_tag; /* index tag */ - bus_space_handle_t index_handle; /* index handle */ - - /* data register */ - int data_id; /* data ID */ - struct resource *data_res; /* data resource */ - bus_space_tag_t data_tag; /* data tag */ - bus_space_handle_t data_handle; /* data handle */ -}; - - -/* Device interface methods */ -static void canbus_identify(driver_t *, device_t); -static int canbus_probe(device_t); -static int canbus_attach(device_t); -static int canbus_detach(device_t); - -/* Bus interface methods */ -static int canbus_print_child(device_t, device_t); -static device_t canbus_add_child(device_t, u_int, const char *, int); -static struct resource * canbus_alloc_resource( - device_t, device_t, int, int *, rman_res_t, rman_res_t, rman_res_t, u_int); -static int canbus_activate_resource( - device_t, device_t, int, int, struct resource *); -static int canbus_deactivate_resource( - device_t, device_t, int, int, struct resource *); -static int canbus_release_resource( - device_t, device_t, int, int, struct resource *); -static int canbus_set_resource ( - device_t, device_t, int, int, rman_res_t, rman_res_t); -static void canbus_delete_resource(device_t, device_t, int, int); - -/* canbus local function */ -static void set_ioresource(device_t dev); -static void delete_ioresource(device_t dev); -static int alloc_ioresource(device_t); -static void release_ioresource(device_t); -static int print_all_resources(device_t); - -static device_method_t canbus_methods[] = { - /* Device interface */ - DEVMETHOD(device_identify, canbus_identify), - DEVMETHOD(device_probe, canbus_probe), - DEVMETHOD(device_attach, canbus_attach), - DEVMETHOD(device_detach, canbus_detach), - - /* Bus interface */ - DEVMETHOD(bus_print_child, canbus_print_child), - DEVMETHOD(bus_add_child, canbus_add_child), - DEVMETHOD(bus_alloc_resource, canbus_alloc_resource), - DEVMETHOD(bus_activate_resource, canbus_activate_resource), - DEVMETHOD(bus_deactivate_resource, canbus_deactivate_resource), - DEVMETHOD(bus_release_resource, canbus_release_resource), - DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), - DEVMETHOD(bus_set_resource, canbus_set_resource), - DEVMETHOD(bus_delete_resource, canbus_delete_resource), - - /* CanBe interface */ - DEVMETHOD(canbus_read, canbus_read), - DEVMETHOD(canbus_write, canbus_write), - DEVMETHOD(canbus_write_multi, canbus_write_multi), - - {0, 0} -}; - -static driver_t canbus_driver = { - "canbus", - canbus_methods, - sizeof(struct canbus_softc), -}; - -devclass_t canbus_devclass; -DRIVER_MODULE(canbus, nexus, canbus_driver, canbus_devclass, 0, 0); -MODULE_VERSION(canbus, 1); - - -static void -canbus_identify(driver_t *drv, device_t parent) -{ - if (device_find_child(parent, "canbus", 0) == NULL) { - if (BUS_ADD_CHILD(parent, 33, "canbus", 0) == NULL) - device_printf(parent, "canbus cannot attach\n"); - } -} - - -static int -canbus_probe(device_t dev) -{ - u_int8_t flag; - - set_ioresource(dev); - if(alloc_ioresource(dev)) - return (ENXIO); - flag = canbus_read(dev, NULL, CANBE_SOUND_INTR_ADDR); - release_ioresource(dev); - - if (bootverbose) - device_printf(dev, "probe flag = 0x%x\n", flag); - - if (flag != CANBE_SOUND_INTR_VAL0 && flag != CANBE_SOUND_INTR_VAL1 && - flag != CANBE_SOUND_INTR_VAL2 && flag != CANBE_SOUND_INTR_VAL3) { - device_printf(dev, "Device Not Found\n"); - return (ENXIO); - } - device_set_desc(dev, "CanBe I/O Bus"); - - return (0); -} - -static int -canbus_attach(device_t dev) -{ - struct canbus_softc *sc = device_get_softc(dev); - struct sysctl_oid *canbus_sysctl_tree; - - sc->io_delay_time = CANBE_IO_DELAY_TIME; - - /* I/O resource setup */ - if(alloc_ioresource(dev)) - return (ENXIO); - - /* Dynamic sysctl tree setup */ - sysctl_ctx_init(&sc->canbus_sysctl_ctx); - canbus_sysctl_tree = SYSCTL_ADD_ROOT_NODE(&sc->canbus_sysctl_ctx, - OID_AUTO, "canbus", CTLFLAG_RD, 0, "CanBe I/O Bus"); - SYSCTL_ADD_INT(&sc->canbus_sysctl_ctx, - SYSCTL_CHILDREN(canbus_sysctl_tree), OID_AUTO, "io_delay_time", - CTLFLAG_RW, &sc->io_delay_time, 0, "CanBe Bus I/O delay time"); - - bus_generic_probe(dev); - bus_generic_attach(dev); - - return (0); -} - - -static int -canbus_detach(device_t dev) -{ - struct canbus_softc *sc = device_get_softc(dev); - - /* I/O resource free */ - release_ioresource(dev); - delete_ioresource(dev); - - /* Dynamic sysctl tree destroy */ - if (sysctl_ctx_free(&sc->canbus_sysctl_ctx)) { - device_printf(dev, - "can't free this context - other oids depend on it\n"); - return (ENOTEMPTY); - } - - return (0); -} - - -static int -canbus_print_child(device_t dev, device_t child) -{ - int retval = 0; - - retval += bus_print_child_header(dev, child); - retval += print_all_resources(child); - retval += bus_print_child_footer(dev, child); - - return (retval); -} - -static device_t -canbus_add_child(device_t bus, u_int order, const char *name, int unit) -{ - device_t child; - struct canbus_device *cbdev; - - child = device_add_child_ordered(bus, order, name, unit); - - cbdev = malloc( - sizeof(struct canbus_device), M_CANBUSDEV, M_NOWAIT | M_ZERO); - if (!cbdev) - return (0); - - resource_list_init(&cbdev->cbdev_resources); - device_set_ivars(child, cbdev); - - return (child); -} - -static struct resource * -canbus_alloc_resource(device_t dev, device_t child, int type, - int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) -{ - return (BUS_ALLOC_RESOURCE(device_get_parent(dev), - child, type, rid, start, end, count, flags)); -} - -static int -canbus_activate_resource( - device_t dev, device_t child, int type, int rid, struct resource *res) -{ - return (BUS_ACTIVATE_RESOURCE( - device_get_parent(dev), child, type, rid, res)); -} - -static int -canbus_deactivate_resource( - device_t dev, device_t child, int type, int rid, struct resource *res) -{ - return (BUS_DEACTIVATE_RESOURCE( - device_get_parent(dev), child, type, rid, res)); -} - -static int -canbus_release_resource( - device_t dev, device_t child, int type, int rid, struct resource *res) -{ - return (BUS_RELEASE_RESOURCE( - device_get_parent(dev), child, type, rid, res)); -} - -static int -canbus_set_resource ( - device_t dev, device_t child, int type, int rid, rman_res_t start, - rman_res_t count) -{ - struct canbus_device *cbdev = - (struct canbus_device *)device_get_ivars(child); - struct resource_list *rl = &cbdev->cbdev_resources; - - resource_list_add(rl, type, rid, start, (start + count - 1), count); - - return (0); -} - -static void -canbus_delete_resource(device_t dev, device_t child, int type, int rid) -{ - struct canbus_device *cbdev = - (struct canbus_device *)device_get_ivars(child); - struct resource_list *rl = &cbdev->cbdev_resources; - - resource_list_delete(rl, type, rid); -} - - -u_int8_t -canbus_read(device_t dev, device_t child, int reg) -{ - struct canbus_softc *sc = device_get_softc(dev); - - bus_space_write_1(sc->index_tag, sc->index_handle, 0, reg); - return (bus_space_read_1(sc->data_tag, sc->data_handle, 0)); -} - -void -canbus_write(device_t dev, device_t child, int reg, u_int8_t val) -{ - struct canbus_softc *sc = device_get_softc(dev); - - bus_space_write_1(sc->index_tag, sc->index_handle, 0, reg); - bus_space_write_1(sc->data_tag, sc->data_handle, 0, val); -} - -void -canbus_write_multi(device_t dev, - device_t child, int reg, const int count, const u_int8_t *vals) -{ - struct canbus_softc *sc = device_get_softc(dev); - int i; - - bus_space_write_1(sc->index_tag, sc->index_handle, 0, reg); - - for (i = 0; i < count; i ++) { - bus_space_write_1(sc->data_tag, sc->data_handle, 0, vals[i]); - DELAY(sc->io_delay_time); - } -} - -void -canbus_delay(device_t dev, device_t child) -{ - struct canbus_softc *sc = device_get_softc(dev); - - DELAY(sc->io_delay_time); -} - - -/* - * canbus local function. - */ - -/* - * CanBe I/O resource set function - */ -static void -set_ioresource(device_t dev) -{ - struct canbus_softc *sc = device_get_softc(dev); - - sc->index_id = 0; - sc->data_id = 1; - - bus_set_resource( - dev, SYS_RES_IOPORT, sc->index_id, CANBE_IOPORT_INDEX, 1); - bus_set_resource( - dev, SYS_RES_IOPORT, sc->data_id, CANBE_IOPORT_DATA, 1); -} - -/* - * CanBe I/O resource delete function - */ -static void -delete_ioresource(device_t dev) -{ - struct canbus_softc *sc = device_get_softc(dev); - - bus_delete_resource(dev, SYS_RES_IOPORT, sc->index_id); - bus_delete_resource(dev, SYS_RES_IOPORT, sc->data_id); -} - -/* - * CanBe I/O resource alloc function - */ -static int -alloc_ioresource(device_t dev) -{ - struct canbus_softc *sc = device_get_softc(dev); - - sc->index_res = bus_alloc_resource_any( - dev, SYS_RES_IOPORT, &sc->index_id, RF_ACTIVE); - sc->data_res = bus_alloc_resource_any( - dev, SYS_RES_IOPORT, &sc->data_id, RF_ACTIVE); - if (sc->index_res == NULL || sc->data_res == NULL) { - device_printf(dev, "could not map I/O\n"); - return (ENXIO); - } - - sc->index_tag = rman_get_bustag(sc->index_res); - sc->index_handle = rman_get_bushandle(sc->index_res); - sc->data_tag = rman_get_bustag(sc->data_res); - sc->data_handle = rman_get_bushandle(sc->data_res); - - return (0); -} - -/* - * CanBe I/O resource release function - */ -static void -release_ioresource(device_t dev) -{ - struct canbus_softc *sc = device_get_softc(dev); - - bus_release_resource(dev, SYS_RES_IOPORT, sc->index_id, sc->index_res); - bus_release_resource(dev, SYS_RES_IOPORT, sc->data_id, sc->data_res); -} - - -static int -print_all_resources(device_t dev) -{ - struct canbus_device *cbdev = - (struct canbus_device *)device_get_ivars(dev); - struct resource_list *rl = &cbdev->cbdev_resources; - int retval = 0; - - if (STAILQ_FIRST(rl)) - retval += printf(" at"); - - retval += resource_list_print_type(rl, "port", SYS_RES_IOPORT, "%#jx"); - retval += resource_list_print_type(rl, "iomem", SYS_RES_MEMORY, "%#jx"); - retval += resource_list_print_type(rl, "irq", SYS_RES_IRQ, "%jd"); - - return retval; -} diff --git a/sys/pc98/pc98/canbus.h b/sys/pc98/pc98/canbus.h deleted file mode 100644 index b63cc765cd6f..000000000000 --- a/sys/pc98/pc98/canbus.h +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * Copyright (c) 2000 KIYOHARA Takashi - * Copyright (c) 2000 Takanori Watanabe - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _PC98_PC98_CANBUS_H_ -#define _PC98_PC98_CANBUS_H_ - -u_int8_t canbus_read(device_t, device_t, int); -void canbus_write(device_t, device_t, int, u_int8_t); -void canbus_write_multi( - device_t, device_t, int, const int, const u_int8_t *); -void canbus_delay(device_t, device_t); - -#endif /* _PC98_PC98_CANBUS_H_ */ diff --git a/sys/pc98/pc98/canbus_if.m b/sys/pc98/pc98/canbus_if.m deleted file mode 100644 index 42d2cd52929c..000000000000 --- a/sys/pc98/pc98/canbus_if.m +++ /dev/null @@ -1,69 +0,0 @@ -#- -# Copyright (c) 2002 KIYOHARA Takashi -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# $FreeBSD$ -# - -#include - -INTERFACE canbus; - -# -# CanBe I/O read -# -METHOD u_int8_t read { - device_t dev; - device_t child; - int reg; -}; - -# -# CanBe I/O write -# -METHOD void write { - device_t dev; - device_t child; - int reg; - u_int8_t val; -}; - -# -# CanBe I/O write multi bytes -# -METHOD void write_multi { - device_t dev; - device_t child; - int reg; - const int count; - const u_int8_t * vals; -}; - -# -# CanBe I/O delay -# -METHOD void delay { - device_t dev; - device_t child; -}; diff --git a/sys/pc98/pc98/canbusvars.h b/sys/pc98/pc98/canbusvars.h deleted file mode 100644 index fc2acc11a976..000000000000 --- a/sys/pc98/pc98/canbusvars.h +++ /dev/null @@ -1,110 +0,0 @@ -/*- - * Copyright (c) 2000 KIYOHARA Takashi - * Copyright (c) 2000 Takanori Watanabe - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _PC98_PC98_CANBUSVARS_H_ -#define _PC98_PC98_CANBUSVARS_H_ - - -/* CanBe I/O register */ -#define CANBE_IOPORT_INDEX 0xf4a -#define CANBE_IOPORT_DATA 0xf4b - -/* - * following registor purpose for spending -- unknown. - */ -#define CANBE_IOPORT1 0x0c24 -#define CANBE_IOPORT2 0x0c2b -#define CANBE_IOPORT3 0x0c2d - - -/* CanBe register number */ -#define CANBE_SOUND_INTR_ADDR 0x01 -#define CANBE_RC_RESET 0x03 -#define CANBE_MUTE_CTRL 0x04 -#define CANBE_RC_DATA_STATUS 0x10 -#define CANBE_RC_RECV_CODE 0x11 -#define CANBE_POWER_CTRL 0x13 -#define CANBE_RC_USED_INTR 0x14 - - -/* CanBe sound interrupt address value */ -#define CANBE_SOUND_INTR_VAL0 0x00 -#define CANBE_SOUND_INTR_VAL1 0x02 -#define CANBE_SOUND_INTR_VAL2 0x03 -#define CANBE_SOUND_INTR_VAL3 0x08 - -/* CanBe remote controler reset */ -#define CANBE_MIKE_THRUE 0x04 -#define CANBE_CTRLR_RESET 0x01 - -/* CanBe mute control */ -#define CANBE_MUTE 0x01 - -/* CanBe remote controler data status */ -#define CANBE_RC_BUSY 0x02 -#define CANBE_RC_STATUS 0x01 - -/* CanBe remote controler receive code */ -#define CANBE_RC_DATA_CHUP 0x00 -#define CANBE_RC_DATA_CHDOWN 0x01 -#define CANBE_RC_DATA_VOLUP 0x02 -#define CANBE_RC_DATA_VOLDOWN 0x03 -#define CANBE_RC_DATA_EJECT 0x04 -#define CANBE_RC_DATA_PLAY 0x05 -#define CANBE_RC_DATA_MUTE 0x09 -#define CANBE_RC_DATA_VIDEO 0x0a -#define CANBE_RC_DATA_NEXT 0x0c -#define CANBE_RC_DATA_PREVIOUS 0x0d -#define CANBE_RC_DATA_M_S 0x1d -#define CANBE_RC_DATA_UP 0x40 -#define CANBE_RC_DATA_DOWN 0x41 -#define CANBE_RC_DATA_LEFT 0x42 -#define CANBE_RC_DATA_RIGHT 0x43 -#define CANBE_RC_DATA_SIZE 0x4d -#define CANBE_RC_DATA_ESC 0x4e -#define CANBE_RC_DATA_CR 0x4f -#define CANBE_RC_DATA_TV 0x53 -#define CANBE_RC_DATA_FREEZE 0x5d -#define CANBE_RC_DATA_CAPTURE 0x5e - -/* CanBe power off data */ -#define CANBE_POWEROFF_DATA { \ - 0x80, 0x06, 0x00, 0x00, \ - 0x80, 0x07, 0x00, 0x01, \ - 0x80, 0x01, 0x00, 0x00 \ -} - -/* CanBe remote controler used intr */ -#define CANBE_RC_INTR 0x04 -#define CANBE_RC_INTR_INT41 0x03 /* irq 10 */ -#define CANBE_RC_INTR_INT1 0x02 /* irq 5 */ -#define CANBE_RC_INTR_INT2 0x01 /* irq 6 */ -#define CANBE_RC_INTR_INT0 0x00 /* irq 3 */ - -#endif /* _PC98_PC98_CANBUSVARS_H_ */ diff --git a/sys/pc98/pc98/genassym.c b/sys/pc98/pc98/genassym.c deleted file mode 100644 index 26858e5e149a..000000000000 --- a/sys/pc98/pc98/genassym.c +++ /dev/null @@ -1,3 +0,0 @@ -/* $FreeBSD$ */ - -#include "../../i386/i386/genassym.c" diff --git a/sys/pc98/pc98/pc98_machdep.c b/sys/pc98/pc98/pc98_machdep.c deleted file mode 100644 index 9f9fbcc347f2..000000000000 --- a/sys/pc98/pc98/pc98_machdep.c +++ /dev/null @@ -1,320 +0,0 @@ -/*- - * Copyright (c) KATO Takenori, 1996, 1997. - * - * All rights reserved. Unpublished rights reserved under the copyright - * laws of Japan. - * - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer as - * the first lines of this file unmodified. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include "opt_pc98.h" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -static int ad_geom_method = AD_GEOM_ADJUST_COMPATIDE; - -SYSCTL_INT(_machdep, OID_AUTO, ad_geom_method, CTLFLAG_RWTUN, &ad_geom_method, 0, - "IDE disk geometry conversion method"); - -/* - * Initialize DMA controller - */ -void -pc98_init_dmac(void) -{ - outb(0x439, (inb(0x439) & 0xfb)); /* DMA Accsess Control over 1MB */ - outb(0x29, (0x0c | 0)); /* Bank Mode Reg. 16M mode */ - outb(0x29, (0x0c | 1)); /* Bank Mode Reg. 16M mode */ - outb(0x29, (0x0c | 2)); /* Bank Mode Reg. 16M mode */ - outb(0x29, (0x0c | 3)); /* Bank Mode Reg. 16M mode */ - outb(0x11, 0x50); -} - -#ifdef EPSON_MEMWIN -/* - * Disconnect phisical memory in 15-16MB region. - * - * EPSON PC-486GR, P, SR, SE, HX, HG and HA only. Other system support - * this feature with software DIP switch. - */ -static void -init_epson_memwin(void) -{ - /* Disable 15MB-16MB caching. */ - switch (epson_machine_id) { - case EPSON_PC486_HX: - case EPSON_PC486_HG: - case EPSON_PC486_HA: - /* Cache control start. */ - outb(0x43f, 0x42); - outw(0xc40, 0x0033); - - /* Disable 0xF00000-0xFFFFFF. */ - outb(0xc48, 0x49); - outb(0xc4c, 0x00); - outb(0xc48, 0x48); - outb(0xc4c, 0xf0); - outb(0xc48, 0x4d); - outb(0xc4c, 0x00); - outb(0xc48, 0x4c); - outb(0xc4c, 0xff); - outb(0xc48, 0x4f); - outb(0xc4c, 0x00); - - /* Cache control end. */ - outb(0x43f, 0x40); - break; - - case EPSON_PC486_GR: - case EPSON_PC486_P: - case EPSON_PC486_GR_SUPER: - case EPSON_PC486_GR_PLUS: - case EPSON_PC486_SE: - case EPSON_PC486_SR: - /* Disable 0xF00000-0xFFFFFF. */ - outb(0x43f, 0x42); - outb(0x467, 0xe0); - outb(0x567, 0xd8); - - outb(0x43f, 0x40); - outb(0x467, 0xe0); - outb(0x567, 0xe0); - break; - } - - /* Disable 15MB-16MB RAM and enable memory window. */ - outb(0x43b, inb(0x43b) & 0xfd); /* Clear bit1. */ -} -#endif - -/* - * Get physical memory size - */ -unsigned int -pc98_getmemsize(unsigned int *base, unsigned int *ext) -{ - unsigned int under16, over16; - - /* available conventional memory size */ - *base = ((PC98_SYSTEM_PARAMETER(0x501) & 7) + 1) * 128; - - /* available protected memory size under 16MB */ - under16 = PC98_SYSTEM_PARAMETER(0x401) * 128 + 1024; -#ifdef EPSON_MEMWIN - if (pc98_machine_type & M_EPSON_PC98) { - if (under16 > (15 * 1024)) - /* chop under16 memory to 15MB */ - under16 = 15 * 1024; - init_epson_memwin(); - } -#endif - - /* available protected memory size over 16MB / 1MB */ - over16 = PC98_SYSTEM_PARAMETER(0x594); - over16 += PC98_SYSTEM_PARAMETER(0x595) * 256; - - if (over16 > 0) - *ext = (16 + over16) * 1024 - 1024; - else - *ext = under16 - 1024; - - return (under16); -} - -/* - * Read a geometry information of SCSI HDD from BIOS work area. - * - * XXX - Before reading BIOS work area, we should check whether - * host adapter support it. - */ -int -scsi_da_bios_params(struct ccb_calc_geometry *ccg) -{ - u_char *tmp; - int target; - - target = ccg->ccb_h.target_id; - tmp = (u_char *)&PC98_SYSTEM_PARAMETER(0x460 + target*4); - if ((PC98_SYSTEM_PARAMETER(0x482) & ((1 << target)&0xff)) != 0) { - ccg->secs_per_track = *tmp; - ccg->cylinders = ((*(tmp+3)<<8)|*(tmp+2))&0xfff; -#if 0 - switch (*(tmp + 3) & 0x30) { - case 0x00: - disk_parms->secsiz = 256; - printf("Warning!: not supported.\n"); - break; - case 0x10: - disk_parms->secsiz = 512; - break; - case 0x20: - disk_parms->secsiz = 1024; - break; - default: - disk_parms->secsiz = 512; - printf("Warning!: not supported. But force to 512\n"); - break; - } -#endif - if (*(tmp+3) & 0x40) { - ccg->cylinders += (*(tmp+1)&0xf0)<<8; - ccg->heads = *(tmp+1)&0x0f; - } else { - ccg->heads = *(tmp+1); - } - return (1); - } - - return (0); -} - -/* - * Adjust the geometry of the IDE HDD. - */ - -/* IDE BIOS compatible mode. */ -static void -pc98_ata_disk_geom_adjust_idebios(struct disk *disk) -{ - - if (disk->d_mediasize < MEDIASIZE_4_3G) { - disk->d_fwsectors = 17; - disk->d_fwheads = 8; - } else if (disk->d_mediasize < MEDIASIZE_29_5G) { - disk->d_fwsectors = 63; - if (disk->d_fwheads != 15) /* Allow 15H63S. */ - disk->d_fwheads = 16; - } else if (disk->d_mediasize < MEDIASIZE_31_5G) { - disk->d_fwsectors = 63; - disk->d_fwheads = 16; - } else if (disk->d_mediasize < MEDIASIZE_127G) { - disk->d_fwsectors = 255; - disk->d_fwheads = 16; - } else { - /* XXX */ - disk->d_fwsectors = 255; - disk->d_fwheads = 255; - } -} - -/* SCSI BIOS compatible mode. */ -static void -pc98_ata_disk_geom_adjust_scsibios(struct disk *disk) -{ - - if (disk->d_mediasize < MEDIASIZE_8G) { - disk->d_fwsectors = 32; - disk->d_fwheads = 8; - } else if (disk->d_mediasize < MEDIASIZE_32G) { - disk->d_fwsectors = 128; - disk->d_fwheads = 8; - } else if (disk->d_mediasize < MEDIASIZE_60G) { - /* Compatible with IFC-USP 1.2. */ - disk->d_fwsectors = 128; - disk->d_fwheads = 15; - } else if (disk->d_mediasize < MEDIASIZE_120G) { - disk->d_fwsectors = 255; - disk->d_fwheads = 15; - } else { - /* XXX */ - disk->d_fwsectors = 255; - disk->d_fwheads = 255; - } -} - -/* Compatible with the revision 1.28. */ -static void -pc98_ata_disk_geom_adjust_cyl16bit(struct disk *disk) -{ - off_t totsec = disk->d_mediasize / disk->d_sectorsize; - off_t cyl = totsec / disk->d_fwsectors / disk->d_fwheads; - - /* - * It is impossible to have more than 65535 cylinders, so if - * we have more then try to adjust. This is lame, but it is - * only POC. - */ - if (cyl > 65355) { - if (totsec < 17*8*65535) { - disk->d_fwsectors = 17; - disk->d_fwheads = 8; - } else if (totsec < 63*16*65535) { - disk->d_fwsectors = 63; - disk->d_fwheads = 16; - } else if (totsec < 255*16*65535) { - disk->d_fwsectors = 255; - disk->d_fwheads = 16; - } else { - disk->d_fwsectors = 255; - disk->d_fwheads = 255; - } - } -} - -void -pc98_ata_disk_firmware_geom_adjust(struct disk *disk) -{ - u_int oldsectors, oldheads; - - oldsectors = disk->d_fwsectors; - oldheads = disk->d_fwheads; - - switch (ad_geom_method) { - case AD_GEOM_ADJUST_COMPATIDE: - pc98_ata_disk_geom_adjust_idebios(disk); - break; - case AD_GEOM_ADJUST_COMPATSCSI: - pc98_ata_disk_geom_adjust_scsibios(disk); - break; - case AD_GEOM_ADJUST_COMPATCYL16: - pc98_ata_disk_geom_adjust_cyl16bit(disk); - break; - default: - /* Do nothing. */ - break; - } - - if (bootverbose && - (oldsectors != disk->d_fwsectors || oldheads != disk->d_fwheads)) - printf( - "%s%d: geometry adjusted from [%dH/%dS] to [%dH/%dS]\n", - disk->d_name, disk->d_unit, - oldheads, oldsectors, - disk->d_fwheads, disk->d_fwsectors); -} diff --git a/sys/pc98/pc98/pc98_machdep.h b/sys/pc98/pc98/pc98_machdep.h deleted file mode 100644 index 6cbdaad1e018..000000000000 --- a/sys/pc98/pc98/pc98_machdep.h +++ /dev/null @@ -1,102 +0,0 @@ -/*- - * Copyright (c) KATO Takenori, 1996. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer as - * the first lines of this file unmodified. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef __PC98_PC98_PC98_MACHDEP_H__ -#define __PC98_PC98_PC98_MACHDEP_H__ - -void pc98_init_dmac(void); -unsigned int pc98_getmemsize(unsigned *, unsigned *); - -#define PC98_VECTOR_SIZE (0x400) -#define PC98_SYSTEM_PARAMETER_SIZE (0x240) -#define PC98_SAVE_AREA (0xa1000) - -#if defined(_KERNEL) && !defined(LOCORE) -/* BIOS parameter block */ -extern unsigned char pc98_system_parameter[]; /* in locore.c */ - -#define OFS_pc98_machine_type 0x220 -#define OFS_epson_machine_id 0x224 -#define OFS_epson_bios_id 0x225 -#define OFS_epson_system_type 0x226 - -#define PC98_SYSTEM_PARAMETER(x) pc98_system_parameter[(x)-0x400] -#define pc98_machine_type (*(unsigned long*)&pc98_system_parameter[OFS_pc98_machine_type]) -#define epson_machine_id (pc98_system_parameter[OFS_epson_machine_id]) -#define epson_bios_id (pc98_system_parameter[OFS_epson_bios_id]) -#define epson_system_type (pc98_system_parameter[OFS_epson_system_type]) - -# define PC98_TYPE_CHECK(x) ((pc98_machine_type & (x)) == (x)) - -/* - * PC98 machine type - */ -#define M_NEC_PC98 0x0001 -#define M_EPSON_PC98 0x0002 -#define M_NOT_H98 0x0010 -#define M_H98 0x0020 -#define M_NOTE 0x0040 -#define M_NORMAL 0x1000 -#define M_8M 0x8000 - -/* - * EPSON machine list - */ -#define EPSON_PC386_NOTE_A 0x20 -#define EPSON_PC386_NOTE_W 0x22 -#define EPSON_PC386_NOTE_AE 0x27 -#define EPSON_PC386_NOTE_WR 0x2a -#define EPSON_PC486_GR 0x2b -#define EPSON_PC486_P 0x30 -#define EPSON_PC486_GR_SUPER 0x31 -#define EPSON_PC486_GR_PLUS 0x32 -#define EPSON_PC486_HX 0x34 -#define EPSON_PC486_HG 0x35 -#define EPSON_PC486_SE 0x37 -#define EPSON_PC486_SR 0x38 -#define EPSON_PC486_HA 0x3b - -/* IDE HDD geometry conversion. */ -#define AD_GEOM_ADJUST_NONE 0 /* Do nothing. */ -#define AD_GEOM_ADJUST_COMPATIDE 1 /* PC-98 IDE BIOS. */ -#define AD_GEOM_ADJUST_COMPATSCSI 2 /* PC-98 SCSI. */ -#define AD_GEOM_ADJUST_COMPATCYL16 100 /* Compat Rev. 1.28. */ - -#define MEDIASIZE_4_3G (4351LL * 1024LL * 1024LL) /* 4351M */ -#define MEDIASIZE_8G (8192LL * 1024LL * 1024LL) /* 8192M */ -#define MEDIASIZE_29_5G (30239LL * 1024LL * 1024LL) /* 30239M */ -#define MEDIASIZE_31_5G (32255LL * 1024 * 1024) /* 32255M */ -#define MEDIASIZE_32G (32768LL * 1024LL * 1024LL) /* 32768M */ -#define MEDIASIZE_60G (61440LL * 1024LL * 1024LL) /* 61440M */ -#define MEDIASIZE_120G (122400LL * 1024LL * 1024LL) /* 122400M */ -#define MEDIASIZE_127G (130558LL * 1024LL * 1024LL) /* 130558M */ - -#endif /* _KERNEL */ - -#endif /* __PC98_PC98_PC98_MACHDEP_H__ */ diff --git a/sys/sys/consio.h b/sys/sys/consio.h index a2b035cada62..d2108deba78d 100644 --- a/sys/sys/consio.h +++ b/sys/sys/consio.h @@ -405,12 +405,6 @@ typedef struct vt_mode vtmode_t; #define SW_VGA_CG640 _IO('S', M_VGA_CG640) #define SW_VGA_MODEX _IO('S', M_VGA_MODEX) -#define SW_PC98_80x25 _IO('S', M_PC98_80x25) -#define SW_PC98_80x30 _IO('S', M_PC98_80x30) -#define SW_PC98_EGC640x400 _IO('S', M_PC98_EGC640x400) -#define SW_PC98_PEGC640x400 _IO('S', M_PC98_PEGC640x400) -#define SW_PC98_PEGC640x480 _IO('S', M_PC98_PEGC640x480) - #define SW_VGA_C90x25 _IO('S', M_VGA_C90x25) #define SW_VGA_M90x25 _IO('S', M_VGA_M90x25) #define SW_VGA_C90x30 _IO('S', M_VGA_C90x30) diff --git a/sys/sys/copyright.h b/sys/sys/copyright.h index e9c19881f284..e3b94303f1d5 100644 --- a/sys/sys/copyright.h +++ b/sys/sys/copyright.h @@ -44,14 +44,5 @@ #define COPYRIGHT_UCB \ "Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994\n\tThe Regents of the University of California. All rights reserved.\n" -/* a port of FreeBSD to the NEC PC98, Japan */ -#if defined(PC98) -#define COPYRIGHT_PC98 \ - "Copyright (c) 1994-2003 FreeBSD(98) porting team.\nCopyright (c) 1992 A.Kojima F.Ukai M.Ishii (KMC).\n" -#else -#define COPYRIGHT_PC98 -#endif - -char copyright[] = COPYRIGHT_Vendor COPYRIGHT_FreeBSD COPYRIGHT_PC98 \ - COPYRIGHT_UCB; +char copyright[] = COPYRIGHT_Vendor COPYRIGHT_FreeBSD COPYRIGHT_UCB; char trademark[] = TRADEMARK_Foundation; diff --git a/sys/sys/disk/pc98.h b/sys/sys/disk/pc98.h deleted file mode 100644 index c5ff46c0a584..000000000000 --- a/sys/sys/disk/pc98.h +++ /dev/null @@ -1,75 +0,0 @@ -/*- - * Copyright (c) 1987, 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)disklabel.h 8.2 (Berkeley) 7/10/94 - * $FreeBSD$ - */ - -#ifndef _SYS_DISK_PC98_H_ -#define _SYS_DISK_PC98_H_ - -#define PC98_BBSECTOR 1 /* DOS boot block relative sector number */ -#define PC98_PARTOFF 0 -#define PC98_PARTSIZE 32 -#define PC98_NPARTS 16 -#define PC98_MAGICOFS 510 -#define PC98_MAGIC 0xAA55 - -#define PC98_MID_BOOTABLE 0x80 -#define PC98_MID_MASK 0x7f -#define PC98_MID_386BSD 0x14 - -#define PC98_SID_ACTIVE 0x80 -#define PC98_SID_MASK 0x7f -#define PC98_SID_386BSD 0x44 - -#define __DOSMID_386BSD (PC98_MID_386BSD | PC98_MID_BOOTABLE) -#define __DOSSID_386BSD (PC98_SID_386BSD | PC98_SID_ACTIVE) -#define PC98_PTYP_386BSD (__DOSSID_386BSD << 8 | __DOSMID_386BSD) - -struct pc98_partition { - unsigned char dp_mid; - unsigned char dp_sid; - unsigned char dp_dum1; - unsigned char dp_dum2; - unsigned char dp_ipl_sct; - unsigned char dp_ipl_head; - unsigned short dp_ipl_cyl; - unsigned char dp_ssect; /* starting sector */ - unsigned char dp_shd; /* starting head */ - unsigned short dp_scyl; /* starting cylinder */ - unsigned char dp_esect; /* end sector */ - unsigned char dp_ehd; /* end head */ - unsigned short dp_ecyl; /* end cylinder */ - unsigned char dp_name[16]; -}; -#ifdef CTASSERT -CTASSERT(sizeof (struct pc98_partition) == PC98_PARTSIZE); -#endif - -#endif /* !_SYS_DISK_PC98_H_ */ diff --git a/sys/sys/diskpc98.h b/sys/sys/diskpc98.h deleted file mode 100644 index 5b75df7016b7..000000000000 --- a/sys/sys/diskpc98.h +++ /dev/null @@ -1,47 +0,0 @@ -/*- - * Copyright (c) 1987, 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)disklabel.h 8.2 (Berkeley) 7/10/94 - * $FreeBSD$ - */ - -#ifndef _SYS_DISKPC98_H_ -#define _SYS_DISKPC98_H_ - -#include -#include - -#define DOSMID_386BSD __DOSMID_386BSD -#define DOSSID_386BSD __DOSSID_386BSD - -void pc98_partition_dec(void const *pp, struct pc98_partition *d); -void pc98_partition_enc(void *pp, struct pc98_partition *d); - -#define DIOCSPC98 _IOW('M', 129, u_char[8192]) - -#endif /* !_SYS_DISKPC98_H_ */ diff --git a/sys/sys/fbio.h b/sys/sys/fbio.h index b0779061fa9c..b64a63708d51 100644 --- a/sys/sys/fbio.h +++ b/sys/sys/fbio.h @@ -82,7 +82,6 @@ #define FBTYPE_CGA 22 #define FBTYPE_EGA 23 #define FBTYPE_VGA 24 -#define FBTYPE_PC98 25 #define FBTYPE_TGA 26 #define FBTYPE_TGA2 27 @@ -381,7 +380,6 @@ struct video_adapter { #define KD_CGA 3 /* color graphics adapter */ #define KD_EGA 4 /* enhanced graphics adapter */ #define KD_VGA 5 /* video graphics adapter */ -#define KD_PC98 6 /* PC-98 display */ #define KD_TGA 7 /* TGA */ #define KD_TGA2 8 /* TGA2 */ char *va_name; @@ -520,12 +518,6 @@ typedef struct video_adapter_info video_adapter_info_t; #define M_ENH_B80x43 0x70 /* ega black & white 80x43 */ #define M_ENH_C80x43 0x71 /* ega color 80x43 */ -#define M_PC98_80x25 98 /* PC98 text 80x25 */ -#define M_PC98_80x30 99 /* PC98 text 80x30 */ -#define M_PC98_EGC640x400 100 /* PC98 graphic 640x400 16 colors */ -#define M_PC98_PEGC640x400 101 /* PC98 graphic 640x400 256 colors */ -#define M_PC98_PEGC640x480 102 /* PC98 graphic 640x480 256 colors */ - #define M_HGC_P0 0xe0 /* hercules graphics - page 0 @ B0000 */ #define M_HGC_P1 0xe1 /* hercules graphics - page 1 @ B8000 */ #define M_MCA_MODE 0xff /* monochrome adapter mode */ diff --git a/sys/sys/fdcio.h b/sys/sys/fdcio.h index 341bbd0e40eb..4a497f502c60 100644 --- a/sys/sys/fdcio.h +++ b/sys/sys/fdcio.h @@ -130,10 +130,6 @@ enum fd_drivetype { #define FD_GOPTS _IOR('F', 64, int) /* drive options, see below */ #define FD_SOPTS _IOW('F', 65, int) - -#ifdef PC98 -#define FD_DEBUG _IOW('F', 66, int) -#endif #define FD_CLRERR _IO('F', 67) /* clear error counter */ @@ -152,10 +148,6 @@ enum fd_drivetype { #define FDOPT_NOERRLOG 0x002 /* no "hard error" kernel log messages */ #define FDOPT_NOERROR 0x0004 /* do not indicate errors, caller will use FD_GSTAT in order to obtain status */ -#ifdef PC98 -#define FDOPT_AUTOSEL 0x8000 /* read/only option: device performs media - * autoselection */ -#endif /* * Transfer rate definitions. Used in the structures above. They @@ -180,19 +172,6 @@ enum fd_drivetype { * XXX: but the kernel needs some of them for proper defaults and it would * XXX: should have been done 20 years ago to make sense. */ -#ifdef PC98 -#define FDF_3_1440 18,2,0xFF,0x1B,80,0,2,2,0x54,1,0,FL_MFM -#define FDF_3_1200 15,2,0xFF,0x1B,80,0,0,2,0x54,1,0,FL_MFM -#define FDF_3_720 9,2,0xFF,0x20,80,0,1,2,0x50,1,0,FL_MFM -#define FDF_3_360 9,2,0xFF,0x20,40,0,1,2,0x50,1,0,FL_MFM|FL_2STEP -#define FDF_3_640 8,2,0xFF,0x2A,80,0,1,2,0x50,1,0,FL_MFM -#define FDF_3_1230 8,3,0xFF,0x35,77,0,0,2,0x74,1,0,FL_MFM -#define FDF_5_1200 15,2,0xFF,0x1B,80,0,0,2,0x54,1,0,FL_MFM -#define FDF_5_720 9,2,0xFF,0x20,80,0,1,2,0x50,1,0,FL_MFM -#define FDF_5_360 9,2,0xFF,0x20,40,0,1,2,0x50,1,0,FL_MFM|FL_2STEP -#define FDF_5_640 8,2,0xFF,0x2A,80,0,1,2,0x50,1,0,FL_MFM -#define FDF_5_1230 8,3,0xFF,0x35,77,0,0,2,0x74,1,0,FL_MFM -#else /* PC98 */ #define FDF_3_2880 36,2,0xFF,0x1B,80,0,FDC_1MBPS,002,0x4C,1,1,FL_MFM|FL_PERPND #define FDF_3_1722 21,2,0xFF,0x04,82,0,FDC_500KBPS,2,0x0C,2,0,FL_MFM #define FDF_3_1476 18,2,0xFF,0x1B,82,0,FDC_500KBPS,2,0x6C,1,0,FL_MFM @@ -212,6 +191,5 @@ enum fd_drivetype { #define FDF_5_400 10,2,0xFF,0x10,80,0,FDC_300KBPS,1,0x2e,1,0,FL_MFM /* RX50 */ #define FDF_5_360 9,2,0xFF,0x23,40,0,FDC_300KBPS,2,0x50,1,0,FL_MFM /* XXX: 0x2a ? */ -#endif #endif /* !_MACHINE_IOCTL_FD_H_ */ diff --git a/sys/x86/isa/atpic.c b/sys/x86/isa/atpic.c index 43504e737973..fc1d2dcdd391 100644 --- a/sys/x86/isa/atpic.c +++ b/sys/x86/isa/atpic.c @@ -52,11 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef PC98 -#include -#else #include -#endif #include #ifdef DEV_MCA #include @@ -282,10 +278,8 @@ atpic_resume(struct pic *pic, bool suspend_cancelled) struct atpic *ap = (struct atpic *)pic; i8259_init(ap, ap == &atpics[SLAVE]); -#ifndef PC98 if (ap == &atpics[SLAVE] && elcr_found) elcr_resume(); -#endif } static int @@ -314,17 +308,6 @@ atpic_config_intr(struct intsrc *isrc, enum intr_trigger trig, if (ai->at_trigger == trig) return (0); -#ifdef PC98 - if ((vector == 0 || vector == 1 || vector == 7 || vector == 8) && - trig == INTR_TRIGGER_LEVEL) { - if (bootverbose) - printf( - "atpic: Ignoring invalid level/low configuration for IRQ%u\n", - vector); - return (EINVAL); - } - return (ENXIO); -#else /* * Certain IRQs can never be level/lo, so don't try to set them * that way if asked. At least some ELCR registers ignore setting @@ -353,7 +336,6 @@ atpic_config_intr(struct intsrc *isrc, enum intr_trigger trig, ai->at_trigger = trig; spinlock_exit(); return (0); -#endif /* PC98 */ } static int @@ -408,11 +390,10 @@ i8259_init(struct atpic *pic, int slave) /* Reset is finished, default to IRR on read. */ outb(pic->at_ioaddr, OCW3_SEL | OCW3_RR); -#ifndef PC98 /* OCW2_L1 sets priority order to 3-7, 0-2 (com2 first). */ if (!slave) outb(pic->at_ioaddr, OCW2_R | OCW2_SL | OCW2_L1); -#endif + spinlock_exit(); } @@ -446,20 +427,6 @@ atpic_startup(void) else #endif -#ifdef PC98 - for (i = 0, ai = atintrs; i < NUM_ISA_IRQS; i++, ai++) - switch (i) { - case 0: - case 1: - case 7: - case 8: - ai->at_trigger = INTR_TRIGGER_EDGE; - break; - default: - ai->at_trigger = INTR_TRIGGER_LEVEL; - break; - } -#else /* * Look for an ELCR. If we find one, update the trigger modes. * If we don't find one, assume that IRQs 0, 1, 2, and 13 are @@ -489,7 +456,6 @@ atpic_startup(void) break; } } -#endif /* PC98 */ } static void @@ -624,9 +590,7 @@ static driver_t atpic_driver = { static devclass_t atpic_devclass; DRIVER_MODULE(atpic, isa, atpic_driver, atpic_devclass, 0, 0); -#ifndef PC98 DRIVER_MODULE(atpic, acpi, atpic_driver, atpic_devclass, 0, 0); -#endif /* * Return a bitmap of the current interrupt requests. This is 8259-specific diff --git a/sys/x86/isa/clock.c b/sys/x86/isa/clock.c index fa4ca5bc6f5c..778481fb73c9 100644 --- a/sys/x86/isa/clock.c +++ b/sys/x86/isa/clock.c @@ -67,17 +67,9 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef PC98 -#include -#else #include -#endif #ifdef DEV_ISA -#ifdef PC98 -#include -#else #include -#endif #include #endif @@ -87,12 +79,8 @@ __FBSDID("$FreeBSD$"); int clkintr_pending; #ifndef TIMER_FREQ -#ifdef PC98 -#define TIMER_FREQ 2457600 -#else #define TIMER_FREQ 1193182 #endif -#endif u_int i8254_freq = TIMER_FREQ; TUNABLE_INT("hw.i8254.freq", &i8254_freq); int i8254_max_count; @@ -110,10 +98,6 @@ struct attimer_softc { int port_rid, intr_rid; struct resource *port_res; struct resource *intr_res; -#ifdef PC98 - int port_rid2; - struct resource *port_res2; -#endif void *intr_handler; struct timecounter tc; struct eventtimer et; @@ -182,11 +166,7 @@ timer_spkr_acquire(void) { int mode; -#ifdef PC98 - mode = TIMER_SEL1 | TIMER_SQWAVE | TIMER_16BIT; -#else mode = TIMER_SEL2 | TIMER_SQWAVE | TIMER_16BIT; -#endif if (timer2_state != RELEASED) return (-1); @@ -199,11 +179,8 @@ timer_spkr_acquire(void) * and this is probably good enough for timer2, so we aren't as * careful with it as with timer0. */ -#ifdef PC98 - outb(TIMER_MODE, TIMER_SEL1 | (mode & 0x3f)); -#else outb(TIMER_MODE, TIMER_SEL2 | (mode & 0x3f)); -#endif + ppi_spkr_on(); /* enable counter2 output to speaker */ return (0); } @@ -215,11 +192,8 @@ timer_spkr_release(void) if (timer2_state != ACQUIRED) return (-1); timer2_state = RELEASED; -#ifdef PC98 - outb(TIMER_MODE, TIMER_SEL1 | TIMER_SQWAVE | TIMER_16BIT); -#else outb(TIMER_MODE, TIMER_SEL2 | TIMER_SQWAVE | TIMER_16BIT); -#endif + ppi_spkr_off(); /* disable counter2 output to speaker */ return (0); } @@ -230,13 +204,8 @@ timer_spkr_setfreq(int freq) freq = i8254_freq / freq; mtx_lock_spin(&clock_lock); -#ifdef PC98 - outb(TIMER_CNTR1, freq & 0xff); - outb(TIMER_CNTR1, freq >> 8); -#else outb(TIMER_CNTR2, freq & 0xff); outb(TIMER_CNTR2, freq >> 8); -#endif mtx_unlock_spin(&clock_lock); } @@ -326,11 +295,7 @@ i8254_delay(int n) while (ticks_left > 0) { #ifdef KDB if (kdb_active) { -#ifdef PC98 - outb(0x5f, 0); -#else inb(0x84); -#endif tick = prev_tick - 1; if (tick <= 0) tick = i8254_max_count; @@ -447,9 +412,7 @@ timer_restore(void) { i8254_restore(); /* restore i8254_freq and hz */ -#ifndef PC98 atrtc_restore(); /* reenable RTC interrupts */ -#endif } #endif @@ -458,10 +421,6 @@ void i8254_init(void) { -#ifdef PC98 - if (pc98_machine_type & M_8M) - i8254_freq = 1996800L; /* 1.9968 MHz */ -#endif set_i8254_freq(MODE_STOP, 0); } @@ -607,51 +566,6 @@ static struct isa_pnp_id attimer_ids[] = { { 0 } }; -#ifdef PC98 -static void -pc98_alloc_resource(device_t dev) -{ - static bus_addr_t iat1[] = {0, 2, 4, 6}; - static bus_addr_t iat2[] = {0, 4}; - struct attimer_softc *sc; - - sc = device_get_softc(dev); - - sc->port_rid = 0; - bus_set_resource(dev, SYS_RES_IOPORT, sc->port_rid, IO_TIMER1, 1); - sc->port_res = isa_alloc_resourcev(dev, SYS_RES_IOPORT, - &sc->port_rid, iat1, 4, RF_ACTIVE); - if (sc->port_res == NULL) - device_printf(dev, "Warning: Couldn't map I/O.\n"); - else - isa_load_resourcev(sc->port_res, iat1, 4); - - sc->port_rid2 = 4; - bus_set_resource(dev, SYS_RES_IOPORT, sc->port_rid2, TIMER_CNTR1, 1); - sc->port_res2 = isa_alloc_resourcev(dev, SYS_RES_IOPORT, - &sc->port_rid2, iat2, 2, RF_ACTIVE); - if (sc->port_res2 == NULL) - device_printf(dev, "Warning: Couldn't map I/O.\n"); - else - isa_load_resourcev(sc->port_res2, iat2, 2); -} - -static void -pc98_release_resource(device_t dev) -{ - struct attimer_softc *sc; - - sc = device_get_softc(dev); - - if (sc->port_res) - bus_release_resource(dev, SYS_RES_IOPORT, sc->port_rid, - sc->port_res); - if (sc->port_res2) - bus_release_resource(dev, SYS_RES_IOPORT, sc->port_rid2, - sc->port_res2); -} -#endif - static int attimer_probe(device_t dev) { @@ -661,11 +575,6 @@ attimer_probe(device_t dev) /* ENOENT means no PnP-ID, device is hinted. */ if (result == ENOENT) { device_set_desc(dev, "AT timer"); -#ifdef PC98 - /* To print resources correctly. */ - pc98_alloc_resource(dev); - pc98_release_resource(dev); -#endif return (BUS_PROBE_LOW_PRIORITY); } return (result); @@ -680,13 +589,9 @@ attimer_attach(device_t dev) attimer_sc = sc = device_get_softc(dev); bzero(sc, sizeof(struct attimer_softc)); -#ifdef PC98 - pc98_alloc_resource(dev); -#else if (!(sc->port_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->port_rid, IO_TIMER1, IO_TIMER1 + 3, 4, RF_ACTIVE))) device_printf(dev,"Warning: Couldn't map I/O.\n"); -#endif i8254_intsrc = intr_lookup_source(0); if (i8254_intsrc != NULL) i8254_pending = i8254_intsrc->is_pic->pic_source_pending; diff --git a/sys/x86/isa/icu.h b/sys/x86/isa/icu.h index 74b21fd97e23..bdd3732513bc 100644 --- a/sys/x86/isa/icu.h +++ b/sys/x86/isa/icu.h @@ -41,38 +41,19 @@ #ifndef _X86_ISA_ICU_H_ #define _X86_ISA_ICU_H_ -#ifdef PC98 -#define ICU_IMR_OFFSET 2 -#else #define ICU_IMR_OFFSET 1 -#endif /* - * PC-98 machines wire the slave 8259A to pin 7 on the master PIC, and * PC-AT machines wire the slave PIC to pin 2 on the master PIC. */ -#ifdef PC98 -#define ICU_SLAVEID 7 -#else #define ICU_SLAVEID 2 -#endif /* * Determine the base master and slave modes not including auto EOI support. * All machines that FreeBSD supports use 8086 mode. */ -#ifdef PC98 -/* - * PC-98 machines do not support auto EOI on the second PIC. Also, it - * seems that PC-98 machine PICs use buffered mode, and the master PIC - * uses special fully nested mode. - */ -#define BASE_MASTER_MODE (ICW4_SFNM | ICW4_BUF | ICW4_MS | ICW4_8086) -#define BASE_SLAVE_MODE (ICW4_BUF | ICW4_8086) -#else #define BASE_MASTER_MODE ICW4_8086 #define BASE_SLAVE_MODE ICW4_8086 -#endif /* Enable automatic EOI if requested. */ #ifdef AUTO_EOI_1 diff --git a/sys/x86/isa/isa.c b/sys/x86/isa/isa.c index e0f8ef1bdaef..27affa5fca3b 100644 --- a/sys/x86/isa/isa.c +++ b/sys/x86/isa/isa.c @@ -64,9 +64,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifdef PC98 -#include -#endif #include @@ -132,108 +129,13 @@ isa_alloc_resource(device_t bus, device_t child, int type, int *rid, start, end, count, flags); } -#ifdef PC98 -/* - * Indirection support. The type of bus_space_handle_t is - * defined in sys/i386/include/bus_pc98.h. - */ -struct resource * -isa_alloc_resourcev(device_t child, int type, int *rid, - bus_addr_t *res, bus_size_t count, u_int flags) -{ - struct isa_device* idev = DEVTOISA(child); - struct resource_list *rl = &idev->id_resources; - - device_t bus = device_get_parent(child); - bus_addr_t start; - bus_space_handle_t bh; - struct resource *re; - struct resource **bsre; - int i, j, k, linear_cnt, ressz, bsrid; - - start = bus_get_resource_start(child, type, *rid); - - linear_cnt = count; - ressz = 1; - for (i = 1; i < count; ++i) { - if (res[i] != res[i - 1] + 1) { - if (i < linear_cnt) - linear_cnt = i; - ++ressz; - } - } - - re = isa_alloc_resource(bus, child, type, rid, - start + res[0], start + res[linear_cnt - 1], - linear_cnt, flags); - if (re == NULL) - return NULL; - - bsre = malloc(sizeof (struct resource *) * ressz, M_DEVBUF, M_NOWAIT); - if (bsre == NULL) { - resource_list_release(rl, bus, child, type, *rid, re); - return NULL; - } - bsre[0] = re; - - for (i = linear_cnt, k = 1; i < count; i = j, k++) { - for (j = i + 1; j < count; j++) { - if (res[j] != res[j - 1] + 1) - break; - } - bsrid = *rid + k; - bsre[k] = isa_alloc_resource(bus, child, type, &bsrid, - start + res[i], start + res[j - 1], j - i, flags); - if (bsre[k] == NULL) { - for (k--; k >= 0; k--) - resource_list_release(rl, bus, child, type, - *rid + k, bsre[k]); - free(bsre, M_DEVBUF); - return NULL; - } - } - - bh = rman_get_bushandle(re); - bh->bsh_res = bsre; - bh->bsh_ressz = ressz; - - return re; -} - -int -isa_load_resourcev(struct resource *re, bus_addr_t *res, bus_size_t count) -{ - - return bus_space_map_load(rman_get_bustag(re), rman_get_bushandle(re), - count, res, 0); -} -#endif /* PC98 */ - int isa_release_resource(device_t bus, device_t child, int type, int rid, struct resource *r) { struct isa_device* idev = DEVTOISA(child); struct resource_list *rl = &idev->id_resources; -#ifdef PC98 - /* - * Indirection support. The type of bus_space_handle_t is - * defined in sys/i386/include/bus_pc98.h. - */ - int i; - bus_space_handle_t bh; - if (type == SYS_RES_MEMORY || type == SYS_RES_IOPORT) { - bh = rman_get_bushandle(r); - if (bh != NULL) { - for (i = 1; i < bh->bsh_ressz; i++) - resource_list_release(rl, bus, child, type, - rid + i, bh->bsh_res[i]); - if (bh->bsh_res != NULL) - free(bh->bsh_res, M_DEVBUF); - } - } -#endif return resource_list_release(rl, bus, child, type, rid, r); } diff --git a/sys/x86/x86/autoconf.c b/sys/x86/x86/autoconf.c index 813fe4c9e286..e4919203bebe 100644 --- a/sys/x86/x86/autoconf.c +++ b/sys/x86/x86/autoconf.c @@ -65,9 +65,6 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef PC98 -#include -#endif #include #ifdef DEV_ISA @@ -123,42 +120,8 @@ configure_final(dummy) cninit_finish(); - if (bootverbose) { -#ifdef PC98 - int i; - - /* - * Print out the BIOS's idea of the disk geometries. - */ - printf("BIOS Geometries:\n"); - for (i = 0; i < N_BIOS_GEOM; i++) { - unsigned long bios_geom; - int max_cylinder, max_head, max_sector; - - bios_geom = bootinfo.bi_bios_geom[i]; - - /* - * XXX the bootstrap punts a 1200K floppy geometry - * when the get-disk-geometry interrupt fails. Skip - * drives that have this geometry. - */ - if (bios_geom == 0x4f020f) - continue; - - printf(" %x:%08lx ", i, bios_geom); - max_cylinder = bios_geom >> 16; - max_head = (bios_geom >> 8) & 0xff; - max_sector = bios_geom & 0xff; - printf( - "0..%d=%d cylinders, 0..%d=%d heads, 1..%d=%d sectors\n", - max_cylinder, max_cylinder + 1, - max_head, max_head + 1, - max_sector, max_sector); - } - printf(" %d accounted for\n", bootinfo.bi_n_bios_used); -#endif - + if (bootverbose) printf("Device configuration finished.\n"); - } + cold = 0; } diff --git a/sys/x86/x86/cpu_machdep.c b/sys/x86/x86/cpu_machdep.c index f28ca6d89831..a5fd04912fba 100644 --- a/sys/x86/x86/cpu_machdep.c +++ b/sys/x86/x86/cpu_machdep.c @@ -243,7 +243,6 @@ static int idle_mwait = 1; /* Use MONITOR/MWAIT for short idle. */ SYSCTL_INT(_machdep, OID_AUTO, idle_mwait, CTLFLAG_RWTUN, &idle_mwait, 0, "Use MONITOR/MWAIT for short idle"); -#ifndef PC98 static void cpu_idle_acpi(sbintime_t sbt) { @@ -262,7 +261,6 @@ cpu_idle_acpi(sbintime_t sbt) acpi_cpu_c1(); *state = STATE_RUNNING; } -#endif /* !PC98 */ static void cpu_idle_hlt(sbintime_t sbt) @@ -369,11 +367,7 @@ cpu_probe_amdc1e(void) } } -#if defined(__i386__) && defined(PC98) -void (*cpu_idle_fn)(sbintime_t) = cpu_idle_hlt; -#else void (*cpu_idle_fn)(sbintime_t) = cpu_idle_acpi; -#endif void cpu_idle(int busy) @@ -450,7 +444,7 @@ struct { { cpu_idle_spin, "spin" }, { cpu_idle_mwait, "mwait" }, { cpu_idle_hlt, "hlt" }, -#if !defined(__i386__) || !defined(PC98) +#if !defined(__i386__) { cpu_idle_acpi, "acpi" }, #endif { NULL, NULL } @@ -469,7 +463,7 @@ idle_sysctl_available(SYSCTL_HANDLER_ARGS) if (strstr(idle_tbl[i].id_name, "mwait") && (cpu_feature2 & CPUID2_MON) == 0) continue; -#if !defined(__i386__) || !defined(PC98) +#if !defined(__i386__) if (strcmp(idle_tbl[i].id_name, "acpi") == 0 && cpu_idle_hook == NULL) continue; @@ -508,7 +502,7 @@ idle_sysctl(SYSCTL_HANDLER_ARGS) if (strstr(idle_tbl[i].id_name, "mwait") && (cpu_feature2 & CPUID2_MON) == 0) continue; -#if !defined(__i386__) || !defined(PC98) +#if !defined(__i386__) if (strcmp(idle_tbl[i].id_name, "acpi") == 0 && cpu_idle_hook == NULL) continue; diff --git a/sys/x86/x86/intr_machdep.c b/sys/x86/x86/intr_machdep.c index 1bc7820d5c3e..217fc29aa492 100644 --- a/sys/x86/x86/intr_machdep.c +++ b/sys/x86/x86/intr_machdep.c @@ -61,12 +61,8 @@ #include #include #include -#ifdef PC98 -#include -#else #include #endif -#endif #define MAX_STRAY_LOG 5 diff --git a/sys/x86/x86/mptable.c b/sys/x86/x86/mptable.c index c20d2a2066d8..d139b71155d7 100644 --- a/sys/x86/x86/mptable.c +++ b/sys/x86/x86/mptable.c @@ -66,13 +66,8 @@ __FBSDID("$FreeBSD$"); #define MAX_LAPIC_ID 31 /* Max local APIC ID for HTT fixup */ #endif -#ifdef PC98 -#define BIOS_BASE (0xe8000) -#define BIOS_SIZE (0x18000) -#else #define BIOS_BASE (0xf0000) #define BIOS_SIZE (0x10000) -#endif #define BIOS_COUNT (BIOS_SIZE/4) typedef void mptable_entry_handler(u_char *entry, void *arg); @@ -635,20 +630,18 @@ conforming_trigger(u_char src_bus, u_char src_bus_irq) KASSERT(src_bus <= mptable_maxbusid, ("bus id %d too large", src_bus)); switch (busses[src_bus].bus_type) { case ISA: -#ifndef PC98 if (elcr_found) return (elcr_read_trigger(src_bus_irq)); else -#endif return (INTR_TRIGGER_EDGE); case PCI: return (INTR_TRIGGER_LEVEL); -#ifndef PC98 + case EISA: KASSERT(src_bus_irq < 16, ("Invalid EISA IRQ %d", src_bus_irq)); KASSERT(elcr_found, ("Missing ELCR")); return (elcr_read_trigger(src_bus_irq)); -#endif + default: panic("%s: unknown bus type %d", __func__, busses[src_bus].bus_type); diff --git a/sys/x86/x86/nexus.c b/sys/x86/x86/nexus.c index 0ed4d21148a2..f115fdd93824 100644 --- a/sys/x86/x86/nexus.c +++ b/sys/x86/x86/nexus.c @@ -75,12 +75,8 @@ __FBSDID("$FreeBSD$"); #ifdef DEV_ISA #include -#ifdef PC98 -#include -#else #include #endif -#endif #include #define ELF_KERN_STR ("elf"__XSTRING(__ELF_WORD_SIZE)" kernel") @@ -245,11 +241,7 @@ nexus_init_resources(void) * multiple bridges. (eg: laptops with docking stations) */ drq_rman.rm_start = 0; -#ifdef PC98 - drq_rman.rm_end = 3; -#else drq_rman.rm_end = 7; -#endif drq_rman.rm_type = RMAN_ARRAY; drq_rman.rm_descr = "DMA request lines"; /* XXX drq 0 not available on some machines */ @@ -485,9 +477,6 @@ nexus_map_resource(device_t bus, device_t child, int type, struct resource *r, { struct resource_map_request args; rman_res_t end, length, start; -#ifdef PC98 - int error; -#endif /* Resources must be active to be mapped. */ if (!(rman_get_flags(r) & RF_ACTIVE)) @@ -521,39 +510,20 @@ nexus_map_resource(device_t bus, device_t child, int type, struct resource *r, */ switch (type) { case SYS_RES_IOPORT: -#ifdef PC98 - error = i386_bus_space_handle_alloc(X86_BUS_SPACE_IO, - start, length, &map->r_bushandle); - if (error) - return (error); -#else map->r_bushandle = start; -#endif map->r_bustag = X86_BUS_SPACE_IO; map->r_size = length; map->r_vaddr = NULL; break; case SYS_RES_MEMORY: -#ifdef PC98 - error = i386_bus_space_handle_alloc(X86_BUS_SPACE_MEM, - start, length, &map->r_bushandle); - if (error) - return (error); -#endif map->r_vaddr = pmap_mapdev_attr(start, length, args.memattr); map->r_bustag = X86_BUS_SPACE_MEM; map->r_size = length; /* - * PC-98 stores the virtual address as a member of the - * structure in the handle. On plain x86, the handle is - * the virtual address. + * The handle is the virtual address. */ -#ifdef PC98 - map->r_bushandle->bsh_base = (bus_addr_t)map->r_vaddr; -#else map->r_bushandle = (bus_space_handle_t)map->r_vaddr; -#endif break; } return (0); @@ -572,10 +542,6 @@ nexus_unmap_resource(device_t bus, device_t child, int type, struct resource *r, pmap_unmapdev((vm_offset_t)map->r_vaddr, map->r_size); /* FALLTHROUGH */ case SYS_RES_IOPORT: -#ifdef PC98 - i386_bus_space_handle_free(map->r_bustag, map->r_bushandle, - map->r_bushandle->bsh_sz); -#endif break; default: return (EINVAL); diff --git a/targets/pseudo/userland/Makefile.depend b/targets/pseudo/userland/Makefile.depend index 700da508c2a0..1201a233c36d 100644 --- a/targets/pseudo/userland/Makefile.depend +++ b/targets/pseudo/userland/Makefile.depend @@ -878,11 +878,6 @@ DIRDEPS.mips= \ sbin/bsdlabel \ sbin/fdisk -DIRDEPS.pc98= \ - sbin/bsdlabel \ - sbin/fdisk_pc98 \ - sbin/sconfig - DIRDEPS.sparc64= \ sbin/bsdlabel \ sbin/sunlabel \ diff --git a/targets/pseudo/userland/misc/Makefile.depend b/targets/pseudo/userland/misc/Makefile.depend index fc2a9ca01be9..e721efedb42d 100644 --- a/targets/pseudo/userland/misc/Makefile.depend +++ b/targets/pseudo/userland/misc/Makefile.depend @@ -88,7 +88,6 @@ DIRDEPS.arm= ${_sys_boot_fdt} ${_sys_boot_efi} DIRDEPS.arm64= ${_sys_boot_fdt} ${_sys_boot_efi} DIRDEPS.i386= ${DIRDEPS.x86sys} ${_sys_boot_efi} DIRDEPS.powerpc= ${_sys_boot_fdt} sys/boot/libstand32 sys/boot/ofw sys/boot/uboot -DIRDEPS.pc98= sys/boot/libstand32 DIRDEPS.sparc64= sys/boot/ofw ${_sys_boot_zfs} .endif diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc index 166998a7a2d4..6706116af8f0 100644 --- a/tools/build/mk/OptionalObsoleteFiles.inc +++ b/tools/build/mk/OptionalObsoleteFiles.inc @@ -7577,8 +7577,6 @@ OLD_FILES+=usr/share/syscons/keymaps/it.iso.kbd OLD_FILES+=usr/share/syscons/keymaps/iw.iso8.kbd OLD_FILES+=usr/share/syscons/keymaps/jp.106.kbd OLD_FILES+=usr/share/syscons/keymaps/jp.106x.kbd -OLD_FILES+=usr/share/syscons/keymaps/jp.pc98.iso.kbd -OLD_FILES+=usr/share/syscons/keymaps/jp.pc98.kbd OLD_FILES+=usr/share/syscons/keymaps/kk.pt154.io.kbd OLD_FILES+=usr/share/syscons/keymaps/kk.pt154.kst.kbd OLD_FILES+=usr/share/syscons/keymaps/latinamerican.iso.acc.kbd diff --git a/tools/tools/kerninclude/kerninclude.sh b/tools/tools/kerninclude/kerninclude.sh index 1efe4c278fc2..fd3e4fd4e072 100644 --- a/tools/tools/kerninclude/kerninclude.sh +++ b/tools/tools/kerninclude/kerninclude.sh @@ -21,7 +21,7 @@ cd /sys init=false # Which kernels you want to check -kernels="LINT GENERIC GENERIC98" +kernels="LINT GENERIC" NO_MODULES=yes export NO_MODULES @@ -61,14 +61,6 @@ echo "Configuring kernels" config LINT config GENERIC ) -( - cd pc98/conf - cp -f GENERIC GENERIC98 - if $init ; then - rm -rf ../../compile/GENERIC98 - fi - config GENERIC98 -) for i in $kernels do diff --git a/tools/tools/sysdoc/sysdoc.sh b/tools/tools/sysdoc/sysdoc.sh index 872eabd212c6..66d26632f8e7 100644 --- a/tools/tools/sysdoc/sysdoc.sh +++ b/tools/tools/sysdoc/sysdoc.sh @@ -210,7 +210,7 @@ EOF # # The nm(1) utility must only be used on the architecture which -# we build it for. Although i386 and pc98 are so; my only fear +# we build it for. Although i386 is so; my only fear # with this is that this will not work properly on cross-builds. while getopts k FLAG; diff --git a/tools/tools/vt/keymaps/KBDFILES.map b/tools/tools/vt/keymaps/KBDFILES.map index 24b90a7736bf..7964570b9a85 100644 --- a/tools/tools/vt/keymaps/KBDFILES.map +++ b/tools/tools/vt/keymaps/KBDFILES.map @@ -78,8 +78,6 @@ ISO8859-1+EURO it.iso.kbd it.kbd ISO8859-1+YEN jp.106.kbd jp.kbd ISO8859-1+YEN jp.106x.kbd jp.capsctrl.kbd -ISO8859-1+YEN jp.pc98.kbd jp.pc98.kbd -ISO8859-1+YEN jp.pc98.iso.kbd jp.pc98.iso.kbd PT154 kk.pt154.kst.kbd kz.kst.kbd PT154 kk.pt154.io.kbd kz.io.kbd diff --git a/tools/tools/vt/keymaps/convert-keymap.pl b/tools/tools/vt/keymaps/convert-keymap.pl index 313c653ba289..4783fe66bca7 100755 --- a/tools/tools/vt/keymaps/convert-keymap.pl +++ b/tools/tools/vt/keymaps/convert-keymap.pl @@ -60,9 +60,6 @@ sub local_to_UCS_code $ucs_char = 0xa5 # replace with Jap. Yen character on PC kbd if $ucs_char == ord('\\') and $use_yen and $current_scancode == 125; -# $ucs_char = 0xa5 # replace with Jap. Yen character on PC98x1 kbd -# if $ucs_char == ord('\\') and $use_yen and $current_scancode == 13; - return prettyprint_token($ucs_char); } diff --git a/usr.bin/mkimg/Makefile b/usr.bin/mkimg/Makefile index 836bed850dca..492b451f3fe0 100644 --- a/usr.bin/mkimg/Makefile +++ b/usr.bin/mkimg/Makefile @@ -27,7 +27,6 @@ SRCS+= \ ebr.c \ gpt.c \ mbr.c \ - pc98.c \ vtoc8.c BINDIR?=/usr/bin diff --git a/usr.bin/mkimg/pc98.c b/usr.bin/mkimg/pc98.c deleted file mode 100644 index 000b26d5bfe6..000000000000 --- a/usr.bin/mkimg/pc98.c +++ /dev/null @@ -1,118 +0,0 @@ -/*- - * Copyright (c) 2014 Juniper Networks, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include - -#include - -#include "endian.h" -#include "image.h" -#include "mkimg.h" -#include "scheme.h" - -#define PC98_BOOTCODESZ 8192 - -static struct mkimg_alias pc98_aliases[] = { - { ALIAS_FREEBSD, ALIAS_INT2TYPE(PC98_PTYP_386BSD) }, - { ALIAS_NONE, 0 } -}; - -static lba_t -pc98_metadata(u_int where, lba_t blk) -{ - if (where == SCHEME_META_IMG_START) - blk += PC98_BOOTCODESZ / secsz; - return (round_track(blk)); -} - -static void -pc98_chs(u_short *cylp, u_char *hdp, u_char *secp, lba_t lba) -{ - u_int cyl, hd, sec; - - mkimg_chs(lba, 0xffff, &cyl, &hd, &sec); - le16enc(cylp, cyl); - *hdp = hd; - *secp = sec; -} - -static int -pc98_write(lba_t imgsz __unused, void *bootcode) -{ - struct part *part; - struct pc98_partition *dpbase, *dp; - u_char *buf; - lba_t size; - int error, ptyp; - - buf = malloc(PC98_BOOTCODESZ); - if (buf == NULL) - return (ENOMEM); - if (bootcode != NULL) { - memcpy(buf, bootcode, PC98_BOOTCODESZ); - memset(buf + secsz, 0, secsz); - } else - memset(buf, 0, PC98_BOOTCODESZ); - le16enc(buf + PC98_MAGICOFS, PC98_MAGIC); - dpbase = (void *)(buf + secsz); - TAILQ_FOREACH(part, &partlist, link) { - size = round_track(part->size); - dp = dpbase + part->index; - ptyp = ALIAS_TYPE2INT(part->type); - dp->dp_mid = ptyp; - dp->dp_sid = ptyp >> 8; - pc98_chs(&dp->dp_scyl, &dp->dp_shd, &dp->dp_ssect, - part->block); - pc98_chs(&dp->dp_scyl, &dp->dp_shd, &dp->dp_ssect, - part->block + size - 1); - if (part->label != NULL) - memcpy(dp->dp_name, part->label, strlen(part->label)); - } - error = image_write(0, buf, PC98_BOOTCODESZ / secsz); - free(buf); - return (error); -} - -static struct mkimg_scheme pc98_scheme = { - .name = "pc98", - .description = "PC-9800 disk partitions", - .aliases = pc98_aliases, - .metadata = pc98_metadata, - .write = pc98_write, - .bootcode = PC98_BOOTCODESZ, - .labellen = 16, - .nparts = PC98_NPARTS, - .maxsecsz = 512 -}; - -SCHEME_DEFINE(pc98_scheme); diff --git a/usr.bin/mkimg/tests/img-1x1-4096-pc98.qcow.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-pc98.qcow.gz.uu deleted file mode 100644 index efca490443b9..000000000000 --- a/usr.bin/mkimg/tests/img-1x1-4096-pc98.qcow.gz.uu +++ /dev/null @@ -1,127 +0,0 @@ -# $FreeBSD$ -begin 644 img-1x1-4096-pc98.qcow.gz -M'XL("+(S(E0``VEM9RTQ>#$M-#`Y-BUP8SDX+G%C;WG`Z^;F[L=JM;;5L%D-T^J\7WW_]?QAJY]^V___5?;W_^\>V/ -MNS&[^<53Z=>#KX9Y[M[6/[ZV.?_QU&%U,_W&W/+MK-;BY-_CO>>[/ -M^?6Y>+M;-3?>F[NDM^OB[4YJ;O=+6%S`LE=SAV)NP*>.:NY4S*WQJ3//V2^^ -MMG=S&WS*U)SCW*K-;?&I4'/W-7#S=@%ZF1OQ*<&=E=Q-^)3@SDKN=OB4X,Y* -M[O;XE.#.2NX.^)3@SDKNCOB4X,Y+[D[XE.#.2^[.^)3@+O_Q<\6=\5.".Z^X -M,_*=*^Z\XL[(=ZZX\XH[(]^YXLXK[HQ\YXH[K[@S\ITK[J+BSLAWH;B+BCLC -MWX7B+DKNR'>AN(N2._)=*.ZBY(Y\%XJ[*+DCWX7B+DKNR'>AN(N2._)=*.Z& -MDCORW:"X&TKNR'>#XFZHN'-^2G`W5-PY^6Y0W`T5=TZ^&Q1W0\6=D^\&Q=U0 -M<>?DNT%Q-U3<.?EN4-RM*^Z6W)'O1L7=6'$W\%."N['B;B#? -MC8J[L>)N(-^-BKNQXFX@WXV*N['B;B#?C8J[L>)N(-^-BKOE/W_K.?+=I+B; -M*NX&\MVDN)M*[LAWD^)N*KDCWTV*NZGDCGPW*>ZFDCORW:2XFTKNR'>3XFXJ -MN2/?38J[7)N7W)'OMLK[O8E=^2[O>)N7W)'OMLK[O8E=^2[O>)N7W)'OMLK[@XE -M=^2[@^+N4')'OCLH[@X5=QM^2G!WJ+C;D.\.BKM#Q=V&?'=0W!TJ[C;DNX/B -M[E!QMR'?'11WAXJ[#?GNH+@[5MQMR'='Q=VQXFY#OCLJ[HXE=^2[H^+N6')' -MOCLJ[HXE=^2[H^+N6')'OCLJ[HXE=^2[H^+N6')'OCLJ[DXE=^2[D^+N5')' -MOCLI[DX5=UM^2G!WJKC;DN].BKM3Q=V6?'=2W)TJ[K;DNY/B[E1QMR7?G11W -MIXJ[+?GNI+@[5]QMR7=GQ=VYXFY+OCLK[LXE=^2[L^+N7')'OCLK[LXE=^2[ -ML^+N7')'OCLK[LXE=^2[L^+N7')'OCL+[FSYB9X#W]F-X,YN2N[`=W8CN+.; -MBKN1GV+NK.SO1O"=J?[.ROYN!-^9ZN^L[.]&\)VI_L[*_FX$WYGJ[ZSL[T;P -MG:G^SLK^;@3?F>KOK.SO1O"=J?[.ROYN!-^9ZN^L[.]&\)VI_L[*_FX$WYGJ -M[ZSL[T;PG:G^SLK^;@3?F>KOK.SO1O"=J?[.ROYN)-^I_L[*_FXDWZG^SLK^ -M;N*G!'=E?S>1[U1_9V5_-Y'O5']G97\WD>]4?V=E?S>1[U1_9V5_-Y'O5']G -M97\WD>]4?V=E?S>1[U1_9V5_-Y'O5']G97\WD>]4?V=E?S>1[U1_9V5_-Y'O -M5']G97\WD>]4?V=E?S>1[U1_9V5_-Y'O5']G97\WD>]4?V=E?[?CIP1W97^W -M(]^I_L[*_FY'OE/]G97]W8Y\I_H[*_N['?E.]7=6]G<[\IWJ[ZSL[W;D.]7? -M6=G?[]4?V=E?[^4_V=E?W=CGRG^CLK^[L= -M^4[U=U;V=SORG>KOK.SO=N0[U=]9V=_MR'>JO[.RO]OS4X*[LK_;D^]4?V=E -M?[KOK.SO]N0[ -MU=]9V=_MR7>JO[.RO]N3[U1_9V5_MR??J?[.ROYN3[Y3_9V5_=V>?*?Z.RO[ -MNSWY3O5W5O9W>_*=ZN^L[._VY#O5WUG9WQWX*<%=V=\=R'>JO[.ROSN0[U1_ -M9V5_=R#?J?[.RO[N0+Y3_9V5_=V!?*?Z.RO[NP/Y3O5W5O9W!_*=ZN^L[.\. -MY#O5WUG9WQW(=ZJ_L[*_.Y#O5']G97]W(-^I_L[*_NY`OE/]G97]W8%\I_H[ -M*_N[`_E.]7=6]G<'\IWJ[ZSL[X[\E."N[.^.Y#O5WUG9WQW)=ZJ_L[*_.Y+O -M5']G97]W)-^I_L[*_NY(OE/]G97]W9%\I_H[*_N[(_E.]7=6]G='\IWJ[ZSL -M[X[D.]7?6=G?']4?V=E?WKO -MK.SO3N0[U=]9V=^=R'>JO[.ROSN1[U1_9V5_=R+?J?[.RO[N1+Y3_9V5_=V) -M?*?Z.RO[NS,_);@K^[LS^4[U=U;V=V?RG>KOK.SOSN0[U=]9V=^=R7>JO[.R -MOSN3[U1_9V5_=R;?J?[.RO[N3+Y3_9V5_=V9?*?Z.RO[NS/Y3O5W5O9W9_*= -MZN^L[._.Y#O5WUG9WYW)=ZJ_L[*_.Y/O5'_GRT_2W*K/@>^^/\7<>>KOEOOT -M5IT[\)VK_LY3?[>:N5LMW,4-/\7<>>KO5C-WJS_;'/C.57_GJ;];7=+9!=U_ -MYZJ_\]3?M;/K<^`[5_V=I_X.YL!WKOH[3_T=S('O7/5WGOJ[9>Y!GP/?N>KO -M//5W#Y:Y59L#W[GJ[SSU=P]F[AYT[L!WKOH[3_W=@YF[!YT[\)VK_LY3?_?@ -MJO_/4WRUS#_L< -M^4[U=Y[ZNX?+7.>.?*?Z.T_]W<.9NX>-.[K_SE5_YZF_>SAS][!Q1_??N>KO -M//5W#R_Y[.C^.U?]G:?^KIU=GR/?J?[.4W\'<^0[U=]YZN]@CGRG^CM/_=TR -M]ZC/D>]4?^>IOWNTS#7NZ/X[5_V=I_[NT7:[.CGRG^CM/_5T[NSY'OE/]G:?^#N;(=ZJ_\]3?P1SY3O5WGOJ[ -M9>YQGR/?J?[.4W_W>)GKW)'O5'_GJ;][/'/WN'%']]^YZN\\]7>/9^X>-^[H -M_CM7_9VG_N[Q)9\=W7_GJK_SU-^UL^MSY#O5WWGJ[V".?*?Z.T_]']#GRG>KO//5W3Y:YQAW=?^>JO_/4WSV9N7O2N2/?J?[.4W_W9.;N -M2>>.?*?Z.T_]W9/+U=F1[U1_YZF_:V?7Y\AWJK_SU-_!'/E.]7>>^CN8(]^I -M_LY3?[?,/>USY#O5WWGJ[YXNXH_OO7/5WGOJ[9S-WSSIWY#O5WWGJ -M[Y[-W#WKW)'O5'_GJ;][=KDZ._*=ZN\\]7?M[/H<^4[U=Y[Z.Y@CWZG^SE-_ -M!W/D.]7?>>KOEKGG?8Y\I_H[3_W=\V6N^4_V=I_[N^>^KOGEWQV=/^=J_[.4W_7SJ[/D>]4?^>IOX,Y\IWJ -M[SSU=S!'OE/]G:?^;IE[T>?(=ZJ_\]3?O5CF&G=T_YVK_LY3?_=BYNY%YXY\ -MI_H[3_W=BYF[%YT[\IWJ[SSU=R\N5V='OE/]G:?^KIU=GR/?J?[.4W\'<^0[ -MU=]YZN]@CGRG^CM/_=TR][+/D>]4?^>IOWNYS'7NR'>JO_/4W[VKO//5W -M,$>^4_V=I_X.YLAWJK_SU-\M>^KM7RUSCCNZ_<]7?>>KO7LW< -MO>K]4?^>IOWLU<_>J^4_V=I_[NU>7J[,AWJK_SU-^UL^MSY#O5WWGJ -M[V".?*?Z.T_]']SGRG>KO//5WKY>YSAWY3O5WGOJ[US-W -MKQMW=/^=J_[.4W_W>N;N=>..[K]SU=]YZN]>7_+9T?UWKOH[3_U=.[L^1[Y3 -M_9VG_@[FR'>JO_/4W\$<^4[U=Y[ZNV7N39\CWZG^SE-_]V:9:]S1_7>N^CM/ -M_=V;F;LWG3ORG>KO//5W;V;NWG3NR'>JO_/4W[VY7)T=^4[U=Y[ZNW9V?8Y\ -MI_H[3_T=S)'O5'_GJ;^#.?*=ZN\\]7?+W-L^1[Y3_9U7_5W0_7>N^CNO^KN@ -M^^]<]7=>]7=!]]^YZN^\ZN^"[K]SU=]YU=\%W7_GJK_SJK\+NO_.57_G57\7 -M=/^=J_[.17_WKL^1[U1_YZF_>[?,->[H_CM7_9VG_N[=S-V[SAWY3O5WGOJ[ -M=S-W[SIWY#O5WWGJ[]Y=KLZ.?*?Z.T_]73N[/D>^4_V=I_X.YLAWJK_SU-_! -M'/E.]7>Q_"3-W?0Y\%VH_N[[)^YQM_CIIG,'O@O5WT7J[V[FO9O&'=U_%ZJ_ -MB]3?WKOVMGU.?!=J/XN4G\'<^"[ -M4/U=I/X.YL!WH?J[2/W=,F=]#GP7JK^+U-_9,M>XH_OO0O5WD?H[FU^>=>[` -M=Z'ZNTC]G<.?!>JOXO4W]GEZNS`=Z'ZNTC]73N[/@>^"]7?1>KO8`Y\ -M%ZJ_B]3?P1SX+E1_%ZF_6^:\SY'O5'\7J;_S9:YS1[Y3_5VD_LYG[KQQ1_?? -MA>KO(O5W/G/GC3NZ_RY4?Q>IO_-+/CNZ_RY4?Q>IOVMGU^?(=ZJ_B]3?P1SY -M3O5WD?H[F"/?J?XN4G^WS$6?(]^I_BY2?Q?+7...[K\+U=]%ZN]BYBXZ=^0[ -MU=]%ZN]BYBXZ=^0[U=]%ZN_BKO(O5W,$>^4_U= -MI/X.YLAWJK^+U-\M1^KO-,M>Y(]^I_BY2?[>9N=LT[NC^NU#] -M7:3^;C-SMVGKOVMGU.?*=ZN\B]7JOXO4WRUSVSY'OE/]7:3^;KO,->[H_KM0_5VD_FX[<[?MW)'O -M5'\7J;_;SMQM.W?D.]7?1>KOMI>KLR/?J?XN4G_7SJ[/D>]4?Q>IOX,Y\IWJ -M[R+U=S!'OE/]7:3^;ID;^QSY3O5WD?J[<9GKW)'O5'\7J;\;9^[&QAW=?Q>J -MOXO4WXTS=V/CCNZ_"]7?1>KOQDL^.[K_+E1_%ZF_:V?7Y\AWJK^+U-_!'/E. -M]7>1^CN8(]^I_BY2?[?,37V.?*?ZNTC]W;3,->[H_KM0_5VD_FZ:N9LZ=^0[ -MU=]%ZN^FF;NI^4_U=I/YNNER='?E.]7>1^KMV=GV.?*?ZNTC]'KO(O5WR]S[/D>^4_U=I/[N_3+7N2/?J?XN4G_W?N;N?>..[K\+ -MU=]%ZN_>S]R];]S1_7>A^KM(_=W[2SX[NO\N5'\7J;]K9]?GR'>JOXO4W\$< -M^4[U=Y'Z.Y@CWZG^+E)_M\Q]Z'/D.]7?1>KO/BQSC3NZ_RY4?Q>IO_LP<_>A -M^4_U=I/[NP\S=A\X=^4[U=Y'ZNP^7J[,CWZG^+E)_U\ZNSY'O5'\7J;^# -M.?*=ZN\B]7JOXO4WWU9NX^-.[K_+E1_%ZF_^WC)9T?WWX7J[R+U=^WL^ASY3O5W -MD?H[F"/?J?XN4G\'<^0[U=]%ZN^6N4]]CGRG^KM(_=VG9:YQ1_??A>KO(O5W -MGV;N/G7NR'>JOXO4WWV:N?O4N2/?J?XN4G_WZ7)U=N0[U=]%ZN_:V?4Y\IWJ -M[R+U=S!'OE/]7:3^#N;(=ZJ_B]3?+7.?^QSY3O5WD?J[S\M?+_GLZ/Z[4/U=I/ZNG5V? -M(]^I_BY2?P=SY#O5WT7J[V".?*?ZNTC]W3+WI<^1[U1_%ZF_^[+,->[H_KM0 -M_5VD_N[+S-V7SAWY3O5WD?J[+S-W7SIWY#O5WT7J[[Y^4_U=I/X.YLAWJK^+U-_!'/E.]7?#\I,T][7/@>\&U=\-J;_[NLQU[L!W -MWY]B[H;4WWV=N?NZ<#?<\%/,W9#ZNZ\S=U__;'/@NT'U=T/J[[Y>TMD-=/]= -M^]"?^/8V_?CVQ\O;P?7MVQU\=;.#O^M/?/O'V_M_M<';ZVK^@\'U>K6['OR? -M^0VO;Z^KF8;58:#W=3[WC^H-W\W1MS__*^F?_/'MIEM(*3]Q-W=U<=V6[N?I -M+^*'8$[T"?GJZ/N]_P58ME=WX/S\=;[]CO'?_^5X^?\?Z2+1]O5=]=='3?F] -MM_N+U[>Z?KNW?Z9M[__S]M.<%V]W=7]N_\NO[:]?W8/K5T??4_VO?#&N;G+Y -MS=^Y/T;N_\Z]F_._5P33K9E__+&S@[_K3WS[]]O[?]T-#K>#?_P_?B!?31"G -"```` -` -end diff --git a/usr.bin/mkimg/tests/img-1x1-4096-pc98.qcow2.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-pc98.qcow2.gz.uu deleted file mode 100644 index afb67c951962..000000000000 --- a/usr.bin/mkimg/tests/img-1x1-4096-pc98.qcow2.gz.uu +++ /dev/null @@ -1,21 +0,0 @@ -# $FreeBSD$ -begin 644 img-1x1-4096-pc98.qcow2.gz -M'XL("*8[(U0``VEM9RTQ>#$M-#`Y-BUP8SDX+G%C;W<`$\Y4!5RHI;^$@BULK*;1P(8NKE)3EG<][5RLIRSN?]VZCI"SO -M?-Z[K9*RO/-Y[W9*RO+.Y[V[5U*6=V!XYQBW5U*6=R"\6Q+N&>,.2LKR#H1W -MSPGWHL-Y+65Y!\*[EX2[8)S2[\#R#H1WKPCWFG%*OP/+.Q#>O2'<)>.4?@>6 -M=R"\>TNX=XQ3^AU8WH'P[OW(.Z_T.["\0^'=!V(5C%/Z'5K>H?#.$PX8I_0[ -MM+Q#X1T2+C!.Z7=H>8?"NTBXDG%*OT/+.Q3>K0E7,4[I=VAYA\*[FG`?&:?T -M.[2\0^'=)\)]9IS2[]#R#H5W7PAWQ3BEWZ'E71#>?27<-\8I_2Y8W@7AW7?" -M73-.Z7?!\BX([VX(=]OA0$MUWA6%?A#N;G3/PKS/GX&?C[URM@/V@G'-?-71%+5\&I%?Z[^ZM,&.:;<,+9VWD:Z`KVI^#:[7SO -MF[[_<&8.#!_.EHR;W,XW>Y2]-F!6%^>5!:`2N?XZMYNK'>]"Q:-MM[Z.ZU.: -M`0RF.U&?&T^W^=7M=L=B%=L%R$S7#7';R;6=KFXYKFXW\V*@O#-.O',;R/#. -I33B8MQ&$]+]>T?;(T=D>./Y:#=\)&`@XVQ4,9?/;L?@/'U:4T(,4```` -` -end diff --git a/usr.bin/mkimg/tests/img-1x1-4096-pc98.raw.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-pc98.raw.gz.uu deleted file mode 100644 index 5398eaef066e..000000000000 --- a/usr.bin/mkimg/tests/img-1x1-4096-pc98.raw.gz.uu +++ /dev/null @@ -1,11 +0,0 @@ -# $FreeBSD$ -begin 644 img-1x1-4096-pc98.raw.gz -M'XL("//%'50``VEM9RTQ>#$M-#`Y-BUP8SDX+G)A=RYO=70`K91!#H,@$$7W -MGF+<=F%@'*INFW3?3=NU-?44'+X@5`4$-0$,,?GP\C\#,&8:`"&P?F.,"_)6 -MN5T6EV*B\?$<4`CH0^!3`2<<:G\=P4"@_KP/QG'Y'$%67OOCN!)#D%T5%39P -M-BYEWC^<`HL&2("X0HM'';[OKXW`F"^PP>$>;C;,C^!JO6HU4[E%/N-B@L&5 -MEE4N.$JY4PCV/156Y#TLB*VW;EUG8.H,#\!:JZ$+G.L+B[\NM(%.W(0_"./V -M&M>X\_D*ASMQP<5]DK5-NRM#=T/F8M3^S3AX9G4"]1L9 -9C'%!/BJW&R!98+8=)-3`X@?$\J!S108````` -` -end diff --git a/usr.bin/mkimg/tests/img-1x1-4096-pc98.vhd.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-pc98.vhd.gz.uu deleted file mode 100644 index dbaca2298497..000000000000 --- a/usr.bin/mkimg/tests/img-1x1-4096-pc98.vhd.gz.uu +++ /dev/null @@ -1,18 +0,0 @@ -# $FreeBSD$ -begin 644 img-1x1-4096-pc98.vhd.gz -M'XL("!4UQ%4``VEM9RTQ>#$M-#`Y-BUP8SDX+G9H9"YO=70`K9?!0IE]M8#8PMCDVMG>N]EMV="2#?3V6VGR:$'^NZ5P`8;`TUV#<1#8NOCERP+ -M1XC^`-`YZ"/H!G3!]T:!WH$I`:C37MBUTGZ%MG[]V]27TT=FCW;3PZ3PK4)S -MML<<%#W$`%;\$'W@>V@=)OOQ\'QW^O/L<&AQ:$&%8:L<0>^CYRCZM>S5,>GI -MA"\=\O[WH"Z/U8U6]#$'$`JD]$;D3AUALL_06456QV-W&1!-%Q]W!5^"CM'9 -M2>P*,;'R9,X%58S.SN'TFM4MN+N-G8L^52@Q#+4"M`2#?$]IX^(0790J'^>W -MZOW<3/3A0JKH09^,^O)E=]&F"KK!5H'B=%YS%SK*98J;297_BIX.[92]H2"( -MPG5@YWX8O1$%OCXMQ4K,ER=C45_%^F@QB&JF7>YH[[/P'(#[XVW`HH`J!OYT -M#M>L;Z>@5G-Q]YV\:G74"]GWS_/;)(X?=@Y3O:-R66@H\5J%3P^_9AS&=`[W -M./P.-PB6U^!R6_O<2%*+P]MFL:/';2UK.^+4FCI><\U-SA9IDP7K-U=6) -M)^,P71E7KER&A"NWQV':0J"ZRDP9R#4R:I<[VL#$M-#`Y-BUP8SDX+G9H9&8N;W5T`*V5/6^#,!"& -M]_R*B[IEB.S#-K!6RIZE[0P4HJAJNW3HP(^O;4SPV4!(9;"0H^.>O.?[@+'A -M`A`(K)IY+AOZYR.]^]UA9VF\>PPH)50Q\$4#+0Z-OE)`(T#O@@5=-RUBZ(_! -M->*X-L8@Y[5HF,&Y<$7B\T,;L,Q!2)`*"MRJ\.WT.A,PI@MXP.$]W$TPWX++ -MC)?WIE:+_(9;,@RXO6/M)YQ84Z<1K'TH6)FV6!"+P,_/,S!=PPVPPMF0`F_Y -MA4E?&I`M:"DV><"5`EYX0.1 -M5E+??'^US<_UU\^PP?%@HOO+^&-FND7E@)7Y$_5N]IZ^I]/E;]LH05!V%*X-FN^*'19XG=5E\2-(_O5(!$\`Y"=RI.]-REC:_8[!M![6P -BYS,N\H,89D>5P4D6>/TWMP-.)2X5_57;_0$2<&2X<`@````` -` -end diff --git a/usr.bin/mkimg/tests/img-1x1-4096-pc98.vmdk.gz.uu b/usr.bin/mkimg/tests/img-1x1-4096-pc98.vmdk.gz.uu deleted file mode 100644 index f76b425d12e7..000000000000 --- a/usr.bin/mkimg/tests/img-1x1-4096-pc98.vmdk.gz.uu +++ /dev/null @@ -1,82 +0,0 @@ -# $FreeBSD$ -begin 644 img-1x1-4096-pc98.vmdk.gz -M'XL("/3%'50``VEM9RTQ>#$M-#`Y-BUP8SDX+G9M9&LN;W5T`*U<76_#@>0B!PB"`,;Y>7E>+MKIWMV2W)U8=-T_4J2O$OR/,F'I"B3%,G\3^LM2;.'Q7P[UWS@\O>; -M?_QTXM7AP%P*7!*!D`U<\4=-NL<_M[H^O?//<_C*WA_EXRR:I -MLJ3L_#(IBV6=)=5Y>2Q-JCEHF@&_2VYNO_XGN1F_]G>W7^X_^_V=W=G.P7GI -MXLO>(@N6>W=GF -M69(W;CLN/GVX;1;N2=*DA'N.Y/*7O]V\]:_<]/2EO2.?,E+[_J[L;T? -M?_SV97S[YN/G3Z%W[FQ=RYH%J%X:E25%YJ!\::Y]A4-T+YOEU)++K[?WO]SV -M'^8ROXYO3M\EA"M=[^8#K/V^UJKGE'+W9.=M7][][WZN-QG\R=X2;MG$4L3\ -MW,4Y*2J'-1_@>.*_/&7<7D%$JY9WV8N>#T'+,NSN_!= -M6^$=B>7N@>5DDYOVODV^;[^.I^]N;KX/)]NZ8O/E-F]M="CE"NU>WTL[Y\:M -M)[T>]'(4P]"=VJ']N>,-1]&Y%@V^4G>L^<,Q;I^G6DYJ7,[ -MS&?J8/\]?OY(N'Y]&<_[<"^)9DG,W,7\ZEG@1_\,ZRO&'9.#&^_OOIWZ;[_> -M?AKF-UKREG##VKMY.^MI/ASF?(#S#I_YW9V?WH?OU*.GFM&3RT/7%MRO'BY+/05DGLHV -M+0K;69]0"'3L[S_?K1M[(WR99I7BZ+ -M8@/H?HJE\_>?YN_W#_LKW?Y*B:PTJY9%LX'[UPSQY;KZ6CME$BI\?=XZ\:D.M]./XNP,A,LW)9%!NXO=X5OG>,K#2KED6S@=OK7>E[ -MQ\A.LWI9#(>*K7SO&#EIEKOCKU)(#_Q:5M:^=XS,-"N71;&!V^M=XWO'R$JS -M:EDT&[B]WK6^=XSL-*N7Q7"HV,[WCI&39KD[$@3D>A^N][UC9*99N2R*#=Q> -M[P;?.T96FE7+HMG`[?5N]+UC9*=9O2R&0\5.OG>,G#3+W>72NSP&5Z6^=XS, -M-"N71;&!V^E=1;YC9*59M2R:#=Q.[RKR'2,[S>IE,1PJEGS'R$FSW%TAO2NB -M<.0[1F::E0[1DZ:Y>Y* -MZ5T9A2/?,3+3K%P6Q09NKW?D.T96FE7+HMG`[?6.?,?(3K-Z60R'BB7?,7+2 -M+'?'7X(@U_MPY#M&9IJ5RZ+8P.WUCGS'R$JS:EDT&[B]WI'O&-EI5B^+X5"Q -MY#M&3IKE[BC(0*YWX>K4]XZ1F6;ELB@V<#N]J\EWC*PTJY9%LX';Z5U-OF-D -MIUF]+(9#Q9+O&#EIEKMKI'=-%(Y\Q\A,LW)9%!NXO=Z1[QA9:58MBV8#M]<[ -M\ATC.\WJ93$<*I9\Q\A)L]P=__\$N=Z'(]\Q,M.L7!;%!FZO=^0[1E::5*)=\Q^8V2F6;DLB@W<7N_(=XRL -M-*N61;.!V^L=^8Z1G6;ULA@.%4N^8^2D6>ZNE][U,;@F];UC9*99N2R*#=Q. -M[QKR'2,KS:IET6S@=GK7D.\8V6E6+XOA4+'D.T9.FN7N!NG=$(4CWS$RTZQ< -M%L4&;J]WY#M&5II5RZ+9P.WUCGS'R$ZS>ED,AXHEWS%RTBQW-TKOQB@<^8Z1 -MF6;ELB@V<'N](]\QLM*L6A;-!FZO=^0[1G::U,S#0KET6Q@=OK'?F.D95FU;)H-G![O2/?,;+3K%X6PZ%BR7>,G#0KE>D9 -MY'H7KDW7WH7(3+-R610;N)W>M9[O0F2E6;4LF@W<3N]:SW\0U>]:SW<0_0ZJWT'T.T3UN];S'42_ -M@^IW$/WN0+&>[R#Z'52_@^AWB$I:K><[B'X'U>\@^AVB^EWK^0ZBWT'U.XA^ -MAZA^UWJ^@^AW4/T.HM\=*-;S'42_@^IW$/T.44FK]7P'T>^@^AU$OT-4OVL] -MWT'T.ZA^!]'O$-7O6L]W$/T.JM]!]+L#Q7J^@^AW4/T.HM\A*FEUJ>^=Z'=0 -M_0ZBWR&JWW7D.]'OH/H=1+]#5+_KR'>BWT'U.XA^=Z!8\IWH=U#]#J+?(2II -M=>0[T>^@^AU$OT-4O^O(=Z+?0?4[B'Z'J'[7D>]$OX/J=Q#][D"QY#O1[Z#Z -M'42_0U32ZLAWHM]!]3N(?H>H?M>1[T2_@^IW$/T.4?VN(]^)?@?5[R#ZW8%B -MR7>BWT'U.XA^AZBDU9'O1+^#ZG<0_0Y1_:XCWXE^!]7O(/H=HOI=1[X3_0ZJ -MWT'TNP/%DN]$OX/J=Q#]#E%)JT]][T2_@^IW$/T.4?VN)]^)?@?5[R#Z':+Z -M74^^$_T.JM]!]+L#Q9+O1+^#ZG<0_0Y12:LGWXE^!]7O(/H=HOI=3[X3_0ZJ -MWT'T.T3UNYY\)_H=5+^#Z'<'BB7?B7X'U>\@^AVBDE9/OA/]#JK?0?0[1/6[ -MGGPG^AU4OX/H=XCJ=SWY3O0[J'X'T>\.%$N^$_T.JM]!]#M$):V>?"?Z'52_ -M@^AWB.IW/?E.]#NH?@?1[Q#5[WKRG>AW4/T.HM\=*)9\)_H=5+^#Z'>(2EI# -MZGLG^AU4OX/H=XCJ=P/Y3O0[J'X'T>\0U>\&\IWH=U#]#J+?'2B6?"?Z'52_ -M@^AWB$I:`_E.]#NH?@?1[Q#5[P;RG>AW4/T.HM\AJM\-Y#O1[Z#Z'42_.U`L -M^4[T.ZA^!]'O$)6T!O*=Z'=0_0ZBWR&JWPWD.]'OH/H=1+]#5+\;R'>BWT'U -M.XA^=Z!8\IWH=U#]#J+?(2II#>0[T>^@^AU$OT-4OQO(=Z+?0?4[B'Z'J'XW -MD.]$OX/J=Q#][D"QY#O1[Z#Z73#30:X%+EF_/=R8KKT+D9EFI>G3M[EW,T2: -M7.UN-/8'8O$'AIG"6M7O`USAK/<7YMO2OX>\W^I?1)AO\_8B_R+"?)NW%_D7 -M$>;;O+W(OX@PWS;Q+R+,MTW\BPCS;1/_(L)\V\2_B##?-O$O(LRW3?R+"/-M -M$_\BPGS;Q+^(,-\V\2\BS+=-_(L(\VT3_R+"?-O$OX@PWS;Q+R+,MTW\BPCS -M;1/_(L)\V\2_B##?-O$O(LRW3?R+"/-M$_\BPGS;Q+^(,-\V\2\BS+=-_(L( -M\VT3_R+"?-O$OX@PWS;Q+R+,MTW\BPCS;1/_(L)\V\2_",ZW;?R+X'S;QK\( -MSK=M_(O@?-O&OPC.MVW\B^!\V\:_",ZW;?R+X'S;QK\(SK=M_(O@?-O&OPC. -MMVW\B^!\V\:_",ZW;?R+X'S;QK\(SK=M_(O@?-O&OPC.MVW\B^!\V\:_",ZW -M;?R+X'S;QK\(SK=M_(O@?-O&OPC.MVW\B^!\V\:_",ZW;?R+X'S;QK\(SK=M -M_(O@?-O&OPC.MVW\B^!\V\:_",ZW;?R+X'S;QK^(,-]FY(O\BPCS;4:^R+^( -M,-]FY(O\BPCS;4:^R+^(,-\V\2\BS+=-_(L(\VT3_R+"?-O$OX@PWS;Q+R+, -MMTW\BPCS;1/_(L)\V\2_B##?-O$O(LRW3?R+"/-M$_\BPGS;Q+^(,-\V\2\B -MS+=-_(L(\VT3_R+"?-O$OX@PWS;Q+R+,MTW\BPCS;1/_(L)\V\2_B##?-O$O -M(LRW3?R+"/-M$_\BPGS;Q+^(,-\V\2\BS+=-_(L(\VT3_R+"?-O$OPC.MVW\ -MBQA-_8L83?V+&$W]BQA-_8L83?V+&$W]BQA-_8L83?V+&$W]BQA-_8L83?V+ -M&$W]BQA-_8L83?V+&$W]BYC2U-"_B,G4OXC)U+^(R=2_B,G4OXC)U+^(R=2_ -MB,G4OXC)U+^(R=2_B,G4OXC)U+^(R=2_B,G4OXC)U+^(R=2_>$[3U-"_>+[Z -M+.%-UC[<=;&K/S!?]K=^.NCUW_L/7+X_;?\$0$R_#;`HDO8:\)^^X'SYO-XF -M3_K\J;JFZ>$6*WB%L^Y?;MR_>;/.RON=[&>5/N,_N[XI9R^1!@_?A5/<4-V^V4FVSA -MNF?/]OG=O;[>76]\&%M`MN_<%>YL2P3UPLRK>>+Z[_T'+N]/VS\K -.8+X`OOH_SBV/UN!>```` -` -end diff --git a/usr.bin/mkimg/tests/img-1x1-512-pc98.qcow.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-pc98.qcow.gz.uu deleted file mode 100644 index 5a36a47ff1bb..000000000000 --- a/usr.bin/mkimg/tests/img-1x1-512-pc98.qcow.gz.uu +++ /dev/null @@ -1,127 +0,0 @@ -# $FreeBSD$ -begin 644 img-1x1-512-pc98.qcow.gz -M'XL("*8S(E0``VEM9RTQ>#$M-3$R+7!C.3@N<6-O=RYO=70`K9W+CAQ'DD7W -M^HKD^TV6F45F1O"-!KJ!V?4L9F:K?*[S`_CQ0U9%N+,LSZ6Q(5$%@40I+C*] -M#@\AZ<#KYN;NQVJUMM6P60W3ZKQ???_U_&&KGWYQ_V/U[;__]5]O?_[Q[8^[ -M,;OYQ5/IUX.OAGGNWM8_OK8Y__'4874S_<;<]P^CN9]>7?P'K^ZG-WL]]_*/ -MNS?+S[D:C'N#JWGN9GY])DYO^+W7]S6]7;L[O;_O[;IXNVLUN+DW^.]Y[L_Y -M];EXNULU-]Z;NZ2WZ^+M3FIN]TM87,"R5W.'8F[`IXYJ[E3,K?&I,\_9+[ZV -M=W,;?,K4G./AN(N*.R/? -MA>(N2N[(=Z&XBY([\ETH[J+DCGP7BKLHN2/?A>(N2N[(=Z&XBY([\ETH[H:2 -M._+=H+@;2N[(=X/B;JBX]&Q=U8<3?P4X*[L>)N(-^- -MBKNQXFX@WXV*N['B;B#?C8J[L>)N(-^-BKNQXFX@WXV*N^4_?^LY\MVDN)LJ -M[@;RW:2XFTKNR'>3XFXJN2/?38J[J>2.?#XVY7]VBKM=Q=V:GQ+<[2KNUN2[G>)N5W&W)M_M%'>[ -MBKLU^6ZGN-M5W*W)=SO%W:[B;DV^VRGNEO\-J>?(=WO%W;[B;DV^VRON]B5W -MY+N]XFY?^VRON]B5WY+N]XFY?^VRON]B5WY+N]XFY?^VRON#B5W -MY+N#XNY0^.RCN#A5W&WY*<'>HN-N0[PZ*NT/%W89\=U#<'2KN-N2[@^+N -M4'&W(=\=%'>'BKL-^>Z@N#M6W&W(=T?%W;'B;D.^.RKNCB5WY+NCXNY8^ -M.RKNCB5WY+NCXNY8^.RKNCB5WY+NCXNY8^.RKN3B5WY+N3XNY4^ -M.RGN3A5W6WY*<'>JN-N2[TZ*NU/%W99\=U+G -MBKLM^>ZDN#M7W&W)=V?%W;GB;DN^.RONSB5WY+NSXNY<^.RONSB5WY+NS -MXNY<^.RONSB5WY+NSXNY<^.PON;/F)G@/?V8W@SFY*[L!W=B.XLYN* -MNY&?8NZL[.]&\)VI_L[*_FX$WYGJ[ZSL[T;PG:G^SLK^;@3?F>KOK.SO1O"= -MJ?[.ROYN!-^9ZN^L[.]&\)VI_L[*_FX$WYGJ[ZSL[T;PG:G^SLK^;@3?F>KO -MK.SO1O"=J?[.ROYN!-^9ZN^L[.]&\)VI_L[*_FXDWZG^SLK^;B3?J?[.ROYN -MXJ<$=V5_-Y'O5']G97\WD>]4?V=E?S>1[U1_9V5_-Y'O5']G97\WD>]4?V=E -M?S>1[U1_9V5_-Y'O5']G97\WD>]4?V=E?S>1[U1_9V5_-Y'O5']G97\WD>]4 -M?V=E?S>1[U1_9V5_-Y'O5']G97\WD>]4?V=E?S>1[U1_9V5_M^.G!'=E?[^4_V=E?W=CGRG^CLK^[L=^4[U=U;V=SORG>KOK.SO=N0[U=]9 -MV=_MR'>JO[.RO]N1[U1_9V5_MR/?J?[.ROYN1[Y3_9V5_=V.?*?Z.RO[NQWY -M3O5W5O9W._*=ZN^L[.]VY#O5WUG9W^W(=ZJ_L[*_V_-3@KNRO]N3[U1_9V5_ -MMR??J?[.ROYN3[Y3_9V5_=V>?*?Z.RO[NSWY3O5W5O9W>_*=ZN^L[._VY#O5 -MWUG9W^W)=ZJ_L[*_VY/O5']G97^W)]^I_L[*_FY/OE/]G97]W9Y\I_H[*_N[ -M/?E.]7=6]G=[\IWJ[ZSL[_;D.]7?6=G?'?@IP5W9WQW(=ZJ_L[*_.Y#O5']G -M97]W(-^I_L[*_NY`OE/]G97]W8%\I_H[*_N[`_E.]7=6]G<'\IWJ[ZSL[P[D -M.]7?6=G?'KOK.SOCOR4X*[L[X[D.]7?6=G?'KOK.SO -MCN0[U=]9V=\=R7>JO[.ROSN2[U1_9V5_=R3?J?[.RO[N2+Y3_9V5_=V1?*?Z -M.RO[NR/Y3O5W5O9W)WY*<%?V=R?RG>KOK.SO3N0[U=]9V=^=R'>JO[.ROSN1 -M[U1_9V5_=R+?J?[.RO[N1+Y3_9V5_=V)?*?Z.RO[NQ/Y3O5W5O9W)_*=ZN^L -M[.].Y#O5WUG9WYW(=ZJ_L[*_.Y'O5']G97]W(M^I_L[*_NY$OE/]G97]W8E\ -MI_H[*_N[,S\EN"O[NS/Y3O5W5O9W9_*=ZN^L[._.Y#O5WUG9WYW)=ZJ_L[*_ -M.Y/O5']G97]W)M^I_L[*_NY,OE/]G97]W9E\I_H[*_N[,_E.]7=6]G=G\IWJ -M[ZSL[\[D.]7?6=G?GK/]L<^,Y5?^>IOUM=TMD%W7_G -MJK_SU-^UL^MSX#M7_9VG_@[FP'>N^CM/_1W,@>]<]7>>^KME[D&?`]^YZN\\ -M]7KO//5W#V;N'G3NP'>N^CM/_=V#F;L'G3OPG:O^SE-_]^!R -M=7;@.U?]G:?^KIU=GP/?N>KO//5W,`>^<]7?>>KO8`Y\YZJ_\]3?+7,/^QSY -M3O5WGOJ[A\M[3,->[H_CM7_9VG_N[1S-VCSAWY3O5WGOJ[1S-WCSIWY#O5 -MWWGJ[QY=KLZ.?*?Z.T_]73N[/D>^4_V=I_X.YLAWJK_SU-_!'/E.]7>>^KME -M[G&?(]^I_LY3?_=XF>O]4?^>IOWL\<_>X<4?WW[GJ[SSU=X]G[AXW[NC^ -M.U?]G:?^[O$EGQW=?^>JO_/4W[6SZW/D.]7?>>KO8(Y\I_H[3_T=S)'O5'_G -MJ;];YI[T.?*=ZN\\]7=/EKG&'=U_YZJ_\]3?/9FY>]*Y(]^I_LY3?_=DYNY) -MYXY\I_H[3_W=D\O5V9'O5'_GJ;]K9]?GR'>JO_/4W\$<^4[U=Y[Z.Y@CWZG^ -MSE-_M\P][7/D.]7?>>KOGBYSG3ORG>KO//5W3V?NGC;NZ/X[5_V=I_[NZ2SH_OO7/5WGOJ[=G9]CGRG^CM/_1W,D>]4?^>IOX,Y -M\IWJ[SSU=\O>^KMG,W?/.G?D.]7?>>KO -MGLWO]4?^>IOWMVN3H[\IWJ[SSU=^WL^ASY3O5WGOH[F"/?J?[.4W\' -M<^0[U=]YZN^6N>=]CGRG^CM/_=WS9:YS1[Y3_9VG_N[YS-WSQAW=?^>JO_/4 -MWSV?N7O>N*/[[USU=Y[ZN^>7?'9T_YVK_LY3?]?.KL^1[U1_YZF_@SGRG>KO -M//5W,$>^4_V=I_YNF7O1Y\AWJK_SU-^]6.8:=W3_G:O^SE-_]V+F[D7GCGRG -M^CM/_=V+F;L7G3ORG>KO//5W+RY79T>^4_V=I_ZNG5V?(]^I_LY3?P=SY#O5 -MWWGJ[V".?*?Z.T_]W3+WLL^1[U1_YZF_>[G,=>[(=ZJ_\]3?O9RY>]FXH_OO -M7/5WGOJ[ES-W+QMW=/^=J_[.4W_W\I+/CNZ_<]7?>>KOVMGU.?*=ZN\\]7

JO_/4WRUSK_H<^4[U=Y[ZNU?+7...[K]SU=]YZN]>S=R] -MZMR1[U1_YZF_>S5S]ZIS1[Y3_9VG_N[5Y>KLR'>JO_/4W[6SZW/D.]7?>>KO -M8(Y\I_H[3_T=S)'O5'_GJ;];YE[W.?*=ZN\\]7>OE[G.'?E.]7>>^KO7,W>O -M&W=T_YVK_LY3?_=ZYNYUXX[NOW/5WWGJ[UY?\MG1_7>N^CM/_5T[NSY'OE/] -MG:?^#N;(=ZJ_\]3?P1SY3O5WGOJ[9>Y-GR/?J?[.4W_W9IEKW-']=Z[Z.T_] -MW9N9NS>=._*=ZN\\]7=O9N[>=.[(=ZJ_\]3?O;E]4?^>IOX,Y\IWJ[SSU=\OJO_.JOPNZ_\Y5?^=5?Q=T -M_YVK_LY%?_>NSY'O5'_GJ;][M\PU[NC^.U?]G:?^[MW,W;O.'?E.]7>>^KMW -M,W?O.G?D.]7?>>KOWEVNSHY\I_H[3_U=.[L^1[Y3_9VG_@[FR'>JO_/4W\$< -M^4[U=['\),W=]#GP7:C^[OLG[G&W^.FF

^"]7?1>KO;N:]F\8=W7\7JK^+ -MU-_=S-S=-.[H_KM0_5VD_N[FDL^.[K\+U=]%ZN_:V?4Y\%VH_BY2?P=SX+M0 -M_5VD_@[FP'>A^KM(_=TR9WT.?!>JOXO4W]DRU[BC^^]"]7>1^CN;7YYU[L!W -MH?J[2/V=S=Q9YPY\%ZJ_B]3?V>7J[,!WH?J[2/U=.[L^![X+U=]%ZN]@#GP7 -MJK^+U-_!'/@N5'\7J;];YKS/D>]4?Q>IO_-EKG-'OE/]7:3^SF?NO'%']]^% -MZN\B]7<^<^>-.[K_+E1_%ZF_\TL^.[K_+E1_%ZF_:V?7Y\AWJK^+U-_!'/E. -M]7>1^CN8(]^I_BY2?[?,19\CWZG^+E)_%\MKOVMGU.?*=ZN\B]7JOXO4WRUS0Y\CWZG^+E)_-RQSG3ORG>KO(O5WP\S=T+BC^^]"]7>1 -M^KMAYFYHW-']=Z'ZNTC]W7#)9T?WWX7J[R+U=^WL^ASY3O5WD?H[F"/?J?XN -M4G\'<^0[U=]%ZN^6N76?(]^I_BY2?[=>YAIW=/]=J/XN4G^WGKE;=^[(=ZJ_ -MB]3?K6?NUIT[\IWJ[R+U=^O+U=F1[U1_%ZF_:V?7Y\AWJK^+U-_!'/E.]7>1 -M^CN8(]^I_BY2?[?,;?H<^4[U=Y'ZN\TRU[DCWZG^+E)_MYFYVS3NZ/Z[4/U= -MI/YN,W.W:=S1_7>A^KM(_=WFDL^.[K\+U=]%ZN_:V?4Y\IWJ[R+U=S!'OE/] -M7:3^#N;(=ZJ_B]3?+7/;/D>^4_U=I/YNN\PU[NC^NU#]7:3^;CMSM^W]4 -M?Q>IO]O.W&T[=^0[U=]%ZN^VEZNS(]^I_BY2?]?.KL^1[U1_%ZF_@SGRG>KO -M(O5W,$>^4_U=I/YNF1O['/E.]7>1^KMQF>O]4?Q>IOQMG[L;&'=U_%ZJ_ -MB]3?C3-W8^..[K\+U=]%ZN_&2SX[NO\N5'\7J;]K9]?GR'>JOXO4W\$<^4[U -M=Y'Z.Y@CWZG^+E)_M\Q-?8Y\I_J[2/W=M,PU[NC^NU#]7:3^;IJYFSIWY#O5 -MWT7J[Z:9NZES1[Y3_5VD_FZZ7)T=^4[U=Y'ZNW9V?8Y\I_J[2/T=S)'O5'\7 -MJ;^#.?*=ZN\B]7?+W/L^1[Y3_5VD_N[],M>Y(]^I_BY2?_=^YNY]XX[NOPO5 -MWT7J[][/W+UOW-']=Z'ZNTC]W?M+/CNZ_RY4?Q>IOVMGU^?(=ZJ_B]3?P1SY -M3O5WD?H[F"/?J?XN4G^WS'WH<^0[U=]%ZN\^+'.-.[K_+E1_%ZF_^S!S]Z%S -M1[Y3_5VD_N[#S-V'SAWY3O5WD?J[#Y>KLR/?J?XN4G_7SJ[/D>]4?Q>IOX,Y -M\IWJ[R+U=S!'OE/]7:3^;IG[V.?(=ZJ_B]3??5SF.G?D.]7?1>KO/L[,EG1_??A>KO(O5W[>SZ'/E.]7>1 -M^CN8(]^I_BY2?P=SY#O5WT7J[Y:Y3WV.?*?ZNTC]W:=EKG%']]^%ZN\B]7>? -M9NX^=>[(=ZJ_B]3??9JY^]2Y(]^I_BY2?_?IKO -M(O5W,$>^4_U=I/X.YLAWJK^+U-\M1^KO/RUSGCGRG^KM(_=WG -MF;O/C3NZ_RY4?Q>IO_L\<_>Y<4?WWX7J[R+U=Y\O^>SH_KM0_5VD_JZ=79\C -MWZG^+E)_!W/D.]7?1>KO8(Y\I_J[2/W=,O>ESY'O5'\7J;_[LLPU[NC^NU#] -M7:3^[LO,W9?.'?E.]7>1^KLO,W=?.G?D.]7?1>KOOERNSHY\I_J[2/U=.[L^ -M1[Y3_5VD_@[FR'>JOXO4W\$<^4[U=\/RDS3WM<^![P;5WPVIO_NZS'7NP'?? -MGV+NAM3??9VY^[IP-]SP4\S=D/J[KS-W7_]L<^"[0?5W0^KOOE[2V0UT_UW[ -MT)_X]C;]^/;'R]O!]>W;'7QULX._ZT]\^\?;^W^UP=OK:OZ#P?5ZM;L>_)_Y -M#:]OKZN9AM5AH/=U/O>/Z@W?S=&W/_\KYS?\S>>WO7W#Z^UJ6*_6F]7HO_L* -M_^^?_PMO>/OWO>&[N9*_]H+M=^9N_[S]Z9_\\>VF6T@I/W$W=W5QW9;NY^DO -MXH=@3O0)^>KH^[W_!5BV5W?@_/QUOOV.\=__Y7CY_Q_I(M'V]5WUUT=-^;VW -M^XO7M[I^N[=_IFWO__/VTYP7;W=U?V[_RZ_MKU_=@^M71]]3_:]\,:YN#$M-3$R+7!C.3@N<6-O=S(N;W5T`*V8VY+3,`R& -M[_L4+H<%%BBQ9*<)AP7VP`QW<`%\CNM5APH.'E-C4`X7S.JF!A3<'"BGZ\-4GTRM+5R5Q8&2JBW<)HM#);6U<+LL+BBI>PNW -MS^*BDCH8.)]1Y0%7*BEOX2"+6RLIM'`ABZN4E.6=SWM7*RG+.Y_W;J.D+.]\ -MWKNMDK*\\WGO=DK*\L[GO;M74I9W8'CG&+=74I9W(+Q;$NX9XPY*RO(.A'?/ -M"?>BPWDM97D'PKN7A+M@G-+OP/(.A'>O"/>:<4J_`\L[$-Z](=PEXY1^!Y9W -M(+Q[2[AWC%/Z'5C>@?#N_<@[K_0[L+Q#X=T'8A6,4_H=6MZA\,X3#ABG]#NT -MO$/A'1(N,$[I=VAYA\*[2+B2<4J_0\L[%-ZM"55=$-Y])=PWQBG]+EC>!>'==\)= -M,T[I=\'R+@CO;@AWV^%`2W7>%85^$.YN=,_"O,^?@9^/O7*V!R:`U5.`4Q4F -M7#WKA&.:<*/!1CG;`\?KU?#=`5MAG@",T6W&P#]IPC$)4P>W"]J\#@<^3KA^ -M<6YA8K,DLUX_:"<1KH"O:GX-KM?.^; -MOO]P9@X,'\Z6C)OUVQV(5VP7(3-<-<=O)M9VN;CFN;C?S8J"\,TZ\#$M-3$R+7!C.3@N> -M8MQV86`^^.X$D.07145-G`V -M+F7>/YP"BP9(@+A"BT<=ON^OC<"8+[#!X1YN-LR/X&J]:C53N44^XV*"P966 -M52XX2KE3"/8]%5;D/2R(K;=N76=@Z@P/P%JKH0N1\"FEYF=0+U&QF, -8<4$^*K<;(%E@MATDU,#B!\3RH'-%!@`` -` -end diff --git a/usr.bin/mkimg/tests/img-1x1-512-pc98.vhd.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-pc98.vhd.gz.uu deleted file mode 100644 index fd654d67bab3..000000000000 --- a/usr.bin/mkimg/tests/img-1x1-512-pc98.vhd.gz.uu +++ /dev/null @@ -1,18 +0,0 @@ -# $FreeBSD$ -begin 644 img-1x1-512-pc98.vhd.gz -M'XL("/\TQ%4``VEM9RTQ>#$M-3$R+7!C.3@N=FAD+F]U=`"ME\%RHS`,AN]Y -M"F7VU@-C"V.3:V=Z[V6W9T)(-]/9;:?)H0?Z[I7`!AL#378-Q$-BZ^.7+`M' -MB/X`T#GH(^@&=,'W1H'>@2D!J-->V+72?H6V?OW;U)?31V:/=M/#I/"M0G.V -MQQP4/<0`5OP0?>![:!TF^_'P?'?Z\^QP:'%H085AJQQ![Z/G*/JU[-4QZ>F$ -M+QWR_O>@+H_5C5;T,0<0"J3T1N1.'6&RS]!915;'8W<9$$T7'W<%7X*.T=E) -M[`HQL?)DS@55C,[.X?2:U2VXNXV=BSY5*#$,M0*T!(-\3VGCXA!=E"H?Y[?J -M_=Q,].%"JNA!GXSZ\F5WT:8*NL%6@>)T7G,7.LIEBIM)E?^*G@[ME+VA((C" -M=6#G?AB]$06^/BW%2LR7)V-17\7Z:#&(:J9=[FCOL_`<@/OC;<"B@"H&_G0. -MUZQOIZ!6MR8N?/,PC* -MX1I$Z54%#SC,+XSZ=K$,#-Q=T0>QNQ7C3#A>>CC\QET(N7(:$*[?'8=I"H+K*3!G(-3)JESO:QRP\>R#:4I_LW8&V-B=3J"PP -MF4)EJW-"A:I93;9;LU!;A8DVXHQ+N!%G7,*-..,2;L09EW`CSKB$&W'&)=V( -/:_J+)<3F"Q0&'5:]#0`` -` -end diff --git a/usr.bin/mkimg/tests/img-1x1-512-pc98.vhdf.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-pc98.vhdf.gz.uu deleted file mode 100644 index ba3cfda16a56..000000000000 --- a/usr.bin/mkimg/tests/img-1x1-512-pc98.vhdf.gz.uu +++ /dev/null @@ -1,14 +0,0 @@ -# $FreeBSD$ -begin 644 img-1x1-512-pc98.vhdf.gz -M'XL("&HEAE4``VEM9RTQ>#$M-3$R+7!C.3@N=FAD9BYO=70`K94];X,P$(;W -M_(J+NF6([,,VL%;*GJ7M#!2BJ&J[=.C`CZ]M3/#90$AEL)"CXYZ\Y_N`L>$" -M$`BLFGDN&_KG([W[W6%G:;Q[#"@E5#'P10,M#HV^4D`C0.^"!5TW+6+HC\$U -MXK@VQB#GM6B8P;EP1>+S0QNPS$%(D`H*W*KP[?0Z$S"F"WC`X3W<33#?@LN, -ME_>F5HO\AELR#+B]8^TGG%A3IQ&L?2A8F;98$(O`S\\S,%W##;#"V9`";_F% -M25\9RT`2[HH^B,.M#"ZG[W,/AW?"!8JK5W.[KFX?JVL2)R,+.V-CYQH([=P! -MAVD'@;"365>@F9'1<]G0GX_T'H#"`9.=H'3?#I6!ZD"UH*39YP)4"7GA`Y%6 -M4M]\?[7-S_77S[#!\6"B^\OX8V:Z1>6`E?D3]6[VGKZGT^5P_;R,N'%4C1-) -M-YOVRA!4'84K@V:[XH=%GB=U67Q(TC^]4@$3P#D)W*D[TW*6-K]CL&T'M;#G -A,R[R@QAF1Y7!219X_3>W`TXE+A7]5=O]`1)P9+AP"``` -` -end diff --git a/usr.bin/mkimg/tests/img-1x1-512-pc98.vmdk.gz.uu b/usr.bin/mkimg/tests/img-1x1-512-pc98.vmdk.gz.uu deleted file mode 100644 index 7f13ae450062..000000000000 --- a/usr.bin/mkimg/tests/img-1x1-512-pc98.vmdk.gz.uu +++ /dev/null @@ -1,82 +0,0 @@ -# $FreeBSD$ -begin 644 img-1x1-512-pc98.vmdk.gz -M'XL(".O%'50``VEM9RTQ>#$M-3$R+7!C.3@N=FUD:RYO=70`K5Q=;]S($7SW -MKZ!]+T$>%JSE]X.!Y"('"((`QOER]QI^YH25XNVNG>W9+D*),4R?Q/ZRU)LX?%?#O7?.#R]YM_ -M_'3BUQ].I\NK%0PN2U*0*IPL-L]S.3WZ(MSYN:S-`_/M'(7+7%9WE>CASCL/ -M[,+E\X/GIU*XNW9Y>'`7`I<$H&0#5SQ1TVZQS^WNCZ]\\]S^,K>'^7C+)JFR -MI.S\,BF+99TEU7EY+$VJ.6B:`;]+;FZ__B>Y&;_V=[=?[C_[_9W=V<[!>>GB -MR]XAS(55I;MP#SBXQD&48Y(-20;W<'*Y^^OMK^/IO^/=U]O/G]Z"Y9[=V>99 -MDC=N.RX^?;AM%NY)TJ2$>X[D\I>_W;SUK]ST]*6](YS+FC*^ -MKV_+[L9/]PYQ\E]A=^YL?7.*Y;ES=U'D2=4DRW8*AWV>'QY\R4OO^KNQO1]_ -M_/9E?/OFX^=/H7?N;%W+F@6H7AJ5)47FH'QIKGV%0W0OF^74DLNOM_>_W/8? -MYC*_CF].WR6$*UWOY@.L_;[6JN>4WN&O6A_=__H%P]9PU -M1\X;G%/F@C8U%6O]Q>.797+Y\"YYXXK\\9=Q>042KEG?9BYX/0Z!Y623F_:^3;YOOXZG[VYNO@\GV[IB\^4V;VUT*.4*[5[?2SOGQJTG -MO1[T!'_PSK*\8=DX,;[^^^G?IOO]Y^ -M&N8W6O*6<,/:NWD[ZVD^'.9\@/,.G]S@W+LWRZF&[1%N=+L;KC:XG*=O9-A4 -M>-KD\G'9WB]C.\Q;F[$)-[G=G9_>A^_4HZ>:T9/+0]<6W*\>+DL]!62>RC8M -M"MM9GU`(=.SO/]^M&WLC?)P]_EGV4C[.KWZD5K\3<(6SWE^9/OIYEFE>+HMB -M`^A^BJ7S]Y_F[_PTJY?%<*1[ -MI:.V42*GQ]WCKQJ0ZWTX_B[`R$RSED,AXJM?.\8.6F6N^.O4D@/_%I6UKYWC,PT*Y=%L8';ZUWC>\?(2K-J -M630;N+W>M;YWC.PTJY?%<*C8SO>.D9-FN3L2!.1Z'Z[WO6-DIEFY+(H-W%[O -M!M\[1E::5*)=\QD>\8V6E6+XOA4+'D -M.T9.FN7N*,A`KG?AZM3WCI&99N6R*#9P.[VKR7>,K#2KED6S@=OI74V^8V2G -M6;TLAD/%DN\8.6F6NVND=TT4CGS'R$RSIE,1PJEGS'R$FSW!W__P2YWHED,AXHEWS%RTBQW1_T1[\AWC*PT -MJY9%LX';ZQWYCI&=9O6R&`X52[YCY*19[JZ7WO4QN";UO6-DIEFY+(H-W$[O -M&O(=(RO-JF71;.!V>M>0[QC9:58OB^%0L>0[1DZ:Y>X&Z=T0A2/?,3+3K%P6 -MQ09NKW?D.T96FE7+HMG`[?6.?,?(3K-Z60R'BB7?,7+2+'[TCWS&RTJQ:%LT&;J]WY#M&=IK5RV(X5"SYCI&39KF[27HW1>'( -M=XS,-"N71;&!V^L=^8Z1E6;5LF@V<'N](]\QLM.L7A;#H6+)=XR<-"N5Z1GD -M>A>N3=?>A%L.A8CW? -MAY`L9[O(/H=5+^#Z'>(2EJMYSN(?@?5[R#Z':+Z7>OY#J+?0?4[B'Z' -MJ'[7>KZ#Z'=0_0ZBWQTHUO,=1+^#ZG<0_0Y12:OU?`?1[Z#Z'42_0U2_:SW? -M0?0[J'X'T>\0U>]:SW<0_0ZJWT'TNP/%>KZ#Z'=0_0ZBWR$J:76I[YWH=U#] -M#J+?(:K?=>0[T>^@^AU$OT-4O^O(=Z+?0?4[B'YWH%CRG>AW4/T.HM\A*FEU -MY#O1[Z#Z'42_0U2_Z\AWHM]!]3N(?H>H?M>1[T2_@^IW$/WN0+'D.]'OH/H= -M1+]#5-+JR'>BWT'U.XA^AZA^UY'O1+^#ZG<0_0Y1_:XCWXE^!]7O(/K=@6+) -M=Z+?0?4[B'Z'J*35D>]$OX/J=Q#]#E']KB/?B7X'U>\@^AVB^EU'OA/]#JK? -M0?2[`\62[T2_@^IW$/T.44FK3WWO1+^#ZG<0_0Y1_:XGWXE^!]7O(/H=HOI= -M3[X3_0ZJWT'TNP/%DN]$OX/J=Q#]#E%)JR??B7X'U>\@^AVB^EU/OA/]#JK? -M0?0[1/6[GGPG^AU4OX/H=P>*)=^)?@?5[R#Z':*25D^^$_T.JM]!]#M$];N> -M?"?Z'52_@^AWB.IW/?E.]#NH?@?1[PX42[X3_0ZJWT'T.T0EK9Y\)_H=5+^# -MZ'>(ZG<]^4[T.ZA^!]'O$-7O>O*=Z'=0_0ZBWQTHEGPG^AU4OX/H=XA*6D/J -M>R?Z'52_@^AWB.IW`_E.]#NH?@?1[Q#5[P;RG>AW4/T.HM\=*)9\)_H=5+^# -MZ'>(2EH#^4[T.ZA^!]'O$-7O!O*=Z'=0_0ZBWR&JWPWD.]'OH/H=1+\[4"SY -M3O0[J'X'T>\0E;0&\IWH=U#]#J+?(:K?#>0[T>^@^AU$OT-4OQO(=Z+?0?4[ -MB'YWH%CRG>AW4/T.HM\A*FD-Y#O1[Z#Z'42_0U2_&\AWHM]!]3N(?H>H?C>0 -M[T2_@^IW$/WN0+'D.]'OH/I=,--!K@4N6;\]W)BNO0N1F6:EZ=.WN7&F<):U>\#7.&L]Q?FV]*_A[S?ZE]$F&_S]B+_(L)\F[<7^1<1 -MYMN\O(6S[E]NW+]R*;BHW`?%%F52GX_N\.=W/SU1<&E7\`IW]>'3 -MC^'"A@]\EG6Y?$"Q1KKWU(-HN??`"O?:8[U^@,N?VYW.>8X5:_SAT^7R(<`: -MJ^>\3`GZ!S_#(VX)YYL\[*^YWL9Y4^XS^[OBEG+Y$&#]^%4]Q0W;[92;;.&Z -M9\_V^=V]OMY=;WP85Q]E>_"=ZT"V[]P5[FQ+!/7"S*MYXOKO_0#T/@/SLAF9W[NZH]4TP&A@T -M`A7Y*2MK]0+-+&W6ZY_?5JO15L-F-?MNZWN_>3A]]6W__J/_WQW -M_]NW/WZ.V?HOKDH_WYZ6N0=;_]?G_,=5A]5Z_H6Y[]^-YN[=7?R-N[OW9B_G -MKO[X^6;Y.E>#\6!PU>;6[?Y,/+WAU^[O2WJ[]O/I_;ZWZ^+MCFIP\V#P:YO[ -M5[L__UNP_-+]_)7X0K,[PM,7VM=E;H]7;=3< -M0^[^=<'=`:\2W%G)W1&O$MQ9R=T)KQ+<6NN/.*.R/?N>+.*^Z,?.>*.Z^X,_*=*^Z\ -MY(Y\%XJ[*+DCWX7B+DKNR'>AN(N2._)=*.ZBY(Y\%XJ[*+DCWX7B+DKNR'>A -MN(N2._)=*.ZBXL[IJD%Q-U3<.?EN4-P-%7=.OAL4=T/%G9/O!L7=4''GY+M! -M<3=4W#GY;E#<#15W3KX;%'=#Q9V3[P;%W5!R1[X;%7=CR1WY;E36W)'O1L7=6')'OAL5=V/)'?EN5-R-)7?DNU%Q-Y;]&Q=U8<1=TU49Q -MMZFX"_+=1G&WJ;@+\MU&<;>IN`ORW49QMZFX"_+=1G&WJ;@+\MU&<;>IN`OR -MW49QMZFX"_+=1G&W*;DCWVT5=]N2._+=5G&W+;DCWVT5=]N2._+=5G&W+;DC -MWVT5=]N2._+=5G&W+;DCWVT5=]N2._+=5G&WK;@;Z*I)<3=5W`WDNTEQ-U7< -M#>2[27$W5=P-Y+M)<3=5W`WDNTEQ-U7<#>2[27$W5=P-Y+M)<3=5W`WDNTEQ -M-Y7_N_BL\O%!Q1[Z;%7=SR1WY;E;7W)'O9L7=7')'OIL5 -M=W/)'?EN5MS-)7?DNUEQ-U?ZHN#N6W)'OCHJ[ -M8\D=^>ZHN#N6W)'OCHJ[8\D=^>ZHN#N6W)'OCHJ[8\D=^>ZHN#N6W)'OCHJ[ -M8\7=EJY:.J#+%PKNMN2[D^+N5'&W)=^=%'>GBKLM^>ZDN#M5W&W)=R?%W:GB -M;DN^.RGN3A5W6_+=27%WJKC;DN].BKM3R1WY[JRX.Y?_.BKMSR1WY[JRX -M.Y?_.BKMSR1WY[JRX.Y?_.BKMSR1WY[JRX.Y?_.BKMSQ=T$5]G= -M#^"%@KL)?&`[ -M4_V=E?W=!+XSU=]9V=]-X#M3_9V5_=T$OC/5WUG9WTW@.U/]G97]W02^,]7? -M6=G?3>`[4_V=E?W=!+XSU=]9V=]-X#M3_9V5_=T$OC/5WUG9WTW@.U/]G97] -MW4Q7J?[.ROYN)M^I_L[*_FXFWZG^SLK^;B;?J?[.ROYN)M^I_L[*_FXFWZG^ -MSLK^;B;?J?[.ROYN)M^I_L[*_FXFWZG^SLK^;B;?J?[.ROYN)M^I_L[*_FXF -MWZG^SLK^;B;?J?[.ROYN)M^I_L[*_FXFWZG^SLK^;B;?J?[.ROYN1U>I_L[* -M_FY'OE/]G97]W8Y\I_H[*_N['?E.]7=6]G<[\IWJ[ZSL[W;D.]7?6=G?[]4?V=E?[^4_V=E?W=CGRG^CLK^[L=^4[U=U;V -M=SORG>KOK.SO=N0[U=]9V=_MR'>JO[.RO]N1[U1_9V5_MZ>K5']G97^W)]^I -M_L[*_FY/OE/]G97]W9Y\I_H[*_N[/?E.]7=6]G=[\IWJ[ZSL[_;D.]7?6=G? -M[KOK.SO]N0[U=]9V=_MR7>JO[.ROSO05:J_L[*_.Y#O5']G97]W -M(-^I_L[*_NY`OE/]G97]W8%\I_H[*_N[`_E.]7=6]G<'\IWJ[ZSL[P[D.]7? -M6=G?'KOK.SO#N0[U=]9V=\=Z2K5WUG9WQW)=ZJ_L[*_.Y+O5']G -M97]W)-^I_L[*_NY(OE/]G97]W9%\I_H[*_N[(_E.]7=6]G='\IWJ[ZSL[X[D -M.]7?6=G?'KOK.SO3G25ZN^L[.].Y#O5WUG9WYW(=ZJ_L[*_.Y'O -M5']G97]W(M^I_L[*_NY$OE/]G97]W8E\I_H[*_N[$_E.]7=6]G]4?V=E?WZ2O5W5O9W9_*=ZN^L[._.Y#O5WUG9WYW)=ZJ_L[*_ -M.Y/O5']G97]W)M^I_L[*_NY,OE/]G97]W9E\I_H[*_N[,_E.]7=6]G=G\IWJ -M[ZSL[\[D.]7?6=G?GK -MQMWJZS('OG/5WWGJ[U:-N]6?RQSXSE5_YZF_@V<'OG/5WWGJ[V`.?.>JO_/4 -MW\$<^,Y5?^>IOX,Y\)VK_LY3?_>HS3WJ<^`[5_V=I_[N4;N]1YT[\)VK_LY3 -M?_>HH

^<]7?>>KO'C7N'G7NP'>N^CM/_1T\._"=J_[.4W\'<^`[5_V= -MI_X.YL!WKOH[3_W=Y1R=?^>JO_/4WSUN>^KO'C;O'"W=T_IVK -M_LY3?_>X>^KNG;>YIGR/?J?[.4W_WM''W=.&.SK]S -MU=]YZN^>-NZ>+MS1^7>N^CM/_=W3QMW3A3LZ_\Y5?^>IOX-G1[Y3_9VG_@[F -MR'>JO_/4W\$<^4[U=Y[Z.Y@CWZG^SE-_]ZS-/>MSY#O5WWGJ[YXU[IYU[LAW -MJK_SU-\]:]P]Z]R1[U1_YZF_>]:X>]:Y(]^I_LY3?P?/CGRG^CM/_1W,D>]4 -M?^>IOX,Y\IWJ[SSU=Y=S=/Z=J_[.4W_WO,T][W/D.]7?>>KOGC?NGB_>^CN8(]^I_LY3?P=SY#O5WWGJ[UZTN1=]CGRG^CM/_=V+QMV+SAWY -M3O5WGOJ[%XV[%YT[\IWJ[SSU=R\:=R\Z=^0[U=]YZN_@V9'O5'_GJ;^#.?*= -MZN\\]7>KO7K:YEWV.?*?Z.T_]W]FX>[EP1^??N>KO//5W+QMW+Q?NZ/P[5_V=I_X.GAWY3O5WGOH[ -MF"/?J?[.4W\'<^0[U=]YZN]@CGRG^CM/_=VK-O>JSY'O5'_GJ;][U;A[U;DC -MWZG^SE-_]ZIQ]ZIS1[Y3_9VG_NY5X^Y5YXY\I_H[3_T=/#ORG>KO//5W,$>^ -M4_V=I_X.YLAWJK_SU-]=SM'Y=Z[Z.T_]W56;N^ISY#O5WWGJ[ZX:=U<+=W3^ -MG:O^SE-_=]6XNUJXH_/O7/5WGOJ[J\;=U<(=G7_GJK_SU-_!LR/?J?[.4W\' -M<^0[U=]YZN]@CGRG^CM/_1W,D>]4?^>IOWO=YE[W.?*=ZN\\]7>O&W>O.W?D -M.]7?>>KO7C?N7G?NR'>JO_/4W[UNW+WNW)'O5'_GJ;^#9T>^4_V=I_X.YLAW -MJK_SU-_!'/E.]7>>^KO+.3K_SE5_YZF_>]/FWO0Y\IWJ[SSU=V\:=V\6[NC\ -M.U?]G:?^[DWC[LW"'9U_YZJ_\]3?O6G';D.]7?>>KO -M8(Y\I_H[3_T=S)'O5'_GJ;^#.?*=ZN\\]7=OV]S;/D>^4_V=I_[N;>/N;>>. -M?*?Z.T_]W=O&W=O.'?E.]7>>^KNWC;NWG3ORG>KO//5W\.S(=ZJ_\]3?P1SY -M3O5WGOH[F"/?J?[.4W]W.4?GW[GJ[[SJ[X+.OW/5WWG5WP6=?^>JO_.JOPLZ -M_\Y5?^=5?Q=T_IVK_LZK_B[H_#M7_9U7_5W0^7>N^CNO^KN@\^]<]7=>]7=! -MY]^YZN\\]7?OV];[/D>^4_V=I_[N?>/N?>>.?*?Z.T_]W?O&W?O.'?E.]7>> -M^KOWC;OWG3ORG>KO//5W\.S(=ZJ_\]3?P1SY3O5WGOH[F"/?J?[.4W]W.4?G -MW\7=#^"%!]RMV]RZSX'OOE_%W$7J[]:-N_7"'9U_%ZJ_B]3?K1MWZX4[.O\N -M5'\7J;];-^[6"W=T_EVH_BY2?P?/#GP7JK^+U-_!'/@N5'\7J;^#.?!=J/XN -M4G\'<^"[4/U=I/[.VISU.?!=J/XN4G]GC3OKW('O0O5WD?H[:]Q9YPY\%ZJ_ -MB]3?6>/..G?@NU#]7:3^#IX=^"Y4?Q>IOX,Y\%VH_BY2?P=SX+M0_5VD_NYR -MCLZ_"]7?1>KOO,UYGR/?J?XN4G_GC3M?N*/S[T+U=Y'Z.V_<^<(=G7\7JK^+ -MU-]YX\X7[NC\NU#]7:3^#IX=^4[U=Y'Z.Y@CWZG^+E)_!W/D.]7?1>KO8(Y\ -MI_J[2/U=M+GH<^0[U=]%ZN^B<1>=._*=ZN\B]7?1N(O.'?E.]7>1^KMHW$7G -MCGRG^KM(_1T\._*=ZN\B]7JOXO4WUW.T?EWH?J[2/W= -MT.:&/D>^4_U=I/YN:-P-"W=T_EVH_BY2?S]4?Q>IOQO; -MW-CGR'>JOXO4WXV-N[%S1[Y3_5VD_FYLW(V=._*=ZN\B]7=CXV[LW)'O5'\7 -MJ;^#9T>^4_U=I/X.YLAWJK^+U-_!'/E.]7>1^KO+.3K_+E1_%ZF_V[2Y39\C -MWZG^+E)_MVG<;1;NZ/R[4/U=I/YNT[C;+-S1^7>A^KM(_=VF<;=9N*/S[T+U -M=Y'Z.WAVY#O5WT7J[V".?*?ZNTC]'KO(O5WVS:W[7/D -M.]7?1>KOMHV[;>>.?*?ZNTC]W;9QM^W]4?Q>IO]LV[K:=._*=ZN\B]7?P -M[,AWJK^+U-_!'/E.]7>1^CN8(]^I_BY2?WKO(O5W4YN;^ASY3O5W -MD?J[J7$W+=S1^7>A^KM(_=W4N)L6[NC\NU#]7:3^;FK<30MW=/Y=J/XN4G\' -MSXY\I_J[2/T=S)'O5'\7J;^#.?*=ZN\B]71^KNY<3=W[LAWJK^+U-_-C;NY^4_U=I/X.GAWY3O5W -MD?H[F"/?J?XN4G\'<^0[U=]%ZN\NY^C\NU#]7:3^[D.;^]#GR'>JOXO4WWUH -MW'U8N*/S[T+U=Y'ZNP^-NP\+=W3^7:C^+E)_]Z%Q]V'ACLZ_"]7?1>KOX-F1 -M[U1_%ZF_@SGRG>KO(O5W,$>^4_U=I/X.YLAWJK^+U-]];',?^QSY3O5WD?J[ -MCXV[CYT[\IWJ[R+U=Q\;=Q\[=^0[U=]%ZN\^-NX^=N[(=ZJ_B]3?P;,CWZG^ -M+E)_!W/D.]7?1>KO8(Y\I_J[2/W=Y1R=?Q>JOXO4WWUJ1^KM/ -MC;M/"W=T_EVH_BY2?_>I1^KOK-G?=Y\AWJK^+U-]= -M-^ZN%^[H_+M0_5VD_NZZ<7>]<$?GWX7J[R+U=]>-N^N%.SK_+E1_%ZF_@V=' -MOE/]7:3^#N;(=ZJ_B]3?P1SY3O5WD?H[F"/?J?XN4G]WT^9N^ASY3O5WD?J[ -MF\;=3>>.?*?ZNTC]W4WC[J9S1[Y3_5VD_NZF<7?3N2/?J?XN4G\'SXY\I_J[ -M2/T=S)'O5'\7J;^#.?*=ZN\B]7<7<\,:KAKN?@`O/.#N+NC]TN?`=X/J[[Z_ -M\("[+XV[+^ME#GPWJ/YN2/W=EW9[7[XN<^"[0?5W0^KOOC3NOORYS('O!M7? -M#:F_@V='?]^V^BCZ"]_>I6_?_KBZ'1QO/]O!5^L=_%N_\.W?WCW\9QF\/9OG -M;PR.XVIW.?C?[0V/MV?SS,/J,-#[:O8S_89OEC?\K[P/V^I@_0]^]W]\;^[ZW;W?PB?209_[(_^UXT_'%P^WU6_/TK\'[S=O[B_U>7;O?TCQO;AK[=[ -M'-OC;GN#P'9?U^H__!PSBQAVCJ``` -` -end diff --git a/usr.bin/mkimg/tests/img-63x255-4096-pc98.qcow2.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-pc98.qcow2.gz.uu deleted file mode 100644 index be431e6cfaa7..000000000000 --- a/usr.bin/mkimg/tests/img-63x255-4096-pc98.qcow2.gz.uu +++ /dev/null @@ -1,22 +0,0 @@ -# $FreeBSD$ -begin 644 img-63x255-4096-pc98.qcow2.gz -M'XL("&/N+50``VEM9RTV,W@R-34M-#`Y-BUP8SDX+G%C;W(.!8*U*_G")2F%,L,;/`#/B9M\189O)XH42U[O6FU0XO$TH^Z9 -ME?9H(Z>J_$LIJY6IE>G4?JN.G\,%*ODPOM3AY[?OR_1U6'B8KH0H9J#9#;@1 -MZV_$@82K]'1`\[@D.V1P<(Z:@G(X(V8W-\#@KA:GI3L5HR41>`G0X\1B7)0? -M^/QHA+DP/RB='_+K9\]Q=*">SP]]?C2JD7!M%@=,5"?A-ED<,E%;"==G<8:) -MNI-PPLY-<):)V@LXG5'EB*N9*"WA((MKF"B4<":+:YDHR3N=]ZYCHB3O=-Z[ -M#1,E>:?SWFV9*,D[G?>N9Z(D[W3>NSLF2O(.!.]4Q.V8*,D[(-X]"KC'$;=G -MHB3O@'CW).">#CC-14G>`?'N6<`]CSBFWX'D'1#O7@3/=VXIUF^AU(WB'Q[EU@51'']#N4O$/B -MG0XXB#BFWZ'D'1+O,.!,Q#']#B7OD'AG`ZZ..*;?H>0=$N^:@&LCCNEW*'F' -MQ+LNX-Y''-/O4/(.B7!6$?0ZXFXAC^IV1O#/$NR\!]W7``1%=5_!5PMY,]"V7/GR:>CS5S -MEP=F@.U#@',9>EQ7=,+63]AIL&'N\L#A9CE^#\"3,`\`6JLV4^`O/V'KA>F, -MZ@TWK[!/M#SA=;I^MK0PUI6DZ/H!^X3V'QDVN\(9MOX'A\;M6UNK%NZ;X9_; -MWU.EC[AB)?$X^0>','!.>&BR$]PZP;DSRS[YSU0VU>O8X-._$]QJ&9O]$3?[ -M@X-[BMIQ`^)D;5E9VJ%=G:^TSN[P[IZQSM_?Y/`]U%?%_)AV!:/ISN2GIM-U -MYX+A^9W4P^$@,UTUQKES05K/40DSJ[>:9M<7+H:F.^.>.]=!QCO7XZ!L(^A. -CG>5HH.OBD[L\RNV=K]%?XXY@5S&SUH!K=3":&J0SM%KXS -M3AIC"@J[=@T+KEQPP5V5^?Q('`KY7&$]9%;8.(6ZAM+0%S3TKL*_Q^]*H<=E -M"XG'T1EN%AR29P-WBW"5,8[1RCC9T$M40_B)YQ'NZM\9IX[4F9,0PY9AUUF= -M-UD:T_F^.,Z0`V0%T00;<>`27[STM:D,8NX>Z$/J;F=Q-5\O(QR=N`N.>UI< -M%$\6PI/3NZ;J^LS!D.N;\>;-M1!^\9&\]&'@".I=.TJ3WO>SVC%:;2=-VL^VA!__XY0DHB#J=+J-C,/`^ -M?M\/(#!F?P"J!-6#ZD!):E<"U!&J&L!TNAO')W>O,+1OKUW[/`X=#AU(5F15(J@F^4[?`!-6 -M'9$>SOB\5%>FZF8K^YV^A[(/1I2ANJ(XA3AAK,QXNB4T:HR/OZ.7J"/$1>HD -M6U@%,M>"RF9GUW!JS^H:W,W!Y<*6BBF,RCP9*`X54MN4C8]#^IH5>C6.C:=E9F+1=<+NS#/P#O@)2W';%JW`N"47YCU'5,9&+F[HP]2=S7A -MJG@\#W!XP5V(<8W;>?W(*(47HG>;JFLS)Z-9SHPOSER"Q#/7XC#O0J#'E<54 -M(*WBR7.[8_A9Q)<%HMN,LNUNZ':/;`J%`V93*-S^D5&A;G>+[=HJ5-(F)=-1 -I@7`9CPJ$RWA4(%S&HP+A,AX5")?QJ$"XK$<%`S2U=_@'6B6GGU\.```` -` -end diff --git a/usr.bin/mkimg/tests/img-63x255-4096-pc98.vhdf.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-pc98.vhdf.gz.uu deleted file mode 100644 index dd1a6651e606..000000000000 --- a/usr.bin/mkimg/tests/img-63x255-4096-pc98.vhdf.gz.uu +++ /dev/null @@ -1,15 +0,0 @@ -# $FreeBSD$ -begin 644 img-63x255-4096-pc98.vhdf.gz -M'XL(",`EAE4``VEM9RTV,W@R-34M-#`Y-BUP8SDX+G9H9&8N;W5T`*V5.V^# -M,!#']WR*D[IE0/;Y`2Q!JI2]2YN9$(BBJNW2H0,?OGY2VT`>E3$A)H=_^=_# -M!R'V`.`(I%VXKAO&YR(>XV:[,30Z/`84`MHY\%4!#0ZUOII#QT'-DA/88&9T -M9A@+=S3NV^.H,LY!;M6J8<(5$\ZYRS/'#\E5(8\K+/O,"BNC4)3`!0@)%=ZK -M\+!_2Q1:7+:46!S>PGG!KG@6<$V`8\HX!$^&Q08=!=:[FW`>X';VXW'\FCH5 -M"=(O&5:=%7F+I5(C7A?F&6@/E`&IG`UCX)1?^--7SV5@Y.X5?3!WM]6X,GZ> -M!CB\X2[$N*/&!?F,4G@C>KNYNBYS,FBZ,^[R^/OON^_(39-C@ -MJ&T&BZ=>CTSO%ED"MOI/Y$G/`WU/^_/V\G'V.-^J?$=2FTVM8@CRF+A+4W#,Z?T4UD6&I5!B=(LNJ_N;4X -0F;E4U(MW\PM:UWFK$@D````` -` -end diff --git a/usr.bin/mkimg/tests/img-63x255-4096-pc98.vmdk.gz.uu b/usr.bin/mkimg/tests/img-63x255-4096-pc98.vmdk.gz.uu deleted file mode 100644 index c3521af3e482..000000000000 --- a/usr.bin/mkimg/tests/img-63x255-4096-pc98.vmdk.gz.uu +++ /dev/null @@ -1,84 +0,0 @@ -# $FreeBSD$ -begin 644 img-63x255-4096-pc98.vmdk.gz -M'XL("&7N+50``VEM9RTV,W@R-34M-#`Y-BUP8SDX+G9M9&LN;W5T`*U<78_< -MQA%\]Z\8G-_RL&`MOY8/LA-'#A`$`8S8L5]#+LGX$%L23H<@`O;'AT-.S16Y -MI$C[^K0GL,7NVNZ>W;Y3=6&39/IR+FM"]QY>#4#X!?NK>/'__CWG8?KT^/'Y[?A_S._FP'YZSP -M_L75(PR%E86_\#<\7.4ABLZEK4OA;[O;TU\>?^E._^V>/CZ^?_<&+/?LSS9+ -M75;Y=+Q_\O*8&?Y)$E?`/X>[_?FO;]^$5VYR^E`_$7&='*/?1YNMZ'DL7?7IZY^[G[X -M]*%[\_#K^W>Q=_YL?@R-BIU>>JA0FF^?;E']"^;\=3<[9?'YY\?K]\/ -M97[L'DY?.L(5OG?#`5Y"7E/50TBQ>;)#VK=O__<\U.O:<+*/A!N3&(L8GCL_ -MN[ST6,,!ID/OTM2E%Y>.\$/"0R49O).[O7]W^L=/#D5ZR=SWW_WI'X2[#'"# -MYY#@$#(4-*LIG^K/ER]+=_O^6_?@B_SAYVY\!1*NFMYFWGDZ!XSFV5^$KDWP -M?HAE_L9XLNYM_5R[;^J/W>G+MV^_B2=;^V*S\3&DUGF48H+VK^^QG4/CII.> -M#GH\BK9M3G5;?WCNGOSQQJ-H_*NU#97Z8\U>CG'^/.5X4KU_Q;C;&_?PV`YG -MZF'_W;W_E7#7Z64\Y.%?$M48F/J+X=4SPG?A&:97C#\F#]<]/WTZ73_]\OBN -M'=YH[@WAVJEW0SK#:4Y)Q9R62<6G'7KW@)?4!FS"=;Y%4U*7\,88L*8\7KJ0 -M#H_A;9HT87IH(=>3$<1$OMT^MA=`UR: -MA`/L9\V9&5/&4T'Z#/[Y_&U(KT0>=QNOQ9]MIYG-W]2"U_)^`$9YU? -MD>S]/.,CG0$Z`4M>\BM\?IEXYAI5B%'.X(;?)D[?#=__&KX_")Q_B5W$L]*H -M6HSF2/<*__/B*IZM1G5B](?@LM`B_H("N1Z;2B/5&Q'.+7J7A][1,]>H0HQR -M!K?5NR+TCIZ51M5B-*O9+8LM0^_HV6I4)T9_".X2>L=?P"#78^]HI,G:;WG+ -MWE6A=_3,-:H0HYS!;?6N#KVC9Z51M1C-:G;+8IO0.WJV&M6)T1^"NX;><:Q` -MKL?>T4CUQF;OVM`[>N8:58A1SN"V>M>%WM&STJA:C&8UNV6Q?>@=/5N-ZL3H -MC\"52>A=)KWC]=@[&JG>V.I=R7E'SURC"C'*&=Q&[TK..WI6&E6+T:QFMRR6 -M\XZ>K49U8O2'X#COT4CUQF;O.._HF6M4(48Y@]OJ'><=/2N-JL5H -M5K-;%LMY1\]6HSHQ^D-PG'>%]([78^]HI'ICLW><=_3,-:H0HYS!;?6.\XZ> -ME4;58C2KV2V+Y;RC9ZM1G1C](3C.._[J!+D>>T.\HV>N4848Y0QN -MJW><=_2L-*H6HUG-;EDLYQT]6XWJQ.B/P%V2T+N+]([78^]HI'ICJW<7SCMZ -MYAI5B%'.X#9Z=^&\HV>E4;48S6IVRV(Y[^C9:E0G1G\(CO.NDM[Q>NP=C51O -M;/:.\XZ>N4858I0SN*W><=[1L]*H6HQF-;MEL9QW]&PUJA.C/P3'>$&N -MQ][12/7&9N\X[^B9:U0A1CF#V^H=YQT]*XVJQ6A6LUL6RWE'SU:C.C'Z0W"< -M=V0M(==C[VBD>F.S=YQW],PUJA"CG,%M]8[SCIZ51M5B-*O9+8OEO*-GJU&= -M&/T1N"H)O;M*[W@]]HY&JC>V>E=QWM$SUZA"C'(&M]&[BO..GI5&U6(TJ]DM -MB^6\HV>K49T8_2$XSKM6>L=KLMJQ=^T=W+)WG'?TS#6J$*.K49T8_2$XSKM.>L?KL74?/2J-J,9K5[);%<=/7.-*L0H -M9W!;O>.\HV>E4;48S6IVRV(Y[^C9:E0G1G\$KDZFWL6=&^3:]RX:J=[8ZET= -MYEWTS#6J$*.\@_!UV^;LZS#L(?P?E[R#\W4IVRV+#O(/P=U#^#L+? -M'8`+\P["WT'Y.PA_AUW^K@[S#L+?0?D["'^'7?ZN#O,.PM]!^3L(?[>2W;+8 -M,.\@_!V4OX/P=P?@PKR#\'=0_@["WV&7OZO#O(/P=U#^#L+?89>_J\.\@_!W -M4/X.PM^M9+\@_-T^7).$W@E_!^7O(/P==OF[AO-.^#LH?P?A -M[[#+WS6<=\+?0?D["'^WDMVR6,X[X>^@_!V$OSL`QWDG_!V4OX/P=]CE[QK. -M.^'OH/P=A+_#+G_7<-X)?P?E[R#\W4IVRV(Y[X2_@_)W$/[N`!SGG?!W4/X. -MPM]AE[]K..^$OX/R=Q#^#KO\7<-Y)_P=E+^#\'_VX:Y)Z)WP=U#^#L+?89>_NW+>"7\'Y>\@_!UV^;LKYYWP=U#^#L+? -MK62W+);S3O@[*'\'X>\.P''>"7\'Y>\@_!UV^;LKYYWP=U#^#L+?89>_NW+> -M"7\'Y>\@_-U*=LMB.>^$OX/R=Q#^[@`_NW+>"7\'Y>\@ -M_!UV^;LKYYWP=U#^#L+?K62W+);S3O@[*'\'X>\.P''>"7\'Y>\@_!UV^;LK -MYYWP=U#^#L+?89>_NW+>"7\'Y>\@_-U*=LMB.>^$OX/R=Q#^;A^N34+OA+^# -M\G<0_@Z[_%W+>2?\'92_@_!WV.7O6LX[X>^@_!V$OUO);EDLYYWP=U#^#L+? -M'8#CO!/^#LK?0?@[[/)W+>>=\'=0_@["WV&7OVLY[X2_@_)W$/YN);MEL9QW -MPM]!^3L(?W<`CO-.^#LH?P?A[[#+W[6<=\+?0?D["'^'7?ZNY;P3_@[*WT'X -MNY7LEL5RW@E_!^7O(/S=`3C..^'OH/P=A+_#+G_7]6LEL6RWDG_!V4OX/P=_MP73+U+DKP(->CC)%&JC=N8].&;S=\ -M)^X%+LR[547?RC_%WKGU[.ZT^,?@[HN=Y(88Y89Q$S&5^_L`)SAC.20NH>O[ -M@$?DD(CK)8=$7)?S\2HY).*ZG(]7R2$1U^4F;R"$1U^4F;R"$1U^4F;R"$1U^4F;R"$1U^4F5.GUUZ__?V -MC=LWI_F?"(C^MP'FN:OO`?\9"L[&3Q.N,G?-UNI*I^/$=L%?S_J7G8WEFEEF -MW+\B^6PBOSW#LC/.\#)FF)?^@W;SPEW.1S/\Z=L?%QE.<&9',L'MOD,B#]IO -MP7TM$*0_\\[SP'C^;J7_*K[-,ZSJ-%.][ZZS^YJ?!A8OC,.OG,]R/R=.\&=;0=!-4Z62?=Q__?VC=MWI_F?"3`+ -3@&8=S/Q'DR1?_!^)[K:L<6`````` -` -end diff --git a/usr.bin/mkimg/tests/img-63x255-512-pc98.qcow.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-pc98.qcow.gz.uu deleted file mode 100644 index 75e7cd548495..000000000000 --- a/usr.bin/mkimg/tests/img-63x255-512-pc98.qcow.gz.uu +++ /dev/null @@ -1,126 +0,0 @@ -# $FreeBSD$ -begin 644 img-63x255-512-pc98.qcow.gz -M'XL("%?N+50``VEM9RTV,W@R-34M-3$R+7!C.3@N<6-O=RYO=70`K9W;CA19 -MMX/0^`_.R&9G?N[JCU33`:�" -M%?DI*VOU`LTL;=;KG]]6J]%6PV8US*OS?O7]Y^V[K>[]Y.'WU;?_^H__?'?_ -MV[<_?H[9^B^N2C_?GI:Y!UO_U^?\QU6'U7K^A;GOWXWF[MU=_(V[N_=F+^>N -M_OCY9ODZ5X/Q8'#5YM;M_DP\O>'7[N]+>KOV\^G]OK?KXNV.:G#S8/!KF_M7 -MNS__6[#\TOW]S<]WBX-_+O:KW=XE?A"LSO"TQ?:UV5NCU=MU-Q# -M[OYUP=T!KQ+<6+. -M*^Z,C.R*.Z^X,_*=*^Z\XL[(=ZZX\XH[(]^YXLXK[HQ\YXH[K[@S\ITK[KSD -MCGP7BKLHN2/?A>(N2N[(=Z&XBY([\ETH[J+DCGP7BKLHN2/?A>(N2N[(=Z&X -MBY([\ETH[J+BSNFJ07$W5-PY^6Y0W`T5=TZ^&Q1W0\6=D^\&Q=U0<>?DNT%Q -M-U3<.?EN4-P-%7=.OAL4=T/%G9/O!L7=4')'OAL5=V/)'?EN5-R-)7?DNU%Q -M-Y;]&Q=U8^&Q5W8\D=^6Y4W(TE=^2[47$WEMR1[T;%W5AQ%W351G&W -MJ;@+\MU&<;>IN`ORW49QMZFX"_+=1G&WJ;@+\MU&<;>IN`ORW49QMZFX"_+= -M1G&WJ;@+\MU&<;MN!OHJDEQ-U7<#>2[27$W5=P- -MY+M)<3=5W`WDNTEQ-U7<#>2[27$W5=P-Y+M)<3=5W`WDNTEQ-U7<#>2[27$W -ME=R1[^[^*SR\4'%'OIL5=W/)'?EN5MS-)7?DNUEQ-Y?]FQ=U<^FQ5W -M<\D=^6Y6W,TE=^2[67$W5]R-=-5.<;>KN!O)=SO%W:[B;B3?[11WNXJ[D7RW -M4]SM*NY&\MU.<;>KN!O)=SO%W:[B;B3?[11WNXJ[D7RW4]SM2N[(=W?_-Q1> -MJ+@CW^T5=_N2._+=7G&W+[DCW^T5=_N2._+=7G&W+[DCW^T5=_N2._+=7G&W -M+[DCW^T5=_N*NPU==5#<'2KN-N2[@^+N4'&W(=\=%'>'BKL-^>Z@N#M4W&W( -M=P?%W:'B;D.^.RCN#A5W&_+=07%WJ+C;D.\.BKM#R1WY[JBX.Y;^.BKMC -MR1WY[JBX.Y;^.BKMCR1WY[JBX.Y;^.BKMCR1WY[JBX.Y;^.BKMC -MQ=V6KEHZH,L7"NZVY+N3XNY4<;*NRWY[J2X.U7<;)N -M2[X[*>Y.%7=;\MU)<7>JN-N2[TZ*NU/)'?GNK+@[E]R1[\Z*NW/)'?GNK+@[ -ME]R1[\Z*NW/)'?GNK+@[E]R1[\Z*NW/)'?GNK+@[E]R1[\Z*NW/%W017V=T/ -MX(6"NPE\9RHXM"HX]`E\9RHXM'7%W02^L[7@SG)_=\'=!+XSU=]9V=]-X#M3 -M_9V5_=T$OC/5WUG9WTW@.U/]G97]W02^,]7?6=G?3>`[4_V=E?W=!+XSU=]9 -MV=]-X#M3_9V5_=T$OC/5WUG9WTW@.U/]G97]W02^,]7?6=G?3>`[4_V=E?W= -M3%>I_L[*_FXFWZG^SLK^;B;?J?[.ROYN)M^I_L[*_FXFWZG^SLK^;B;?J?[. -MROYN)M^I_L[*_FXFWZG^SLK^;B;?J?[.ROYN)M^I_L[*_FXFWZG^SLK^;B;? -MJ?[.ROYN)M^I_L[*_FXFWZG^SLK^;B;?J?[.ROYN)M^I_L[*_FY'5ZG^SLK^ -M;D>^4_V=E?W=CGRG^CLK^[L=^4[U=U;V=SORG>KOK.SO=N0[U=]9V=_MR'>J -MO[.RO]N1[U1_9V5_MR/?J?[.ROYN1[Y3_9V5_=V.?*?Z.RO[NQWY3O5W5O9W -M._*=ZN^L[.]VY#O5WUG9W^W(=ZJ_L[*_VY'O5']G97^WIZM4?V=E?[KOK.SO]N0[U=]9V=_M -MR7>JO[.RO]N3[U1_9V5_MR??J?[.ROYN3[Y3_9V5_=V>?*?Z.RO[NSWY3O5W -M5O9W>_*=ZN^L[._VY#O5WUG9W^W)=ZJ_L[*_.]!5JK^SLK\[D.]4?V=E?W<@ -MWZG^SLK^[D"^4_V=E?W=@7RG^CLK^[L#^4[U=U;V=P?RG>KOK.SO#N0[U=]9 -MV=\=R'>JO[.ROSN0[U1_9V5_=R#?J?[.RO[N0+Y3_9V5_=V!?*?Z.RO[NP/Y -M3O5W5O9W!_*=ZN^L[.\.Y#O5WUG9WQWI*M7?6=G?'KOK.SOCN0[ -MU=]9V=\=R7>JO[.ROSN2[U1_9V5_=R3?J?[.RO[N2+Y3_9V5_=V1?*?Z.RO[ -MNR/Y3O5W5O9W1_*=ZN^L[.].=)7J[ZSL[T[D.]7?6=G?G]4 -M?V=E?WKOK.SO -M3N0[U=]9V=^=R'>JO[.ROSN1[U1_9V5_=R+?J?[.RO[N1+Y3_9V5_=V)?*?Z -M.RO[NQ/Y3O5W5O9W9[I*]7=6]G=G\IWJ[ZSL[\[D.]7?6=G?GKO -MK.SOSN0[U=]9V=^=R7>JO[.ROSN3[U1_9V5_=R;?J?[.RO[N3+Y3_9V5_=V9 -M?*?Z.ZOZNUC#57[W`WCA`7=WG*SZ'/C.57_GJ;];M;W5>ID#W[GJ[SSU=ZO& -MW>KK,@>^<]7?>>KO5HV[U9_+'/C.57_GJ;^#9P>^<]7?>>KO8`Y\YZJ_\]3? -MP1SXSE5_YZF_@SGPG:O^SE-_]ZC-/>ISX#M7_9VG_NY1N[U'G3OPG:O^SE-_ -M]ZAQ]ZAS![YSU=]YZN\>->X>=>[`=Z[Z.T_]'3P[\)VK_LY3?P=SX#M7_9VG -M_@[FP'>N^CM/_=WE')U_YZJ_\]3?/6YSC_L<^4[U=Y[ZN\>-N\<+=W3^G:O^ -MSE-_][AQ]WCACLZ_<]7?>>KO'C?N'B_KO//5W,$>^ -M4_V=I_X.YLAWJK_SU-_!'/E.]7>>^KLG;>Y)GR/?J?[.4W_WI''WI'-'OE/] -MG:?^[DGC[DGGCGRG^CM/_=V3QMV3SAWY3O5WGOH[>';D.]7?>>KO8(Y\I_H[ -M3_T=S)'O5'_GJ;^[G*/S[USU=Y[ZNZ=M[FF?(]^I_LY3?_>T>KOGC7NGG7NR'>J -MO_/4WSUKW#WKW)'O5'_GJ;][UKA[UKDCWZG^SE-_!\^.?*?Z.T_]'KO//5WEW-T_IVK_LY3?_>\S3WO<^0[U=]YZN^>-^Z>+]S1^7>N -M^CM/_=WSQMWSA3LZ_\Y5?^>IOWO>N'N^<$?GW[GJ[SSU=_#LR'>JO_/4W\$< -M^4[U=Y[Z.Y@CWZG^SE-_!W/D.]7?>>KO7K2Y%WV.?*?Z.T_]W8O&W8O.'?E. -M]7>>^KL7C;L7G3ORG>KO//5W+QIW+SIWY#O5WWGJ[^#9D>]4?^>IOX,Y\IWJ -M[SSU=S!'OE/]G:?^[G*.SK]SU=]YZN]>MKF7?8Y\I_H[3_W=R\;=RX4[.O_. -M57_GJ;][V;A[N7!'Y]^YZN\\]7'?E.]7>>^CN8 -M(]^I_LY3?P=SY#O5WWGJ[V".?*?Z.T_]W:LV]ZK/D>]4?^>IOWO5N'O5N2/? -MJ?[.4W_WJG'WJG-'OE/]G:?^[E7C[E7GCGRG^CM/_1T\._*=ZN\\]7JO_/4WUW.T?EWKOH[3_W=59N[ZG/D.]7?>>KOKAIW5PMW=/Z= -MJ_[.4W]WU;B[6KBC\^]<]7>>^KNKQMW5PAV=?^>JO_/4W\&S(]^I_LY3?P=S -MY#O5WWGJ[V".?*?Z.T_]']WF7O-^Y>=^[(=ZJ_\]3?O6[[]4?^>IOX-G1[Y3_9VG_@[FR'>J -MO_/4W\$<^4[U=Y[ZN\LY.O_.57_GJ;][T^;>]#GRG>KO//5W;QIW;Q;NZ/P[ -M5_V=I_[N3>/NS<(=G7_GJK_SU-^]:=R]6;BC\^]<]7>>^CMX=N0[U=]YZN]@ -MCGRG^CM/_1W,D>]4?^>IOX,Y\IWJ[SSU=V_;W-L^1[Y3_9VG_NYMX^YMYXY\ -MI_H[3_W=V\;=V\X=^4[U=Y[ZN[>-N[>=._*=ZN\\]7?P[,AWJK_SU-_!'/E. -M]7>>^CN8(]^I_LY3?WKOO.KO@LZ_<]7?>=7?!9U_YZJ_\ZJ_"SK_ -MSE5_YU5_%W3^G:O^SJO^+NC\.U?]G5?]7=#Y=Z[Z.Z_ZNZ#S[USU=U[U=T'G -MW[GJ[SSU=^_;UOL^1[Y3_9VG_NY]X^Y]YXY\I_H[3_W=^\;=^\X=^4[U=Y[Z -MN_>-N_>=._*=ZN\\]7?P[,AWJK_SU-_!'/E.]7>>^CN8(]^I_LY3?W^^7\7<1>KOUHV[]<(=G7\7JK^+U-^M&W?KA3LZ_RY4 -M?Q>IOULW[M8+=W3^7:C^+E)_!\\.?!>JOXO4W\$<^"Y4?Q>IOX,Y\%VH_BY2 -M?P=SX+M0_5VD_L[:G/4Y\%VH_BY2?V>-.^O<@>]"]7>1^CMKW%GG#GP7JK^+ -MU-]9X\XZ=^"[4/U=I/X.GAWX+E1_%ZF_@SGP7:C^+E)_!W/@NU#]7:3^[G*. -MSK\+U=]%ZN^\S7F?(]^I_BY2?^>-.U^XH_/O0O5WD?H[;]SYPAV=?Q>JOXO4 -MWWGCSA?NZ/R[4/U=I/X.GAWY3O5WD?H[F"/?J?XN4G\'<^0[U=]%ZN]@CGRG -M^KM(_5VTN>ASY#O5WT7J[Z)Q%YT[\IWJ[R+U=]&XB\X=^4[U=Y'ZNVC<1>>. -M?*?ZNTC]'3P[\IWJ[R+U=S!'OE/]7:3^#N;(=ZJ_B]3?7<[1^7>A^KM(_=W0 -MYH8^1[Y3_5VD_FYHW`T+=W3^7:C^+E)_-S3NAH4[.O\N5'\7J;\;&G?#PAV= -M?Q>JOXO4W\&S(]^I_BY2?P=SY#O5WT7J[V".?*?ZNTC]']4?Q>I -MOX-G1[Y3_5VD_@[FR'>JOXO4W\$<^4[U=Y'ZN\LY.O\N5'\7J;_;M+E-GR/? -MJ?XN4G^W:=QM%N[H_+M0_5VD_F[3N-LLW-'Y=Z'ZNTC]W:9QMUFXH_/O0O5W -MD?H[>';D.]7?1>KO8(Y\I_J[2/T=S)'O5'\7J;^#.?*=ZN\B]7?;-K?M<^0[ -MU=]%ZN^VC;MMYXY\I_J[2/W=MG&W[=R1[U1_%ZF_VS;NMIT[\IWJ[R+U=_#L -MR'>JOXO4W\$<^4[U=Y'Z.Y@CWZG^+E)_=SE'Y]^%ZN\B]7=3FYOZ'/E.]7>1 -M^KNI<3]4?Q>IOX,Y\IWJ[R+U=S!'OE/]7:3^;FYSJOXO4W\V-N[ES1[Y3_5VD_@Z>'?E.]7>1 -M^CN8(]^I_BY2?P=SY#O5WT7J[R[GZ/R[4/U=I/[N0YO[T.?(=ZJ_B]3??6C< -M?5BXH_/O0O5WD?J[#XV[#PMW=/Y=J/XN4G_WH7'W8>&.SK\+U=]%ZN_@V9'O -M5'\7J;^#.?*=ZN\B]7JOXO4WWUL1^KN/ -MC;N/G3ORG>KO(O5W'QMW'SMWY#O5WT7J[SXV[CYV[LAWJK^+U-_!LR/?J?XN -M4G\'<^0[U=]%ZN]@CGRG^KM(_=WE')U_%ZJ_B]3??6ISG_H<^4[U=Y'ZNT^- -MNT\+=W3^7:C^+E)_]ZEQ]VGACLZ_"]7?1>KO/C7N/BWKO(O5W,$>^4_U=I/X.YLAWJK^+U-_!'/E.]7>1^KO/;>YSGR/?J?XN4G_W -MN7'WN7-'OE/]7:3^[G/C[G/GCGRG^KM(_=WGQMWGSAWY3O5WD?H[>';D.]7? -M1>KO8(Y\I_J[2/T=S)'O5'\7J;^[G*/S[T+U=Y'ZN^LV=]WGR'>JOXO4WUTW -M[JX7[NC\NU#]7:3^[KIQ=[UP1^??A>KO(O5WUXV[ZX4[.O\N5'\7J;^#9T>^ -M4_U=I/X.YLAWJK^+U-_!'/E.]7>1^CN8(]^I_BY2?W?3YF[Z'/E.]7>1^KN; -MQMU-YXY\I_J[2/W=3>/NIG-'OE/]7:3^[J9Q=].Y(]^I_BY2?P?/CGRG^KM( -M_1W,D>]4?Q>IOX,Y\IWJ[R+U=Q=SPQJN&NY^`"\\X.XNZ/W2Y\!W@^KOOK_P -M@+LOC;LOZV4.?#>H_FY(_=V7=GM?OBYSX+M!]7=#ZN^^-.Z^_+G,@>\&U=\- -MJ;^#9T=_W[;Z*/H+W]ZE;]_^N+H='&\_V\%7ZQW\6[_P[=_>/?QG&;P]F^=O -M#([C:G_K-=SC=WN&X70WC:MRL)O_5._S??_^?=(<_YW[;1_)S#G3P<.[NAI?? -M.B_F;N[-_=#!^=ZOO`_;ZF#]#W[W?WQO[OK=O=_")])!G_LASA.](-_L;];! -M=''DY/W/^?8LYUBM[_[7C3\<7#[?5;\_2OP?O-V_N+_5Y=N]_2/&]N&OMWMS -M7KS=U<.YVS]BW/L\'WR$Q=.[OKP[^BON_\F'<7%PXB]^Y?X8>?B5^W/.?Z\( -IYENS_/CM=`?_UB]\^_KNX3\_!XX/`=E_7ZC_\'#.+&':.H```` -` -end diff --git a/usr.bin/mkimg/tests/img-63x255-512-pc98.qcow2.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-pc98.qcow2.gz.uu deleted file mode 100644 index 2d392cdc5a48..000000000000 --- a/usr.bin/mkimg/tests/img-63x255-512-pc98.qcow2.gz.uu +++ /dev/null @@ -1,22 +0,0 @@ -# $FreeBSD$ -begin 644 img-63x255-512-pc98.qcow2.gz -M'XL("%?N+50``VEM9RTV,W@R-34M-3$R+7!C.3@N<6-O=S(N;W5T`*V8VW+3 -M,!!`W_,5X@X%@K4K^<(E*84RPQL\`,^)FWQ%AF\GBA1+7N]:;5#B\32C[IF5 -M]F@CIZK\2RFKE:F5Z=1^JXZ?PP4J^3"^U.'GM^_+]'58>)BNA"AFH-D-N!'K -M;\2!A*OT=$#SN"0[9'!PCIJ"E.Q6C)1%X"=#CQ&)6(JYDH+>$@BVN8*)1P)HMKF2C).YWWKF.B).]TWKL- -M$R5YI_/>;9DHR3N=]ZYGHB3O=-Z[.R9*\@X$[U3$[9@HR3L@WCT*N,<1MV>B -M).^`>/Y9P#V/.*;?@>0=$.]>!-S+B&/Z'4C>`?'N5(?'N76!5$0=$N\PX$S$,?T.)>^0>&<#KHXXIM^AY!T2[YJ`:R..Z78?$ -MNR[@WD<^0>/[RP.%F.7X/P),P#P!:JS93X"\_8>N%Z8SJ -M#3>OL$^T/.%UNGZVM##6E:3H^@'[A/8?&3:[PAFV_@>'QNU;6ZL6[IOAG]O? -M4Z6/N&(E\3CY!XFTW7G -M@N'YG=3#X2`S737&N7-!6L]1"3.KMYIFUQ\!P,C5+VT29/>][*[9VOT5_CCER\M(WZT":"(&7CR#C.,$+X!BB"Z -MC7'?,-U+WJ?BJW`T.7X&U!I="OPQ0(+<)4QCM'*.-G02U1#^(GG$>[JWQFGCM29DQ##EF'769TW -M61K3^;XXSI`#9`71!!MQX!)?O/2UJ0QB[A[H0^IN9W$U7R\C')VX"XY[6EP4 -M3Q;"D].[INKZS,&0ZYOQYLVU$'YS/8[R%H+651:3@;:*)^.^8?HN>?=`%8#9 -/3M!6/B&*?U("+YGG!@`` -` -end diff --git a/usr.bin/mkimg/tests/img-63x255-512-pc98.vhd.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-pc98.vhd.gz.uu deleted file mode 100644 index eada46f7974d..000000000000 --- a/usr.bin/mkimg/tests/img-63x255-512-pc98.vhd.gz.uu +++ /dev/null @@ -1,18 +0,0 @@ -# $FreeBSD$ -begin 644 img-63x255-512-pc98.vhd.gz -M'XL(""TUQ%4``VEM9RTV,W@R-34M-3$R+7!C.3@N=FAD+F]U=`"ME\]OI"`4 -MQ^_S5[QD;ST8>`(ZET[2I/>][/:,5IM)TW:S[:$'__CE"2B(.ITNHV,P\#Y^ -MWP\@,&9_`*H$U8/J0$EJ5P+4$:H:P'2Z&\A -M56Q.]EB",!^I`#5]1#U2&P:/*7[H(\1%ZB1; -M6`4RUX+*9F?7<&K/ZAK3OGK;772E@E-BK0)!I;WG+HR4MR5NI53^*WHJMA.N88+`I._` -MT?TX>C,*0GV*LYV8;R=C4Y\F?<+,,[WRW.X8[HKXFH!-?QU02M`I\)=WN"5] -M1P&M6(N[F[))Q'#_>^5&5SK;"FQ.+R$\X+#]3[&G0)<:2?<3`F*#5H.9>=>PG:`N[5_CQ-[ -MZFA5Z-8Z-IV5F8M%UPN[,,_`.^`E+<=L6K<"X)1?F/4=4QD8N;NC#U)W->&J -M>#P/<'C!78AQC=MY_<@HA1>B=YNJ:S,GHUG.C"_.7(+$,]?B,.]"H,>5Q50@ -MK>+)<[MC^%G$EP6BVXRR[6[H=H]L"H4#9E,HW/Z14:%N=XOMVBI4TB8ETU&! -H%0@7,:C`N$R'A4(E_&H0+BL1P4#-+5W^`=:):>?7PX````` -` -end diff --git a/usr.bin/mkimg/tests/img-63x255-512-pc98.vhdf.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-pc98.vhdf.gz.uu deleted file mode 100644 index ffafcc7b102e..000000000000 --- a/usr.bin/mkimg/tests/img-63x255-512-pc98.vhdf.gz.uu +++ /dev/null @@ -1,15 +0,0 @@ -# $FreeBSD$ -begin 644 img-63x255-512-pc98.vhdf.gz -M'XL("*(EAE4``VEM9RTV,W@R-34M-3$R+7!C.3@N=FAD9BYO=70`K94[;X,P -M$,?W?(J3NF5`]OD!+$&JE+U+FYD0B**J[=*A`Q^^?E+;0!Z5,2$FAW_YW\,' -M(?8`X`BD7;BN&\;G(A[C9KLQ-#H\!A0"VCGP50$-#K6^FD/'0<&N>!9P38!CRC@$3X;%!AT%UKN;8NE4B->%^89:`^4`:F<#6/@E%_XTU?/96#D[A5],'>WU;@R?IX& -M.+SA+L2XH\8%^8Q2>"-ZN[FZ+G,R:+HS[MRY&A+O7(O#O(V@-IU%5:#NXK/K -MNF%\*>)A@=P!;9"`'D#U(H>:IUAVU._1-%K0AR?G.T'.)X,SI_13618:E4&)TBRZK^YM3B9 -/N534BW?S"UK7>:L2"0`` -` -end diff --git a/usr.bin/mkimg/tests/img-63x255-512-pc98.vmdk.gz.uu b/usr.bin/mkimg/tests/img-63x255-512-pc98.vmdk.gz.uu deleted file mode 100644 index b2d29cc5eeeb..000000000000 --- a/usr.bin/mkimg/tests/img-63x255-512-pc98.vmdk.gz.uu +++ /dev/null @@ -1,84 +0,0 @@ -# $FreeBSD$ -begin 644 img-63x255-512-pc98.vmdk.gz -M'XL("%CN+50``VEM9RTV,W@R-34M-3$R+7!C.3@N=FUD:RYO=70`K5Q=C]S& -M$7SWKQB'0T[-%;FD -M2/OZM">PQ>[:[I[=OE-U89-D^G(N:UR6N:QU>>$2N.&?IH=+TA=C>&3QQNUO -M;__^XXE??SR=;E],8/!1$H)$X<28/<_MM/@BW/ES4;,;P^.\"Y?ZJ.8N,,"= -M-VYLP@W]<.>U$&97C[=;?R%P+@*Y&5R^4M-FL9_+[@]?A.;Y_%*?PW"\1>7* -MU!5-,%V1CW;JRO-X+W'EX-0/@%^ZMX\?_^/>=A^O3X\?GM^'_,[^;`?GK/#^ -MQ=4C#(65A;_P-SQ_?L$?OP%;/S9QN:DX_/G?F+/'-EY<9T2Q=]>GKG[N?OCT -MH7OS\.O[=[%W_FQ]RZH1Z#(V*G5YZJ%":;Y]N4?T+YOQU-SME\?GGQ^OWP]E -M?NP>3E\ZPA6^=\,!7D)>4]5#2+%YLD/:MV__]SS4Z]IPLH^$&Y,8BQB>.S^[ -MO/18PP&F0^_2U*47EX[P0\)#)1F\D[N]?W?ZQT\.17K)W/??_>D?A+L,<(/G -MD.`0,A0TJRF?ZL^7+TMW^_Y;]^"+_.'G;GP%$JZ:WF;>>3H'C.;97X2N3?!^ -MB&7^QGBR[FW]7+MOZH_=Z91B@O:O[[&=0^.FDYX. -M>CR*MFU.=5M_>.Z>_/'&HVC\J[4-E?ICS5Z.,/R8/UST_?3I=/_WR^*X= -MWFCN#>':J7=#.L-I3DG%G)9)Q:<=>O>`E]0&;,)UOD534I?PQABPICQ>NI`. -MC]P_0A=NGTX_=W4[I.4>SGG^$(^B7QZ%MFC1A>F@AUY,1Q$2^W3ZV%T#7)J$ -M`^QGS9ER\B_EX94\930?H,_OG\;4BO1!YW&Z_%GVVGFI>'WM$SUZA"C'(& -MM]6[(O2.GI5&U6(TJ]DMBRU#[^C9:E0G1G\([A)ZQU_`(-=C[VBDR=IO> -M5:%W],PUJA"CG,%M]:X.O:-GI5&U&,UJ=LMBF]`[>K8:U8G1'X*[AMYQK$"N -MQ][12/7&9N_:T#MZYAI5B%'.X+9ZUX7>T;/2J%J,9C6[9;%]Z!T]6XWJQ.B/ -MP)5)Z%TFO>/UV#L:J=[8ZEW)>4?/7*,*,E8:58O1K&:W+);S -MCIZM1G5B](?@..]RZ1VOQ][12/7&9N\X[^B9:U0A1CF#V^H=YQT]*XVJQ6A6 -MLUL6RWE'SU:C.C'Z0W"<=X7TCM=C[VBD>F.S=YQW],PUJA"CG,%M]8[SCIZ5 -M1M5B-*O9+8OEO*-GJU&=&/TA.,X[_NH$N1Y[1R/5&YN]X[RC9ZY1A1CE#&ZK -M=YQW]*PTJA:C6K$Z(_`79+0NXOTCM=C[VBD>F.K=Q?..WKF -M&E6(4<[@-GIWX;RC9Z51M1C-:G;+8CGOZ-EJ5"=&?PB.\ZZ2WO%Z[!V-5&]L -M]H[SCIZY1A5BE#.XK=YQWM&STJA:C&8UNV6QG'?T;#6J$Z,_!,=YQ_]X0:[' -MWM%(]<9F[SCOZ)EK5"%&.8/;ZAWG'3TKC:K%:%:S6Q;+>4?/5J,Z,?I#<)QW -M9"TAUV/O:*1Z8[-WG'?TS#6J$*.K49T8 -M_1&X*@F]NTKO>#WVCD:J-[9Z5W'>T3/7J$*,<@:WT;N*\XZ>E4;58C2KV2V+ -MY;RC9ZM1G1C](3C.NU9ZQVNRVK%W[1W<=_3,-:H0HYS!;?6.\XZ>E4;5 -M8C2KV2V+Y;RC9ZM1G1C](3C.NTYZQ^NQ=S12O;'9.\X[>N8:58A1SN"V>L=Y -M1\]*HVHQFM7LEL5RWM&SU:A.C/X0'.==+[WC]=@[&JG>V.P=YQT]Q9T;Y-KW+AJIWMCJ71WF -M7?3,-:H0HYS!;?2N#O,N>E8:58O1K&:W+#;,N^C9:E0G1G\(+LP["'\'Y>\@ -M_!UV^;LZS#L(?P?E[R#\'7;YNSK,.PA_!^7O(/S=2G;+8L.\@_!W4/X.PM\= -M@`OS#L+?0?D["'^'7?ZN#O,.PM]!^3L(?X==_JX.\P["WT'Y.PA_MY+=LM@P -M[R#\'92_@_!W!^#"O(/P=U#^#L+?89>_J\.\@_!W4/X.PM]AE[^KP[R#\'=0 -M_@["WZUDMRPVS#L(?P?E[R#\W3Y"7\'Y>\@_!UV^;N&\T[X.RA_!^'O -ML,O?-9QWPM]!^3L(?[>2W;)8SCOA[Z#\'82_.P#'>2?\'92_@_!WV.7O&LX[ -MX>^@_!V$O\,N?]=PW@E_!^7O(/S=2G;+8CGOA+^#\G<0_NX`'.>=\'=0_@[" -MWV&7OVLX[X2_@_)W$/X.N_Q=PWDG_!V4OX/P=RO9+8OEO!/^#LK?0?B[`W"< -M=\+?0?D["'^'7?ZNX;P3_@[*WT'X.^SR=PWGG?!W4/X.PM^M9+]:SCOA[Z#\'82_6\EN62SGG?!W4/X.PM\= -M@..\$_X.RM]!^#OL\G_:SGOA+^#\G<0_FXENV6QG'?" -MWT'Y.PA_=P".\T[X.RA_!^'OL,O?M9QWPM]!^3L(?X==_J[EO!/^#LK?0?B[ -ME>R6Q7+>"7\'Y>\@_-T!.,X[X>^@_!V$O\,N?]=RW@E_!^7O(/P==OF[EO-. -M^#LH?P?A[U:R6Q;+>2?\'92_@_!W^W!=,O4N2O`@UZ.,D4:J-VYCTX9O-WPG -M[@4NS+M51=_*/\7>N?7L[K3XQ^#NBYWDAACEAG$3,97[^P`G.&,Y)"ZAZ_N` -M1^20B.MR/EXEAT1;R"$1U^4F;R"$1U^4F;R"$1U^4F;R"$1U^4FG^9\(B/ZW`>:YJ^\!_QD*SL9/$ZXR=\W6ZDJGX\1VP5_/^I>=C>6:66;< -MOR+Y;"*_/<.R,\[P,F:8E_Z#=O/"7V^0R(/VF_! -M?2UP_C>"7CQGGP5^A4LYC?5:X+Z:O@F7?2X[75$=*];XP[LOR641I^?L?_)X -M0I#_SSO/`>/YNI?\JOLTSK-R/Y.?NR_7_]35CZ_5\Y@-ZHURW1S._]35\YP= -MX4[WOKK/[FI\&%B^,PZ^G^9\),`N` -29AW,_$>3)%_\'XGNMJQQ8``` -` -end diff --git a/usr.bin/mkimg/tests/mkimg.sh b/usr.bin/mkimg/tests/mkimg.sh index 8dfb74c40d04..76abcebec65c 100755 --- a/usr.bin/mkimg/tests/mkimg.sh +++ b/usr.bin/mkimg/tests/mkimg.sh @@ -3,12 +3,12 @@ mkimg_blksz_list="512 4096" mkimg_format_list="qcow qcow2 raw vhd vhdf vmdk" mkimg_geom_list="1x1 63x255" -mkimg_scheme_list="apm bsd ebr gpt mbr pc98 vtoc8" +mkimg_scheme_list="apm bsd ebr gpt mbr vtoc8" bootcode() { case $1 in - bsd|pc98) echo 8192 ;; + bsd) echo 8192 ;; gpt|mbr) echo 512 ;; *) echo 0 ;; esac @@ -106,7 +106,7 @@ mkimg_test() format=$4 case $scheme in - ebr|mbr|pc98) + ebr|mbr) bsd=`makeimage raw bsd $blksz $geom _tmp` partinfo="freebsd:=$bsd" ;; diff --git a/usr.sbin/Makefile.i386 b/usr.sbin/Makefile.i386 index e8a44c4d8d74..3d64cb2d6b29 100644 --- a/usr.sbin/Makefile.i386 +++ b/usr.sbin/Makefile.i386 @@ -1,14 +1,21 @@ # $FreeBSD$ +.if ${MK_ACPI} != "no" +SUBDIR+= acpi +.endif .if ${MK_APM} != "no" SUBDIR+= apm SUBDIR+= apmd .endif SUBDIR+= asf +SUBDIR+= boot0cfg .if ${MK_TOOLCHAIN} != "no" SUBDIR+= btxld .endif SUBDIR+= cpucontrol +.if ${MK_HYPERV} != "no" +SUBDIR+= hyperv +.endif SUBDIR+= kgmon SUBDIR+= kgzip SUBDIR+= lptcontrol @@ -19,16 +26,3 @@ SUBDIR+= ndiscvt SUBDIR+= pnpinfo SUBDIR+= spkrtest SUBDIR+= zzz - -# Differentiate between FreeBSD/i386 and FreeBSD/pc98 -.if ${MACHINE} == "i386" -.if ${MK_ACPI} != "no" -SUBDIR+= acpi -.endif -SUBDIR+= boot0cfg -.if ${MK_HYPERV} != "no" -SUBDIR+= hyperv -.endif -.elif ${MACHINE} == "pc98" -SUBDIR+= boot98cfg -.endif diff --git a/usr.sbin/boot98cfg/Makefile b/usr.sbin/boot98cfg/Makefile deleted file mode 100644 index 57dfe94c1f8b..000000000000 --- a/usr.sbin/boot98cfg/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# $FreeBSD$ - -PROG= boot98cfg -MAN= boot98cfg.8 - -WARNS?= 2 - -LIBADD= geom - -.include diff --git a/usr.sbin/boot98cfg/Makefile.depend b/usr.sbin/boot98cfg/Makefile.depend deleted file mode 100644 index 2df49d098af1..000000000000 --- a/usr.sbin/boot98cfg/Makefile.depend +++ /dev/null @@ -1,17 +0,0 @@ -# $FreeBSD$ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - gnu/lib/libgcc \ - include \ - include/xlocale \ - lib/${CSU_DIR} \ - lib/libc \ - lib/libgeom \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif diff --git a/usr.sbin/boot98cfg/boot98cfg.8 b/usr.sbin/boot98cfg/boot98cfg.8 deleted file mode 100644 index 96ebbcdd0fd3..000000000000 --- a/usr.sbin/boot98cfg/boot98cfg.8 +++ /dev/null @@ -1,104 +0,0 @@ -.\" Copyright (c) KATO Takenori, 2000. -.\" -.\" All rights reserved. Unpublished rights reserved under the copyright -.\" laws of Japan. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer as -.\" the first lines of this file unmodified. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. The name of the author may not be used to endorse or promote products -.\" derived from this software without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -.\" -.\" $FreeBSD$ -.\" -.Dd July 10, 2000 -.Dt BOOT98CFG 8 -.Os -.Sh NAME -.Nm boot98cfg -.Nd HDD boot manager installation utility -.Sh SYNOPSIS -.Nm -.Op Fl B -.Op Fl i Ar boot0 -.Op Fl m Ar boot0.5 -.Op Fl s Ar secsize -.Op Fl v Ar version -.Op Fl f Ar boot0.bak -.Op Fl F Ar boot0.5.bak -.Ar disk -.Sh DESCRIPTION -On NEC PC-98s, -.Sq boot loader -consists of the -.Sq IPL -and -.Sq HDD boot menu . -The IPL occupies sector 0 of a disk and is followed by the partition -table. -The IPL loads the HDD boot menu that starts from 0x400. -.Pp -The -.Nm -utility installs and makes backup copy of the IPL and the HDD boot menu; and -allows changing the version number field in the sector 0. -.Pp -Note that the format command in NEC's OSs replaces the HDD boot menu -with its own HDD boot menu when the version number field is smaller -than that in the format command. -.Pp -The options are: -.Bl -tag -width indent -.It Fl B -Install the IPL and HDD boot menu. -This option causes the IPL and HDD -boot menu code to be replaced. -.It Fl i Ar boot0 -Specify which IPL image to use. -The default is /boot/boot0. -.It Fl m Ar boot0.5 -Specify which HDD boot menu image to use. -The default is -/boot/boot0.5. -.It Fl f Ar boot0.bak -Specify that a backup copy of the preexisting IPL should be written to -.Ar boot0.bak . -This file is created if it does not exist, and truncated if it does. -.It Fl F Ar boot0.5.bak -Specify that a backup copy of the preexisting HDD boot menu should be -written to -.Ar boot0.5.bak . -This file is created if it does not exist, and truncated if it does. -.It Fl v Ar version -Specify the version number. -.It Fl s Ar secsize -Specify the sector size. -The default sector size is 512 -(bytes/sector). -.El -.Sh EXIT STATUS -.Ex -std -.Sh SEE ALSO -.Xr boot 8 , -.Xr fdisk 8 -.Sh AUTHORS -.An NOKUBI Hirotaka , -.An KATO Takenori diff --git a/usr.sbin/boot98cfg/boot98cfg.c b/usr.sbin/boot98cfg/boot98cfg.c deleted file mode 100644 index 0ed1b170c666..000000000000 --- a/usr.sbin/boot98cfg/boot98cfg.c +++ /dev/null @@ -1,319 +0,0 @@ -/* - * Copyright (c) KATO Takenori, 2000. - * - * All rights reserved. Unpublished rights reserved under the copyright - * laws of Japan. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer as - * the first lines of this file unmodified. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Copyright (c) 1999 Robert Nordier - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT - * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define BOOTSIZE 0x2000 -#define IPLSIZE 512 /* IPL size */ -#define BOOTMENUSIZE 7168 /* Max HDD boot menu size */ -#define BOOTMENUOFF 0x400 - -u_char boot0buf[BOOTSIZE]; -u_char ipl[IPLSIZE]; -u_char menu[BOOTMENUSIZE]; - -static int read_boot(const char *, u_char *); -static int write_boot(const char *, u_char *); -static char *mkrdev(const char *); -static void usage(void); - -/* - * Boot manager installation/configuration utility. - */ -int -main(int argc, char *argv[]) -{ - char *endptr; - const char *iplpath = "/boot/boot0", *menupath = "/boot/boot0.5"; - char *iplbakpath = NULL, *menubakpath = NULL; - char *disk; - int B_flag = 0; - int c; - int fd1; - int n; - int secsize = 512; - int v_flag = 0, version; - - while ((c = getopt(argc, argv, "BF:f:i:m:s:v:")) != -1) { - switch (c) { - case 'B': - B_flag = 1; - break; - case 'F': - menubakpath = optarg; - break; - case 'f': - iplbakpath = optarg; - break; - case 'i': - iplpath = optarg; - break; - case 'm': - menupath = optarg; - break; - case 's': - secsize = strtol(optarg, &endptr, 0); - if (errno || *optarg == '\0' || *endptr) - errx(1, "%s: Bad argument to -s option", - optarg); - switch (secsize) { - case 256: - case 512: - case 1024: - case 2048: - break; - default: - errx(1, "%s: unsupported sector size", optarg); - break; - } - break; - case 'v': - v_flag = 1; - version = strtol(optarg, &endptr, 0); - if (errno || *optarg == '\0' || *endptr || - version < 0 || version > 255) - errx(1, "%s: Bad argument to -v option", - optarg); - break; - default: - usage(); - /* NOTREACHED */ - break; - } - } - argc -= optind; - argv += optind; - if (argc != 1) - usage(); - disk = mkrdev(*argv); - - read_boot(disk, boot0buf); - - if (iplbakpath != NULL) { - fd1 = open(iplbakpath, O_WRONLY | O_CREAT | O_TRUNC, 0666); - if (fd1 < 0) - err(1, "%s", iplbakpath); - n = write(fd1, boot0buf, IPLSIZE); - if (n == -1) - err(1, "%s", iplbakpath); - if (n != IPLSIZE) - errx(1, "%s: short write", iplbakpath); - close(fd1); - } - - if (menubakpath != NULL) { - fd1 = open(menubakpath, O_WRONLY | O_CREAT | O_TRUNC, 0666); - if (fd1 < 0) - err(1, "%s", menubakpath); - n = write(fd1, boot0buf + BOOTMENUOFF, BOOTMENUSIZE); - if (n == -1) - err(1, "%s", menubakpath); - if (n != BOOTMENUSIZE) - errx(1, "%s: short write", menubakpath); - close(fd1); - } - - if (B_flag) { - /* Read IPL (boot0). */ - fd1 = open(iplpath, O_RDONLY); - if (fd1 < 0) - err(1, "%s", disk); - n = read(fd1, ipl, IPLSIZE); - if (n < 0) - err(1, "%s", iplpath); - if (n != IPLSIZE) - errx(1, "%s: invalid file", iplpath); - close(fd1); - - /* Read HDD boot menu (boot0.5). */ - fd1 = open(menupath, O_RDONLY); - if (fd1 < 0) - err(1, "%s", disk); - n = read(fd1, menu, BOOTMENUSIZE); - if (n < 0) - err(1, "%s", menupath); - if (n != BOOTMENUSIZE) - errx(1, "%s: invalid file", menupath); - close(fd1); - - memcpy(boot0buf, ipl, IPLSIZE); - memcpy(boot0buf + BOOTMENUOFF, menu, BOOTMENUSIZE); - } - - /* Set version number field. */ - if (v_flag) - *(boot0buf + secsize - 4) = (u_char)version; - - if (B_flag || v_flag) - write_boot(disk, boot0buf); - - return 0; -} - -static int -read_boot(const char *disk, u_char *boot) -{ - int fd, n; - - /* Read IPL, partition table and HDD boot menu. */ - fd = open(disk, O_RDONLY); - if (fd < 0) - err(1, "%s", disk); - n = read(fd, boot, BOOTSIZE); - if (n != BOOTSIZE) - errx(1, "%s: short read", disk); - close(fd); - - return 0; -} - -static int -write_boot(const char *disk, u_char *boot) -{ - int fd, n, i; - char buf[MAXPATHLEN]; - const char *q; - struct gctl_req *grq; - - fd = open(disk, O_WRONLY, 0666); - if (fd != -1) { - if ((n = write(fd, boot, BOOTSIZE)) < 0) - err(1, "%s", disk); - if (n != BOOTSIZE) - errx(1, "%s: short write", disk); - close(fd); - return 0; - } - - grq = gctl_get_handle(); - gctl_ro_param(grq, "verb", -1, "write PC98"); - gctl_ro_param(grq, "class", -1, "PC98"); - q = strrchr(disk, '/'); - if (q == NULL) - q = disk; - else - q++; - gctl_ro_param(grq, "geom", -1, q); - gctl_ro_param(grq, "data", BOOTSIZE, boot); - q = gctl_issue(grq); - if (q == NULL) - return 0; - - warnx("%s: %s", disk, q); - gctl_free(grq); - - for (i = 0; i < PC98_NPARTS; i++) { - snprintf(buf, sizeof(buf), "%ss%d", disk, i + 1); - fd = open(buf, O_RDONLY); - if (fd < 0) - continue; - n = ioctl(fd, DIOCSPC98, boot); - if (n != 0) - err(1, "%s: ioctl DIOCSPC98", disk); - close(fd); - return 0; - } - - err(1, "%s", disk); -} - -/* - * Produce a device path for a "canonical" name, where appropriate. - */ -static char * -mkrdev(const char *fname) -{ - char buf[MAXPATHLEN]; - char *s; - - if (!strchr(fname, '/')) { - snprintf(buf, sizeof(buf), "%s%s", _PATH_DEV, fname); - s = strdup(buf); - } else - s = strdup(fname); - - if (s == NULL) - errx(1, "No more memory"); - return s; -} - -/* - * Display usage information. - */ -static void -usage(void) -{ - fprintf(stderr, - "boot98cfg [-B][-i boot0][-m boot0.5][-s secsize][-v version]\n" - " [-f ipl.bak][-F menu.bak] disk\n"); - exit(1); -} diff --git a/usr.sbin/bsdinstall/partedit/gpart_ops.c b/usr.sbin/bsdinstall/partedit/gpart_ops.c index 9a5d82d65b44..26f8f46703d4 100644 --- a/usr.sbin/bsdinstall/partedit/gpart_ops.c +++ b/usr.sbin/bsdinstall/partedit/gpart_ops.c @@ -73,8 +73,6 @@ scheme_supports_labels(const char *scheme) return (1); if (strcmp(scheme, "GPT") == 0) return (1); - if (strcmp(scheme, "PC98") == 0) - return (1); return (0); } @@ -221,8 +219,6 @@ choose_part_type(const char *def_scheme) "Bootable on most x86 systems and EFI aware ARM64", 0 }, {"MBR", "DOS Partitions", "Bootable on most x86 systems", 0 }, - {"PC98", "NEC PC9801 Partition Table", - "Bootable on NEC PC9801 systems", 0 }, {"VTOC8", "Sun VTOC8 Partition Table", "Bootable on Sun SPARC systems", 0 }, }; @@ -325,8 +321,7 @@ gpart_activate(struct gprovider *pp) } } - if (strcmp(scheme, "MBR") == 0 || strcmp(scheme, "EBR") == 0 || - strcmp(scheme, "PC98") == 0) + if (strcmp(scheme, "MBR") == 0 || strcmp(scheme, "EBR") == 0) attribute = "active"; else return; @@ -979,7 +974,7 @@ gpart_create(struct gprovider *pp, char *default_type, char *default_size, items[1].text = sizestr; /* Special-case the MBR default type for nested partitions */ - if (strcmp(scheme, "MBR") == 0 || strcmp(scheme, "PC98") == 0) { + if (strcmp(scheme, "MBR") == 0) { items[0].text = "freebsd"; items[0].help = "Filesystem type (e.g. freebsd, fat32)"; } diff --git a/usr.sbin/bsdinstall/partedit/part_wizard.c b/usr.sbin/bsdinstall/partedit/part_wizard.c index 1e9c89919238..4ac7603b7416 100644 --- a/usr.sbin/bsdinstall/partedit/part_wizard.c +++ b/usr.sbin/bsdinstall/partedit/part_wizard.c @@ -280,7 +280,7 @@ wizard_partition(struct gmesh *mesh, const char *disk) gpart_partition(disk, scheme); } - if (strcmp(scheme, "PC98") == 0 || strcmp(scheme, "MBR") == 0) { + if (strcmp(scheme, "MBR") == 0) { struct gmesh submesh; geom_gettree(&submesh); gpart_create(provider_for_name(&submesh, disk), diff --git a/usr.sbin/bsdinstall/partedit/partedit_pc98.c b/usr.sbin/bsdinstall/partedit/partedit_pc98.c deleted file mode 100644 index 8e914eab0ca7..000000000000 --- a/usr.sbin/bsdinstall/partedit/partedit_pc98.c +++ /dev/null @@ -1,83 +0,0 @@ -/*- - * Copyright (c) 2011 Nathan Whitehorn - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#include - -#include "partedit.h" - -const char * -default_scheme(void) { - return ("PC98"); -} - -int -is_scheme_bootable(const char *part_type) { - if (strcmp(part_type, "BSD") == 0) - return (1); - if (strcmp(part_type, "PC98") == 0) - return (1); - - return (0); -} - -int -is_fs_bootable(const char *part_type, const char *fs) -{ - if (strcmp(fs, "freebsd-ufs") == 0) - return (1); - - return (0); -} - -size_t -bootpart_size(const char *part_type) { - /* No boot partition */ - return (0); -} - -const char * -bootpart_type(const char *scheme) { - return ("freebsd-boot"); -} - -const char * -bootcode_path(const char *part_type) { - if (strcmp(part_type, "PC98") == 0) - return ("/boot/pc98boot"); - if (strcmp(part_type, "BSD") == 0) - return ("/boot/boot"); - - return (NULL); -} - -const char * -partcode_path(const char *part_type, const char *fs_type) { - /* No partcode */ - return (NULL); -} - diff --git a/usr.sbin/bsdinstall/partedit/scripted.c b/usr.sbin/bsdinstall/partedit/scripted.c index 876df5498ba9..75390f3b426f 100644 --- a/usr.sbin/bsdinstall/partedit/scripted.c +++ b/usr.sbin/bsdinstall/partedit/scripted.c @@ -94,7 +94,7 @@ part_config(char *disk, const char *scheme, char *config) gpart_destroy(gpart); gpart_partition(disk, scheme); - if (strcmp(scheme, "PC98") == 0 || strcmp(scheme, "MBR") == 0) { + if (strcmp(scheme, "MBR") == 0) { struct gmesh submesh; geom_gettree(&submesh); gpart_create(provider_for_name(&submesh, disk), diff --git a/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_partition_tbl.c b/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_partition_tbl.c index fa0d2bd06e9a..e7548b6f1dc5 100644 --- a/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_partition_tbl.c +++ b/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_partition_tbl.c @@ -50,11 +50,7 @@ #include "hostres_oid.h" #include "hostres_tree.h" -#ifdef PC98 -#define HR_FREEBSD_PART_TYPE 0xc494 -#else #define HR_FREEBSD_PART_TYPE 165 -#endif /* Maximum length for label and id including \0 */ #define PART_STR_MLEN (128 + 1) diff --git a/usr.sbin/config/config.5 b/usr.sbin/config/config.5 index e0e92b851491..dc22bd7952df 100644 --- a/usr.sbin/config/config.5 +++ b/usr.sbin/config/config.5 @@ -187,8 +187,6 @@ The AMD x86-64 architecture. The Intel x86 based PC architecture. .It Cm mips The MIPS architecture. -.It Cm pc98 -The PC98 architecture. .It Cm powerpc The IBM PowerPC architecture. .It Cm sparc64 @@ -200,11 +198,6 @@ If argument is specified, it points .Xr config 8 to the cpu architecture of the machine. -Currently the -.Cm pc98 -architecture requires its cpu architecture -to be set to -.Cm i386 . When .Ar cpuarch is not specified, it is assumed to be the same as diff --git a/usr.sbin/fdcontrol/Makefile b/usr.sbin/fdcontrol/Makefile index 5f1426b18ba1..1212ea5c762a 100644 --- a/usr.sbin/fdcontrol/Makefile +++ b/usr.sbin/fdcontrol/Makefile @@ -7,8 +7,4 @@ SRCS= fdcontrol.c fdutil.c CFLAGS+= -I${.CURDIR}/../fdread MAN= fdcontrol.8 -.if ${MACHINE} == "pc98" -CFLAGS+= -DPC98 -.endif - .include diff --git a/usr.sbin/fdformat/Makefile b/usr.sbin/fdformat/Makefile index 59cd124f50d0..91fa5ab5c731 100644 --- a/usr.sbin/fdformat/Makefile +++ b/usr.sbin/fdformat/Makefile @@ -7,8 +7,4 @@ SRCS= fdformat.c fdutil.c CFLAGS+= -I${.CURDIR}/../fdread -.if ${MACHINE} == "pc98" -CFLAGS+= -DPC98 -.endif - .include diff --git a/usr.sbin/fdread/Makefile b/usr.sbin/fdread/Makefile index e99c6205c4c3..05e588de00e1 100644 --- a/usr.sbin/fdread/Makefile +++ b/usr.sbin/fdread/Makefile @@ -3,8 +3,4 @@ PROG= fdread SRCS= fdread.c fdutil.c -.if ${MACHINE} == "pc98" -CFLAGS+= -DPC98 -.endif - .include diff --git a/usr.sbin/fdread/fdutil.c b/usr.sbin/fdread/fdutil.c index bdd295aedf85..1bc823202a06 100644 --- a/usr.sbin/fdread/fdutil.c +++ b/usr.sbin/fdread/fdutil.c @@ -92,7 +92,6 @@ static struct fd_type fd_types_auto[1] = static struct fd_type fd_types_288m[] = { -#ifndef PC98 #if 0 { FDF_3_2880 }, #endif @@ -103,20 +102,10 @@ static struct fd_type fd_types_288m[] = { { FDF_3_820 }, { FDF_3_800 }, { FDF_3_720 }, -#endif /* !PC98 */ { 0,0,0,0,0,0,0,0,0,0,0,0 } }; static struct fd_type fd_types_144m[] = { -#ifdef PC98 - { FDF_3_1440 }, - { FDF_3_1200 }, - { FDF_3_720 }, - { FDF_3_360 }, - { FDF_3_640 }, - { FDF_3_1230 }, - { 0,0,0,0,0,0,0,0,0,0,0,0 } -#else { FDF_3_1722 }, { FDF_3_1476 }, { FDF_3_1440 }, @@ -125,18 +114,9 @@ static struct fd_type fd_types_144m[] = { { FDF_3_800 }, { FDF_3_720 }, { 0,0,0,0,0,0,0,0,0,0,0,0 } -#endif }; static struct fd_type fd_types_12m[] = { -#ifdef PC98 - { FDF_5_1200 }, - { FDF_5_720 }, - { FDF_5_360 }, - { FDF_5_640 }, - { FDF_5_1230 }, - { 0,0,0,0,0,0,0,0,0,0,0,0 } -#else { FDF_5_1200 }, { FDF_5_1230 }, { FDF_5_1480 }, @@ -147,22 +127,17 @@ static struct fd_type fd_types_12m[] = { { FDF_5_360 | FL_2STEP }, { FDF_5_640 }, { 0,0,0,0,0,0,0,0,0,0,0,0 } -#endif }; static struct fd_type fd_types_720k[] = { -#ifndef PC98 { FDF_3_720 }, -#endif { 0,0,0,0,0,0,0,0,0,0,0,0 } }; static struct fd_type fd_types_360k[] = { -#ifndef PC98 { FDF_5_360 }, -#endif { 0,0,0,0,0,0,0,0,0,0,0,0 } }; diff --git a/usr.sbin/kgzip/kgzip.8 b/usr.sbin/kgzip/kgzip.8 index bcf395735a98..fd7b4e3e6250 100644 --- a/usr.sbin/kgzip/kgzip.8 +++ b/usr.sbin/kgzip/kgzip.8 @@ -148,7 +148,7 @@ kernels is limited to situations where cannot be used. .Pp .Pa kgzldr.o -is only available for the i386 and pc98 architectures. +is only available for the i386 architecture. .Pp The preferred method of compressing a kernel is simply to diff --git a/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh b/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh index 5fe354033e32..25430a0acc69 100755 --- a/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh +++ b/usr.sbin/pc-sysinstall/backend-partmanager/create-part.sh @@ -60,7 +60,6 @@ case $TYPE in apm|APM) ;; bsd|BSD) ;; ebr|EBR) ;; - pc98|pc98) ;; gpt|GPT) ;; mbr|MBR) ;; vtoc8|VTOC8) ;; diff --git a/usr.sbin/pnpinfo/Makefile b/usr.sbin/pnpinfo/Makefile index 164ef37790cf..de84e98788bd 100644 --- a/usr.sbin/pnpinfo/Makefile +++ b/usr.sbin/pnpinfo/Makefile @@ -7,10 +7,6 @@ MAN= pnpinfo.8 CFLAGS+= -I${.CURDIR}/../../sys -.if ${MACHINE} == "pc98" -CFLAGS+= -DPC98 -.endif - WARNS?= 2 .include diff --git a/usr.sbin/vidcontrol/vidcontrol.c b/usr.sbin/vidcontrol/vidcontrol.c index 6d79863be0cf..5c81a855677c 100644 --- a/usr.sbin/vidcontrol/vidcontrol.c +++ b/usr.sbin/vidcontrol/vidcontrol.c @@ -1028,7 +1028,6 @@ static const char { KD_CGA, "CGA" }, { KD_EGA, "EGA" }, { KD_VGA, "VGA" }, - { KD_PC98, "PC-98xx" }, { KD_TGA, "TGA" }, { -1, "Unknown" }, }; @@ -1190,19 +1189,10 @@ show_info(char *arg) static void test_frame(void) { - int i, cur_mode, fore; + int i, fore; fore = 15; - if (ioctl(0, CONS_GET, &cur_mode) < 0) - err(1, "must be on a virtual console"); - switch (cur_mode) { - case M_PC98_80x25: - case M_PC98_80x30: - fore = 7; - break; - } - fprintf(stdout, "\033[=0G\n\n"); for (i=0; i<8; i++) { fprintf(stdout, "\033[=%dF\033[=0G %2d \033[=%dF%-16s" From 661cf9b6820bdc09f1f97dda6f8ecd0d6c67b484 Mon Sep 17 00:00:00 2001 From: Yoshihiro Takahashi Date: Sat, 28 Jan 2017 02:25:33 +0000 Subject: [PATCH 14/51] Regen after r312910. --- share/man/man5/src.conf.5 | 42 +++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 index 971a36951b54..0470c8efdbd8 100644 --- a/share/man/man5/src.conf.5 +++ b/share/man/man5/src.conf.5 @@ -1,7 +1,7 @@ .\" DO NOT EDIT-- this file is automatically generated. .\" from FreeBSD: head/tools/build/options/makeman 306729 2016-10-05 20:12:00Z emaste .\" $FreeBSD$ -.Dd January 6, 2017 +.Dd January 28, 2017 .Dt SRC.CONF 5 .Os .Sh NAME @@ -177,7 +177,7 @@ Set to build and install binutils (as, ld, objcopy, and objdump) as part of the normal system build. .Pp It is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, pc98/i386, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. .It Va WITHOUT_BINUTILS_BOOTSTRAP .\" from FreeBSD: head/tools/build/options/WITHOUT_BINUTILS_BOOTSTRAP 295490 2016-02-10 23:57:09Z emaste Set to not build binutils (as, ld, objcopy and objdump) @@ -195,7 +195,7 @@ Set build binutils (as, ld, objcopy and objdump) as part of the bootstrap process. .Pp It is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, pc98/i386, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. .It Va WITHOUT_BLACKLIST .\" from FreeBSD: head/tools/build/options/WITHOUT_BLACKLIST 301554 2016-06-07 16:35:55Z lidl Set this if you do not want to build blacklistd / blacklistctl. @@ -352,7 +352,7 @@ When set, it also enforces the following options: Set to build the Clang C/C++ compiler during the normal phase of the build. .Pp It is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386, pc98/i386, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. .It Va WITHOUT_CLANG_BOOTSTRAP .\" from FreeBSD: head/tools/build/options/WITHOUT_CLANG_BOOTSTRAP 273177 2014-10-16 18:28:11Z skreuzer Set to not build the Clang C/C++ compiler during the bootstrap phase of the build. @@ -367,7 +367,7 @@ mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, Set to build the Clang C/C++ compiler during the bootstrap phase of the build. .Pp It is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386 and pc98/i386. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64 and i386/i386. .It Va WITH_CLANG_EXTRAS .\" from FreeBSD: head/tools/build/options/WITH_CLANG_EXTRAS 231057 2012-02-05 23:56:22Z dim Set to build additional clang and llvm tools, such as bugpoint. @@ -384,7 +384,7 @@ Set to build the ARCMigrate, Rewriter and StaticAnalyzer components of the Clang C/C++ compiler. .Pp It is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386, pc98/i386, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. .It Va WITHOUT_CLANG_IS_CC .\" from FreeBSD: head/tools/build/options/WITHOUT_CLANG_IS_CC 242629 2012-11-05 21:53:23Z brooks Set to install the GCC compiler as @@ -404,7 +404,7 @@ and .Pa /usr/bin/cpp . .Pp It is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386 and pc98/i386. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64 and i386/i386. .It Va WITHOUT_CPP .\" from FreeBSD: head/tools/build/options/WITHOUT_CPP 156932 2006-03-21 07:50:50Z ru Set to not build @@ -652,7 +652,7 @@ and .Xr efivar 8 . .Pp It is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386 and pc98/i386. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64 and i386/i386. .It Va WITH_EISA .\" from FreeBSD: head/tools/build/options/WITH_EISA 264654 2014-04-18 16:53:06Z imp Set to build EISA kernel modules. @@ -726,7 +726,7 @@ Set to not build games. Set to not build and install gcc and g++ as part of the normal build process. .Pp It is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386 and pc98/i386. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64 and i386/i386. .It Va WITH_GCC .\" from FreeBSD: head/tools/build/options/WITH_GCC 255326 2013-09-06 20:49:48Z zeising Set to build and install gcc and g++. @@ -741,7 +741,7 @@ unless an alternative compiler is provided via XCC. .Pp It is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386 and pc98/i386. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64 and i386/i386. .It Va WITH_GCC_BOOTSTRAP .\" from FreeBSD: head/tools/build/options/WITH_GCC_BOOTSTRAP 264660 2014-04-18 17:03:58Z imp Set to build gcc and g++ as part of the bootstrap process. @@ -766,7 +766,7 @@ Set to build .Xr gdb 1 . .Pp It is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, pc98/i386, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. .It Va WITHOUT_GNU .\" from FreeBSD: head/tools/build/options/WITHOUT_GNU 174550 2007-12-12 16:43:17Z ru Set to not build contributed GNU software as a part of the base system. @@ -787,7 +787,7 @@ Do not build the GNU C++ stack (g++, libstdc++). This is the default on platforms where clang is the system compiler. .Pp It is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386 and pc98/i386. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64 and i386/i386. .It Va WITH_GNUCXX .\" from FreeBSD: head/tools/build/options/WITH_GNUCXX 255321 2013-09-06 20:08:03Z theraven Build the GNU C++ stack (g++, libstdc++). @@ -1035,7 +1035,7 @@ library. Set to not build LLVM's lld linker. .Pp It is a default setting on -arm/arm, arm/armeb, arm/armv6, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, pc98/i386, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +arm/arm, arm/armeb, arm/armv6, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. .It Va WITH_LLD .\" from FreeBSD: head/tools/build/options/WITH_LLD 309124 2016-11-24 22:54:55Z dim Set to build LLVM's lld linker. @@ -1047,21 +1047,21 @@ amd64/amd64 and arm64/aarch64. Set to not build the LLDB debugger. .Pp It is a default setting on -arm/arm, arm/armeb, arm/armv6, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, pc98/i386, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +arm/arm, arm/armeb, arm/armv6, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. .It Va WITH_LLDB .\" from FreeBSD: head/tools/build/options/WITH_LLDB 255722 2013-09-20 01:52:02Z emaste Set to build the LLDB debugger. .Pp It is a default setting on amd64/amd64 and arm64/aarch64. -.It Va WITHOUT_LLD_AS_LD -.\" from FreeBSD: head/tools/build/options/WITHOUT_LLD_AS_LD 309142 2016-11-25 13:15:28Z emaste +.It Va WITHOUT_LLD_IS_LD +.\" from FreeBSD: head/tools/build/options/WITHOUT_LLD_IS_LD 312855 2017-01-27 01:59:12Z emaste Set to use GNU binutils ld as the system linker, instead of LLVM's LLD. .Pp It is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, pc98/i386, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. -.It Va WITH_LLD_AS_LD -.\" from FreeBSD: head/tools/build/options/WITH_LLD_AS_LD 309142 2016-11-25 13:15:28Z emaste +amd64/amd64, arm/arm, arm/armeb, arm/armv6, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +.It Va WITH_LLD_IS_LD +.\" from FreeBSD: head/tools/build/options/WITH_LLD_IS_LD 312855 2017-01-27 01:59:12Z emaste Set to use LLVM's LLD as the system linker, instead of GNU binutils ld. .Pp It is a default setting on @@ -1077,7 +1077,7 @@ arm/arm, arm/armeb, arm/armv6, mips/mipsel, mips/mips, mips/mips64el, mips/mips6 Set to use LLVM's libunwind stack unwinder (instead of GCC's unwinder). .Pp It is a default setting on -amd64/amd64, arm64/aarch64, i386/i386 and pc98/i386. +amd64/amd64, arm64/aarch64 and i386/i386. .It Va WITHOUT_LOCALES .\" from FreeBSD: head/tools/build/options/WITHOUT_LOCALES 156932 2006-03-21 07:50:50Z ru Set to not build localization files; see @@ -1454,7 +1454,7 @@ mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, Set to build world with propolice stack smashing protection. .Pp It is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386, pc98/i386, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. .It Va WITH_STAGING .\" from FreeBSD: head/tools/build/options/WITH_STAGING 290816 2015-11-14 03:24:48Z sjg Enable staging of files to a stage tree. From f7c79dd679de4dc79adf284b0a9bceb0672bf69a Mon Sep 17 00:00:00 2001 From: Yoshihiro Takahashi Date: Sat, 28 Jan 2017 03:53:53 +0000 Subject: [PATCH 15/51] Garbage collect the FPU_ERROR_BROKEN option. It is for pc98 only. --- sys/i386/isa/npx.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/sys/i386/isa/npx.c b/sys/i386/isa/npx.c index d481279e53f4..bf1c66a8ef43 100644 --- a/sys/i386/isa/npx.c +++ b/sys/i386/isa/npx.c @@ -304,14 +304,6 @@ npx_probe(void) */ control &= ~(1 << 2); /* enable divide by 0 trap */ fldcw(control); -#ifdef FPU_ERROR_BROKEN - /* - * FPU error signal doesn't work on some CPU - * accelerator board. - */ - hw_float = 1; - return (1); -#endif npx_traps_while_probing = 0; fp_divide_by_0(); if (npx_traps_while_probing != 0) { From 740a9bfadd9a23deae9ea33d5add4a7bbd705da5 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Sat, 28 Jan 2017 04:33:51 +0000 Subject: [PATCH 16/51] Improve the aio tests * Add tests for aio_suspend(2). * Add tests for polled completion notification. * Test the full matrix of file descriptor types and completion notification mechanisms. * Don't bother with mkstemp, because ATF runs every test in its own temp dir. * Fix some typos. * Remove extraneous ATF_REQUIRE_KERNEL_MODULE calls. Reviewed by: jhb MFC after: 4 weeks Differential Revision: https://reviews.freebsd.org/D9045 --- tests/sys/aio/aio_test.c | 336 ++++++++++++++++++++++++++++----------- 1 file changed, 244 insertions(+), 92 deletions(-) diff --git a/tests/sys/aio/aio_test.c b/tests/sys/aio/aio_test.c index 33ccd7d3ab7b..edb37e39f57f 100644 --- a/tests/sys/aio/aio_test.c +++ b/tests/sys/aio/aio_test.c @@ -33,7 +33,7 @@ * reading it from a second descriptor using AIO. For some targets, the same * fd is used for write and read (i.e., file, md device), but for others the * operation is performed on a peer (pty, socket, fifo, etc). A timeout is - * initiated to detect undo blocking. This test does not attempt to exercise + * initiated to detect undue blocking. This test does not attempt to exercise * error cases or more subtle asynchronous behavior, just make sure that the * basic operations work on some basic object types. */ @@ -74,6 +74,13 @@ #define GLOBAL_MAX 16384 #define BUFFER_MAX GLOBAL_MAX + +/* + * A completion function will block until the aio has completed, then return + * the result of the aio. errno will be set appropriately. + */ +typedef ssize_t (*completion)(struct aiocb*); + struct aio_context { int ac_read_fd, ac_write_fd; long ac_seed; @@ -179,6 +186,45 @@ aio_context_init(struct aio_context *ac, int read_fd, ac->ac_cleanup_arg = cleanup_arg; } +static ssize_t +poll(struct aiocb *aio) { + int err; + + while ((err = aio_error(aio)) == EINPROGRESS && !aio_timedout) + usleep(25000); + switch (err) { + case EINPROGRESS: + errno = EINTR; + return (-1); + case 0: + return (aio_return(aio)); + default: + return (err); + } +} + +static ssize_t +suspend(struct aiocb *aio) { + const struct aiocb *const iocbs[] = {aio}; + int err; + + err = aio_suspend(iocbs, 1, NULL); + if (err == 0) + return (aio_return(aio)); + else + return (err); +} + +static ssize_t +waitcomplete(struct aiocb *aio) { + struct aiocb *aiop; + ssize_t ret; + + ret = aio_waitcomplete(&aiop, NULL); + ATF_REQUIRE_EQ(aio, aiop); + return (ret); +} + /* * Each tester can register a callback to clean up in the event the test * fails. Preserve the value of errno so that subsequent calls to errx() @@ -201,13 +247,11 @@ aio_cleanup(struct aio_context *ac) * file descriptor. */ static void -aio_write_test(struct aio_context *ac) +aio_write_test(struct aio_context *ac, completion comp) { - struct aiocb aio, *aiop; + struct aiocb aio; ssize_t len; - ATF_REQUIRE_KERNEL_MODULE("aio"); - bzero(&aio, sizeof(aio)); aio.aio_buf = ac->ac_buffer; aio.aio_nbytes = ac->ac_buflen; @@ -227,24 +271,23 @@ aio_write_test(struct aio_context *ac) atf_tc_fail("aio_write failed: %s", strerror(errno)); } - len = aio_waitcomplete(&aiop, NULL); + len = comp(&aio); if (len < 0) { if (errno == EINTR) { if (aio_timedout) { aio_cleanup(ac); - atf_tc_fail("aio_waitcomplete timed out"); + atf_tc_fail("aio timed out"); } } aio_cleanup(ac); - atf_tc_fail("aio_waitcomplete failed: %s", strerror(errno)); + atf_tc_fail("aio failed: %s", strerror(errno)); } aio_timeout_stop(); if (len != ac->ac_buflen) { aio_cleanup(ac); - atf_tc_fail("aio_waitcomplete short write (%jd)", - (intmax_t)len); + atf_tc_fail("aio short write (%jd)", (intmax_t)len); } } @@ -253,13 +296,11 @@ aio_write_test(struct aio_context *ac) * provided file descriptor. */ static void -aio_read_test(struct aio_context *ac) +aio_read_test(struct aio_context *ac, completion comp) { - struct aiocb aio, *aiop; + struct aiocb aio; ssize_t len; - ATF_REQUIRE_KERNEL_MODULE("aio"); - bzero(ac->ac_buffer, ac->ac_buflen); bzero(&aio, sizeof(aio)); aio.aio_buf = ac->ac_buffer; @@ -273,30 +314,30 @@ aio_read_test(struct aio_context *ac) if (errno == EINTR) { if (aio_timedout) { aio_cleanup(ac); - atf_tc_fail("aio_write timed out"); + atf_tc_fail("aio_read timed out"); } } aio_cleanup(ac); atf_tc_fail("aio_read failed: %s", strerror(errno)); } - len = aio_waitcomplete(&aiop, NULL); + len = comp(&aio); if (len < 0) { if (errno == EINTR) { if (aio_timedout) { aio_cleanup(ac); - atf_tc_fail("aio_waitcomplete timed out"); + atf_tc_fail("aio timed out"); } } aio_cleanup(ac); - atf_tc_fail("aio_waitcomplete failed: %s", strerror(errno)); + atf_tc_fail("aio failed: %s", strerror(errno)); } aio_timeout_stop(); if (len != ac->ac_buflen) { aio_cleanup(ac); - atf_tc_fail("aio_waitcomplete short read (%jd)", + atf_tc_fail("aio short read (%jd)", (intmax_t)len); } @@ -316,9 +357,11 @@ aio_read_test(struct aio_context *ac) * Test with a classic file. Assumes we can create a moderate size temporary * file. */ +#define FILE_LEN GLOBAL_MAX +#define FILE_PATHNAME "testfile" +#define FILE_TIMEOUT 30 struct aio_file_arg { int afa_fd; - char *afa_pathname; }; static void @@ -328,15 +371,12 @@ aio_file_cleanup(void *arg) afa = arg; close(afa->afa_fd); - unlink(afa->afa_pathname); + unlink(FILE_PATHNAME); } -#define FILE_LEN GLOBAL_MAX -#define FILE_TIMEOUT 30 -ATF_TC_WITHOUT_HEAD(aio_file_test); -ATF_TC_BODY(aio_file_test, tc) +static void +aio_file_test(completion comp) { - char pathname[PATH_MAX]; struct aio_file_arg arg; struct aio_context ac; int fd; @@ -344,25 +384,43 @@ ATF_TC_BODY(aio_file_test, tc) ATF_REQUIRE_KERNEL_MODULE("aio"); ATF_REQUIRE_UNSAFE_AIO(); - strcpy(pathname, PATH_TEMPLATE); - fd = mkstemp(pathname); - ATF_REQUIRE_MSG(fd != -1, "mkstemp failed: %s", strerror(errno)); + fd = open(FILE_PATHNAME, O_RDWR | O_CREAT); + ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); arg.afa_fd = fd; - arg.afa_pathname = pathname; aio_context_init(&ac, fd, fd, FILE_LEN, FILE_TIMEOUT, aio_file_cleanup, &arg); - aio_write_test(&ac); - aio_read_test(&ac); + aio_write_test(&ac, comp); + aio_read_test(&ac, comp); aio_file_cleanup(&arg); } +ATF_TC_WITHOUT_HEAD(file_poll); +ATF_TC_BODY(file_poll, tc) +{ + aio_file_test(poll); +} + +ATF_TC_WITHOUT_HEAD(file_suspend); +ATF_TC_BODY(file_suspend, tc) +{ + aio_file_test(suspend); +} + +ATF_TC_WITHOUT_HEAD(file_waitcomplete); +ATF_TC_BODY(file_waitcomplete, tc) +{ + aio_file_test(waitcomplete); +} + +#define FIFO_LEN 256 +#define FIFO_PATHNAME "testfifo" +#define FIFO_TIMEOUT 30 struct aio_fifo_arg { int afa_read_fd; int afa_write_fd; - char *afa_pathname; }; static void @@ -375,39 +433,25 @@ aio_fifo_cleanup(void *arg) close(afa->afa_read_fd); if (afa->afa_write_fd != -1) close(afa->afa_write_fd); - unlink(afa->afa_pathname); + unlink(FIFO_PATHNAME); } -#define FIFO_LEN 256 -#define FIFO_TIMEOUT 30 -ATF_TC_WITHOUT_HEAD(aio_fifo_test); -ATF_TC_BODY(aio_fifo_test, tc) +static void +aio_fifo_test(completion comp) { int error, read_fd = -1, write_fd = -1; struct aio_fifo_arg arg; - char pathname[PATH_MAX]; struct aio_context ac; ATF_REQUIRE_KERNEL_MODULE("aio"); ATF_REQUIRE_UNSAFE_AIO(); - /* - * In theory, mkstemp() can return a name that is then collided with. - * Because this is a regression test, we treat that as a test failure - * rather than retrying. - */ - strcpy(pathname, PATH_TEMPLATE); - ATF_REQUIRE_MSG(mkstemp(pathname) != -1, - "mkstemp failed: %s", strerror(errno)); - ATF_REQUIRE_MSG(unlink(pathname) == 0, - "unlink failed: %s", strerror(errno)); - ATF_REQUIRE_MSG(mkfifo(pathname, 0600) != -1, + ATF_REQUIRE_MSG(mkfifo(FIFO_PATHNAME, 0600) != -1, "mkfifo failed: %s", strerror(errno)); - arg.afa_pathname = pathname; arg.afa_read_fd = -1; arg.afa_write_fd = -1; - read_fd = open(pathname, O_RDONLY | O_NONBLOCK); + read_fd = open(FIFO_PATHNAME, O_RDONLY | O_NONBLOCK); if (read_fd == -1) { error = errno; aio_fifo_cleanup(&arg); @@ -417,7 +461,7 @@ ATF_TC_BODY(aio_fifo_test, tc) } arg.afa_read_fd = read_fd; - write_fd = open(pathname, O_WRONLY); + write_fd = open(FIFO_PATHNAME, O_WRONLY); if (write_fd == -1) { error = errno; aio_fifo_cleanup(&arg); @@ -429,12 +473,30 @@ ATF_TC_BODY(aio_fifo_test, tc) aio_context_init(&ac, read_fd, write_fd, FIFO_LEN, FIFO_TIMEOUT, aio_fifo_cleanup, &arg); - aio_write_test(&ac); - aio_read_test(&ac); + aio_write_test(&ac, comp); + aio_read_test(&ac, comp); aio_fifo_cleanup(&arg); } +ATF_TC_WITHOUT_HEAD(fifo_poll); +ATF_TC_BODY(fifo_poll, tc) +{ + aio_fifo_test(poll); +} + +ATF_TC_WITHOUT_HEAD(fifo_suspend); +ATF_TC_BODY(fifo_suspend, tc) +{ + aio_fifo_test(waitcomplete); +} + +ATF_TC_WITHOUT_HEAD(fifo_waitcomplete); +ATF_TC_BODY(fifo_waitcomplete, tc) +{ + aio_fifo_test(waitcomplete); +} + struct aio_unix_socketpair_arg { int asa_sockets[2]; }; @@ -451,8 +513,8 @@ aio_unix_socketpair_cleanup(void *arg) #define UNIX_SOCKETPAIR_LEN 256 #define UNIX_SOCKETPAIR_TIMEOUT 30 -ATF_TC_WITHOUT_HEAD(aio_unix_socketpair_test); -ATF_TC_BODY(aio_unix_socketpair_test, tc) +static void +aio_unix_socketpair_test(completion comp) { struct aio_unix_socketpair_arg arg; struct aio_context ac; @@ -471,12 +533,12 @@ ATF_TC_BODY(aio_unix_socketpair_test, tc) aio_unix_socketpair_cleanup, &arg); ATF_REQUIRE_MSG(getrusage(RUSAGE_SELF, &ru_before) != -1, "getrusage failed: %s", strerror(errno)); - aio_write_test(&ac); + aio_write_test(&ac, comp); ATF_REQUIRE_MSG(getrusage(RUSAGE_SELF, &ru_after) != -1, "getrusage failed: %s", strerror(errno)); ATF_REQUIRE(ru_after.ru_msgsnd == ru_before.ru_msgsnd + 1); ru_before = ru_after; - aio_read_test(&ac); + aio_read_test(&ac, comp); ATF_REQUIRE_MSG(getrusage(RUSAGE_SELF, &ru_after) != -1, "getrusage failed: %s", strerror(errno)); ATF_REQUIRE(ru_after.ru_msgrcv == ru_before.ru_msgrcv + 1); @@ -484,6 +546,24 @@ ATF_TC_BODY(aio_unix_socketpair_test, tc) aio_unix_socketpair_cleanup(&arg); } +ATF_TC_WITHOUT_HEAD(socket_poll); +ATF_TC_BODY(socket_poll, tc) +{ + aio_unix_socketpair_test(poll); +} + +ATF_TC_WITHOUT_HEAD(socket_suspend); +ATF_TC_BODY(socket_suspend, tc) +{ + aio_unix_socketpair_test(suspend); +} + +ATF_TC_WITHOUT_HEAD(socket_waitcomplete); +ATF_TC_BODY(socket_waitcomplete, tc) +{ + aio_unix_socketpair_test(waitcomplete); +} + struct aio_pty_arg { int apa_read_fd; int apa_write_fd; @@ -501,8 +581,8 @@ aio_pty_cleanup(void *arg) #define PTY_LEN 256 #define PTY_TIMEOUT 30 -ATF_TC_WITHOUT_HEAD(aio_pty_test); -ATF_TC_BODY(aio_pty_test, tc) +static void +aio_pty_test(completion comp) { struct aio_pty_arg arg; struct aio_context ac; @@ -535,12 +615,30 @@ ATF_TC_BODY(aio_pty_test, tc) aio_context_init(&ac, read_fd, write_fd, PTY_LEN, PTY_TIMEOUT, aio_pty_cleanup, &arg); - aio_write_test(&ac); - aio_read_test(&ac); + aio_write_test(&ac, comp); + aio_read_test(&ac, comp); aio_pty_cleanup(&arg); } +ATF_TC_WITHOUT_HEAD(pty_poll); +ATF_TC_BODY(pty_poll, tc) +{ + aio_pty_test(poll); +} + +ATF_TC_WITHOUT_HEAD(pty_suspend); +ATF_TC_BODY(pty_suspend, tc) +{ + aio_pty_test(suspend); +} + +ATF_TC_WITHOUT_HEAD(pty_waitcomplete); +ATF_TC_BODY(pty_waitcomplete, tc) +{ + aio_pty_test(waitcomplete); +} + static void aio_pipe_cleanup(void *arg) { @@ -552,8 +650,8 @@ aio_pipe_cleanup(void *arg) #define PIPE_LEN 256 #define PIPE_TIMEOUT 30 -ATF_TC_WITHOUT_HEAD(aio_pipe_test); -ATF_TC_BODY(aio_pipe_test, tc) +static void +aio_pipe_test(completion comp) { struct aio_context ac; int pipes[2]; @@ -566,12 +664,30 @@ ATF_TC_BODY(aio_pipe_test, tc) aio_context_init(&ac, pipes[0], pipes[1], PIPE_LEN, PIPE_TIMEOUT, aio_pipe_cleanup, pipes); - aio_write_test(&ac); - aio_read_test(&ac); + aio_write_test(&ac, comp); + aio_read_test(&ac, comp); aio_pipe_cleanup(pipes); } +ATF_TC_WITHOUT_HEAD(pipe_poll); +ATF_TC_BODY(pipe_poll, tc) +{ + aio_pipe_test(poll); +} + +ATF_TC_WITHOUT_HEAD(pipe_suspend); +ATF_TC_BODY(pipe_suspend, tc) +{ + aio_pipe_test(suspend); +} + +ATF_TC_WITHOUT_HEAD(pipe_waitcomplete); +ATF_TC_BODY(pipe_waitcomplete, tc) +{ + aio_pipe_test(waitcomplete); +} + struct aio_md_arg { int ama_mdctl_fd; int ama_unit; @@ -608,13 +724,8 @@ aio_md_cleanup(void *arg) #define MD_LEN GLOBAL_MAX #define MD_TIMEOUT 30 -ATF_TC(aio_md_test); -ATF_TC_HEAD(aio_md_test, tc) -{ - - atf_tc_set_md_var(tc, "require.user", "root"); -} -ATF_TC_BODY(aio_md_test, tc) +static void +aio_md_test(completion comp) { int error, fd, mdctl_fd, unit; char pathname[PATH_MAX]; @@ -654,16 +765,48 @@ ATF_TC_BODY(aio_md_test, tc) aio_context_init(&ac, fd, fd, MD_LEN, MD_TIMEOUT, aio_md_cleanup, &arg); - aio_write_test(&ac); - aio_read_test(&ac); + aio_write_test(&ac, comp); + aio_read_test(&ac, comp); aio_md_cleanup(&arg); } +ATF_TC(md_poll); +ATF_TC_HEAD(md_poll, tc) +{ + + atf_tc_set_md_var(tc, "require.user", "root"); +} +ATF_TC_BODY(md_poll, tc) +{ + aio_md_test(poll); +} + +ATF_TC(md_suspend); +ATF_TC_HEAD(md_suspend, tc) +{ + + atf_tc_set_md_var(tc, "require.user", "root"); +} +ATF_TC_BODY(md_suspend, tc) +{ + aio_md_test(suspend); +} + +ATF_TC(md_waitcomplete); +ATF_TC_HEAD(md_waitcomplete, tc) +{ + + atf_tc_set_md_var(tc, "require.user", "root"); +} +ATF_TC_BODY(md_waitcomplete, tc) +{ + aio_md_test(waitcomplete); +} + ATF_TC_WITHOUT_HEAD(aio_large_read_test); ATF_TC_BODY(aio_large_read_test, tc) { - char pathname[PATH_MAX]; struct aiocb cb, *cbp; ssize_t nread; size_t len; @@ -689,11 +832,10 @@ ATF_TC_BODY(aio_large_read_test, tc) len = INT_MAX; #endif - strcpy(pathname, PATH_TEMPLATE); - fd = mkstemp(pathname); - ATF_REQUIRE_MSG(fd != -1, "mkstemp failed: %s", strerror(errno)); + fd = open(FILE_PATHNAME, O_RDWR | O_CREAT); + ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); - unlink(pathname); + unlink(FILE_PATHNAME); memset(&cb, 0, sizeof(cb)); cb.aio_nbytes = len; @@ -937,7 +1079,6 @@ ATF_TC_BODY(aio_fsync_test, tc) char *buffer; } buffers[16]; struct stat sb; - char pathname[PATH_MAX]; ssize_t rval; unsigned i; int fd; @@ -945,10 +1086,9 @@ ATF_TC_BODY(aio_fsync_test, tc) ATF_REQUIRE_KERNEL_MODULE("aio"); ATF_REQUIRE_UNSAFE_AIO(); - strcpy(pathname, PATH_TEMPLATE); - fd = mkstemp(pathname); - ATF_REQUIRE_MSG(fd != -1, "mkstemp failed: %s", strerror(errno)); - unlink(pathname); + fd = open(FILE_PATHNAME, O_RDWR | O_CREAT); + ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); + unlink(FILE_PATHNAME); ATF_REQUIRE(fstat(fd, &sb) == 0); ATF_REQUIRE(sb.st_blksize != 0); @@ -1009,12 +1149,24 @@ ATF_TC_BODY(aio_fsync_test, tc) ATF_TP_ADD_TCS(tp) { - ATF_TP_ADD_TC(tp, aio_file_test); - ATF_TP_ADD_TC(tp, aio_fifo_test); - ATF_TP_ADD_TC(tp, aio_unix_socketpair_test); - ATF_TP_ADD_TC(tp, aio_pty_test); - ATF_TP_ADD_TC(tp, aio_pipe_test); - ATF_TP_ADD_TC(tp, aio_md_test); + ATF_TP_ADD_TC(tp, file_poll); + ATF_TP_ADD_TC(tp, file_suspend); + ATF_TP_ADD_TC(tp, file_waitcomplete); + ATF_TP_ADD_TC(tp, fifo_poll); + ATF_TP_ADD_TC(tp, fifo_suspend); + ATF_TP_ADD_TC(tp, fifo_waitcomplete); + ATF_TP_ADD_TC(tp, socket_poll); + ATF_TP_ADD_TC(tp, socket_suspend); + ATF_TP_ADD_TC(tp, socket_waitcomplete); + ATF_TP_ADD_TC(tp, pty_poll); + ATF_TP_ADD_TC(tp, pty_suspend); + ATF_TP_ADD_TC(tp, pty_waitcomplete); + ATF_TP_ADD_TC(tp, pipe_poll); + ATF_TP_ADD_TC(tp, pipe_suspend); + ATF_TP_ADD_TC(tp, pipe_waitcomplete); + ATF_TP_ADD_TC(tp, md_poll); + ATF_TP_ADD_TC(tp, md_suspend); + ATF_TP_ADD_TC(tp, md_waitcomplete); ATF_TP_ADD_TC(tp, aio_large_read_test); ATF_TP_ADD_TC(tp, aio_socket_two_reads); ATF_TP_ADD_TC(tp, aio_socket_blocking_short_write); From 2b372753e240509674818013c1186e2b32b92775 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Sat, 28 Jan 2017 05:07:53 +0000 Subject: [PATCH 17/51] Honor LINKS=x y in dtb modules. We need this for compatibility links for old, FreeBSD names. --- sys/conf/dtb.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/conf/dtb.mk b/sys/conf/dtb.mk index f32b0202b94a..81c98ef0ad36 100644 --- a/sys/conf/dtb.mk +++ b/sys/conf/dtb.mk @@ -76,3 +76,4 @@ _dtbinstall: .include .include +.include From da5b9d11e98ab35e0b7d5e635187f6a9b0b9eeb6 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Sat, 28 Jan 2017 05:07:55 +0000 Subject: [PATCH 18/51] Switch to Linux / device tree upstream names. U-boot uses these by default, and the fewer changes relative to the upstream u-boot the better. Add compatibility links for the old names. Add dts file for BeagleBone Green while we're here. --- sys/modules/dtb/am335x/Makefile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/modules/dtb/am335x/Makefile b/sys/modules/dtb/am335x/Makefile index b60f4a9c5ed7..f862b7897e6c 100644 --- a/sys/modules/dtb/am335x/Makefile +++ b/sys/modules/dtb/am335x/Makefile @@ -1,8 +1,13 @@ # $FreeBSD$ # All the dts files for am335x systems we support. DTS= \ - beaglebone.dts \ - beaglebone-black.dts \ + am335x-bone.dts \ + am335x-boneblack.dts \ + am335x-bonegreen.dts \ ufw.dts +LINKS= \ + ${DTBDIR}/am3335x-bone.dtb ${DTBDIR}/beaglebone.dtb \ + ${DTBDIR}/am3335x-boneblack.dtb ${DTBDIR}/beaglebone-black.dtb + .include From 6597559ea7d7ea42366a6b203e019144915fe742 Mon Sep 17 00:00:00 2001 From: Dexuan Cui Date: Sat, 28 Jan 2017 07:26:42 +0000 Subject: [PATCH 19/51] ifnet: move the new ifnet_event EVENTHANDLER_DECLARE to net/if_var.h Thank glebius for pointing this out: "The network stuff shall not be added to sys/eventhandler.h" Reviewed by: David_A_Bright_DELL.com, sephe, glebius Approved by: sephe (mentor) MFC after: 2 weeks Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D9345 --- sys/net/if.c | 1 - sys/net/if_var.h | 5 +++++ sys/sys/eventhandler.h | 7 ------- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/sys/net/if.c b/sys/net/if.c index 043ecdfea1cc..7f91a4dc6669 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -59,7 +59,6 @@ #include #include #include -#include #include #include diff --git a/sys/net/if_var.h b/sys/net/if_var.h index 7c8fd7ec80a4..48122900f27c 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -404,6 +404,11 @@ EVENTHANDLER_DECLARE(ifnet_departure_event, ifnet_departure_event_handler_t); /* Interface link state change event */ typedef void (*ifnet_link_event_handler_t)(void *, struct ifnet *, int); EVENTHANDLER_DECLARE(ifnet_link_event, ifnet_link_event_handler_t); +/* Interface up/down event */ +#define IFNET_EVENT_UP 0 +#define IFNET_EVENT_DOWN 1 +typedef void (*ifnet_event_fn)(void *, struct ifnet *ifp, int event); +EVENTHANDLER_DECLARE(ifnet_event, ifnet_event_fn); #endif /* _SYS_EVENTHANDLER_H_ */ /* diff --git a/sys/sys/eventhandler.h b/sys/sys/eventhandler.h index 0f0665ccb947..b071c63926ee 100644 --- a/sys/sys/eventhandler.h +++ b/sys/sys/eventhandler.h @@ -284,11 +284,4 @@ typedef void (*swapoff_fn)(void *, struct swdevt *); EVENTHANDLER_DECLARE(swapon, swapon_fn); EVENTHANDLER_DECLARE(swapoff, swapoff_fn); -/* ifup/ifdown events */ -#define IFNET_EVENT_UP 0 -#define IFNET_EVENT_DOWN 1 -struct ifnet; -typedef void (*ifnet_event_fn)(void *, struct ifnet *ifp, int event); -EVENTHANDLER_DECLARE(ifnet_event, ifnet_event_fn); - #endif /* _SYS_EVENTHANDLER_H_ */ From 0a225f01e1063a5449c36467f7c1279517b117d6 Mon Sep 17 00:00:00 2001 From: Yoshihiro Takahashi Date: Sat, 28 Jan 2017 09:58:00 +0000 Subject: [PATCH 20/51] Remove more pc98 support. --- share/man/man4/ed.4 | 2 +- share/man/man4/le.4 | 7 ------- share/man/man4/man4.i386/ep.4 | 2 -- sys/dev/pci/isa_pci.c | 3 --- sys/modules/ata/atacbus/Makefile | 9 --------- 5 files changed, 1 insertion(+), 22 deletions(-) delete mode 100644 sys/modules/ata/atacbus/Makefile diff --git a/share/man/man4/ed.4 b/share/man/man4/ed.4 index e7594c60c70a..a64a80895793 100644 --- a/share/man/man4/ed.4 +++ b/share/man/man4/ed.4 @@ -257,7 +257,7 @@ Winbond W89C940 Winbond W89C940F .El .Pp -C-Bus, ISA, PCI and PC Card devices are supported. +ISA, PCI and PC Card devices are supported. .Pp The .Nm diff --git a/share/man/man4/le.4 b/share/man/man4/le.4 index 0316e4687398..cd3f0f23ca10 100644 --- a/share/man/man4/le.4 +++ b/share/man/man4/le.4 @@ -57,13 +57,6 @@ module at boot time, place the following line in if_le_load="YES" .Ed .Pp -For C-Bus non-PnP adapters, the port address and the IRQ number have to be -specified in -.Pa /boot/device.hints : -.Cd hint.le.0.at="isa" -.Cd hint.le.0.port="0x03d0" -.Cd hint.le.0.irq="6" -.Pp For ISA non-PnP adapters, the port address as well as the IRQ and the DRQ numbers have to be specified in .Pa /boot/device.hints : diff --git a/share/man/man4/man4.i386/ep.4 b/share/man/man4/man4.i386/ep.4 index a99c901c59da..0814e8410738 100644 --- a/share/man/man4/man4.i386/ep.4 +++ b/share/man/man4/man4.i386/ep.4 @@ -99,8 +99,6 @@ driver supports Ethernet adapters based on the .It 3Com 3C562/3C563 PCMCIA .It -3Com 3C569B-J-TPO, 3C569B-J-COMBO CBUS -.It 3Com 3C574, 3C574TX, 3C574-TX, 3CCFE574BT, 3CXFE574BT, 3C3FE574BT PCMCIA .It 3Com 3C579-TP, 3C579-BNC EISA diff --git a/sys/dev/pci/isa_pci.c b/sys/dev/pci/isa_pci.c index 950920da0c82..94a4732b5079 100644 --- a/sys/dev/pci/isa_pci.c +++ b/sys/dev/pci/isa_pci.c @@ -136,9 +136,6 @@ isab_pci_probe(device_t dev) case 0x00001078: /* Cyrix Cx5510 */ case 0x01001078: /* Cyrix Cx5530 */ case 0xc7001045: /* OPTi 82C700 (FireStar) */ - case 0x00011033: /* NEC 0001 (C-bus) */ - case 0x002c1033: /* NEC 002C (C-bus) */ - case 0x003b1033: /* NEC 003B (C-bus) */ case 0x886a1060: /* UMC UM8886 ISA */ case 0x02001166: /* ServerWorks IB6566 PCI */ if (bootverbose) diff --git a/sys/modules/ata/atacbus/Makefile b/sys/modules/ata/atacbus/Makefile deleted file mode 100644 index a291ad4a165f..000000000000 --- a/sys/modules/ata/atacbus/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# $FreeBSD$ - -.PATH: ${.CURDIR}/../../../dev/ata - -KMOD= atacbus -SRCS= ata-cbus.c -SRCS+= ata_if.h bus_if.h device_if.h isa_if.h - -.include From d166e6c63f0a8d604887f0b2054bd12f1bb24e2b Mon Sep 17 00:00:00 2001 From: Robert Watson Date: Sat, 28 Jan 2017 11:38:51 +0000 Subject: [PATCH 21/51] As with GENERIC on other architectures, include COMPAT_FREEBSD10 and COMPAT_FREEBSD11 in the generic BERI kernel configuration template. MFC after: 1 week Sponsored by: DARPA, AFRL --- sys/mips/conf/BERI_TEMPLATE | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/mips/conf/BERI_TEMPLATE b/sys/mips/conf/BERI_TEMPLATE index 7901f7722493..5371d935fa52 100644 --- a/sys/mips/conf/BERI_TEMPLATE +++ b/sys/mips/conf/BERI_TEMPLATE @@ -33,6 +33,9 @@ options KTRACE options CAPABILITY_MODE options CAPABILITIES +options COMPAT_FREEBSD10 +options COMPAT_FREEBSD11 + options SCHED_ULE options FFS #Berkeley Fast Filesystem From 55e0d88afd2b8fdee88a56f77cc1ec21c4ae9347 Mon Sep 17 00:00:00 2001 From: Robert Watson Date: Sat, 28 Jan 2017 12:26:22 +0000 Subject: [PATCH 22/51] Fix build of aio_test on MIPS, where the compiler warns about the local variable 'err' shadowing the global function err(3). Which it does. Sponsored by: DARPA, AFRL --- tests/sys/aio/aio_test.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/sys/aio/aio_test.c b/tests/sys/aio/aio_test.c index edb37e39f57f..ca8b41eec242 100644 --- a/tests/sys/aio/aio_test.c +++ b/tests/sys/aio/aio_test.c @@ -188,31 +188,31 @@ aio_context_init(struct aio_context *ac, int read_fd, static ssize_t poll(struct aiocb *aio) { - int err; + int error; - while ((err = aio_error(aio)) == EINPROGRESS && !aio_timedout) + while ((error = aio_error(aio)) == EINPROGRESS && !aio_timedout) usleep(25000); - switch (err) { + switch (error) { case EINPROGRESS: errno = EINTR; return (-1); case 0: return (aio_return(aio)); default: - return (err); + return (error); } } static ssize_t suspend(struct aiocb *aio) { const struct aiocb *const iocbs[] = {aio}; - int err; + int error; - err = aio_suspend(iocbs, 1, NULL); - if (err == 0) + error = aio_suspend(iocbs, 1, NULL); + if (error == 0) return (aio_return(aio)); else - return (err); + return (error); } static ssize_t From 95fadd99d5c43e5f377403f02f87d73ef4e756bb Mon Sep 17 00:00:00 2001 From: Robert Watson Date: Sat, 28 Jan 2017 12:43:19 +0000 Subject: [PATCH 23/51] Merge robustness improvements for the ALTERA JTAG UART driver from CheriBSD, which attempt to work around an inherent race in the UART's control-register design in detecting whether JTAG is currently, present, which will otherwise lead to moderately frequent output drops when running in polled rather than interrupt-driven operation. Now, these drops are quite infrequent. commit 9f33fddac9215e32781a4f016ba17eab804fb6d4 Author: Robert N. M. Watson Date: Thu Jul 16 17:34:12 2015 +0000 Add a new sysctl, hw.altera_jtag_uart.ac_poll_delay, which allows the (default 10ms) delay associated with a full JTAG UART buffer combined with a lack of a JTAG-present flag to be tuned. Setting this higher may cause some JTAG configurations to be more reliable when printing out low-level console output at a speed greater than the JTAG UART is willing to carry data. Or it may not. commit 73992ef7607738b2973736e409ccd644b30eadba Author: Robert N. M. Watson Date: Sun Jan 1 15:13:07 2017 +0000 Minor improvements to the Altera JTAG UART device driver: - Minor rework to the logic to detect JTAG presence in order to be a bit more resilient to inevitable races: increase the retry period from two seconds to four seconds for trying to find JTAG, and more agressively clear the miss counter if JTAG has been reconnected. Once JTAG has vanished, stop prodding the miss counter. - Do a bit of reworking of the output code to frob the control register less by checking whether write interrupts are enabled/disabled before changing their state. This should reduce the opportunity for races with JTAG discovery (which are inherent to the Altera hardware-software interface, but can at least be minimised). - Add statistics relating to interrupt enable/disable/JTAG discovery/etc. With these changes, polled-mode JTAG UART ttys appear substantially more robust. MFC after: 1 week Sponsored by: DARPA, AFRL --- .../altera/jtag_uart/altera_jtag_uart_cons.c | 17 +- .../altera/jtag_uart/altera_jtag_uart_tty.c | 156 +++++++++++++----- 2 files changed, 127 insertions(+), 46 deletions(-) diff --git a/sys/dev/altera/jtag_uart/altera_jtag_uart_cons.c b/sys/dev/altera/jtag_uart/altera_jtag_uart_cons.c index 96d20ceb21f4..07e884dde63a 100644 --- a/sys/dev/altera/jtag_uart/altera_jtag_uart_cons.c +++ b/sys/dev/altera/jtag_uart/altera_jtag_uart_cons.c @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -49,6 +50,9 @@ __FBSDID("$FreeBSD$"); devclass_t altera_jtag_uart_devclass; +static SYSCTL_NODE(_hw, OID_AUTO, altera_jtag_uart, CTLFLAG_RW, 0, + "Altera JTAG UART configuration knobs"); + /* * One-byte buffer as we can't check whether the UART is readable without * actually reading from it, synchronised by a spinlock; this lock also @@ -82,6 +86,11 @@ static cn_ungrab_t aju_cnungrab; * no AC bit set. */ #define ALTERA_JTAG_UART_AC_POLL_DELAY 10000 +static u_int altera_jtag_uart_ac_poll_delay = + ALTERA_JTAG_UART_AC_POLL_DELAY; +SYSCTL_UINT(_hw_altera_jtag_uart, OID_AUTO, ac_poll_delay, + CTLFLAG_RW, &altera_jtag_uart_ac_poll_delay, 0, + "Maximum delay waiting for JTAG present flag when buffer is full"); /* * I/O routines lifted from Deimos. This is not only MIPS-specific, but also @@ -220,10 +229,10 @@ aju_cons_write(char ch) * layer clearing of the bit doesn't trigger a TTY-layer * disconnection. * - * XXXRW: The polling delay may require tuning. - * * XXXRW: Notice the inherent race with hardware: in clearing the - * bit, we may race with hardware setting the same bit. + * bit, we may race with hardware setting the same bit. This can + * cause real-world reliability problems due to lost output on the + * console. */ v = aju_cons_control_read(); if (v & ALTERA_JTAG_UART_CONTROL_AC) { @@ -235,7 +244,7 @@ aju_cons_write(char ch) while ((v & ALTERA_JTAG_UART_CONTROL_WSPACE) == 0) { if (!aju_cons_jtag_present) return; - DELAY(ALTERA_JTAG_UART_AC_POLL_DELAY); + DELAY(altera_jtag_uart_ac_poll_delay); v = aju_cons_control_read(); if (v & ALTERA_JTAG_UART_CONTROL_AC) { aju_cons_jtag_present = 1; diff --git a/sys/dev/altera/jtag_uart/altera_jtag_uart_tty.c b/sys/dev/altera/jtag_uart/altera_jtag_uart_tty.c index 1e9a1b89657d..9f16dba6d99e 100644 --- a/sys/dev/altera/jtag_uart/altera_jtag_uart_tty.c +++ b/sys/dev/altera/jtag_uart/altera_jtag_uart_tty.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2011-2012 Robert N. M. Watson + * Copyright (c) 2011-2012, 2016 Robert N. M. Watson * All rights reserved. * * This software was developed by SRI International and the University of @@ -40,10 +40,12 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include #include #include @@ -65,9 +67,9 @@ static struct ttydevsw aju_ttydevsw = { /* * When polling for the AC bit, the number of times we have to not see it - * before assuming JTAG has disappeared on us. By default, two seconds. + * before assuming JTAG has disappeared on us. By default, four seconds. */ -#define AJU_JTAG_MAXMISS 10 +#define AJU_JTAG_MAXMISS 20 /* * Polling intervals for input/output and JTAG connection events. @@ -75,6 +77,53 @@ static struct ttydevsw aju_ttydevsw = { #define AJU_IO_POLLINTERVAL (hz/100) #define AJU_AC_POLLINTERVAL (hz/5) +/* + * Statistics on JTAG removal events when sending, for debugging purposes + * only. + */ +static u_int aju_jtag_vanished; +SYSCTL_UINT(_debug, OID_AUTO, aju_jtag_vanished, CTLFLAG_RW, + &aju_jtag_vanished, 0, "Number of times JTAG has vanished"); + +static u_int aju_jtag_appeared; +SYSCTL_UINT(_debug, OID_AUTO, aju_jtag_appeared, CTLFLAG_RW, + &aju_jtag_appeared, 0, "Number of times JTAG has appeared"); + +SYSCTL_INT(_debug, OID_AUTO, aju_cons_jtag_present, CTLFLAG_RW, + &aju_cons_jtag_present, 0, "JTAG console present flag"); + +SYSCTL_UINT(_debug, OID_AUTO, aju_cons_jtag_missed, CTLFLAG_RW, + &aju_cons_jtag_missed, 0, "JTAG console missed counter"); + +/* + * Interrupt-related statistics. + */ +static u_int aju_intr_readable_enabled; +SYSCTL_UINT(_debug, OID_AUTO, aju_intr_readable_enabled, CTLFLAG_RW, + &aju_intr_readable_enabled, 0, "Number of times read interrupt enabled"); + +static u_int aju_intr_writable_disabled; +SYSCTL_UINT(_debug, OID_AUTO, aju_intr_writable_disabled, CTLFLAG_RW, + &aju_intr_writable_disabled, 0, + "Number of times write interrupt disabled"); + +static u_int aju_intr_writable_enabled; +SYSCTL_UINT(_debug, OID_AUTO, aju_intr_writable_enabled, CTLFLAG_RW, + &aju_intr_writable_enabled, 0, + "Number of times write interrupt enabled"); + +static u_int aju_intr_disabled; +SYSCTL_UINT(_debug, OID_AUTO, aju_intr_disabled, CTLFLAG_RW, + &aju_intr_disabled, 0, "Number of times write interrupt disabled"); + +static u_int aju_intr_read_count; +SYSCTL_UINT(_debug, OID_AUTO, aju_intr_read_count, CTLFLAG_RW, + &aju_intr_read_count, 0, "Number of times read interrupt fired"); + +static u_int aju_intr_write_count; +SYSCTL_UINT(_debug, OID_AUTO, aju_intr_write_count, CTLFLAG_RW, + &aju_intr_write_count, 0, "Number of times write interrupt fired"); + /* * Low-level read and write register routines; the Altera UART is little * endian, so we byte swap 32-bit reads and writes. @@ -160,6 +209,7 @@ aju_intr_readable_enable(struct altera_jtag_uart_softc *sc) AJU_LOCK_ASSERT(sc); + atomic_add_int(&aju_intr_readable_enabled, 1); v = aju_control_read(sc); v |= ALTERA_JTAG_UART_CONTROL_RE; aju_control_write(sc, v); @@ -172,6 +222,7 @@ aju_intr_writable_enable(struct altera_jtag_uart_softc *sc) AJU_LOCK_ASSERT(sc); + atomic_add_int(&aju_intr_writable_enabled, 1); v = aju_control_read(sc); v |= ALTERA_JTAG_UART_CONTROL_WE; aju_control_write(sc, v); @@ -184,6 +235,7 @@ aju_intr_writable_disable(struct altera_jtag_uart_softc *sc) AJU_LOCK_ASSERT(sc); + atomic_add_int(&aju_intr_writable_disabled, 1); v = aju_control_read(sc); v &= ~ALTERA_JTAG_UART_CONTROL_WE; aju_control_write(sc, v); @@ -196,6 +248,7 @@ aju_intr_disable(struct altera_jtag_uart_softc *sc) AJU_LOCK_ASSERT(sc); + atomic_add_int(&aju_intr_disabled, 1); v = aju_control_read(sc); v &= ~(ALTERA_JTAG_UART_CONTROL_RE | ALTERA_JTAG_UART_CONTROL_WE); aju_control_write(sc, v); @@ -249,30 +302,7 @@ aju_handle_output(struct altera_jtag_uart_softc *sc, struct tty *tp) AJU_UNLOCK(sc); while (ttydisc_getc_poll(tp) != 0) { AJU_LOCK(sc); - v = aju_control_read(sc); - if ((v & ALTERA_JTAG_UART_CONTROL_WSPACE) != 0) { - AJU_UNLOCK(sc); - if (ttydisc_getc(tp, &ch, sizeof(ch)) != sizeof(ch)) - panic("%s: ttydisc_getc", __func__); - AJU_LOCK(sc); - - /* - * XXXRW: There is a slight race here in which we test - * for writability, drop the lock, get the character - * from the tty layer, re-acquire the lock, and then - * write. It's possible for other code -- - * specifically, the low-level console -- to have - * written in the mean time, which might mean that - * there is no longer space. The BERI memory bus will - * cause this write to block, wedging the processor - * until space is available -- which could be a while - * if JTAG is not attached! - * - * The 'easy' fix is to drop the character if WSPACE - * has become unset. Not sure what the 'hard' fix is. - */ - aju_data_write(sc, ch); - } else { + if (*sc->ajus_jtag_presentp == 0) { /* * If JTAG is not present, then we will drop this * character instead of perhaps scheduling an @@ -281,21 +311,50 @@ aju_handle_output(struct altera_jtag_uart_softc *sc, struct tty *tp) * later even though we aren't interested in sending * anymore. Loop to drain TTY-layer buffer. */ - if (*sc->ajus_jtag_presentp == 0) { - if (ttydisc_getc(tp, &ch, sizeof(ch)) != - sizeof(ch)) - panic("%s: ttydisc_getc 2", __func__); - AJU_UNLOCK(sc); - continue; - } - if (sc->ajus_irq_res != NULL) + AJU_UNLOCK(sc); + if (ttydisc_getc(tp, &ch, sizeof(ch)) != + sizeof(ch)) + panic("%s: ttydisc_getc", __func__); + continue; + } + v = aju_control_read(sc); + if ((v & ALTERA_JTAG_UART_CONTROL_WSPACE) == 0) { + if (sc->ajus_irq_res != NULL && + (v & ALTERA_JTAG_UART_CONTROL_WE) == 0) aju_intr_writable_enable(sc); return; } AJU_UNLOCK(sc); + if (ttydisc_getc(tp, &ch, sizeof(ch)) != sizeof(ch)) + panic("%s: ttydisc_getc 2", __func__); + AJU_LOCK(sc); + + /* + * XXXRW: There is a slight race here in which we test for + * writability, drop the lock, get the character from the tty + * layer, re-acquire the lock, and then write. It's possible + * for other code -- specifically, the low-level console -- to + * have* written in the mean time, which might mean that there + * is no longer space. The BERI memory bus will cause this + * write to block, wedging the processor until space is + * available -- which could be a while if JTAG is not + * attached! + * + * The 'easy' fix is to drop the character if WSPACE has + * become unset. Not sure what the 'hard' fix is. + */ + aju_data_write(sc, ch); + AJU_UNLOCK(sc); } AJU_LOCK(sc); - aju_intr_writable_disable(sc); + + /* + * If interrupts are configured, and there's no data to write, but we + * had previously enabled write interrupts, disable them now. + */ + v = aju_control_read(sc); + if (sc->ajus_irq_res != NULL && (v & ALTERA_JTAG_UART_CONTROL_WE) != 0) + aju_intr_writable_disable(sc); } static void @@ -355,16 +414,25 @@ aju_ac_callout(void *arg) v &= ~ALTERA_JTAG_UART_CONTROL_AC; aju_control_write(sc, v); if (*sc->ajus_jtag_presentp == 0) { - *sc->ajus_jtag_missedp = 0; *sc->ajus_jtag_presentp = 1; + atomic_add_int(&aju_jtag_appeared, 1); aju_handle_output(sc, tp); } + + /* Any hit eliminates all recent misses. */ + *sc->ajus_jtag_missedp = 0; } else if (*sc->ajus_jtag_presentp != 0) { - (*sc->ajus_jtag_missedp)++; - if (*sc->ajus_jtag_missedp >= AJU_JTAG_MAXMISS) { + /* + * If we've exceeded our tolerance for misses, mark JTAG as + * disconnected and drain output. Otherwise, bump the miss + * counter. + */ + if (*sc->ajus_jtag_missedp > AJU_JTAG_MAXMISS) { *sc->ajus_jtag_presentp = 0; + atomic_add_int(&aju_jtag_vanished, 1); aju_handle_output(sc, tp); - } + } else + (*sc->ajus_jtag_missedp)++; } callout_reset(&sc->ajus_ac_callout, AJU_AC_POLLINTERVAL, aju_ac_callout, sc); @@ -382,10 +450,14 @@ aju_intr(void *arg) tty_lock(tp); AJU_LOCK(sc); v = aju_control_read(sc); - if (v & ALTERA_JTAG_UART_CONTROL_RI) + if (v & ALTERA_JTAG_UART_CONTROL_RI) { + atomic_add_int(&aju_intr_read_count, 1); aju_handle_input(sc, tp); - if (v & ALTERA_JTAG_UART_CONTROL_WI) + } + if (v & ALTERA_JTAG_UART_CONTROL_WI) { + atomic_add_int(&aju_intr_write_count, 1); aju_handle_output(sc, tp); + } AJU_UNLOCK(sc); tty_unlock(tp); } From 2f1c6436580adcc84ffcec9f53b7c76aedb33c2e Mon Sep 17 00:00:00 2001 From: Hiroki Sato Date: Sat, 28 Jan 2017 13:09:18 +0000 Subject: [PATCH 24/51] Fix a bug which caused not to create AF_LOCAL sockets when family is specified. Spotted by: Alex Deiter --- usr.sbin/syslogd/syslogd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index 278e4be57535..3ca1006cf69d 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -2908,7 +2908,8 @@ socksetup(struct peer *pe) /* Only AF_LOCAL in secure mode. */ continue; } - if (family != AF_UNSPEC && res->ai_family != family) + if (family != AF_UNSPEC && + res->ai_family != AF_LOCAL && res->ai_family != family) continue; s = socket(res->ai_family, res->ai_socktype, From f00e79c8470318cef8b419e33daa6c72b43f8fdb Mon Sep 17 00:00:00 2001 From: Robert Watson Date: Sat, 28 Jan 2017 13:25:06 +0000 Subject: [PATCH 25/51] Merge enhancements to the ALTERA Avalon bus generic device attachment driver to support exposing a GEOM device, which can be used to mount Avalon-attached ROMs, reserved areas of DRAM, etc, as a filesystem: commit 9deb1e60eaaaf7a3687e48c58af5efd756f32ec6 Author: Robert N. M. Watson Date: Sat Mar 5 20:33:12 2016 +0000 Use format strings with make_dev(9) in avgen(4). commit 0bf2176c23e7425bfa042c08a24f8a25fe6d8885 Author: Robert N. M. Watson Date: Tue Mar 1 10:23:23 2016 +0000 Implement a new "geomio" configuration argument to altera_avgen(4), the generic I/O device we attach to various BERI peripherals. The new option requests that, instead of exposing the underlying device via a special device node in /dev, it instead be exposed via geom(4), allowing it to be used with filesystems. The current implementation does not allow a device to be exposed both for file/mmap and geom, so one of the two models must be selected when configuring it via FDT or device.hints. A typical use of the new option will be: sri-cambridge,geomio = "rw"; MFC after: 1 week Sponsored by: DARPA, AFRL --- sys/dev/altera/avgen/altera_avgen.c | 236 +++++++++++++++++++--- sys/dev/altera/avgen/altera_avgen.h | 17 +- sys/dev/altera/avgen/altera_avgen_fdt.c | 13 +- sys/dev/altera/avgen/altera_avgen_nexus.c | 11 +- 4 files changed, 240 insertions(+), 37 deletions(-) diff --git a/sys/dev/altera/avgen/altera_avgen.c b/sys/dev/altera/avgen/altera_avgen.c index f880e8608dcd..abe007163a16 100644 --- a/sys/dev/altera/avgen/altera_avgen.c +++ b/sys/dev/altera/avgen/altera_avgen.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2012-2013 Robert N. M. Watson + * Copyright (c) 2012-2013, 2016 Robert N. M. Watson * All rights reserved. * * This software was developed by SRI International and the University of @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -45,6 +46,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include #include @@ -65,14 +68,19 @@ static d_mmap_t altera_avgen_mmap; static d_read_t altera_avgen_read; static d_write_t altera_avgen_write; +#define ALTERA_AVGEN_DEVNAME "altera_avgen" +#define ALTERA_AVGEN_DEVNAME_FMT (ALTERA_AVGEN_DEVNAME "%d") + static struct cdevsw avg_cdevsw = { .d_version = D_VERSION, .d_mmap = altera_avgen_mmap, .d_read = altera_avgen_read, .d_write = altera_avgen_write, - .d_name = "altera_avgen", + .d_name = ALTERA_AVGEN_DEVNAME, }; +#define ALTERA_AVGEN_SECTORSIZE 512 /* Not configurable at this time. */ + static int altera_avgen_read(struct cdev *dev, struct uio *uio, int flag) { @@ -227,11 +235,103 @@ altera_avgen_mmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, return (0); } +/* + * NB: We serialise block reads and writes in case the OS is generating + * concurrent I/O against the same block, in which case we want one I/O (or + * another) to win. This is not sufficient to provide atomicity for the + * sector in the presence of a fail stop -- however, we're just writing this + * to non-persistent DRAM .. right? + */ +static void +altera_avgen_disk_strategy(struct bio *bp) +{ + struct altera_avgen_softc *sc; + void *data; + long bcount; + daddr_t pblkno; + + sc = bp->bio_disk->d_drv1; + data = bp->bio_data; + bcount = bp->bio_bcount; + pblkno = bp->bio_pblkno; + + /* + * Serialize block reads / writes. + */ + mtx_lock(&sc->avg_disk_mtx); + switch (bp->bio_cmd) { + case BIO_READ: + if (!(sc->avg_flags & ALTERA_AVALON_FLAG_GEOM_READ)) { + biofinish(bp, NULL, EIO); + break; + } + switch (sc->avg_width) { + case 1: + bus_read_region_1(sc->avg_res, + bp->bio_pblkno * ALTERA_AVGEN_SECTORSIZE, + (uint8_t *)data, bcount); + break; + + case 2: + bus_read_region_2(sc->avg_res, + bp->bio_pblkno * ALTERA_AVGEN_SECTORSIZE, + (uint16_t *)data, bcount / 2); + break; + + case 4: + bus_read_region_4(sc->avg_res, + bp->bio_pblkno * ALTERA_AVGEN_SECTORSIZE, + (uint32_t *)data, bcount / 4); + break; + + default: + panic("%s: unexpected width %u", __func__, + sc->avg_width); + } + break; + + case BIO_WRITE: + if (!(sc->avg_flags & ALTERA_AVALON_FLAG_GEOM_WRITE)) { + biofinish(bp, NULL, EROFS); + break; + } + switch (sc->avg_width) { + case 1: + bus_write_region_1(sc->avg_res, + bp->bio_pblkno * ALTERA_AVGEN_SECTORSIZE, + (uint8_t *)data, bcount); + break; + + case 2: + bus_write_region_2(sc->avg_res, + bp->bio_pblkno * ALTERA_AVGEN_SECTORSIZE, + (uint16_t *)data, bcount / 2); + break; + + case 4: + bus_write_region_4(sc->avg_res, + bp->bio_pblkno * ALTERA_AVGEN_SECTORSIZE, + (uint32_t *)data, bcount / 4); + break; + + default: + panic("%s: unexpected width %u", __func__, + sc->avg_width); + } + break; + + default: + panic("%s: unsupported I/O operation %d", __func__, + bp->bio_cmd); + } + mtx_unlock(&sc->avg_disk_mtx); + biofinish(bp, NULL, 0); +} static int altera_avgen_process_options(struct altera_avgen_softc *sc, - const char *str_fileio, const char *str_mmapio, const char *str_devname, - int devunit) + const char *str_fileio, const char *str_geomio, const char *str_mmapio, + const char *str_devname, int devunit) { const char *cp; device_t dev = sc->avg_dev; @@ -239,12 +339,30 @@ altera_avgen_process_options(struct altera_avgen_softc *sc, /* * Check for valid combinations of options. */ - if (str_fileio == NULL && str_mmapio == NULL) { + if (str_fileio == NULL && str_geomio == NULL && str_mmapio == NULL) { device_printf(dev, - "at least one of %s or %s must be specified\n", - ALTERA_AVALON_STR_FILEIO, ALTERA_AVALON_STR_MMAPIO); + "at least one of %s, %s, or %s must be specified\n", + ALTERA_AVALON_STR_FILEIO, ALTERA_AVALON_STR_GEOMIO, + ALTERA_AVALON_STR_MMAPIO); return (ENXIO); } + + /* + * Validity check: a device can either be a GEOM device (in which case + * we use GEOM to register the device node), or a special device -- + * but not both as that causes a collision in /dev. + */ + if (str_geomio != NULL && (str_fileio != NULL || str_mmapio != NULL)) { + device_printf(dev, + "at most one of %s and (%s or %s) may be specified\n", + ALTERA_AVALON_STR_GEOMIO, ALTERA_AVALON_STR_FILEIO, + ALTERA_AVALON_STR_MMAPIO); + return (ENXIO); + } + + /* + * Ensure that a unit is specified if a name is also specified. + */ if (str_devname == NULL && devunit != -1) { device_printf(dev, "%s requires %s be specified\n", ALTERA_AVALON_STR_DEVUNIT, ALTERA_AVALON_STR_DEVNAME); @@ -288,6 +406,25 @@ altera_avgen_process_options(struct altera_avgen_softc *sc, } } } + if (str_geomio != NULL) { + for (cp = str_geomio; *cp != '\0'; cp++){ + switch (*cp) { + case ALTERA_AVALON_CHAR_READ: + sc->avg_flags |= ALTERA_AVALON_FLAG_GEOM_READ; + break; + + case ALTERA_AVALON_CHAR_WRITE: + sc->avg_flags |= ALTERA_AVALON_FLAG_GEOM_WRITE; + break; + + default: + device_printf(dev, + "invalid %s character %c\n", + ALTERA_AVALON_STR_GEOMIO, *cp); + return (ENXIO); + } + } + } if (str_mmapio != NULL) { for (cp = str_mmapio; *cp != '\0'; cp++) { switch (*cp) { @@ -317,13 +454,14 @@ altera_avgen_process_options(struct altera_avgen_softc *sc, int altera_avgen_attach(struct altera_avgen_softc *sc, const char *str_fileio, - const char *str_mmapio, const char *str_devname, int devunit) + const char *str_geomio, const char *str_mmapio, const char *str_devname, + int devunit) { device_t dev = sc->avg_dev; int error; - error = altera_avgen_process_options(sc, str_fileio, str_mmapio, - str_devname, devunit); + error = altera_avgen_process_options(sc, str_fileio, str_geomio, + str_mmapio, str_devname, devunit); if (error) return (error); @@ -339,23 +477,59 @@ altera_avgen_attach(struct altera_avgen_softc *sc, const char *str_fileio, } } - /* Device node allocation. */ - if (str_devname == NULL) { - str_devname = "altera_avgen%d"; + /* + * If a GEOM permission is requested, then create the device via GEOM. + * Otherwise, create a special device. We checked during options + * processing that both weren't requested a once. + */ + if (str_devname != NULL) { + sc->avg_name = strdup(str_devname, M_TEMP); devunit = sc->avg_unit; + } else + sc->avg_name = strdup(ALTERA_AVGEN_DEVNAME, M_TEMP); + if (sc->avg_flags & (ALTERA_AVALON_FLAG_GEOM_READ | + ALTERA_AVALON_FLAG_GEOM_WRITE)) { + mtx_init(&sc->avg_disk_mtx, "altera_avgen_disk", NULL, + MTX_DEF); + sc->avg_disk = disk_alloc(); + sc->avg_disk->d_drv1 = sc; + sc->avg_disk->d_strategy = altera_avgen_disk_strategy; + if (devunit == -1) + devunit = 0; + sc->avg_disk->d_name = sc->avg_name; + sc->avg_disk->d_unit = devunit; + + /* + * NB: As avg_res is a multiple of PAGE_SIZE, it is also a + * multiple of ALTERA_AVGEN_SECTORSIZE. + */ + sc->avg_disk->d_sectorsize = ALTERA_AVGEN_SECTORSIZE; + sc->avg_disk->d_mediasize = rman_get_size(sc->avg_res); + sc->avg_disk->d_maxsize = ALTERA_AVGEN_SECTORSIZE; + disk_create(sc->avg_disk, DISK_VERSION); + } else { + /* Device node allocation. */ + if (str_devname == NULL) { + str_devname = ALTERA_AVGEN_DEVNAME_FMT; + devunit = sc->avg_unit; + } + if (devunit != -1) + sc->avg_cdev = make_dev(&avg_cdevsw, sc->avg_unit, + UID_ROOT, GID_WHEEL, S_IRUSR | S_IWUSR, "%s%d", + str_devname, devunit); + else + sc->avg_cdev = make_dev(&avg_cdevsw, sc->avg_unit, + UID_ROOT, GID_WHEEL, S_IRUSR | S_IWUSR, + "%s", str_devname); + if (sc->avg_cdev == NULL) { + device_printf(sc->avg_dev, "%s: make_dev failed\n", + __func__); + return (ENXIO); + } + + /* XXXRW: Slight race between make_dev(9) and here. */ + sc->avg_cdev->si_drv1 = sc; } - if (devunit != -1) - sc->avg_cdev = make_dev(&avg_cdevsw, sc->avg_unit, UID_ROOT, - GID_WHEEL, S_IRUSR | S_IWUSR, str_devname, devunit); - else - sc->avg_cdev = make_dev(&avg_cdevsw, sc->avg_unit, UID_ROOT, - GID_WHEEL, S_IRUSR | S_IWUSR, str_devname); - if (sc->avg_cdev == NULL) { - device_printf(sc->avg_dev, "%s: make_dev failed\n", __func__); - return (ENXIO); - } - /* XXXRW: Slight race between make_dev(9) and here. */ - sc->avg_cdev->si_drv1 = sc; return (0); } @@ -363,5 +537,15 @@ void altera_avgen_detach(struct altera_avgen_softc *sc) { - destroy_dev(sc->avg_cdev); + KASSERT((sc->avg_disk != NULL) || (sc->avg_cdev != NULL), + ("%s: neither GEOM nor special device", __func__)); + + if (sc->avg_disk != NULL) { + disk_gone(sc->avg_disk); + disk_destroy(sc->avg_disk); + free(sc->avg_name, M_TEMP); + mtx_destroy(&sc->avg_disk_mtx); + } else { + destroy_dev(sc->avg_cdev); + } } diff --git a/sys/dev/altera/avgen/altera_avgen.h b/sys/dev/altera/avgen/altera_avgen.h index fb25a3cc276b..9c276015de25 100644 --- a/sys/dev/altera/avgen/altera_avgen.h +++ b/sys/dev/altera/avgen/altera_avgen.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2012 Robert N. M. Watson + * Copyright (c) 2012, 2016 Robert N. M. Watson * All rights reserved. * * This software was developed by SRI International and the University of @@ -39,6 +39,7 @@ struct altera_avgen_softc { */ device_t avg_dev; int avg_unit; + char *avg_name; /* * The device node and memory-mapped I/O region. @@ -52,6 +53,13 @@ struct altera_avgen_softc { */ u_int avg_flags; u_int avg_width; + u_int avg_sectorsize; + + /* + * disk(9) state, if required for this device. + */ + struct disk *avg_disk; + struct mtx avg_disk_mtx; }; /* @@ -63,6 +71,8 @@ struct altera_avgen_softc { #define ALTERA_AVALON_FLAG_MMAP_READ 0x04 #define ALTERA_AVALON_FLAG_MMAP_WRITE 0x08 #define ALTERA_AVALON_FLAG_MMAP_EXEC 0x10 +#define ALTERA_AVALON_FLAG_GEOM_READ 0x20 +#define ALTERA_AVALON_FLAG_GEOM_WRITE 0x40 #define ALTERA_AVALON_CHAR_READ 'r' #define ALTERA_AVALON_CHAR_WRITE 'w' @@ -70,6 +80,7 @@ struct altera_avgen_softc { #define ALTERA_AVALON_STR_WIDTH "width" #define ALTERA_AVALON_STR_FILEIO "fileio" +#define ALTERA_AVALON_STR_GEOMIO "geomio" #define ALTERA_AVALON_STR_MMAPIO "mmapio" #define ALTERA_AVALON_STR_DEVNAME "devname" #define ALTERA_AVALON_STR_DEVUNIT "devunit" @@ -78,8 +89,8 @@ struct altera_avgen_softc { * Driver setup routines from the bus attachment/teardown. */ int altera_avgen_attach(struct altera_avgen_softc *sc, - const char *str_fileio, const char *str_mmapio, - const char *str_devname, int devunit); + const char *str_fileio, const char *str_geomio, + const char *str_mmapio, const char *str_devname, int devunit); void altera_avgen_detach(struct altera_avgen_softc *sc); extern devclass_t altera_avgen_devclass; diff --git a/sys/dev/altera/avgen/altera_avgen_fdt.c b/sys/dev/altera/avgen/altera_avgen_fdt.c index 79e07eae1e53..548d3b14016c 100644 --- a/sys/dev/altera/avgen/altera_avgen_fdt.c +++ b/sys/dev/altera/avgen/altera_avgen_fdt.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2012-2013 Robert N. M. Watson + * Copyright (c) 2012-2013, 2016 Robert N. M. Watson * All rights reserved. * * This software was developed by SRI International and the University of @@ -75,7 +75,7 @@ static int altera_avgen_fdt_attach(device_t dev) { struct altera_avgen_softc *sc; - char *str_fileio, *str_mmapio; + char *str_fileio, *str_geomio, *str_mmapio; char *str_devname; phandle_t node; pcell_t cell; @@ -90,6 +90,7 @@ altera_avgen_fdt_attach(device_t dev) * expose the device via /dev. */ str_fileio = NULL; + str_geomio = NULL; str_mmapio = NULL; str_devname = NULL; devunit = -1; @@ -99,6 +100,8 @@ altera_avgen_fdt_attach(device_t dev) sc->avg_width = cell; (void)OF_getprop_alloc(node, "sri-cambridge,fileio", sizeof(char), (void **)&str_fileio); + (void)OF_getprop_alloc(node, "sri-cambridge,geomio", sizeof(char), + (void **)&str_geomio); (void)OF_getprop_alloc(node, "sri-cambridge,mmapio", sizeof(char), (void **)&str_mmapio); (void)OF_getprop_alloc(node, "sri-cambridge,devname", sizeof(char), @@ -114,13 +117,15 @@ altera_avgen_fdt_attach(device_t dev) device_printf(dev, "couldn't map memory\n"); return (ENXIO); } - error = altera_avgen_attach(sc, str_fileio, str_mmapio, str_devname, - devunit); + error = altera_avgen_attach(sc, str_fileio, str_geomio, str_mmapio, + str_devname, devunit); if (error != 0) bus_release_resource(dev, SYS_RES_MEMORY, sc->avg_rid, sc->avg_res); if (str_fileio != NULL) OF_prop_free(str_fileio); + if (str_geomio != NULL) + OF_prop_free(str_geomio); if (str_mmapio != NULL) OF_prop_free(str_mmapio); if (str_devname != NULL) diff --git a/sys/dev/altera/avgen/altera_avgen_nexus.c b/sys/dev/altera/avgen/altera_avgen_nexus.c index c3daab736623..2438da66c64f 100644 --- a/sys/dev/altera/avgen/altera_avgen_nexus.c +++ b/sys/dev/altera/avgen/altera_avgen_nexus.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2012-2013 Robert N. M. Watson + * Copyright (c) 2012-2013, 2016 Robert N. M. Watson * All rights reserved. * * This software was developed by SRI International and the University of @@ -64,7 +64,7 @@ static int altera_avgen_nexus_attach(device_t dev) { struct altera_avgen_softc *sc; - const char *str_fileio, *str_mmapio; + const char *str_fileio, *str_geomio, *str_mmapio; const char *str_devname; int devunit, error; @@ -77,6 +77,7 @@ altera_avgen_nexus_attach(device_t dev) * on the device, and whether it is cached. */ str_fileio = NULL; + str_geomio = NULL; str_mmapio = NULL; str_devname = NULL; devunit = -1; @@ -89,6 +90,8 @@ altera_avgen_nexus_attach(device_t dev) } (void)resource_string_value(device_get_name(dev), device_get_unit(dev), ALTERA_AVALON_STR_FILEIO, &str_fileio); + (void)resource_string_value(device_get_name(dev), + device_get_unit(dev), ALTERA_AVALON_STR_GEOMIO, &str_geomio); (void)resource_string_value(device_get_name(dev), device_get_unit(dev), ALTERA_AVALON_STR_MMAPIO, &str_mmapio); (void)resource_string_value(device_get_name(dev), @@ -104,8 +107,8 @@ altera_avgen_nexus_attach(device_t dev) device_printf(dev, "couldn't map memory\n"); return (ENXIO); } - error = altera_avgen_attach(sc, str_fileio, str_mmapio, str_devname, - devunit); + error = altera_avgen_attach(sc, str_fileio, str_geomio, str_mmapio, + str_devname, devunit); if (error != 0) bus_release_resource(dev, SYS_RES_MEMORY, sc->avg_rid, sc->avg_res); From 2e8e6c3a4f2da68ae1cf178f0f6eac35f8bc1c5a Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Sat, 28 Jan 2017 15:43:19 +0000 Subject: [PATCH 26/51] Make the drm2 module depend on linuxkpi Use linux memory allocation to reduce diff with upstream --- sys/dev/drm2/drm_agpsupport.c | 14 ++++++-------- sys/dev/drm2/drm_drv.c | 3 ++- sys/dev/drm2/drm_os_freebsd.c | 2 +- sys/dev/drm2/drm_os_freebsd.h | 1 - sys/dev/drm2/drm_stub.c | 5 +++-- sys/modules/drm2/drm2/Makefile | 2 ++ 6 files changed, 14 insertions(+), 13 deletions(-) diff --git a/sys/dev/drm2/drm_agpsupport.c b/sys/dev/drm2/drm_agpsupport.c index 131a9ad9cc91..025350fc4bb7 100644 --- a/sys/dev/drm2/drm_agpsupport.c +++ b/sys/dev/drm2/drm_agpsupport.c @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include +#include #if __OS_HAS_AGP @@ -208,15 +209,13 @@ int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request) if (!dev->agp || !dev->agp->acquired) return -EINVAL; - if (!(entry = malloc(sizeof(*entry), DRM_MEM_AGPLISTS, M_NOWAIT))) + if (!(entry = kzalloc(sizeof(*entry), GFP_KERNEL))) return -ENOMEM; - memset(entry, 0, sizeof(*entry)); - pages = (request->size + PAGE_SIZE - 1) / PAGE_SIZE; type = (u32) request->type; if (!(memory = agp_alloc_memory(dev->agp->bridge, type, pages << PAGE_SHIFT))) { - free(entry, DRM_MEM_AGPLISTS); + kfree(entry); return -ENOMEM; } @@ -376,7 +375,7 @@ int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request) list_del(&entry->head); drm_free_agp(entry->memory, entry->pages); - free(entry, DRM_MEM_AGPLISTS); + kfree(entry); return 0; } EXPORT_SYMBOL(drm_agp_free); @@ -404,12 +403,11 @@ struct drm_agp_head *drm_agp_init(struct drm_device *dev) { struct drm_agp_head *head = NULL; - if (!(head = malloc(sizeof(*head), DRM_MEM_AGPLISTS, M_NOWAIT))) + if (!(head = kzalloc(sizeof(*head), GFP_KERNEL))) return NULL; - memset((void *)head, 0, sizeof(*head)); head->bridge = agp_find_device(); if (!head->bridge) { - free(head, DRM_MEM_AGPLISTS); + kfree(head); return NULL; } else { agp_get_info(head->bridge, &head->agp_info); diff --git a/sys/dev/drm2/drm_drv.c b/sys/dev/drm2/drm_drv.c index 9529ac3dfa4b..c220668bdb71 100644 --- a/sys/dev/drm2/drm_drv.c +++ b/sys/dev/drm2/drm_drv.c @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -211,7 +212,7 @@ int drm_lastclose(struct drm_device * dev) if (entry->bound) drm_unbind_agp(entry->memory); drm_free_agp(entry->memory, entry->pages); - free(entry, DRM_MEM_AGPLISTS); + kfree(entry); } INIT_LIST_HEAD(&dev->agp->memory); diff --git a/sys/dev/drm2/drm_os_freebsd.c b/sys/dev/drm2/drm_os_freebsd.c index 4ce8081887ba..90d7319a2ea0 100644 --- a/sys/dev/drm2/drm_os_freebsd.c +++ b/sys/dev/drm2/drm_os_freebsd.c @@ -24,7 +24,6 @@ MALLOC_DEFINE(DRM_MEM_QUEUES, "drm_queues", "DRM QUEUE Data Structures"); MALLOC_DEFINE(DRM_MEM_CMDS, "drm_cmds", "DRM COMMAND Data Structures"); MALLOC_DEFINE(DRM_MEM_MAPPINGS, "drm_mapping", "DRM MAPPING Data Structures"); MALLOC_DEFINE(DRM_MEM_BUFLISTS, "drm_buflists", "DRM BUFLISTS Data Structures"); -MALLOC_DEFINE(DRM_MEM_AGPLISTS, "drm_agplists", "DRM AGPLISTS Data Structures"); MALLOC_DEFINE(DRM_MEM_CTXBITMAP, "drm_ctxbitmap", "DRM CTXBITMAP Data Structures"); MALLOC_DEFINE(DRM_MEM_SGLISTS, "drm_sglists", "DRM SGLISTS Data Structures"); @@ -496,4 +495,5 @@ MODULE_VERSION(drmn, 1); MODULE_DEPEND(drmn, agp, 1, 1, 1); MODULE_DEPEND(drmn, pci, 1, 1, 1); MODULE_DEPEND(drmn, mem, 1, 1, 1); +MODULE_DEPEND(drmn, linuxkpi, 1, 1, 1); MODULE_DEPEND(drmn, iicbus, 1, 1, 1); diff --git a/sys/dev/drm2/drm_os_freebsd.h b/sys/dev/drm2/drm_os_freebsd.h index 11c9feb9b4aa..cedc7a25228d 100644 --- a/sys/dev/drm2/drm_os_freebsd.h +++ b/sys/dev/drm2/drm_os_freebsd.h @@ -552,7 +552,6 @@ MALLOC_DECLARE(DRM_MEM_QUEUES); MALLOC_DECLARE(DRM_MEM_CMDS); MALLOC_DECLARE(DRM_MEM_MAPPINGS); MALLOC_DECLARE(DRM_MEM_BUFLISTS); -MALLOC_DECLARE(DRM_MEM_AGPLISTS); MALLOC_DECLARE(DRM_MEM_CTXBITMAP); MALLOC_DECLARE(DRM_MEM_SGLISTS); MALLOC_DECLARE(DRM_MEM_MM); diff --git a/sys/dev/drm2/drm_stub.c b/sys/dev/drm2/drm_stub.c index 06663ac8ef70..54b1a80cb7a1 100644 --- a/sys/dev/drm2/drm_stub.c +++ b/sys/dev/drm2/drm_stub.c @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #ifdef DRM_DEBUG_DEFAULT_ON unsigned int drm_debug = (DRM_DEBUGBITS_DEBUG | DRM_DEBUGBITS_KMS | @@ -315,7 +316,7 @@ void drm_cancel_fill_in_dev(struct drm_device *dev) DRM_MTRR_WC); DRM_DEBUG("mtrr_del=%d\n", retval); } - free(dev->agp, DRM_MEM_AGPLISTS); + kfree(dev->agp); dev->agp = NULL; drm_ht_remove(&dev->map_hash); @@ -467,7 +468,7 @@ void drm_put_dev(struct drm_device *dev) drm_sysctl_cleanup(dev); if (drm_core_has_AGP(dev) && dev->agp) { - free(dev->agp, DRM_MEM_AGPLISTS); + kfree(dev->agp); dev->agp = NULL; } diff --git a/sys/modules/drm2/drm2/Makefile b/sys/modules/drm2/drm2/Makefile index 35bee2972091..75696466db6d 100644 --- a/sys/modules/drm2/drm2/Makefile +++ b/sys/modules/drm2/drm2/Makefile @@ -48,6 +48,8 @@ SRCS = \ ati_pcigart.c #ttm_page_alloc_dma.c +CFLAGS+= -I${.CURDIR}/../../../compat/linuxkpi/common/include + .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_ARCH} == "powerpc64" SRCS += drm_ioc32.c .endif From 835809f99fb625567e0f5e06d1465e61e20cb3f3 Mon Sep 17 00:00:00 2001 From: Sean Bruno Date: Sat, 28 Jan 2017 15:44:14 +0000 Subject: [PATCH 27/51] Fix i386 compile failure by moving needed closing parenthesis out of conditional block. Submitted by: hiren Reported by: cy --- sys/net/iflib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index c6cc40535904..ad91a24ab6aa 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -1536,8 +1536,8 @@ iflib_rxsd_alloc(iflib_rxq_t rxq) goto fail; } } - } #endif + } return (0); fail: From dc5f9fcdae3869ad302953abf997f3a198ca1f4b Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Sat, 28 Jan 2017 16:24:06 +0000 Subject: [PATCH 28/51] Implement atomic_fcmpset_* for arm and arm64. --- sys/arm/include/atomic-v4.h | 51 +++++++++++++++++ sys/arm/include/atomic-v6.h | 110 ++++++++++++++++++++++++++++++++++++ sys/arm/include/atomic.h | 6 ++ sys/arm64/include/atomic.h | 64 +++++++++++++++++++++ 4 files changed, 231 insertions(+) diff --git a/sys/arm/include/atomic-v4.h b/sys/arm/include/atomic-v4.h index b4ff5bf15a5e..80f3f94e0e44 100644 --- a/sys/arm/include/atomic-v4.h +++ b/sys/arm/include/atomic-v4.h @@ -112,6 +112,43 @@ atomic_clear_64(volatile uint64_t *address, uint64_t clearmask) __with_interrupts_disabled(*address &= ~clearmask); } +static __inline int +atomic_fcmpset_32(volatile u_int32_t *p, volatile u_int32_t *cmpval, volatile u_int32_t newval) +{ + u_int32_t ret; + + __with_interrupts_disabled( + { + ret = *p; + if (*p == *cmpval) { + *p = newval; + ret = 1; + } else { + *cmpval = *p; + ret = 0; + } + }); + return (ret); +} + +static __inline int +atomic_fcmpset_64(volatile u_int64_t *p, volatile u_int64_t *cmpval, volatile u_int64_t newval) +{ + u_int64_t ret; + + __with_interrupts_disabled( + { + if (*p == *cmpval) { + *p = newval; + ret = 1; + } else { + *cmpval = *p; + ret = 0; + } + }); + return (ret); +} + static __inline u_int32_t atomic_cmpset_32(volatile u_int32_t *p, volatile u_int32_t cmpval, volatile u_int32_t newval) { @@ -370,6 +407,12 @@ atomic_swap_32(volatile u_int32_t *p, u_int32_t v) return (__swp(v, p)); } +#define atomic_fcmpset_rel_32 atomic_fcmpset_32 +#define atomic_fcmpset_acq_32 atomic_fcmpset_32 +#define atomic_fcmpset_rel_64 atomic_fcmpset_64 +#define atomic_fcmpset_acq_64 atomic_fcmpset_64 +#define atomic_fcmpset_acq_long atomic_fcmpset_long +#define atomic_fcmpset_rel_long atomic_fcmpset_long #define atomic_cmpset_rel_32 atomic_cmpset_32 #define atomic_cmpset_acq_32 atomic_cmpset_32 #define atomic_cmpset_rel_64 atomic_cmpset_64 @@ -420,6 +463,14 @@ atomic_cmpset_long(volatile u_long *dst, u_long old, u_long newe) return (atomic_cmpset_32((volatile uint32_t *)dst, old, newe)); } +static __inline u_long +atomic_fcmpset_long(volatile u_long *dst, u_long *old, u_long newe) +{ + + return (atomic_fcmpset_32((volatile uint32_t *)dst, + (uint32_t *)old, newe)); +} + static __inline u_long atomic_fetchadd_long(volatile u_long *p, u_long v) { diff --git a/sys/arm/include/atomic-v6.h b/sys/arm/include/atomic-v6.h index 507a1d08191b..287ade9e3853 100644 --- a/sys/arm/include/atomic-v6.h +++ b/sys/arm/include/atomic-v6.h @@ -190,6 +190,116 @@ ATOMIC_ACQ_REL(clear, 32) ATOMIC_ACQ_REL(clear, 64) ATOMIC_ACQ_REL_LONG(clear) +static __inline int +atomic_fcmpset_32(volatile uint32_t *p, uint32_t *cmpval, uint32_t newval) +{ + uint32_t tmp; + uint32_t _cmpval = *cmpval; + int ret; + + __asm __volatile( + "1: mov %0, #1 \n" + " ldrex %1, [%2] \n" + " cmp %1, %3 \n" + " it ne \n" + " bne 2f \n" + " strex %0, %4, [%2] \n" + "2:" + : "=&r" (ret), "=&r" (tmp), "+r" (p), "+r" (_cmpval), "+r" (newval) + : : "cc", "memory"); + *cmpval = tmp; + return (!ret); +} + +static __inline uint64_t +atomic_fcmpset_64(volatile uint64_t *p, uint64_t *cmpval, uint64_t newval) +{ + uint64_t tmp; + uint64_t _cmpval = *cmpval; + int ret; + + __asm __volatile( + "1: mov %[ret], #1 \n" + " ldrexd %Q[tmp], %R[tmp], [%[ptr]] \n" + " teq %Q[tmp], %Q[_cmpval] \n" + " itee eq \n" + " teqeq %R[tmp], %R[_cmpval] \n" + " bne 2f \n" + " strexd %[ret], %Q[newval], %R[newval], [%[ptr]]\n" + "2: \n" + : [ret] "=&r" (ret), + [tmp] "=&r" (tmp) + : [ptr] "r" (p), + [_cmpval] "r" (_cmpval), + [newval] "r" (newval) + : "cc", "memory"); + *cmpval = tmp; + return (!ret); +} + +static __inline u_long +atomic_fcmpset_long(volatile u_long *p, u_long *cmpval, u_long newval) +{ + + return (atomic_fcmpset_32((volatile uint32_t *)p, + (uint32_t *)cmpval, newval)); +} + +static __inline uint64_t +atomic_fcmpset_acq_64(volatile uint64_t *p, uint64_t *cmpval, uint64_t newval) +{ + uint64_t ret; + + ret = atomic_fcmpset_64(p, cmpval, newval); + dmb(); + return (ret); +} + +static __inline u_long +atomic_fcmpset_acq_long(volatile u_long *p, u_long *cmpval, u_long newval) +{ + u_long ret; + + ret = atomic_fcmpset_long(p, cmpval, newval); + dmb(); + return (ret); +} + +static __inline uint32_t +atomic_fcmpset_acq_32(volatile uint32_t *p, uint32_t *cmpval, uint32_t newval) +{ + + uint32_t ret; + + ret = atomic_fcmpset_32(p, cmpval, newval); + dmb(); + return (ret); +} + +static __inline uint32_t +atomic_fcmpset_rel_32(volatile uint32_t *p, uint32_t *cmpval, uint32_t newval) +{ + + dmb(); + return (atomic_fcmpset_32(p, cmpval, newval)); +} + +static __inline uint64_t +atomic_fcmpset_rel_64(volatile uint64_t *p, uint64_t *cmpval, uint64_t newval) +{ + + dmb(); + return (atomic_fcmpset_64(p, cmpval, newval)); +} + +static __inline u_long +atomic_fcmpset_rel_long(volatile u_long *p, u_long *cmpval, u_long newval) +{ + + dmb(); + return (atomic_fcmpset_long(p, cmpval, newval)); +} + static __inline uint32_t atomic_cmpset_32(volatile uint32_t *p, uint32_t cmpval, uint32_t newval) { diff --git a/sys/arm/include/atomic.h b/sys/arm/include/atomic.h index e31be000458c..4c404dc4bf74 100644 --- a/sys/arm/include/atomic.h +++ b/sys/arm/include/atomic.h @@ -84,6 +84,9 @@ atomic_store_long(volatile u_long *dst, u_long src) #define atomic_set_ptr atomic_set_32 #define atomic_set_acq_ptr atomic_set_acq_32 #define atomic_set_rel_ptr atomic_set_rel_32 +#define atomic_fcmpset_ptr atomic_fcmpset_32 +#define atomic_fcmpset_rel_ptr atomic_fcmpset_rel_32 +#define atomic_fcmpset_acq_ptr atomic_fcmpset_acq_32 #define atomic_cmpset_ptr atomic_cmpset_32 #define atomic_cmpset_acq_ptr atomic_cmpset_acq_32 #define atomic_cmpset_rel_ptr atomic_cmpset_rel_32 @@ -105,6 +108,9 @@ atomic_store_long(volatile u_long *dst, u_long src) #define atomic_set_int atomic_set_32 #define atomic_set_acq_int atomic_set_acq_32 #define atomic_set_rel_int atomic_set_rel_32 +#define atomic_fcmpset_int atomic_fcmpset_32 +#define atomic_fcmpset_acq_int atomic_fcmpset_acq_32 +#define atomic_fcmpset_rel_int atomic_fcmpset_rel_32 #define atomic_cmpset_int atomic_cmpset_32 #define atomic_cmpset_acq_int atomic_cmpset_acq_32 #define atomic_cmpset_rel_int atomic_cmpset_rel_32 diff --git a/sys/arm64/include/atomic.h b/sys/arm64/include/atomic.h index 41ad6ccffee4..9318de1c3bda 100644 --- a/sys/arm64/include/atomic.h +++ b/sys/arm64/include/atomic.h @@ -98,6 +98,61 @@ ATOMIC(clear, bic) ATOMIC(set, orr) ATOMIC(subtract, sub) +#define ATOMIC_FCMPSET(bar, a, l) \ +static __inline int \ +atomic_fcmpset_##bar##32(volatile uint32_t *p, uint32_t *cmpval, \ + uint32_t newval) \ +{ \ + uint32_t tmp; \ + uint32_t _cmpval = *cmpval; \ + int res; \ + \ + __asm __volatile( \ + "1: mov %w1, #1 \n" \ + " ld"#a"xr %w0, [%2] \n" \ + " cmp %w0, %w3 \n" \ + " b.ne 2f \n" \ + " st"#l"xr %w1, %w4, [%2] \n" \ + "2:" \ + : "=&r"(tmp), "=&r"(res) \ + : "r" (p), "r" (_cmpval), "r" (newval) \ + : "cc", "memory" \ + ); \ + *cmpval = tmp; \ + \ + return (!res); \ +} \ + \ +static __inline int \ +atomic_fcmpset_##bar##64(volatile uint64_t *p, uint64_t *cmpval, \ + uint64_t newval) \ +{ \ + uint64_t tmp; \ + uint64_t _cmpval = *cmpval; \ + int res; \ + \ + __asm __volatile( \ + "1: mov %w1, #1 \n" \ + " ld"#a"xr %0, [%2] \n" \ + " cmp %0, %3 \n" \ + " b.ne 2f \n" \ + " st"#l"xr %w1, %4, [%2] \n" \ + "2:" \ + : "=&r"(tmp), "=&r"(res) \ + : "r" (p), "r" (_cmpval), "r" (newval) \ + : "cc", "memory" \ + ); \ + *cmpval = tmp; \ + \ + return (!res); \ +} + +ATOMIC_FCMPSET( , , ) +ATOMIC_FCMPSET(acq_, a, ) +ATOMIC_FCMPSET(rel_, ,l) + +#undef ATOMIC_FCMPSET + #define ATOMIC_CMPSET(bar, a, l) \ static __inline int \ atomic_cmpset_##bar##32(volatile uint32_t *p, uint32_t cmpval, \ @@ -311,6 +366,7 @@ atomic_store_rel_64(volatile uint64_t *p, uint64_t val) #define atomic_add_int atomic_add_32 +#define atomic_fcmpset_int atomic_fcmpset_32 #define atomic_clear_int atomic_clear_32 #define atomic_cmpset_int atomic_cmpset_32 #define atomic_fetchadd_int atomic_fetchadd_32 @@ -320,6 +376,7 @@ atomic_store_rel_64(volatile uint64_t *p, uint64_t val) #define atomic_subtract_int atomic_subtract_32 #define atomic_add_acq_int atomic_add_acq_32 +#define atomic_fcmpset_acq_int atomic_fcmpset_acq_32 #define atomic_clear_acq_int atomic_clear_acq_32 #define atomic_cmpset_acq_int atomic_cmpset_acq_32 #define atomic_load_acq_int atomic_load_acq_32 @@ -327,6 +384,7 @@ atomic_store_rel_64(volatile uint64_t *p, uint64_t val) #define atomic_subtract_acq_int atomic_subtract_acq_32 #define atomic_add_rel_int atomic_add_rel_32 +#define atomic_fcmpset_rel_int atomic_fcmpset_rel_32 #define atomic_clear_rel_int atomic_add_rel_32 #define atomic_cmpset_rel_int atomic_cmpset_rel_32 #define atomic_set_rel_int atomic_set_rel_32 @@ -334,6 +392,7 @@ atomic_store_rel_64(volatile uint64_t *p, uint64_t val) #define atomic_store_rel_int atomic_store_rel_32 #define atomic_add_long atomic_add_64 +#define atomic_fcmpset_long atomic_fcmpset_64 #define atomic_clear_long atomic_clear_64 #define atomic_cmpset_long atomic_cmpset_64 #define atomic_fetchadd_long atomic_fetchadd_64 @@ -343,6 +402,7 @@ atomic_store_rel_64(volatile uint64_t *p, uint64_t val) #define atomic_subtract_long atomic_subtract_64 #define atomic_add_ptr atomic_add_64 +#define atomic_fcmpset_ptr atomic_fcmpset_64 #define atomic_clear_ptr atomic_clear_64 #define atomic_cmpset_ptr atomic_cmpset_64 #define atomic_fetchadd_ptr atomic_fetchadd_64 @@ -352,6 +412,7 @@ atomic_store_rel_64(volatile uint64_t *p, uint64_t val) #define atomic_subtract_ptr atomic_subtract_64 #define atomic_add_acq_long atomic_add_acq_64 +#define atomic_fcmpset_acq_long atomic_fcmpset_acq_64 #define atomic_clear_acq_long atomic_add_acq_64 #define atomic_cmpset_acq_long atomic_cmpset_acq_64 #define atomic_load_acq_long atomic_load_acq_64 @@ -359,6 +420,7 @@ atomic_store_rel_64(volatile uint64_t *p, uint64_t val) #define atomic_subtract_acq_long atomic_subtract_acq_64 #define atomic_add_acq_ptr atomic_add_acq_64 +#define atomic_fcmpset_acq_ptr atomic_fcmpset_acq_64 #define atomic_clear_acq_ptr atomic_add_acq_64 #define atomic_cmpset_acq_ptr atomic_cmpset_acq_64 #define atomic_load_acq_ptr atomic_load_acq_64 @@ -366,6 +428,7 @@ atomic_store_rel_64(volatile uint64_t *p, uint64_t val) #define atomic_subtract_acq_ptr atomic_subtract_acq_64 #define atomic_add_rel_long atomic_add_rel_64 +#define atomic_fcmpset_rel_long atomic_fcmpset_rel_64 #define atomic_clear_rel_long atomic_clear_rel_64 #define atomic_cmpset_rel_long atomic_cmpset_rel_64 #define atomic_set_rel_long atomic_set_rel_64 @@ -373,6 +436,7 @@ atomic_store_rel_64(volatile uint64_t *p, uint64_t val) #define atomic_store_rel_long atomic_store_rel_64 #define atomic_add_rel_ptr atomic_add_rel_64 +#define atomic_fcmpset_rel_ptr atomic_fcmpset_rel_64 #define atomic_clear_rel_ptr atomic_clear_rel_64 #define atomic_cmpset_rel_ptr atomic_cmpset_rel_64 #define atomic_set_rel_ptr atomic_set_rel_64 From 814aaaa7da4dab462d90e12e7b48b75f2093ccfd Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Sat, 28 Jan 2017 16:30:14 +0000 Subject: [PATCH 29/51] Revert r312923 a better approach will be taken later --- bin/ed/Makefile | 2 +- contrib/dma/mail.c | 79 ++++++++---- share/mk/bsd.doc.mk | 4 +- sys/amd64/amd64/db_trace.c | 15 +++ sys/amd64/cloudabi64/cloudabi64_sysvec.c | 2 + sys/cam/ctl/ctl_ioctl.h | 2 +- sys/cddl/dev/fbt/x86/fbt_isa.c | 2 + sys/compat/cloudabi/cloudabi_fd.c | 1 + sys/compat/cloudabi64/cloudabi64_poll.c | 1 + .../linuxkpi/common/include/linux/slab.h | 8 ++ .../acpica/components/namespace/nsxfeval.c | 40 +++++- sys/contrib/dev/acpica/include/acpixf.h | 8 ++ sys/ddb/ddb.h | 1 + sys/dev/drm2/drm_agpsupport.c | 14 +- sys/dev/drm2/drm_bufs.c | 122 +++++++++--------- sys/dev/drm2/drm_dma.c | 10 +- sys/dev/drm2/drm_drv.c | 3 +- sys/dev/drm2/drm_os_freebsd.c | 3 +- sys/dev/drm2/drm_os_freebsd.h | 2 +- sys/dev/drm2/drm_stub.c | 5 +- sys/fs/nfsserver/nfs_nfsdstate.c | 4 +- sys/kern/kern_descrip.c | 8 ++ sys/kern/kern_shutdown.c | 8 ++ sys/modules/drm2/drm2/Makefile | 2 - tools/build/Makefile | 5 + tools/tools/locale/etc/unicode.conf | 4 +- usr.bin/getconf/confstr.gperf | 3 + usr.bin/getconf/getconf.c | 1 - usr.bin/getconf/limits.gperf | 28 +++- usr.bin/getconf/pathconf.gperf | 38 ++++-- usr.bin/getconf/progenv.gperf | 11 +- usr.bin/getconf/sysconf.gperf | 42 +++++- usr.sbin/nscd/nscd.c | 3 +- usr.sbin/nscd/nscdcli.c | 3 +- 34 files changed, 333 insertions(+), 151 deletions(-) diff --git a/bin/ed/Makefile b/bin/ed/Makefile index 40e06134e87d..b5905e3e5e4e 100644 --- a/bin/ed/Makefile +++ b/bin/ed/Makefile @@ -9,7 +9,7 @@ LINKS= ${BINDIR}/ed ${BINDIR}/red MLINKS= ed.1 red.1 .if ${MK_OPENSSL} != "no" && ${MK_ED_CRYPTO} != "no" -CFLAGS+=-DDES +CFLAGS+=-DDES -I/usr/include/private/openssl LIBADD= crypto .endif diff --git a/contrib/dma/mail.c b/contrib/dma/mail.c index 842072c55242..994d1bdd895f 100644 --- a/contrib/dma/mail.c +++ b/contrib/dma/mail.c @@ -38,6 +38,7 @@ #include #include #include +#include #include "dma.h" @@ -341,18 +342,41 @@ parse_addrs(struct parse_state *ps, char *s, struct queue *queue) goto again; } +static int +writeline(struct queue *queue, const char *line, ssize_t linelen) +{ + ssize_t len; + + while (linelen > 0) { + len = linelen; + if (linelen > 1000) { + len = 990; + } + if (fwrite(line, len, 1, queue->mailf) != 1) + return (-1); + if (linelen <= 1000) + break; + if (fwrite("\n", 1, 1, queue->mailf) != 1) + return (-1); + line += 990; + linelen = strlen(line); + } + return (0); +} + int readmail(struct queue *queue, int nodot, int recp_from_header) { struct parse_state parse_state; - char line[1000]; /* by RFC2822 */ - size_t linelen; + char *line = NULL; + ssize_t linelen; + size_t linecap = 0; + char newline[1000]; size_t error; int had_headers = 0; int had_from = 0; int had_messagid = 0; int had_date = 0; - int had_last_line = 0; int nocopy = 0; parse_state.state = NONE; @@ -372,24 +396,15 @@ readmail(struct queue *queue, int nodot, int recp_from_header) return (-1); while (!feof(stdin)) { - if (fgets(line, sizeof(line) - 1, stdin) == NULL) + newline[0] = '\0'; + if ((linelen = getline(&line, &linecap, stdin)) <= 0) break; - if (had_last_line) - errlogx(EX_DATAERR, "bad mail input format:" - " from %s (uid %d) (envelope-from %s)", - username, useruid, queue->sender); - linelen = strlen(line); - if (linelen == 0 || line[linelen - 1] != '\n') { - /* - * This line did not end with a newline character. - * If we fix it, it better be the last line of - * the file. - */ - line[linelen] = '\n'; - line[linelen + 1] = 0; - had_last_line = 1; - } if (!had_headers) { + if (linelen > 1000) + errlogx(EX_DATAERR, "bad mail input format:" + " from %s (uid %d) (envelope-from %s)", + username, useruid, queue->sender); + /* * Unless this is a continuation, switch of * the Bcc: nocopy flag. @@ -425,36 +440,44 @@ readmail(struct queue *queue, int nodot, int recp_from_header) } } - if (strcmp(line, "\n") == 0 && !had_headers) { + if (line[0] == '\n' && !had_headers) { had_headers = 1; while (!had_date || !had_messagid || !had_from) { if (!had_date) { had_date = 1; - snprintf(line, sizeof(line), "Date: %s\n", rfc822date()); + snprintf(newline, sizeof(newline), "Date: %s\n", rfc822date()); } else if (!had_messagid) { /* XXX msgid, assign earlier and log? */ had_messagid = 1; - snprintf(line, sizeof(line), "Message-Id: <%"PRIxMAX".%s.%"PRIxMAX"@%s>\n", + snprintf(newline, sizeof(newline), "Message-Id: <%"PRIxMAX".%s.%"PRIxMAX"@%s>\n", (uintmax_t)time(NULL), queue->id, (uintmax_t)random(), hostname()); } else if (!had_from) { had_from = 1; - snprintf(line, sizeof(line), "From: <%s>\n", queue->sender); + snprintf(newline, sizeof(newline), "From: <%s>\n", queue->sender); } - if (fwrite(line, strlen(line), 1, queue->mailf) != 1) - return (-1); + if (fwrite(newline, strlen(newline), 1, queue->mailf) != 1) + goto fail; } - strcpy(line, "\n"); + strlcpy(newline, "\n", sizeof(newline)); } if (!nodot && linelen == 2 && line[0] == '.') break; if (!nocopy) { - if (fwrite(line, strlen(line), 1, queue->mailf) != 1) - return (-1); + if (newline[0] != '\0') { + if (fwrite(newline, strlen(newline), 1, queue->mailf) != 1) + goto fail; + } else { + if (writeline(queue, line, linelen) != 0) + goto fail; + } } } return (0); +fail: + free(line); + return (-1); } diff --git a/share/mk/bsd.doc.mk b/share/mk/bsd.doc.mk index 5b88ae5d9f0b..64648abb2c5a 100644 --- a/share/mk/bsd.doc.mk +++ b/share/mk/bsd.doc.mk @@ -54,10 +54,10 @@ INDXBIB?= indxbib PIC?= pic REFER?= refer .for _dev in ${PRINTERDEVICE:Mascii} -ROFF.ascii?= groff -Tascii -P-c ${TRFLAGS} -mtty-char ${MACROS} ${PAGES:C/^/-o/1} +ROFF.ascii?= nroff -Tascii -P-c ${TRFLAGS} -mtty-char ${MACROS} ${PAGES:C/^/-o/1} .endfor .for _dev in ${PRINTERDEVICE:Nascii} -ROFF.${_dev}?= groff -T${_dev} ${TRFLAGS} ${MACROS} ${PAGES:C/^/-o/1} +ROFF.${_dev}?= nroff -T${_dev} ${TRFLAGS} ${MACROS} ${PAGES:C/^/-o/1} .endfor SOELIM?= soelim TBL?= tbl diff --git a/sys/amd64/amd64/db_trace.c b/sys/amd64/amd64/db_trace.c index 381237b6b321..b93c3a839fbd 100644 --- a/sys/amd64/amd64/db_trace.c +++ b/sys/amd64/amd64/db_trace.c @@ -270,6 +270,7 @@ db_nextframe(struct amd64_frame **fp, db_addr_t *ip, struct thread *td) *fp = (struct amd64_frame *) rbp; } + static int db_backtrace(struct thread *td, struct trapframe *tf, struct amd64_frame *frame, db_addr_t pc, register_t sp, int count) @@ -384,6 +385,20 @@ db_trace_self(void) db_backtrace(curthread, NULL, frame, callpc, 0, -1); } +void +db_trace_self_depth(int depth) +{ + struct amd64_frame *frame; + db_addr_t callpc; + register_t rbp; + + __asm __volatile("movq %%rbp,%0" : "=r" (rbp)); + frame = (struct amd64_frame *)rbp; + callpc = (db_addr_t)db_get_value((long)&frame->f_retaddr, 8, FALSE); + frame = frame->f_frame; + db_backtrace(curthread, NULL, frame, callpc, 0, depth); +} + int db_trace_thread(struct thread *thr, int count) { diff --git a/sys/amd64/cloudabi64/cloudabi64_sysvec.c b/sys/amd64/cloudabi64/cloudabi64_sysvec.c index 060825e79987..71754a7f8aca 100644 --- a/sys/amd64/cloudabi64/cloudabi64_sysvec.c +++ b/sys/amd64/cloudabi64/cloudabi64_sysvec.c @@ -27,6 +27,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -38,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include diff --git a/sys/cam/ctl/ctl_ioctl.h b/sys/cam/ctl/ctl_ioctl.h index 48ba9b0e70fb..dcabb0fcda14 100644 --- a/sys/cam/ctl/ctl_ioctl.h +++ b/sys/cam/ctl/ctl_ioctl.h @@ -150,7 +150,7 @@ struct ctl_lun_io_stats { uint64_t lun_number; uint32_t blocksize; ctl_lun_stats_flags flags; - struct ctl_lun_io_port_stats ports[CTL_MAX_PORTS]; + struct ctl_lun_io_port_stats *ports; }; struct ctl_stats { diff --git a/sys/cddl/dev/fbt/x86/fbt_isa.c b/sys/cddl/dev/fbt/x86/fbt_isa.c index 3f4d8c58ad0d..fb0eb2482e60 100644 --- a/sys/cddl/dev/fbt/x86/fbt_isa.c +++ b/sys/cddl/dev/fbt/x86/fbt_isa.c @@ -34,6 +34,8 @@ #include +#include + #include "fbt.h" #define FBT_PUSHL_EBP 0x55 diff --git a/sys/compat/cloudabi/cloudabi_fd.c b/sys/compat/cloudabi/cloudabi_fd.c index 2f2725ec716d..78e6cf0683c2 100644 --- a/sys/compat/cloudabi/cloudabi_fd.c +++ b/sys/compat/cloudabi/cloudabi_fd.c @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include diff --git a/sys/compat/cloudabi64/cloudabi64_poll.c b/sys/compat/cloudabi64/cloudabi64_poll.c index 3df526598934..795163f5c5f6 100644 --- a/sys/compat/cloudabi64/cloudabi64_poll.c +++ b/sys/compat/cloudabi64/cloudabi64_poll.c @@ -27,6 +27,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include diff --git a/sys/compat/linuxkpi/common/include/linux/slab.h b/sys/compat/linuxkpi/common/include/linux/slab.h index d35f7a1ef89a..91d77deb7fef 100644 --- a/sys/compat/linuxkpi/common/include/linux/slab.h +++ b/sys/compat/linuxkpi/common/include/linux/slab.h @@ -72,6 +72,14 @@ struct linux_kmem_cache { }; #define SLAB_HWCACHE_ALIGN 0x0001 +static inline void * +kmalloc_array(size_t n, size_t size, gfp_t flags) +{ + if (size != 0 && n > SIZE_MAX / size) + return (NULL); + return kmalloc(n * size, flags); +} +} static inline int linux_kmem_ctor(void *mem, int size, void *arg, int flags) diff --git a/sys/contrib/dev/acpica/components/namespace/nsxfeval.c b/sys/contrib/dev/acpica/components/namespace/nsxfeval.c index 363970476d7a..5bd50db35b7a 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsxfeval.c +++ b/sys/contrib/dev/acpica/components/namespace/nsxfeval.c @@ -1022,23 +1022,25 @@ ACPI_EXPORT_SYMBOL (AcpiDetachData) /******************************************************************************* * - * FUNCTION: AcpiGetData + * FUNCTION: AcpiGetDataFull * * PARAMETERS: ObjHandle - Namespace node - * Handler - Handler used in call to AttachData + * Handle - Handler used in call to attach_data * Data - Where the data is returned + * Callback - function to execute before returning * * RETURN: Status * - * DESCRIPTION: Retrieve data that was previously attached to a namespace node. + * DESCRIPTION: Retrieve data that was previously attached to a namespace node + * and execute a callback before returning. * ******************************************************************************/ - ACPI_STATUS -AcpiGetData ( +AcpiGetDataFull ( ACPI_HANDLE ObjHandle, ACPI_OBJECT_HANDLER Handler, - void **Data) + void **Data, + void (*Callback)(void *)) { ACPI_NAMESPACE_NODE *Node; ACPI_STATUS Status; @@ -1069,10 +1071,34 @@ AcpiGetData ( } Status = AcpiNsGetAttachedData (Node, Handler, Data); - + if (ACPI_SUCCESS(Status) && Callback) { + Callback(*Data); + } UnlockAndExit: (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return (Status); } +ACPI_EXPORT_SYMBOL (AcpiGetDataFull) +/******************************************************************************* + * + * FUNCTION: AcpiGetData + * + * PARAMETERS: ObjHandle - Namespace node + * Handler - Handler used in call to AttachData + * Data - Where the data is returned + * + * RETURN: Status + * + * DESCRIPTION: Retrieve data that was previously attached to a namespace node. + * + ******************************************************************************/ +ACPI_STATUS +AcpiGetData ( + ACPI_HANDLE ObjHandle, + ACPI_OBJECT_HANDLER Handler, + void **Data) +{ + return (AcpiGetDataFull(ObjHandle, Handler, Data, NULL)); +} ACPI_EXPORT_SYMBOL (AcpiGetData) diff --git a/sys/contrib/dev/acpica/include/acpixf.h b/sys/contrib/dev/acpica/include/acpixf.h index ae946711c948..3a1e72068947 100644 --- a/sys/contrib/dev/acpica/include/acpixf.h +++ b/sys/contrib/dev/acpica/include/acpixf.h @@ -670,6 +670,14 @@ AcpiGetData ( ACPI_OBJECT_HANDLER Handler, void **Data)) +ACPI_EXTERNAL_RETURN_STATUS ( +ACPI_STATUS +AcpiGetDataFull ( + ACPI_HANDLE Object, + ACPI_OBJECT_HANDLER Handler, + void **Data, + void (*Callback)(void *))) + ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiDebugTrace ( diff --git a/sys/ddb/ddb.h b/sys/ddb/ddb.h index fcf772b59458..990b3d502dcc 100644 --- a/sys/ddb/ddb.h +++ b/sys/ddb/ddb.h @@ -219,6 +219,7 @@ bool db_stop_at_pc(int type, int code, bool *is_breakpoint, bool *is_watchpoint); #define db_strcpy strcpy void db_trace_self(void); +void db_trace_self_depth(int); int db_trace_thread(struct thread *, int); bool db_value_of_name(const char *name, db_expr_t *valuep); bool db_value_of_name_pcpu(const char *name, db_expr_t *valuep); diff --git a/sys/dev/drm2/drm_agpsupport.c b/sys/dev/drm2/drm_agpsupport.c index 025350fc4bb7..131a9ad9cc91 100644 --- a/sys/dev/drm2/drm_agpsupport.c +++ b/sys/dev/drm2/drm_agpsupport.c @@ -35,7 +35,6 @@ __FBSDID("$FreeBSD$"); #include -#include #if __OS_HAS_AGP @@ -209,13 +208,15 @@ int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request) if (!dev->agp || !dev->agp->acquired) return -EINVAL; - if (!(entry = kzalloc(sizeof(*entry), GFP_KERNEL))) + if (!(entry = malloc(sizeof(*entry), DRM_MEM_AGPLISTS, M_NOWAIT))) return -ENOMEM; + memset(entry, 0, sizeof(*entry)); + pages = (request->size + PAGE_SIZE - 1) / PAGE_SIZE; type = (u32) request->type; if (!(memory = agp_alloc_memory(dev->agp->bridge, type, pages << PAGE_SHIFT))) { - kfree(entry); + free(entry, DRM_MEM_AGPLISTS); return -ENOMEM; } @@ -375,7 +376,7 @@ int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request) list_del(&entry->head); drm_free_agp(entry->memory, entry->pages); - kfree(entry); + free(entry, DRM_MEM_AGPLISTS); return 0; } EXPORT_SYMBOL(drm_agp_free); @@ -403,11 +404,12 @@ struct drm_agp_head *drm_agp_init(struct drm_device *dev) { struct drm_agp_head *head = NULL; - if (!(head = kzalloc(sizeof(*head), GFP_KERNEL))) + if (!(head = malloc(sizeof(*head), DRM_MEM_AGPLISTS, M_NOWAIT))) return NULL; + memset((void *)head, 0, sizeof(*head)); head->bridge = agp_find_device(); if (!head->bridge) { - kfree(head); + free(head, DRM_MEM_AGPLISTS); return NULL; } else { agp_get_info(head->bridge, &head->agp_info); diff --git a/sys/dev/drm2/drm_bufs.c b/sys/dev/drm2/drm_bufs.c index 483ee55e06d1..488a6be310d9 100644 --- a/sys/dev/drm2/drm_bufs.c +++ b/sys/dev/drm2/drm_bufs.c @@ -39,6 +39,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include + #include #include @@ -216,7 +219,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, int ret; int align; - map = malloc(sizeof(*map), DRM_MEM_MAPS, M_NOWAIT); + map = kmalloc(sizeof(*map), GFP_KERNEL); if (!map) return -ENOMEM; @@ -230,7 +233,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, * when processes fork. */ if ((map->flags & _DRM_REMOVABLE) && map->type != _DRM_SHM) { - free(map, DRM_MEM_MAPS); + kfree(map); return -EINVAL; } DRM_DEBUG("offset = 0x%08llx, size = 0x%08lx, type = %d\n", @@ -249,7 +252,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, * constant. */ if ((map->offset & ((resource_size_t)PAGE_MASK)) || (map->size & (PAGE_MASK))) { - free(map, DRM_MEM_MAPS); + kfree(map); return -EINVAL; } map->mtrr = -1; @@ -281,7 +284,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, list->map->size = map->size; } - free(map, DRM_MEM_MAPS); + kfree(map); *maplist = list; return 0; } @@ -298,7 +301,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, if (map->type == _DRM_REGISTERS) { drm_core_ioremap(map, dev); if (!map->handle) { - free(map, DRM_MEM_MAPS); + kfree(map); return -ENOMEM; } } @@ -314,23 +317,23 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, list->map->size = map->size; } - free(map, DRM_MEM_MAPS); + kfree(map); *maplist = list; return 0; } - map->handle = malloc(map->size, DRM_MEM_MAPS, M_NOWAIT); + map->handle = vmalloc_user(map->size); DRM_DEBUG("%lu %d %p\n", map->size, drm_order(map->size), map->handle); if (!map->handle) { - free(map, DRM_MEM_MAPS); + kfree(map); return -ENOMEM; } map->offset = (unsigned long)map->handle; if (map->flags & _DRM_CONTAINS_LOCK) { /* Prevent a 2nd X Server from creating a 2nd lock */ if (dev->primary->master->lock.hw_lock != NULL) { - free(map->handle, DRM_MEM_MAPS); - free(map, DRM_MEM_MAPS); + kfree(map->handle); + kfree(map); return -EBUSY; } dev->sigdata.lock = dev->primary->master->lock.hw_lock = map->handle; /* Pointer to lock */ @@ -341,7 +344,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, int valid = 0; if (!drm_core_has_AGP(dev)) { - free(map, DRM_MEM_MAPS); + kfree(map); return -EINVAL; } #ifdef __linux__ @@ -376,7 +379,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, } } if (!list_empty(&dev->agp->memory) && !valid) { - free(map, DRM_MEM_MAPS); + kfree(map); return -EPERM; } DRM_DEBUG("AGP offset = 0x%08llx, size = 0x%08lx\n", @@ -389,7 +392,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, break; case _DRM_SCATTER_GATHER: if (!dev->sg) { - free(map, DRM_MEM_MAPS); + kfree(map); return -EINVAL; } map->handle = (void *)(dev->sg->vaddr + offset); @@ -405,7 +408,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, align = PAGE_SIZE; dmah = drm_pci_alloc(dev, map->size, align, BUS_SPACE_MAXADDR); if (!dmah) { - free(map, DRM_MEM_MAPS); + kfree(map); return -ENOMEM; } map->handle = dmah->vaddr; @@ -413,15 +416,15 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, map->dmah = dmah; break; default: - free(map, DRM_MEM_MAPS); + kfree(map); return -EINVAL; } - list = malloc(sizeof(*list), DRM_MEM_MAPS, M_ZERO | M_NOWAIT); + list = kzalloc(sizeof(*list), GFP_KERNEL); if (!list) { if (map->type == _DRM_REGISTERS) drm_core_ioremapfree(map, dev); - free(map, DRM_MEM_MAPS); + kfree(map); return -EINVAL; } list->map = map; @@ -438,8 +441,8 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, if (ret) { if (map->type == _DRM_REGISTERS) drm_core_ioremapfree(map, dev); - free(map, DRM_MEM_MAPS); - free(list, DRM_MEM_MAPS); + kfree(map); + kfree(list); DRM_UNLOCK(dev); return ret; } @@ -523,7 +526,7 @@ int drm_rmmap_locked(struct drm_device *dev, struct drm_local_map *map) list_del(&r_list->head); drm_ht_remove_key(&dev->map_hash, r_list->user_token >> PAGE_SHIFT); - free(r_list, DRM_MEM_MAPS); + kfree(r_list); found = 1; break; } @@ -545,7 +548,7 @@ int drm_rmmap_locked(struct drm_device *dev, struct drm_local_map *map) } break; case _DRM_SHM: - free(map->handle, DRM_MEM_MAPS); + kfree(map->handle); if (master) { if (dev->sigdata.lock == master->lock.hw_lock) dev->sigdata.lock = NULL; @@ -564,7 +567,7 @@ int drm_rmmap_locked(struct drm_device *dev, struct drm_local_map *map) DRM_ERROR("tried to rmmap GEM object\n"); break; } - free(map, DRM_MEM_MAPS); + kfree(map); return 0; } @@ -655,16 +658,16 @@ static void drm_cleanup_buf_error(struct drm_device * dev, drm_pci_free(dev, entry->seglist[i]); } } - free(entry->seglist, DRM_MEM_SEGS); + kfree(entry->seglist); entry->seg_count = 0; } if (entry->buf_count) { for (i = 0; i < entry->buf_count; i++) { - free(entry->buflist[i].dev_private, DRM_MEM_BUFS); + kfree(entry->buflist[i].dev_private); } - free(entry->buflist, DRM_MEM_BUFS); + kfree(entry->buflist); entry->buf_count = 0; } @@ -761,8 +764,7 @@ int drm_addbufs_agp(struct drm_device * dev, struct drm_buf_desc * request) return -EINVAL; } - entry->buflist = malloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS, - M_NOWAIT | M_ZERO); + entry->buflist = kcalloc(count, sizeof(*entry->buflist), GFP_KERNEL); if (!entry->buflist) { DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); @@ -790,8 +792,7 @@ int drm_addbufs_agp(struct drm_device * dev, struct drm_buf_desc * request) buf->file_priv = NULL; buf->dev_priv_size = dev->driver->dev_priv_size; - buf->dev_private = malloc(buf->dev_priv_size, DRM_MEM_BUFS, - M_NOWAIT | M_ZERO); + buf->dev_private = kzalloc(buf->dev_priv_size, GFP_KERNEL); if (!buf->dev_private) { /* Set count correctly so we free the proper amount. */ entry->buf_count = count; @@ -810,9 +811,8 @@ int drm_addbufs_agp(struct drm_device * dev, struct drm_buf_desc * request) DRM_DEBUG("byte_count: %d\n", byte_count); - temp_buflist = realloc(dma->buflist, - (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), - DRM_MEM_BUFS, M_NOWAIT); + temp_buflist = krealloc(dma->buflist, + (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), GFP_KERNEL); if (!temp_buflist) { /* Free the entry because it isn't valid */ drm_cleanup_buf_error(dev, entry); @@ -912,18 +912,16 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request) return -EINVAL; } - entry->buflist = malloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS, - M_NOWAIT | M_ZERO); + entry->buflist = kcalloc(count, sizeof(*entry->buflist), GFP_KERNEL); if (!entry->buflist) { DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); return -ENOMEM; } - entry->seglist = malloc(count * sizeof(*entry->seglist), DRM_MEM_SEGS, - M_NOWAIT | M_ZERO); + entry->seglist = kcalloc(count, sizeof(*entry->seglist), GFP_KERNEL); if (!entry->seglist) { - free(entry->buflist, DRM_MEM_BUFS); + kfree(entry->buflist); DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); return -ENOMEM; @@ -932,11 +930,12 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request) /* Keep the original pagelist until we know all the allocations * have succeeded */ - temp_pagelist = malloc((dma->page_count + (count << page_order)) * - sizeof(*dma->pagelist), DRM_MEM_PAGES, M_NOWAIT); + temp_pagelist = kmalloc_array(dma->page_count + (count << page_order), + sizeof(*dma->pagelist), + GFP_KERNEL); if (!temp_pagelist) { - free(entry->buflist, DRM_MEM_BUFS); - free(entry->seglist, DRM_MEM_SEGS); + kfree(entry->buflist); + kfree(entry->seglist); DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); return -ENOMEM; @@ -960,7 +959,7 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request) entry->buf_count = count; entry->seg_count = count; drm_cleanup_buf_error(dev, entry); - free(temp_pagelist, DRM_MEM_PAGES); + kfree(temp_pagelist); DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); return -ENOMEM; @@ -990,14 +989,14 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request) buf->file_priv = NULL; buf->dev_priv_size = dev->driver->dev_priv_size; - buf->dev_private = malloc(buf->dev_priv_size, - DRM_MEM_BUFS, M_NOWAIT | M_ZERO); + buf->dev_private = kzalloc(buf->dev_priv_size, + GFP_KERNEL); if (!buf->dev_private) { /* Set count correctly so we free the proper amount. */ entry->buf_count = count; entry->seg_count = count; drm_cleanup_buf_error(dev, entry); - free(temp_pagelist, DRM_MEM_PAGES); + kfree(temp_pagelist); DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); return -ENOMEM; @@ -1009,13 +1008,13 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request) byte_count += PAGE_SIZE << page_order; } - temp_buflist = realloc(dma->buflist, - (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), - DRM_MEM_BUFS, M_NOWAIT); + temp_buflist = krealloc(dma->buflist, + (dma->buf_count + entry->buf_count) * + sizeof(*dma->buflist), GFP_KERNEL); if (!temp_buflist) { /* Free the entry because it isn't valid */ drm_cleanup_buf_error(dev, entry); - free(temp_pagelist, DRM_MEM_PAGES); + kfree(temp_pagelist); DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); return -ENOMEM; @@ -1030,7 +1029,7 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request) * with the new one. */ if (dma->page_count) { - free(dma->pagelist, DRM_MEM_PAGES); + kfree(dma->pagelist); } dma->pagelist = temp_pagelist; @@ -1124,8 +1123,7 @@ static int drm_addbufs_sg(struct drm_device * dev, struct drm_buf_desc * request return -EINVAL; } - entry->buflist = malloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS, - M_NOWAIT | M_ZERO); + entry->buflist = kcalloc(count, sizeof(*entry->buflist), GFP_KERNEL); if (!entry->buflist) { DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); @@ -1154,8 +1152,7 @@ static int drm_addbufs_sg(struct drm_device * dev, struct drm_buf_desc * request buf->file_priv = NULL; buf->dev_priv_size = dev->driver->dev_priv_size; - buf->dev_private = malloc(buf->dev_priv_size, DRM_MEM_BUFS, - M_NOWAIT | M_ZERO); + buf->dev_private = kzalloc(buf->dev_priv_size, GFP_KERNEL); if (!buf->dev_private) { /* Set count correctly so we free the proper amount. */ entry->buf_count = count; @@ -1174,9 +1171,9 @@ static int drm_addbufs_sg(struct drm_device * dev, struct drm_buf_desc * request DRM_DEBUG("byte_count: %d\n", byte_count); - temp_buflist = realloc(dma->buflist, - (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), - DRM_MEM_BUFS, M_NOWAIT); + temp_buflist = krealloc(dma->buflist, + (dma->buf_count + entry->buf_count) * + sizeof(*dma->buflist), GFP_KERNEL); if (!temp_buflist) { /* Free the entry because it isn't valid */ drm_cleanup_buf_error(dev, entry); @@ -1280,8 +1277,7 @@ static int drm_addbufs_fb(struct drm_device * dev, struct drm_buf_desc * request return -EINVAL; } - entry->buflist = malloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS, - M_NOWAIT | M_ZERO); + entry->buflist = kzalloc(count * sizeof(*entry->buflist), GFP_KERNEL); if (!entry->buflist) { DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); @@ -1309,8 +1305,7 @@ static int drm_addbufs_fb(struct drm_device * dev, struct drm_buf_desc * request buf->file_priv = NULL; buf->dev_priv_size = dev->driver->dev_priv_size; - buf->dev_private = malloc(buf->dev_priv_size, DRM_MEM_BUFS, - M_NOWAIT | M_ZERO); + buf->dev_private = kmalloc(buf->dev_priv_size, GFP_KERNEL); if (!buf->dev_private) { /* Set count correctly so we free the proper amount. */ entry->buf_count = count; @@ -1329,9 +1324,8 @@ static int drm_addbufs_fb(struct drm_device * dev, struct drm_buf_desc * request DRM_DEBUG("byte_count: %d\n", byte_count); - temp_buflist = realloc(dma->buflist, - (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), - DRM_MEM_BUFS, M_NOWAIT); + temp_buflist = krealloc(dma->buflist, + (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), GFP_KERNEL); if (!temp_buflist) { /* Free the entry because it isn't valid */ drm_cleanup_buf_error(dev, entry); diff --git a/sys/dev/drm2/drm_dma.c b/sys/dev/drm2/drm_dma.c index 380be2b8ca31..9ce6e3e9693e 100644 --- a/sys/dev/drm2/drm_dma.c +++ b/sys/dev/drm2/drm_dma.c @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include +#include /** * Initialize the DMA data. @@ -89,18 +90,17 @@ void drm_dma_takedown(struct drm_device *dev) drm_pci_free(dev, dma->bufs[i].seglist[j]); } } - free(dma->bufs[i].seglist, DRM_MEM_SEGS); + kfree(dma->bufs[i].seglist); } if (dma->bufs[i].buf_count) { for (j = 0; j < dma->bufs[i].buf_count; j++) { - free(dma->bufs[i].buflist[j].dev_private, - DRM_MEM_BUFS); + kfree(dma->bufs[i].buflist[j].dev_private); } - free(dma->bufs[i].buflist, DRM_MEM_BUFS); + kfree(dma->bufs[i].buflist); } } - free(dma->buflist, DRM_MEM_BUFS); + kfree(dma->buflist); free(dma->pagelist, DRM_MEM_PAGES); free(dev->dma, DRM_MEM_DRIVER); dev->dma = NULL; diff --git a/sys/dev/drm2/drm_drv.c b/sys/dev/drm2/drm_drv.c index c220668bdb71..9529ac3dfa4b 100644 --- a/sys/dev/drm2/drm_drv.c +++ b/sys/dev/drm2/drm_drv.c @@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include #include @@ -212,7 +211,7 @@ int drm_lastclose(struct drm_device * dev) if (entry->bound) drm_unbind_agp(entry->memory); drm_free_agp(entry->memory, entry->pages); - kfree(entry); + free(entry, DRM_MEM_AGPLISTS); } INIT_LIST_HEAD(&dev->agp->memory); diff --git a/sys/dev/drm2/drm_os_freebsd.c b/sys/dev/drm2/drm_os_freebsd.c index 90d7319a2ea0..854cc54a8ad4 100644 --- a/sys/dev/drm2/drm_os_freebsd.c +++ b/sys/dev/drm2/drm_os_freebsd.c @@ -16,7 +16,6 @@ MALLOC_DEFINE(DRM_MEM_MAGIC, "drm_magic", "DRM MAGIC Data Structures"); MALLOC_DEFINE(DRM_MEM_MINOR, "drm_minor", "DRM MINOR Data Structures"); MALLOC_DEFINE(DRM_MEM_IOCTLS, "drm_ioctls", "DRM IOCTL Data Structures"); MALLOC_DEFINE(DRM_MEM_MAPS, "drm_maps", "DRM MAP Data Structures"); -MALLOC_DEFINE(DRM_MEM_BUFS, "drm_bufs", "DRM BUFFER Data Structures"); MALLOC_DEFINE(DRM_MEM_SEGS, "drm_segs", "DRM SEGMENTS Data Structures"); MALLOC_DEFINE(DRM_MEM_PAGES, "drm_pages", "DRM PAGES Data Structures"); MALLOC_DEFINE(DRM_MEM_FILES, "drm_files", "DRM FILE Data Structures"); @@ -24,6 +23,7 @@ MALLOC_DEFINE(DRM_MEM_QUEUES, "drm_queues", "DRM QUEUE Data Structures"); MALLOC_DEFINE(DRM_MEM_CMDS, "drm_cmds", "DRM COMMAND Data Structures"); MALLOC_DEFINE(DRM_MEM_MAPPINGS, "drm_mapping", "DRM MAPPING Data Structures"); MALLOC_DEFINE(DRM_MEM_BUFLISTS, "drm_buflists", "DRM BUFLISTS Data Structures"); +MALLOC_DEFINE(DRM_MEM_AGPLISTS, "drm_agplists", "DRM AGPLISTS Data Structures"); MALLOC_DEFINE(DRM_MEM_CTXBITMAP, "drm_ctxbitmap", "DRM CTXBITMAP Data Structures"); MALLOC_DEFINE(DRM_MEM_SGLISTS, "drm_sglists", "DRM SGLISTS Data Structures"); @@ -495,5 +495,4 @@ MODULE_VERSION(drmn, 1); MODULE_DEPEND(drmn, agp, 1, 1, 1); MODULE_DEPEND(drmn, pci, 1, 1, 1); MODULE_DEPEND(drmn, mem, 1, 1, 1); -MODULE_DEPEND(drmn, linuxkpi, 1, 1, 1); MODULE_DEPEND(drmn, iicbus, 1, 1, 1); diff --git a/sys/dev/drm2/drm_os_freebsd.h b/sys/dev/drm2/drm_os_freebsd.h index cedc7a25228d..05fc921906bb 100644 --- a/sys/dev/drm2/drm_os_freebsd.h +++ b/sys/dev/drm2/drm_os_freebsd.h @@ -544,7 +544,6 @@ MALLOC_DECLARE(DRM_MEM_MAGIC); MALLOC_DECLARE(DRM_MEM_MINOR); MALLOC_DECLARE(DRM_MEM_IOCTLS); MALLOC_DECLARE(DRM_MEM_MAPS); -MALLOC_DECLARE(DRM_MEM_BUFS); MALLOC_DECLARE(DRM_MEM_SEGS); MALLOC_DECLARE(DRM_MEM_PAGES); MALLOC_DECLARE(DRM_MEM_FILES); @@ -552,6 +551,7 @@ MALLOC_DECLARE(DRM_MEM_QUEUES); MALLOC_DECLARE(DRM_MEM_CMDS); MALLOC_DECLARE(DRM_MEM_MAPPINGS); MALLOC_DECLARE(DRM_MEM_BUFLISTS); +MALLOC_DECLARE(DRM_MEM_AGPLISTS); MALLOC_DECLARE(DRM_MEM_CTXBITMAP); MALLOC_DECLARE(DRM_MEM_SGLISTS); MALLOC_DECLARE(DRM_MEM_MM); diff --git a/sys/dev/drm2/drm_stub.c b/sys/dev/drm2/drm_stub.c index 54b1a80cb7a1..06663ac8ef70 100644 --- a/sys/dev/drm2/drm_stub.c +++ b/sys/dev/drm2/drm_stub.c @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #ifdef DRM_DEBUG_DEFAULT_ON unsigned int drm_debug = (DRM_DEBUGBITS_DEBUG | DRM_DEBUGBITS_KMS | @@ -316,7 +315,7 @@ void drm_cancel_fill_in_dev(struct drm_device *dev) DRM_MTRR_WC); DRM_DEBUG("mtrr_del=%d\n", retval); } - kfree(dev->agp); + free(dev->agp, DRM_MEM_AGPLISTS); dev->agp = NULL; drm_ht_remove(&dev->map_hash); @@ -468,7 +467,7 @@ void drm_put_dev(struct drm_device *dev) drm_sysctl_cleanup(dev); if (drm_core_has_AGP(dev) && dev->agp) { - kfree(dev->agp); + free(dev->agp, DRM_MEM_AGPLISTS); dev->agp = NULL; } diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c index 1c2e7d1a762e..d4c5fd11b718 100644 --- a/sys/fs/nfsserver/nfs_nfsdstate.c +++ b/sys/fs/nfsserver/nfs_nfsdstate.c @@ -3081,7 +3081,7 @@ nfsrv_openctrl(struct nfsrv_descript *nd, vnode_t vp, new_deleg->ls_stateid.other[2] = delegstateidp->other[2] = nfsrv_nextstateindex(clp); if (writedeleg && !NFSVNO_EXRDONLY(exp) && - (nfsrv_writedelegifpos || !readonly) && + (nfsrv_writedelegifpos && !readonly) && (new_stp->ls_flags & NFSLCK_WANTRDELEG) == 0) { new_deleg->ls_flags = (NFSLCK_DELEGWRITE | NFSLCK_READACCESS | NFSLCK_WRITEACCESS); @@ -3153,7 +3153,7 @@ nfsrv_openctrl(struct nfsrv_descript *nd, vnode_t vp, delegstateidp->other[2] = nfsrv_nextstateindex(clp); if (writedeleg && !NFSVNO_EXRDONLY(exp) && - (nfsrv_writedelegifpos || !readonly) && + (nfsrv_writedelegifpos && !readonly) && ((nd->nd_flag & ND_NFSV41) == 0 || (new_stp->ls_flags & NFSLCK_WANTRDELEG) == 0)) { diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index fd6c796da14d..51e716c30218 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -4074,6 +4075,13 @@ invfo_sendfile(struct file *fp, int sockfd, struct uio *hdr_uio, return (EINVAL); } +bool +fd_modified(struct filedesc *fdp, int fd, uint32_t seq) +{ + + return (!seq_consistent(fd_seq(fdp->fd_files, fd), seq)); +} + /*-------------------------------------------------------------------*/ /* diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c index 370a5447be4d..161548be272c 100644 --- a/sys/kern/kern_shutdown.c +++ b/sys/kern/kern_shutdown.c @@ -722,6 +722,14 @@ vpanic(const char *fmt, va_list ap) spinlock_enter(); +#if 0 +/***** DEBUGGING DRM *****/ + + doadump(0); + EVENTHANDLER_INVOKE(shutdown_final, RB_NOSYNC); + +/************************/ +#endif #ifdef SMP /* * stop_cpus_hard(other_cpus) should prevent multiple CPUs from diff --git a/sys/modules/drm2/drm2/Makefile b/sys/modules/drm2/drm2/Makefile index 75696466db6d..35bee2972091 100644 --- a/sys/modules/drm2/drm2/Makefile +++ b/sys/modules/drm2/drm2/Makefile @@ -48,8 +48,6 @@ SRCS = \ ati_pcigart.c #ttm_page_alloc_dma.c -CFLAGS+= -I${.CURDIR}/../../../compat/linuxkpi/common/include - .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_ARCH} == "powerpc64" SRCS += drm_ioc32.c .endif diff --git a/tools/build/Makefile b/tools/build/Makefile index 63b147ceb985..0368021e3457 100644 --- a/tools/build/Makefile +++ b/tools/build/Makefile @@ -41,6 +41,11 @@ SYSINCS+= stat.h SRCS+= futimens.c utimensat.c .endif +.if !exists(/usr/include/capsicum_helpers.h) +.PATH: ${.CURDIR}/../../lib/libcapsicum/ +INCS+= capsicum_helpers.h +.endif + .if empty(SRCS) SRCS= dummy.c .endif diff --git a/tools/tools/locale/etc/unicode.conf b/tools/tools/locale/etc/unicode.conf index 8d5e4e104d01..42a216cdeb10 100644 --- a/tools/tools/locale/etc/unicode.conf +++ b/tools/tools/locale/etc/unicode.conf @@ -1,4 +1,4 @@ # $FreeBSD$ -cldr ~/unicode/cldr/30.0.3 -unidata ~/unicode/UNIDATA/9.0.0 +cldr /home/bapt/unicode/cldr/30.0.3 +unidata /home/bapt/unicode/UNIDATA/9.0.0 diff --git a/usr.bin/getconf/confstr.gperf b/usr.bin/getconf/confstr.gperf index c629987e5caf..11434ba29e96 100644 --- a/usr.bin/getconf/confstr.gperf +++ b/usr.bin/getconf/confstr.gperf @@ -52,6 +52,9 @@ _POSIX_V6_LPBIG_OFFBIG_CFLAGS, _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS _POSIX_V6_LPBIG_OFFBIG_LDFLAGS, _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS _POSIX_V6_LPBIG_OFFBIG_LIBS, _CS_POSIX_V6_LPBIG_OFFBIG_LIBS _POSIX_V6_WIDTH_RESTRICTED_ENVS, _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS +DARWIN_USER_DIR, _CS_DARWIN_USER_DIR +DARWIN_USER_TEMP_DIR, _CS_DARWIN_USER_TEMP_DIR +DARWIN_USER_CACHE_DIR, _CS_DARWIN_USER_CACHE_DIR %% int find_confstr(const char *name, int *key) diff --git a/usr.bin/getconf/getconf.c b/usr.bin/getconf/getconf.c index a82196e33d2e..5da036c2e6d5 100644 --- a/usr.bin/getconf/getconf.c +++ b/usr.bin/getconf/getconf.c @@ -187,4 +187,3 @@ do_pathconf(const char *name, int key, const char *path) else printf("%ld\n", value); } - diff --git a/usr.bin/getconf/limits.gperf b/usr.bin/getconf/limits.gperf index 68e0d65e78ff..a944191c810b 100644 --- a/usr.bin/getconf/limits.gperf +++ b/usr.bin/getconf/limits.gperf @@ -9,6 +9,9 @@ #include #include +#ifdef APPLE_GETCONF_UNDERSCORE +#include +#endif /* APPLE_GETCONF_UNDERSCORE */ #include "getconf.h" @@ -20,11 +23,11 @@ static const struct map *in_word_set(const char *str); %} struct map { const char *name; intmax_t value; int valid; }; %% -_POSIX_CLOCKRES_MIN, _POSIX_CLOCKRES_MIN _POSIX_AIO_LISTIO_MAX, _POSIX_AIO_LISTIO_MAX _POSIX_AIO_MAX, _POSIX_AIO_MAX _POSIX_ARG_MAX, _POSIX_ARG_MAX _POSIX_CHILD_MAX, _POSIX_CHILD_MAX +_POSIX_CLOCKRES_MIN, _POSIX_CLOCKRES_MIN _POSIX_DELAYTIMER_MAX, _POSIX_DELAYTIMER_MAX _POSIX_HOST_NAME_MAX, _POSIX_HOST_NAME_MAX _POSIX_LINK_MAX, _POSIX_LINK_MAX @@ -64,7 +67,7 @@ _POSIX2_BC_SCALE_MAX, _POSIX2_BC_SCALE_MAX _POSIX2_BC_STRING_MAX, _POSIX2_BC_STRING_MAX _POSIX2_CHARCLASS_NAME_MAX, _POSIX2_CHARCLASS_NAME_MAX _POSIX2_COLL_WEIGHTS_MAX, _POSIX2_COLL_WEIGHTS_MAX -_POSIX2_EXPR_NEXT_MAX, _POSIX2_EXPR_NEST_MAX +_POSIX2_EXPR_NEST_MAX, _POSIX2_EXPR_NEST_MAX _POSIX2_LINE_MAX, _POSIX2_LINE_MAX _POSIX2_RE_DUP_MAX, _POSIX2_RE_DUP_MAX _XOPEN_IOV_MAX, _XOPEN_IOV_MAX @@ -105,6 +108,9 @@ int find_limit(const char *name, intmax_t *value) { const struct map *rv; +#ifdef APPLE_GETCONF_UNDERSCORE + char *alt; +#endif /* APPLE_GETCONF_UNDERSCORE */ rv = in_word_set(name); if (rv != NULL) { @@ -114,5 +120,23 @@ find_limit(const char *name, intmax_t *value) } return -1; } +#ifdef APPLE_GETCONF_UNDERSCORE + if(*name == '_') + alt = (char *)name + 1; + else { + if((alt = (char *)alloca(strlen(name) + 2)) == NULL) + return 0; + *alt = '_'; + strcpy(alt + 1, name); + } + rv = in_word_set(alt); + if (rv != NULL) { + if (rv->valid) { + *value = rv->value; + return 1; + } + return -1; + } +#endif /* APPLE_GETCONF_UNDERSCORE */ return 0; } diff --git a/usr.bin/getconf/pathconf.gperf b/usr.bin/getconf/pathconf.gperf index f283546f063a..3b9e0f478364 100644 --- a/usr.bin/getconf/pathconf.gperf +++ b/usr.bin/getconf/pathconf.gperf @@ -9,6 +9,9 @@ #include #include +#ifdef APPLE_GETCONF_UNDERSCORE +#include +#endif /* APPLE_GETCONF_UNDERSCORE */ #include "getconf.h" @@ -20,17 +23,10 @@ static const struct map *in_word_set(const char *str); %} struct map { const char *name; int key; int valid; }; %% -ACL_EXTENDED, _PC_ACL_EXTENDED -ACL_NFS4, _PC_ACL_NFS4 -ACL_PATH_MAX, _PC_ACL_PATH_MAX -CAP_PRESENT, _PC_CAP_PRESENT FILESIZEBITS, _PC_FILESIZEBITS -INF_PRESENT, _PC_INF_PRESENT LINK_MAX, _PC_LINK_MAX -MAC_PRESENT, _PC_MAC_PRESENT MAX_CANON, _PC_MAX_CANON MAX_INPUT, _PC_MAX_INPUT -MIN_HOLE_SIZE, _PC_MIN_HOLE_SIZE NAME_MAX, _PC_NAME_MAX PATH_MAX, _PC_PATH_MAX PIPE_BUF, _PC_PIPE_BUF @@ -39,24 +35,28 @@ POSIX_REC_INCR_XFER_SIZE, _PC_REC_INCR_XFER_SIZE POSIX_REC_MAX_XFER_SIZE, _PC_REC_MAX_XFER_SIZE POSIX_REC_MIN_XFER_SIZE, _PC_REC_MIN_XFER_SIZE POSIX_REC_XFER_ALIGN, _PC_REC_XFER_ALIGN +POSIX2_SYMLINKS, _PC_2_SYMLINKS SYMLINK_MAX, _PC_SYMLINK_MAX TRUSTEDBSD_ACL_EXTENDED, _PC_ACL_EXTENDED -TRUSTEDBSD_ACL_NFS4, _PC_ACL_NFS4 TRUSTEDBSD_ACL_PATH_MAX, _PC_ACL_PATH_MAX TRUSTEDBSD_CAP_PRESENT, _PC_CAP_PRESENT TRUSTEDBSD_INF_PRESENT, _PC_INF_PRESENT TRUSTEDBSD_MAC_PRESENT, _PC_MAC_PRESENT +_POSIX_ASYNC_IO, _PC_ASYNC_IO _POSIX_CHOWN_RESTRICTED, _PC_CHOWN_RESTRICTED _POSIX_NO_TRUNC, _PC_NO_TRUNC -_POSIX_VDISABLE, _PC_VDISABLE -_POSIX_ASYNC_IO, _PC_ASYNC_IO +_POSIX_PATH_MAX, _PC_PATH_MAX _POSIX_PRIO_IO, _PC_PRIO_IO _POSIX_SYNC_IO, _PC_SYNC_IO +_POSIX_VDISABLE, _PC_VDISABLE %% int find_pathconf(const char *name, int *key) { const struct map *rv; +#ifdef APPLE_GETCONF_UNDERSCORE + char *alt; +#endif /* APPLE_GETCONF_UNDERSCORE */ rv = in_word_set(name); if (rv != NULL) { @@ -66,5 +66,23 @@ find_pathconf(const char *name, int *key) } return -1; } +#ifdef APPLE_GETCONF_UNDERSCORE + if(*name == '_') + alt = (char *)name + 1; + else { + if((alt = (char *)alloca(strlen(name) + 2)) == NULL) + return 0; + *alt = '_'; + strcpy(alt + 1, name); + } + rv = in_word_set(alt); + if (rv != NULL) { + if (rv->valid) { + *key = rv->key; + return 1; + } + return -1; + } +#endif /* APPLE_GETCONF_UNDERSCORE */ return 0; } diff --git a/usr.bin/getconf/progenv.gperf b/usr.bin/getconf/progenv.gperf index 481055393b79..564c7d944775 100644 --- a/usr.bin/getconf/progenv.gperf +++ b/usr.bin/getconf/progenv.gperf @@ -30,11 +30,14 @@ static const struct map *in_word_set(const char *str); * be updated. (We cheat here and define the supported environments * statically.) */ -#if defined(__sparc64__) || defined(__amd64__) +#if defined(__alpha__) || defined(__sparc64__) #define have_LP64_OFF64 NULL +#elif defined(__APPLE__) +#define have_LP64_OFF64 NULL +#define have_LPBIG_OFFBIG NULL #endif -#if defined(__i386__) || defined(__powerpc__) +#if defined(__i386__) || defined(__powerpc__) || defined(__x86_64__) #define have_ILP32_OFFBIG NULL #endif @@ -44,11 +47,11 @@ struct map { const char *name; const char *alt_path; int valid; }; POSIX_V6_ILP32_OFF32, notdef POSIX_V6_ILP32_OFFBIG, have_ILP32_OFFBIG POSIX_V6_LP64_OFF64, have_LP64_OFF64 -POSIX_V6_LPBIG_OFFBIG, notdef +POSIX_V6_LPBIG_OFFBIG, have_LPBIG_OFFBIG _POSIX_V6_ILP32_OFF32, notdef _POSIX_V6_ILP32_OFFBIG, have_ILP32_OFFBIG _POSIX_V6_LP64_OFF64, have_LP64_OFF64 -_POSIX_V6_LPBIG_OFFBIG, notdef +_POSIX_V6_LPBIG_OFFBIG, have_LPBIG_OFFBIG %% int find_progenv(const char *name, const char **alt_path) diff --git a/usr.bin/getconf/sysconf.gperf b/usr.bin/getconf/sysconf.gperf index 6a0a34989877..f6f750af64d2 100644 --- a/usr.bin/getconf/sysconf.gperf +++ b/usr.bin/getconf/sysconf.gperf @@ -9,6 +9,9 @@ #include #include +#ifdef APPLE_GETCONF_UNDERSCORE +#include +#endif /* APPLE_GETCONF_UNDERSCORE */ #include "getconf.h" @@ -70,9 +73,16 @@ _POSIX2_C_VERSION, _SC_2_C_VERSION _POSIX2_FORT_DEV, _SC_2_FORT_DEV _POSIX2_FORT_RUN, _SC_2_FORT_RUN _POSIX2_LOCALEDEF, _SC_2_LOCALEDEF +_POSIX2_PBS, _SC_PBS +_POSIX2_PBS_ACCOUNTING, _SC_PBS_ACCOUNTING +_POSIX2_PBS_CHECKPOINT, _SC_PBS_CHECKPOINT +_POSIX2_PBS_LOCATE, _SC_PBS_LOCATE +_POSIX2_PBS_MESSAGE, _SC_PBS_MESSAGE +_POSIX2_PBS_TRACK, _SC_PBS_TRACK _POSIX2_SW_DEV, _SC_2_SW_DEV _POSIX2_UPE, _SC_2_UPE _POSIX2_VERSION, _SC_2_VERSION +_POSIX_ADVISORY_INFO, _SC_ADVISORY_INFO _POSIX_ASYNCHRONOUS_IO, _SC_ASYNCHRONOUS_IO _POSIX_BARRIERS, _SC_BARRIERS _POSIX_CLOCK_SELECTION, _SC_CLOCK_SELECTION @@ -89,6 +99,7 @@ _POSIX_MESSAGE_PASSING, _SC_MESSAGE_PASSING _POSIX_MONOTONIC_CLOCK, _SC_MONOTONIC_CLOCK _POSIX_PRIORITIZED_IO, _SC_PRIORITIZED_IO _POSIX_PRIORITY_SCHEDULING, _SC_PRIORITY_SCHEDULING +_POSIX_RAW_SOCKETS, _SC_RAW_SOCKETS _POSIX_READER_WRITER_LOCKS, _SC_READER_WRITER_LOCKS _POSIX_REALTIME_SIGNALS, _SC_REALTIME_SIGNALS _POSIX_REGEXP, _SC_REGEXP @@ -99,6 +110,7 @@ _POSIX_SHELL, _SC_SHELL _POSIX_SPAWN, _SC_SPAWN _POSIX_SPIN_LOCKS, _SC_SPIN_LOCKS _POSIX_SPORADIC_SERVER, _SC_SPORADIC_SERVER +_POSIX_SS_REPL_MAX, _SC_SS_REPL_MAX _POSIX_SYNCHRONIZED_IO, _SC_SYNCHRONIZED_IO _POSIX_THREADS, _SC_THREADS _POSIX_THREAD_ATTR_STACKADDR, _SC_THREAD_ATTR_STACKADDR @@ -111,23 +123,28 @@ _POSIX_THREAD_PROCESS_SHARED, _SC_THREAD_PROCESS_SHARED _POSIX_THREAD_SAFE_FUNCTIONS, _SC_THREAD_SAFE_FUNCTIONS _POSIX_THREAD_SPORADIC_SERVER, _SC_THREAD_SPORADIC_SERVER _POSIX_TIMEOUTS, _SC_TIMEOUTS +_POSIX_TIMERS, _SC_TIMERS _POSIX_TRACE, _SC_TRACE _POSIX_TRACE_EVENT_FILTER, _SC_TRACE_EVENT_FILTER +_POSIX_TRACE_EVENT_NAME_MAX, _SC_TRACE_EVENT_NAME_MAX _POSIX_TRACE_INHERIT, _SC_TRACE_INHERIT _POSIX_TRACE_LOG, _SC_TRACE_LOG -_POSIX_TIMERS, _SC_TIMERS +_POSIX_TRACE_NAME_MAX, _SC_TRACE_NAME_MAX +_POSIX_TRACE_SYS_MAX, _SC_TRACE_SYS_MAX +_POSIX_TRACE_USER_EVENT_MAX, _SC_TRACE_USER_EVENT_MAX _POSIX_TYPED_MEMORY_OBJECTS, _SC_TYPED_MEMORY_OBJECTS -_POSIX_VERSION, _SC_VERSION _POSIX_V6_ILP32_OFF32, _SC_V6_ILP32_OFF32 _POSIX_V6_ILP32_OFFBIG, _SC_V6_ILP32_OFFBIG _POSIX_V6_LP64_OFF64, _SC_V6_LP64_OFF64 _POSIX_V6_LPBIG_OFFBIG, _SC_V6_LPBIG_OFFBIG +_POSIX_VERSION, _SC_VERSION _XOPEN_CRYPT, _SC_XOPEN_CRYPT _XOPEN_ENH_I18N, _SC_XOPEN_ENH_I18N _XOPEN_LEGACY, _SC_XOPEN_LEGACY _XOPEN_REALTIME, _SC_XOPEN_REALTIME _XOPEN_REALTIME_THREADS, _SC_XOPEN_REALTIME_THREADS _XOPEN_SHM, _SC_XOPEN_SHM +_XOPEN_STREAMS, _SC_XOPEN_STREAMS _XOPEN_UNIX, _SC_XOPEN_UNIX _XOPEN_VERSION, _SC_XOPEN_VERSION _XOPEN_XCU_VERSION, _SC_XCU_VERSION @@ -136,6 +153,9 @@ int find_sysconf(const char *name, int *key) { const struct map *rv; +#ifdef APPLE_GETCONF_UNDERSCORE + char *alt; +#endif /* APPLE_GETCONF_UNDERSCORE */ rv = in_word_set(name); if (rv != NULL) { @@ -145,5 +165,23 @@ find_sysconf(const char *name, int *key) } return -1; } +#ifdef APPLE_GETCONF_UNDERSCORE + if(*name == '_') + alt = (char *)name + 1; + else { + if((alt = (char *)alloca(strlen(name) + 2)) == NULL) + return 0; + *alt = '_'; + strcpy(alt + 1, name); + } + rv = in_word_set(alt); + if (rv != NULL) { + if (rv->valid) { + *key = rv->key; + return 1; + } + return -1; + } +#endif /* APPLE_GETCONF_UNDERSCORE */ return 0; } diff --git a/usr.sbin/nscd/nscd.c b/usr.sbin/nscd/nscd.c index 6b5af943a500..33b6aa52350a 100644 --- a/usr.sbin/nscd/nscd.c +++ b/usr.sbin/nscd/nscd.c @@ -167,7 +167,7 @@ init_runtime_env(struct configuration *config) retval = calloc(1, sizeof(*retval)); assert(retval != NULL); - retval->sockfd = socket(PF_LOCAL, SOCK_STREAM, 0); + retval->sockfd = socket(PF_LOCAL, SOCK_STREAM|SOCK_NONBLOCK, 0); if (config->force_unlink == 1) unlink(config->socket_path); @@ -198,7 +198,6 @@ init_runtime_env(struct configuration *config) */ chmod(config->socket_path, config->socket_mode); listen(retval->sockfd, -1); - fcntl(retval->sockfd, F_SETFL, O_NONBLOCK); retval->queue = kqueue(); assert(retval->queue != -1); diff --git a/usr.sbin/nscd/nscdcli.c b/usr.sbin/nscd/nscdcli.c index 9b0720116dc4..e43b658b79ef 100644 --- a/usr.sbin/nscd/nscdcli.c +++ b/usr.sbin/nscd/nscdcli.c @@ -189,7 +189,7 @@ open_nscd_connection__(struct nscd_connection_params const *params) TRACE_IN(open_nscd_connection); assert(params != NULL); - client_socket = socket(PF_LOCAL, SOCK_STREAM, 0); + client_socket = socket(PF_LOCAL, SOCK_STREAM|SOCK_NONBLOCK, 0); client_address.sun_family = PF_LOCAL; strlcpy(client_address.sun_path, params->socket_path, sizeof(client_address.sun_path)); @@ -203,7 +203,6 @@ open_nscd_connection__(struct nscd_connection_params const *params) TRACE_OUT(open_nscd_connection); return (NULL); } - fcntl(client_socket, F_SETFL, O_NONBLOCK); retval = calloc(1, sizeof(*retval)); assert(retval != NULL); From b4b4b5304bd22eab265c9c049cb7fc6b55c4ef3f Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Sat, 28 Jan 2017 16:31:23 +0000 Subject: [PATCH 30/51] Revert crap accidentally committed --- bin/ed/Makefile | 2 +- contrib/dma/mail.c | 79 ++++-------- share/mk/bsd.doc.mk | 4 +- sys/amd64/amd64/db_trace.c | 15 --- sys/amd64/cloudabi64/cloudabi64_sysvec.c | 2 - sys/cam/ctl/ctl_ioctl.h | 2 +- sys/cddl/dev/fbt/x86/fbt_isa.c | 2 - sys/compat/cloudabi/cloudabi_fd.c | 1 - sys/compat/cloudabi64/cloudabi64_poll.c | 1 - .../linuxkpi/common/include/linux/slab.h | 8 -- .../acpica/components/namespace/nsxfeval.c | 40 +----- sys/contrib/dev/acpica/include/acpixf.h | 8 -- sys/ddb/ddb.h | 1 - sys/dev/drm2/drm_agpsupport.c | 14 +- sys/dev/drm2/drm_bufs.c | 122 +++++++++--------- sys/dev/drm2/drm_dma.c | 10 +- sys/dev/drm2/drm_drv.c | 3 +- sys/dev/drm2/drm_os_freebsd.c | 3 +- sys/dev/drm2/drm_os_freebsd.h | 2 +- sys/dev/drm2/drm_stub.c | 5 +- sys/fs/nfsserver/nfs_nfsdstate.c | 4 +- sys/kern/kern_descrip.c | 8 -- sys/kern/kern_shutdown.c | 8 -- sys/modules/drm2/drm2/Makefile | 2 + tools/build/Makefile | 5 - tools/tools/locale/etc/unicode.conf | 4 +- usr.bin/getconf/confstr.gperf | 3 - usr.bin/getconf/getconf.c | 1 + usr.bin/getconf/limits.gperf | 28 +--- usr.bin/getconf/pathconf.gperf | 38 ++---- usr.bin/getconf/progenv.gperf | 11 +- usr.bin/getconf/sysconf.gperf | 42 +----- usr.sbin/nscd/nscd.c | 3 +- usr.sbin/nscd/nscdcli.c | 3 +- 34 files changed, 151 insertions(+), 333 deletions(-) diff --git a/bin/ed/Makefile b/bin/ed/Makefile index b5905e3e5e4e..40e06134e87d 100644 --- a/bin/ed/Makefile +++ b/bin/ed/Makefile @@ -9,7 +9,7 @@ LINKS= ${BINDIR}/ed ${BINDIR}/red MLINKS= ed.1 red.1 .if ${MK_OPENSSL} != "no" && ${MK_ED_CRYPTO} != "no" -CFLAGS+=-DDES -I/usr/include/private/openssl +CFLAGS+=-DDES LIBADD= crypto .endif diff --git a/contrib/dma/mail.c b/contrib/dma/mail.c index 994d1bdd895f..842072c55242 100644 --- a/contrib/dma/mail.c +++ b/contrib/dma/mail.c @@ -38,7 +38,6 @@ #include #include #include -#include #include "dma.h" @@ -342,41 +341,18 @@ parse_addrs(struct parse_state *ps, char *s, struct queue *queue) goto again; } -static int -writeline(struct queue *queue, const char *line, ssize_t linelen) -{ - ssize_t len; - - while (linelen > 0) { - len = linelen; - if (linelen > 1000) { - len = 990; - } - if (fwrite(line, len, 1, queue->mailf) != 1) - return (-1); - if (linelen <= 1000) - break; - if (fwrite("\n", 1, 1, queue->mailf) != 1) - return (-1); - line += 990; - linelen = strlen(line); - } - return (0); -} - int readmail(struct queue *queue, int nodot, int recp_from_header) { struct parse_state parse_state; - char *line = NULL; - ssize_t linelen; - size_t linecap = 0; - char newline[1000]; + char line[1000]; /* by RFC2822 */ + size_t linelen; size_t error; int had_headers = 0; int had_from = 0; int had_messagid = 0; int had_date = 0; + int had_last_line = 0; int nocopy = 0; parse_state.state = NONE; @@ -396,15 +372,24 @@ readmail(struct queue *queue, int nodot, int recp_from_header) return (-1); while (!feof(stdin)) { - newline[0] = '\0'; - if ((linelen = getline(&line, &linecap, stdin)) <= 0) + if (fgets(line, sizeof(line) - 1, stdin) == NULL) break; + if (had_last_line) + errlogx(EX_DATAERR, "bad mail input format:" + " from %s (uid %d) (envelope-from %s)", + username, useruid, queue->sender); + linelen = strlen(line); + if (linelen == 0 || line[linelen - 1] != '\n') { + /* + * This line did not end with a newline character. + * If we fix it, it better be the last line of + * the file. + */ + line[linelen] = '\n'; + line[linelen + 1] = 0; + had_last_line = 1; + } if (!had_headers) { - if (linelen > 1000) - errlogx(EX_DATAERR, "bad mail input format:" - " from %s (uid %d) (envelope-from %s)", - username, useruid, queue->sender); - /* * Unless this is a continuation, switch of * the Bcc: nocopy flag. @@ -440,44 +425,36 @@ readmail(struct queue *queue, int nodot, int recp_from_header) } } - if (line[0] == '\n' && !had_headers) { + if (strcmp(line, "\n") == 0 && !had_headers) { had_headers = 1; while (!had_date || !had_messagid || !had_from) { if (!had_date) { had_date = 1; - snprintf(newline, sizeof(newline), "Date: %s\n", rfc822date()); + snprintf(line, sizeof(line), "Date: %s\n", rfc822date()); } else if (!had_messagid) { /* XXX msgid, assign earlier and log? */ had_messagid = 1; - snprintf(newline, sizeof(newline), "Message-Id: <%"PRIxMAX".%s.%"PRIxMAX"@%s>\n", + snprintf(line, sizeof(line), "Message-Id: <%"PRIxMAX".%s.%"PRIxMAX"@%s>\n", (uintmax_t)time(NULL), queue->id, (uintmax_t)random(), hostname()); } else if (!had_from) { had_from = 1; - snprintf(newline, sizeof(newline), "From: <%s>\n", queue->sender); + snprintf(line, sizeof(line), "From: <%s>\n", queue->sender); } - if (fwrite(newline, strlen(newline), 1, queue->mailf) != 1) - goto fail; + if (fwrite(line, strlen(line), 1, queue->mailf) != 1) + return (-1); } - strlcpy(newline, "\n", sizeof(newline)); + strcpy(line, "\n"); } if (!nodot && linelen == 2 && line[0] == '.') break; if (!nocopy) { - if (newline[0] != '\0') { - if (fwrite(newline, strlen(newline), 1, queue->mailf) != 1) - goto fail; - } else { - if (writeline(queue, line, linelen) != 0) - goto fail; - } + if (fwrite(line, strlen(line), 1, queue->mailf) != 1) + return (-1); } } return (0); -fail: - free(line); - return (-1); } diff --git a/share/mk/bsd.doc.mk b/share/mk/bsd.doc.mk index 64648abb2c5a..5b88ae5d9f0b 100644 --- a/share/mk/bsd.doc.mk +++ b/share/mk/bsd.doc.mk @@ -54,10 +54,10 @@ INDXBIB?= indxbib PIC?= pic REFER?= refer .for _dev in ${PRINTERDEVICE:Mascii} -ROFF.ascii?= nroff -Tascii -P-c ${TRFLAGS} -mtty-char ${MACROS} ${PAGES:C/^/-o/1} +ROFF.ascii?= groff -Tascii -P-c ${TRFLAGS} -mtty-char ${MACROS} ${PAGES:C/^/-o/1} .endfor .for _dev in ${PRINTERDEVICE:Nascii} -ROFF.${_dev}?= nroff -T${_dev} ${TRFLAGS} ${MACROS} ${PAGES:C/^/-o/1} +ROFF.${_dev}?= groff -T${_dev} ${TRFLAGS} ${MACROS} ${PAGES:C/^/-o/1} .endfor SOELIM?= soelim TBL?= tbl diff --git a/sys/amd64/amd64/db_trace.c b/sys/amd64/amd64/db_trace.c index b93c3a839fbd..381237b6b321 100644 --- a/sys/amd64/amd64/db_trace.c +++ b/sys/amd64/amd64/db_trace.c @@ -270,7 +270,6 @@ db_nextframe(struct amd64_frame **fp, db_addr_t *ip, struct thread *td) *fp = (struct amd64_frame *) rbp; } - static int db_backtrace(struct thread *td, struct trapframe *tf, struct amd64_frame *frame, db_addr_t pc, register_t sp, int count) @@ -385,20 +384,6 @@ db_trace_self(void) db_backtrace(curthread, NULL, frame, callpc, 0, -1); } -void -db_trace_self_depth(int depth) -{ - struct amd64_frame *frame; - db_addr_t callpc; - register_t rbp; - - __asm __volatile("movq %%rbp,%0" : "=r" (rbp)); - frame = (struct amd64_frame *)rbp; - callpc = (db_addr_t)db_get_value((long)&frame->f_retaddr, 8, FALSE); - frame = frame->f_frame; - db_backtrace(curthread, NULL, frame, callpc, 0, depth); -} - int db_trace_thread(struct thread *thr, int count) { diff --git a/sys/amd64/cloudabi64/cloudabi64_sysvec.c b/sys/amd64/cloudabi64/cloudabi64_sysvec.c index 71754a7f8aca..060825e79987 100644 --- a/sys/amd64/cloudabi64/cloudabi64_sysvec.c +++ b/sys/amd64/cloudabi64/cloudabi64_sysvec.c @@ -27,7 +27,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include #include @@ -39,7 +38,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include diff --git a/sys/cam/ctl/ctl_ioctl.h b/sys/cam/ctl/ctl_ioctl.h index dcabb0fcda14..48ba9b0e70fb 100644 --- a/sys/cam/ctl/ctl_ioctl.h +++ b/sys/cam/ctl/ctl_ioctl.h @@ -150,7 +150,7 @@ struct ctl_lun_io_stats { uint64_t lun_number; uint32_t blocksize; ctl_lun_stats_flags flags; - struct ctl_lun_io_port_stats *ports; + struct ctl_lun_io_port_stats ports[CTL_MAX_PORTS]; }; struct ctl_stats { diff --git a/sys/cddl/dev/fbt/x86/fbt_isa.c b/sys/cddl/dev/fbt/x86/fbt_isa.c index fb0eb2482e60..3f4d8c58ad0d 100644 --- a/sys/cddl/dev/fbt/x86/fbt_isa.c +++ b/sys/cddl/dev/fbt/x86/fbt_isa.c @@ -34,8 +34,6 @@ #include -#include - #include "fbt.h" #define FBT_PUSHL_EBP 0x55 diff --git a/sys/compat/cloudabi/cloudabi_fd.c b/sys/compat/cloudabi/cloudabi_fd.c index 78e6cf0683c2..2f2725ec716d 100644 --- a/sys/compat/cloudabi/cloudabi_fd.c +++ b/sys/compat/cloudabi/cloudabi_fd.c @@ -34,7 +34,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include diff --git a/sys/compat/cloudabi64/cloudabi64_poll.c b/sys/compat/cloudabi64/cloudabi64_poll.c index 795163f5c5f6..3df526598934 100644 --- a/sys/compat/cloudabi64/cloudabi64_poll.c +++ b/sys/compat/cloudabi64/cloudabi64_poll.c @@ -27,7 +27,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include diff --git a/sys/compat/linuxkpi/common/include/linux/slab.h b/sys/compat/linuxkpi/common/include/linux/slab.h index 91d77deb7fef..d35f7a1ef89a 100644 --- a/sys/compat/linuxkpi/common/include/linux/slab.h +++ b/sys/compat/linuxkpi/common/include/linux/slab.h @@ -72,14 +72,6 @@ struct linux_kmem_cache { }; #define SLAB_HWCACHE_ALIGN 0x0001 -static inline void * -kmalloc_array(size_t n, size_t size, gfp_t flags) -{ - if (size != 0 && n > SIZE_MAX / size) - return (NULL); - return kmalloc(n * size, flags); -} -} static inline int linux_kmem_ctor(void *mem, int size, void *arg, int flags) diff --git a/sys/contrib/dev/acpica/components/namespace/nsxfeval.c b/sys/contrib/dev/acpica/components/namespace/nsxfeval.c index 5bd50db35b7a..363970476d7a 100644 --- a/sys/contrib/dev/acpica/components/namespace/nsxfeval.c +++ b/sys/contrib/dev/acpica/components/namespace/nsxfeval.c @@ -1022,25 +1022,23 @@ ACPI_EXPORT_SYMBOL (AcpiDetachData) /******************************************************************************* * - * FUNCTION: AcpiGetDataFull + * FUNCTION: AcpiGetData * * PARAMETERS: ObjHandle - Namespace node - * Handle - Handler used in call to attach_data + * Handler - Handler used in call to AttachData * Data - Where the data is returned - * Callback - function to execute before returning * * RETURN: Status * - * DESCRIPTION: Retrieve data that was previously attached to a namespace node - * and execute a callback before returning. + * DESCRIPTION: Retrieve data that was previously attached to a namespace node. * ******************************************************************************/ + ACPI_STATUS -AcpiGetDataFull ( +AcpiGetData ( ACPI_HANDLE ObjHandle, ACPI_OBJECT_HANDLER Handler, - void **Data, - void (*Callback)(void *)) + void **Data) { ACPI_NAMESPACE_NODE *Node; ACPI_STATUS Status; @@ -1071,34 +1069,10 @@ AcpiGetDataFull ( } Status = AcpiNsGetAttachedData (Node, Handler, Data); - if (ACPI_SUCCESS(Status) && Callback) { - Callback(*Data); - } + UnlockAndExit: (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return (Status); } -ACPI_EXPORT_SYMBOL (AcpiGetDataFull) -/******************************************************************************* - * - * FUNCTION: AcpiGetData - * - * PARAMETERS: ObjHandle - Namespace node - * Handler - Handler used in call to AttachData - * Data - Where the data is returned - * - * RETURN: Status - * - * DESCRIPTION: Retrieve data that was previously attached to a namespace node. - * - ******************************************************************************/ -ACPI_STATUS -AcpiGetData ( - ACPI_HANDLE ObjHandle, - ACPI_OBJECT_HANDLER Handler, - void **Data) -{ - return (AcpiGetDataFull(ObjHandle, Handler, Data, NULL)); -} ACPI_EXPORT_SYMBOL (AcpiGetData) diff --git a/sys/contrib/dev/acpica/include/acpixf.h b/sys/contrib/dev/acpica/include/acpixf.h index 3a1e72068947..ae946711c948 100644 --- a/sys/contrib/dev/acpica/include/acpixf.h +++ b/sys/contrib/dev/acpica/include/acpixf.h @@ -670,14 +670,6 @@ AcpiGetData ( ACPI_OBJECT_HANDLER Handler, void **Data)) -ACPI_EXTERNAL_RETURN_STATUS ( -ACPI_STATUS -AcpiGetDataFull ( - ACPI_HANDLE Object, - ACPI_OBJECT_HANDLER Handler, - void **Data, - void (*Callback)(void *))) - ACPI_EXTERNAL_RETURN_STATUS ( ACPI_STATUS AcpiDebugTrace ( diff --git a/sys/ddb/ddb.h b/sys/ddb/ddb.h index 990b3d502dcc..fcf772b59458 100644 --- a/sys/ddb/ddb.h +++ b/sys/ddb/ddb.h @@ -219,7 +219,6 @@ bool db_stop_at_pc(int type, int code, bool *is_breakpoint, bool *is_watchpoint); #define db_strcpy strcpy void db_trace_self(void); -void db_trace_self_depth(int); int db_trace_thread(struct thread *, int); bool db_value_of_name(const char *name, db_expr_t *valuep); bool db_value_of_name_pcpu(const char *name, db_expr_t *valuep); diff --git a/sys/dev/drm2/drm_agpsupport.c b/sys/dev/drm2/drm_agpsupport.c index 131a9ad9cc91..025350fc4bb7 100644 --- a/sys/dev/drm2/drm_agpsupport.c +++ b/sys/dev/drm2/drm_agpsupport.c @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include +#include #if __OS_HAS_AGP @@ -208,15 +209,13 @@ int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request) if (!dev->agp || !dev->agp->acquired) return -EINVAL; - if (!(entry = malloc(sizeof(*entry), DRM_MEM_AGPLISTS, M_NOWAIT))) + if (!(entry = kzalloc(sizeof(*entry), GFP_KERNEL))) return -ENOMEM; - memset(entry, 0, sizeof(*entry)); - pages = (request->size + PAGE_SIZE - 1) / PAGE_SIZE; type = (u32) request->type; if (!(memory = agp_alloc_memory(dev->agp->bridge, type, pages << PAGE_SHIFT))) { - free(entry, DRM_MEM_AGPLISTS); + kfree(entry); return -ENOMEM; } @@ -376,7 +375,7 @@ int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request) list_del(&entry->head); drm_free_agp(entry->memory, entry->pages); - free(entry, DRM_MEM_AGPLISTS); + kfree(entry); return 0; } EXPORT_SYMBOL(drm_agp_free); @@ -404,12 +403,11 @@ struct drm_agp_head *drm_agp_init(struct drm_device *dev) { struct drm_agp_head *head = NULL; - if (!(head = malloc(sizeof(*head), DRM_MEM_AGPLISTS, M_NOWAIT))) + if (!(head = kzalloc(sizeof(*head), GFP_KERNEL))) return NULL; - memset((void *)head, 0, sizeof(*head)); head->bridge = agp_find_device(); if (!head->bridge) { - free(head, DRM_MEM_AGPLISTS); + kfree(head); return NULL; } else { agp_get_info(head->bridge, &head->agp_info); diff --git a/sys/dev/drm2/drm_bufs.c b/sys/dev/drm2/drm_bufs.c index 488a6be310d9..483ee55e06d1 100644 --- a/sys/dev/drm2/drm_bufs.c +++ b/sys/dev/drm2/drm_bufs.c @@ -39,9 +39,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include - #include #include @@ -219,7 +216,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, int ret; int align; - map = kmalloc(sizeof(*map), GFP_KERNEL); + map = malloc(sizeof(*map), DRM_MEM_MAPS, M_NOWAIT); if (!map) return -ENOMEM; @@ -233,7 +230,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, * when processes fork. */ if ((map->flags & _DRM_REMOVABLE) && map->type != _DRM_SHM) { - kfree(map); + free(map, DRM_MEM_MAPS); return -EINVAL; } DRM_DEBUG("offset = 0x%08llx, size = 0x%08lx, type = %d\n", @@ -252,7 +249,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, * constant. */ if ((map->offset & ((resource_size_t)PAGE_MASK)) || (map->size & (PAGE_MASK))) { - kfree(map); + free(map, DRM_MEM_MAPS); return -EINVAL; } map->mtrr = -1; @@ -284,7 +281,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, list->map->size = map->size; } - kfree(map); + free(map, DRM_MEM_MAPS); *maplist = list; return 0; } @@ -301,7 +298,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, if (map->type == _DRM_REGISTERS) { drm_core_ioremap(map, dev); if (!map->handle) { - kfree(map); + free(map, DRM_MEM_MAPS); return -ENOMEM; } } @@ -317,23 +314,23 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, list->map->size = map->size; } - kfree(map); + free(map, DRM_MEM_MAPS); *maplist = list; return 0; } - map->handle = vmalloc_user(map->size); + map->handle = malloc(map->size, DRM_MEM_MAPS, M_NOWAIT); DRM_DEBUG("%lu %d %p\n", map->size, drm_order(map->size), map->handle); if (!map->handle) { - kfree(map); + free(map, DRM_MEM_MAPS); return -ENOMEM; } map->offset = (unsigned long)map->handle; if (map->flags & _DRM_CONTAINS_LOCK) { /* Prevent a 2nd X Server from creating a 2nd lock */ if (dev->primary->master->lock.hw_lock != NULL) { - kfree(map->handle); - kfree(map); + free(map->handle, DRM_MEM_MAPS); + free(map, DRM_MEM_MAPS); return -EBUSY; } dev->sigdata.lock = dev->primary->master->lock.hw_lock = map->handle; /* Pointer to lock */ @@ -344,7 +341,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, int valid = 0; if (!drm_core_has_AGP(dev)) { - kfree(map); + free(map, DRM_MEM_MAPS); return -EINVAL; } #ifdef __linux__ @@ -379,7 +376,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, } } if (!list_empty(&dev->agp->memory) && !valid) { - kfree(map); + free(map, DRM_MEM_MAPS); return -EPERM; } DRM_DEBUG("AGP offset = 0x%08llx, size = 0x%08lx\n", @@ -392,7 +389,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, break; case _DRM_SCATTER_GATHER: if (!dev->sg) { - kfree(map); + free(map, DRM_MEM_MAPS); return -EINVAL; } map->handle = (void *)(dev->sg->vaddr + offset); @@ -408,7 +405,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, align = PAGE_SIZE; dmah = drm_pci_alloc(dev, map->size, align, BUS_SPACE_MAXADDR); if (!dmah) { - kfree(map); + free(map, DRM_MEM_MAPS); return -ENOMEM; } map->handle = dmah->vaddr; @@ -416,15 +413,15 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, map->dmah = dmah; break; default: - kfree(map); + free(map, DRM_MEM_MAPS); return -EINVAL; } - list = kzalloc(sizeof(*list), GFP_KERNEL); + list = malloc(sizeof(*list), DRM_MEM_MAPS, M_ZERO | M_NOWAIT); if (!list) { if (map->type == _DRM_REGISTERS) drm_core_ioremapfree(map, dev); - kfree(map); + free(map, DRM_MEM_MAPS); return -EINVAL; } list->map = map; @@ -441,8 +438,8 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, if (ret) { if (map->type == _DRM_REGISTERS) drm_core_ioremapfree(map, dev); - kfree(map); - kfree(list); + free(map, DRM_MEM_MAPS); + free(list, DRM_MEM_MAPS); DRM_UNLOCK(dev); return ret; } @@ -526,7 +523,7 @@ int drm_rmmap_locked(struct drm_device *dev, struct drm_local_map *map) list_del(&r_list->head); drm_ht_remove_key(&dev->map_hash, r_list->user_token >> PAGE_SHIFT); - kfree(r_list); + free(r_list, DRM_MEM_MAPS); found = 1; break; } @@ -548,7 +545,7 @@ int drm_rmmap_locked(struct drm_device *dev, struct drm_local_map *map) } break; case _DRM_SHM: - kfree(map->handle); + free(map->handle, DRM_MEM_MAPS); if (master) { if (dev->sigdata.lock == master->lock.hw_lock) dev->sigdata.lock = NULL; @@ -567,7 +564,7 @@ int drm_rmmap_locked(struct drm_device *dev, struct drm_local_map *map) DRM_ERROR("tried to rmmap GEM object\n"); break; } - kfree(map); + free(map, DRM_MEM_MAPS); return 0; } @@ -658,16 +655,16 @@ static void drm_cleanup_buf_error(struct drm_device * dev, drm_pci_free(dev, entry->seglist[i]); } } - kfree(entry->seglist); + free(entry->seglist, DRM_MEM_SEGS); entry->seg_count = 0; } if (entry->buf_count) { for (i = 0; i < entry->buf_count; i++) { - kfree(entry->buflist[i].dev_private); + free(entry->buflist[i].dev_private, DRM_MEM_BUFS); } - kfree(entry->buflist); + free(entry->buflist, DRM_MEM_BUFS); entry->buf_count = 0; } @@ -764,7 +761,8 @@ int drm_addbufs_agp(struct drm_device * dev, struct drm_buf_desc * request) return -EINVAL; } - entry->buflist = kcalloc(count, sizeof(*entry->buflist), GFP_KERNEL); + entry->buflist = malloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS, + M_NOWAIT | M_ZERO); if (!entry->buflist) { DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); @@ -792,7 +790,8 @@ int drm_addbufs_agp(struct drm_device * dev, struct drm_buf_desc * request) buf->file_priv = NULL; buf->dev_priv_size = dev->driver->dev_priv_size; - buf->dev_private = kzalloc(buf->dev_priv_size, GFP_KERNEL); + buf->dev_private = malloc(buf->dev_priv_size, DRM_MEM_BUFS, + M_NOWAIT | M_ZERO); if (!buf->dev_private) { /* Set count correctly so we free the proper amount. */ entry->buf_count = count; @@ -811,8 +810,9 @@ int drm_addbufs_agp(struct drm_device * dev, struct drm_buf_desc * request) DRM_DEBUG("byte_count: %d\n", byte_count); - temp_buflist = krealloc(dma->buflist, - (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), GFP_KERNEL); + temp_buflist = realloc(dma->buflist, + (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), + DRM_MEM_BUFS, M_NOWAIT); if (!temp_buflist) { /* Free the entry because it isn't valid */ drm_cleanup_buf_error(dev, entry); @@ -912,16 +912,18 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request) return -EINVAL; } - entry->buflist = kcalloc(count, sizeof(*entry->buflist), GFP_KERNEL); + entry->buflist = malloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS, + M_NOWAIT | M_ZERO); if (!entry->buflist) { DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); return -ENOMEM; } - entry->seglist = kcalloc(count, sizeof(*entry->seglist), GFP_KERNEL); + entry->seglist = malloc(count * sizeof(*entry->seglist), DRM_MEM_SEGS, + M_NOWAIT | M_ZERO); if (!entry->seglist) { - kfree(entry->buflist); + free(entry->buflist, DRM_MEM_BUFS); DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); return -ENOMEM; @@ -930,12 +932,11 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request) /* Keep the original pagelist until we know all the allocations * have succeeded */ - temp_pagelist = kmalloc_array(dma->page_count + (count << page_order), - sizeof(*dma->pagelist), - GFP_KERNEL); + temp_pagelist = malloc((dma->page_count + (count << page_order)) * + sizeof(*dma->pagelist), DRM_MEM_PAGES, M_NOWAIT); if (!temp_pagelist) { - kfree(entry->buflist); - kfree(entry->seglist); + free(entry->buflist, DRM_MEM_BUFS); + free(entry->seglist, DRM_MEM_SEGS); DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); return -ENOMEM; @@ -959,7 +960,7 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request) entry->buf_count = count; entry->seg_count = count; drm_cleanup_buf_error(dev, entry); - kfree(temp_pagelist); + free(temp_pagelist, DRM_MEM_PAGES); DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); return -ENOMEM; @@ -989,14 +990,14 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request) buf->file_priv = NULL; buf->dev_priv_size = dev->driver->dev_priv_size; - buf->dev_private = kzalloc(buf->dev_priv_size, - GFP_KERNEL); + buf->dev_private = malloc(buf->dev_priv_size, + DRM_MEM_BUFS, M_NOWAIT | M_ZERO); if (!buf->dev_private) { /* Set count correctly so we free the proper amount. */ entry->buf_count = count; entry->seg_count = count; drm_cleanup_buf_error(dev, entry); - kfree(temp_pagelist); + free(temp_pagelist, DRM_MEM_PAGES); DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); return -ENOMEM; @@ -1008,13 +1009,13 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request) byte_count += PAGE_SIZE << page_order; } - temp_buflist = krealloc(dma->buflist, - (dma->buf_count + entry->buf_count) * - sizeof(*dma->buflist), GFP_KERNEL); + temp_buflist = realloc(dma->buflist, + (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), + DRM_MEM_BUFS, M_NOWAIT); if (!temp_buflist) { /* Free the entry because it isn't valid */ drm_cleanup_buf_error(dev, entry); - kfree(temp_pagelist); + free(temp_pagelist, DRM_MEM_PAGES); DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); return -ENOMEM; @@ -1029,7 +1030,7 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request) * with the new one. */ if (dma->page_count) { - kfree(dma->pagelist); + free(dma->pagelist, DRM_MEM_PAGES); } dma->pagelist = temp_pagelist; @@ -1123,7 +1124,8 @@ static int drm_addbufs_sg(struct drm_device * dev, struct drm_buf_desc * request return -EINVAL; } - entry->buflist = kcalloc(count, sizeof(*entry->buflist), GFP_KERNEL); + entry->buflist = malloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS, + M_NOWAIT | M_ZERO); if (!entry->buflist) { DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); @@ -1152,7 +1154,8 @@ static int drm_addbufs_sg(struct drm_device * dev, struct drm_buf_desc * request buf->file_priv = NULL; buf->dev_priv_size = dev->driver->dev_priv_size; - buf->dev_private = kzalloc(buf->dev_priv_size, GFP_KERNEL); + buf->dev_private = malloc(buf->dev_priv_size, DRM_MEM_BUFS, + M_NOWAIT | M_ZERO); if (!buf->dev_private) { /* Set count correctly so we free the proper amount. */ entry->buf_count = count; @@ -1171,9 +1174,9 @@ static int drm_addbufs_sg(struct drm_device * dev, struct drm_buf_desc * request DRM_DEBUG("byte_count: %d\n", byte_count); - temp_buflist = krealloc(dma->buflist, - (dma->buf_count + entry->buf_count) * - sizeof(*dma->buflist), GFP_KERNEL); + temp_buflist = realloc(dma->buflist, + (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), + DRM_MEM_BUFS, M_NOWAIT); if (!temp_buflist) { /* Free the entry because it isn't valid */ drm_cleanup_buf_error(dev, entry); @@ -1277,7 +1280,8 @@ static int drm_addbufs_fb(struct drm_device * dev, struct drm_buf_desc * request return -EINVAL; } - entry->buflist = kzalloc(count * sizeof(*entry->buflist), GFP_KERNEL); + entry->buflist = malloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS, + M_NOWAIT | M_ZERO); if (!entry->buflist) { DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); @@ -1305,7 +1309,8 @@ static int drm_addbufs_fb(struct drm_device * dev, struct drm_buf_desc * request buf->file_priv = NULL; buf->dev_priv_size = dev->driver->dev_priv_size; - buf->dev_private = kmalloc(buf->dev_priv_size, GFP_KERNEL); + buf->dev_private = malloc(buf->dev_priv_size, DRM_MEM_BUFS, + M_NOWAIT | M_ZERO); if (!buf->dev_private) { /* Set count correctly so we free the proper amount. */ entry->buf_count = count; @@ -1324,8 +1329,9 @@ static int drm_addbufs_fb(struct drm_device * dev, struct drm_buf_desc * request DRM_DEBUG("byte_count: %d\n", byte_count); - temp_buflist = krealloc(dma->buflist, - (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), GFP_KERNEL); + temp_buflist = realloc(dma->buflist, + (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), + DRM_MEM_BUFS, M_NOWAIT); if (!temp_buflist) { /* Free the entry because it isn't valid */ drm_cleanup_buf_error(dev, entry); diff --git a/sys/dev/drm2/drm_dma.c b/sys/dev/drm2/drm_dma.c index 9ce6e3e9693e..380be2b8ca31 100644 --- a/sys/dev/drm2/drm_dma.c +++ b/sys/dev/drm2/drm_dma.c @@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$"); #include -#include /** * Initialize the DMA data. @@ -90,17 +89,18 @@ void drm_dma_takedown(struct drm_device *dev) drm_pci_free(dev, dma->bufs[i].seglist[j]); } } - kfree(dma->bufs[i].seglist); + free(dma->bufs[i].seglist, DRM_MEM_SEGS); } if (dma->bufs[i].buf_count) { for (j = 0; j < dma->bufs[i].buf_count; j++) { - kfree(dma->bufs[i].buflist[j].dev_private); + free(dma->bufs[i].buflist[j].dev_private, + DRM_MEM_BUFS); } - kfree(dma->bufs[i].buflist); + free(dma->bufs[i].buflist, DRM_MEM_BUFS); } } - kfree(dma->buflist); + free(dma->buflist, DRM_MEM_BUFS); free(dma->pagelist, DRM_MEM_PAGES); free(dev->dma, DRM_MEM_DRIVER); dev->dma = NULL; diff --git a/sys/dev/drm2/drm_drv.c b/sys/dev/drm2/drm_drv.c index 9529ac3dfa4b..c220668bdb71 100644 --- a/sys/dev/drm2/drm_drv.c +++ b/sys/dev/drm2/drm_drv.c @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -211,7 +212,7 @@ int drm_lastclose(struct drm_device * dev) if (entry->bound) drm_unbind_agp(entry->memory); drm_free_agp(entry->memory, entry->pages); - free(entry, DRM_MEM_AGPLISTS); + kfree(entry); } INIT_LIST_HEAD(&dev->agp->memory); diff --git a/sys/dev/drm2/drm_os_freebsd.c b/sys/dev/drm2/drm_os_freebsd.c index 854cc54a8ad4..90d7319a2ea0 100644 --- a/sys/dev/drm2/drm_os_freebsd.c +++ b/sys/dev/drm2/drm_os_freebsd.c @@ -16,6 +16,7 @@ MALLOC_DEFINE(DRM_MEM_MAGIC, "drm_magic", "DRM MAGIC Data Structures"); MALLOC_DEFINE(DRM_MEM_MINOR, "drm_minor", "DRM MINOR Data Structures"); MALLOC_DEFINE(DRM_MEM_IOCTLS, "drm_ioctls", "DRM IOCTL Data Structures"); MALLOC_DEFINE(DRM_MEM_MAPS, "drm_maps", "DRM MAP Data Structures"); +MALLOC_DEFINE(DRM_MEM_BUFS, "drm_bufs", "DRM BUFFER Data Structures"); MALLOC_DEFINE(DRM_MEM_SEGS, "drm_segs", "DRM SEGMENTS Data Structures"); MALLOC_DEFINE(DRM_MEM_PAGES, "drm_pages", "DRM PAGES Data Structures"); MALLOC_DEFINE(DRM_MEM_FILES, "drm_files", "DRM FILE Data Structures"); @@ -23,7 +24,6 @@ MALLOC_DEFINE(DRM_MEM_QUEUES, "drm_queues", "DRM QUEUE Data Structures"); MALLOC_DEFINE(DRM_MEM_CMDS, "drm_cmds", "DRM COMMAND Data Structures"); MALLOC_DEFINE(DRM_MEM_MAPPINGS, "drm_mapping", "DRM MAPPING Data Structures"); MALLOC_DEFINE(DRM_MEM_BUFLISTS, "drm_buflists", "DRM BUFLISTS Data Structures"); -MALLOC_DEFINE(DRM_MEM_AGPLISTS, "drm_agplists", "DRM AGPLISTS Data Structures"); MALLOC_DEFINE(DRM_MEM_CTXBITMAP, "drm_ctxbitmap", "DRM CTXBITMAP Data Structures"); MALLOC_DEFINE(DRM_MEM_SGLISTS, "drm_sglists", "DRM SGLISTS Data Structures"); @@ -495,4 +495,5 @@ MODULE_VERSION(drmn, 1); MODULE_DEPEND(drmn, agp, 1, 1, 1); MODULE_DEPEND(drmn, pci, 1, 1, 1); MODULE_DEPEND(drmn, mem, 1, 1, 1); +MODULE_DEPEND(drmn, linuxkpi, 1, 1, 1); MODULE_DEPEND(drmn, iicbus, 1, 1, 1); diff --git a/sys/dev/drm2/drm_os_freebsd.h b/sys/dev/drm2/drm_os_freebsd.h index 05fc921906bb..cedc7a25228d 100644 --- a/sys/dev/drm2/drm_os_freebsd.h +++ b/sys/dev/drm2/drm_os_freebsd.h @@ -544,6 +544,7 @@ MALLOC_DECLARE(DRM_MEM_MAGIC); MALLOC_DECLARE(DRM_MEM_MINOR); MALLOC_DECLARE(DRM_MEM_IOCTLS); MALLOC_DECLARE(DRM_MEM_MAPS); +MALLOC_DECLARE(DRM_MEM_BUFS); MALLOC_DECLARE(DRM_MEM_SEGS); MALLOC_DECLARE(DRM_MEM_PAGES); MALLOC_DECLARE(DRM_MEM_FILES); @@ -551,7 +552,6 @@ MALLOC_DECLARE(DRM_MEM_QUEUES); MALLOC_DECLARE(DRM_MEM_CMDS); MALLOC_DECLARE(DRM_MEM_MAPPINGS); MALLOC_DECLARE(DRM_MEM_BUFLISTS); -MALLOC_DECLARE(DRM_MEM_AGPLISTS); MALLOC_DECLARE(DRM_MEM_CTXBITMAP); MALLOC_DECLARE(DRM_MEM_SGLISTS); MALLOC_DECLARE(DRM_MEM_MM); diff --git a/sys/dev/drm2/drm_stub.c b/sys/dev/drm2/drm_stub.c index 06663ac8ef70..54b1a80cb7a1 100644 --- a/sys/dev/drm2/drm_stub.c +++ b/sys/dev/drm2/drm_stub.c @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #ifdef DRM_DEBUG_DEFAULT_ON unsigned int drm_debug = (DRM_DEBUGBITS_DEBUG | DRM_DEBUGBITS_KMS | @@ -315,7 +316,7 @@ void drm_cancel_fill_in_dev(struct drm_device *dev) DRM_MTRR_WC); DRM_DEBUG("mtrr_del=%d\n", retval); } - free(dev->agp, DRM_MEM_AGPLISTS); + kfree(dev->agp); dev->agp = NULL; drm_ht_remove(&dev->map_hash); @@ -467,7 +468,7 @@ void drm_put_dev(struct drm_device *dev) drm_sysctl_cleanup(dev); if (drm_core_has_AGP(dev) && dev->agp) { - free(dev->agp, DRM_MEM_AGPLISTS); + kfree(dev->agp); dev->agp = NULL; } diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c index d4c5fd11b718..1c2e7d1a762e 100644 --- a/sys/fs/nfsserver/nfs_nfsdstate.c +++ b/sys/fs/nfsserver/nfs_nfsdstate.c @@ -3081,7 +3081,7 @@ nfsrv_openctrl(struct nfsrv_descript *nd, vnode_t vp, new_deleg->ls_stateid.other[2] = delegstateidp->other[2] = nfsrv_nextstateindex(clp); if (writedeleg && !NFSVNO_EXRDONLY(exp) && - (nfsrv_writedelegifpos && !readonly) && + (nfsrv_writedelegifpos || !readonly) && (new_stp->ls_flags & NFSLCK_WANTRDELEG) == 0) { new_deleg->ls_flags = (NFSLCK_DELEGWRITE | NFSLCK_READACCESS | NFSLCK_WRITEACCESS); @@ -3153,7 +3153,7 @@ nfsrv_openctrl(struct nfsrv_descript *nd, vnode_t vp, delegstateidp->other[2] = nfsrv_nextstateindex(clp); if (writedeleg && !NFSVNO_EXRDONLY(exp) && - (nfsrv_writedelegifpos && !readonly) && + (nfsrv_writedelegifpos || !readonly) && ((nd->nd_flag & ND_NFSV41) == 0 || (new_stp->ls_flags & NFSLCK_WANTRDELEG) == 0)) { diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 51e716c30218..fd6c796da14d 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -69,7 +69,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -4075,13 +4074,6 @@ invfo_sendfile(struct file *fp, int sockfd, struct uio *hdr_uio, return (EINVAL); } -bool -fd_modified(struct filedesc *fdp, int fd, uint32_t seq) -{ - - return (!seq_consistent(fd_seq(fdp->fd_files, fd), seq)); -} - /*-------------------------------------------------------------------*/ /* diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c index 161548be272c..370a5447be4d 100644 --- a/sys/kern/kern_shutdown.c +++ b/sys/kern/kern_shutdown.c @@ -722,14 +722,6 @@ vpanic(const char *fmt, va_list ap) spinlock_enter(); -#if 0 -/***** DEBUGGING DRM *****/ - - doadump(0); - EVENTHANDLER_INVOKE(shutdown_final, RB_NOSYNC); - -/************************/ -#endif #ifdef SMP /* * stop_cpus_hard(other_cpus) should prevent multiple CPUs from diff --git a/sys/modules/drm2/drm2/Makefile b/sys/modules/drm2/drm2/Makefile index 35bee2972091..75696466db6d 100644 --- a/sys/modules/drm2/drm2/Makefile +++ b/sys/modules/drm2/drm2/Makefile @@ -48,6 +48,8 @@ SRCS = \ ati_pcigart.c #ttm_page_alloc_dma.c +CFLAGS+= -I${.CURDIR}/../../../compat/linuxkpi/common/include + .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_ARCH} == "powerpc64" SRCS += drm_ioc32.c .endif diff --git a/tools/build/Makefile b/tools/build/Makefile index 0368021e3457..63b147ceb985 100644 --- a/tools/build/Makefile +++ b/tools/build/Makefile @@ -41,11 +41,6 @@ SYSINCS+= stat.h SRCS+= futimens.c utimensat.c .endif -.if !exists(/usr/include/capsicum_helpers.h) -.PATH: ${.CURDIR}/../../lib/libcapsicum/ -INCS+= capsicum_helpers.h -.endif - .if empty(SRCS) SRCS= dummy.c .endif diff --git a/tools/tools/locale/etc/unicode.conf b/tools/tools/locale/etc/unicode.conf index 42a216cdeb10..8d5e4e104d01 100644 --- a/tools/tools/locale/etc/unicode.conf +++ b/tools/tools/locale/etc/unicode.conf @@ -1,4 +1,4 @@ # $FreeBSD$ -cldr /home/bapt/unicode/cldr/30.0.3 -unidata /home/bapt/unicode/UNIDATA/9.0.0 +cldr ~/unicode/cldr/30.0.3 +unidata ~/unicode/UNIDATA/9.0.0 diff --git a/usr.bin/getconf/confstr.gperf b/usr.bin/getconf/confstr.gperf index 11434ba29e96..c629987e5caf 100644 --- a/usr.bin/getconf/confstr.gperf +++ b/usr.bin/getconf/confstr.gperf @@ -52,9 +52,6 @@ _POSIX_V6_LPBIG_OFFBIG_CFLAGS, _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS _POSIX_V6_LPBIG_OFFBIG_LDFLAGS, _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS _POSIX_V6_LPBIG_OFFBIG_LIBS, _CS_POSIX_V6_LPBIG_OFFBIG_LIBS _POSIX_V6_WIDTH_RESTRICTED_ENVS, _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS -DARWIN_USER_DIR, _CS_DARWIN_USER_DIR -DARWIN_USER_TEMP_DIR, _CS_DARWIN_USER_TEMP_DIR -DARWIN_USER_CACHE_DIR, _CS_DARWIN_USER_CACHE_DIR %% int find_confstr(const char *name, int *key) diff --git a/usr.bin/getconf/getconf.c b/usr.bin/getconf/getconf.c index 5da036c2e6d5..a82196e33d2e 100644 --- a/usr.bin/getconf/getconf.c +++ b/usr.bin/getconf/getconf.c @@ -187,3 +187,4 @@ do_pathconf(const char *name, int key, const char *path) else printf("%ld\n", value); } + diff --git a/usr.bin/getconf/limits.gperf b/usr.bin/getconf/limits.gperf index a944191c810b..68e0d65e78ff 100644 --- a/usr.bin/getconf/limits.gperf +++ b/usr.bin/getconf/limits.gperf @@ -9,9 +9,6 @@ #include #include -#ifdef APPLE_GETCONF_UNDERSCORE -#include -#endif /* APPLE_GETCONF_UNDERSCORE */ #include "getconf.h" @@ -23,11 +20,11 @@ static const struct map *in_word_set(const char *str); %} struct map { const char *name; intmax_t value; int valid; }; %% +_POSIX_CLOCKRES_MIN, _POSIX_CLOCKRES_MIN _POSIX_AIO_LISTIO_MAX, _POSIX_AIO_LISTIO_MAX _POSIX_AIO_MAX, _POSIX_AIO_MAX _POSIX_ARG_MAX, _POSIX_ARG_MAX _POSIX_CHILD_MAX, _POSIX_CHILD_MAX -_POSIX_CLOCKRES_MIN, _POSIX_CLOCKRES_MIN _POSIX_DELAYTIMER_MAX, _POSIX_DELAYTIMER_MAX _POSIX_HOST_NAME_MAX, _POSIX_HOST_NAME_MAX _POSIX_LINK_MAX, _POSIX_LINK_MAX @@ -67,7 +64,7 @@ _POSIX2_BC_SCALE_MAX, _POSIX2_BC_SCALE_MAX _POSIX2_BC_STRING_MAX, _POSIX2_BC_STRING_MAX _POSIX2_CHARCLASS_NAME_MAX, _POSIX2_CHARCLASS_NAME_MAX _POSIX2_COLL_WEIGHTS_MAX, _POSIX2_COLL_WEIGHTS_MAX -_POSIX2_EXPR_NEST_MAX, _POSIX2_EXPR_NEST_MAX +_POSIX2_EXPR_NEXT_MAX, _POSIX2_EXPR_NEST_MAX _POSIX2_LINE_MAX, _POSIX2_LINE_MAX _POSIX2_RE_DUP_MAX, _POSIX2_RE_DUP_MAX _XOPEN_IOV_MAX, _XOPEN_IOV_MAX @@ -108,9 +105,6 @@ int find_limit(const char *name, intmax_t *value) { const struct map *rv; -#ifdef APPLE_GETCONF_UNDERSCORE - char *alt; -#endif /* APPLE_GETCONF_UNDERSCORE */ rv = in_word_set(name); if (rv != NULL) { @@ -120,23 +114,5 @@ find_limit(const char *name, intmax_t *value) } return -1; } -#ifdef APPLE_GETCONF_UNDERSCORE - if(*name == '_') - alt = (char *)name + 1; - else { - if((alt = (char *)alloca(strlen(name) + 2)) == NULL) - return 0; - *alt = '_'; - strcpy(alt + 1, name); - } - rv = in_word_set(alt); - if (rv != NULL) { - if (rv->valid) { - *value = rv->value; - return 1; - } - return -1; - } -#endif /* APPLE_GETCONF_UNDERSCORE */ return 0; } diff --git a/usr.bin/getconf/pathconf.gperf b/usr.bin/getconf/pathconf.gperf index 3b9e0f478364..f283546f063a 100644 --- a/usr.bin/getconf/pathconf.gperf +++ b/usr.bin/getconf/pathconf.gperf @@ -9,9 +9,6 @@ #include #include -#ifdef APPLE_GETCONF_UNDERSCORE -#include -#endif /* APPLE_GETCONF_UNDERSCORE */ #include "getconf.h" @@ -23,10 +20,17 @@ static const struct map *in_word_set(const char *str); %} struct map { const char *name; int key; int valid; }; %% +ACL_EXTENDED, _PC_ACL_EXTENDED +ACL_NFS4, _PC_ACL_NFS4 +ACL_PATH_MAX, _PC_ACL_PATH_MAX +CAP_PRESENT, _PC_CAP_PRESENT FILESIZEBITS, _PC_FILESIZEBITS +INF_PRESENT, _PC_INF_PRESENT LINK_MAX, _PC_LINK_MAX +MAC_PRESENT, _PC_MAC_PRESENT MAX_CANON, _PC_MAX_CANON MAX_INPUT, _PC_MAX_INPUT +MIN_HOLE_SIZE, _PC_MIN_HOLE_SIZE NAME_MAX, _PC_NAME_MAX PATH_MAX, _PC_PATH_MAX PIPE_BUF, _PC_PIPE_BUF @@ -35,28 +39,24 @@ POSIX_REC_INCR_XFER_SIZE, _PC_REC_INCR_XFER_SIZE POSIX_REC_MAX_XFER_SIZE, _PC_REC_MAX_XFER_SIZE POSIX_REC_MIN_XFER_SIZE, _PC_REC_MIN_XFER_SIZE POSIX_REC_XFER_ALIGN, _PC_REC_XFER_ALIGN -POSIX2_SYMLINKS, _PC_2_SYMLINKS SYMLINK_MAX, _PC_SYMLINK_MAX TRUSTEDBSD_ACL_EXTENDED, _PC_ACL_EXTENDED +TRUSTEDBSD_ACL_NFS4, _PC_ACL_NFS4 TRUSTEDBSD_ACL_PATH_MAX, _PC_ACL_PATH_MAX TRUSTEDBSD_CAP_PRESENT, _PC_CAP_PRESENT TRUSTEDBSD_INF_PRESENT, _PC_INF_PRESENT TRUSTEDBSD_MAC_PRESENT, _PC_MAC_PRESENT -_POSIX_ASYNC_IO, _PC_ASYNC_IO _POSIX_CHOWN_RESTRICTED, _PC_CHOWN_RESTRICTED _POSIX_NO_TRUNC, _PC_NO_TRUNC -_POSIX_PATH_MAX, _PC_PATH_MAX +_POSIX_VDISABLE, _PC_VDISABLE +_POSIX_ASYNC_IO, _PC_ASYNC_IO _POSIX_PRIO_IO, _PC_PRIO_IO _POSIX_SYNC_IO, _PC_SYNC_IO -_POSIX_VDISABLE, _PC_VDISABLE %% int find_pathconf(const char *name, int *key) { const struct map *rv; -#ifdef APPLE_GETCONF_UNDERSCORE - char *alt; -#endif /* APPLE_GETCONF_UNDERSCORE */ rv = in_word_set(name); if (rv != NULL) { @@ -66,23 +66,5 @@ find_pathconf(const char *name, int *key) } return -1; } -#ifdef APPLE_GETCONF_UNDERSCORE - if(*name == '_') - alt = (char *)name + 1; - else { - if((alt = (char *)alloca(strlen(name) + 2)) == NULL) - return 0; - *alt = '_'; - strcpy(alt + 1, name); - } - rv = in_word_set(alt); - if (rv != NULL) { - if (rv->valid) { - *key = rv->key; - return 1; - } - return -1; - } -#endif /* APPLE_GETCONF_UNDERSCORE */ return 0; } diff --git a/usr.bin/getconf/progenv.gperf b/usr.bin/getconf/progenv.gperf index 564c7d944775..481055393b79 100644 --- a/usr.bin/getconf/progenv.gperf +++ b/usr.bin/getconf/progenv.gperf @@ -30,14 +30,11 @@ static const struct map *in_word_set(const char *str); * be updated. (We cheat here and define the supported environments * statically.) */ -#if defined(__alpha__) || defined(__sparc64__) +#if defined(__sparc64__) || defined(__amd64__) #define have_LP64_OFF64 NULL -#elif defined(__APPLE__) -#define have_LP64_OFF64 NULL -#define have_LPBIG_OFFBIG NULL #endif -#if defined(__i386__) || defined(__powerpc__) || defined(__x86_64__) +#if defined(__i386__) || defined(__powerpc__) #define have_ILP32_OFFBIG NULL #endif @@ -47,11 +44,11 @@ struct map { const char *name; const char *alt_path; int valid; }; POSIX_V6_ILP32_OFF32, notdef POSIX_V6_ILP32_OFFBIG, have_ILP32_OFFBIG POSIX_V6_LP64_OFF64, have_LP64_OFF64 -POSIX_V6_LPBIG_OFFBIG, have_LPBIG_OFFBIG +POSIX_V6_LPBIG_OFFBIG, notdef _POSIX_V6_ILP32_OFF32, notdef _POSIX_V6_ILP32_OFFBIG, have_ILP32_OFFBIG _POSIX_V6_LP64_OFF64, have_LP64_OFF64 -_POSIX_V6_LPBIG_OFFBIG, have_LPBIG_OFFBIG +_POSIX_V6_LPBIG_OFFBIG, notdef %% int find_progenv(const char *name, const char **alt_path) diff --git a/usr.bin/getconf/sysconf.gperf b/usr.bin/getconf/sysconf.gperf index f6f750af64d2..6a0a34989877 100644 --- a/usr.bin/getconf/sysconf.gperf +++ b/usr.bin/getconf/sysconf.gperf @@ -9,9 +9,6 @@ #include #include -#ifdef APPLE_GETCONF_UNDERSCORE -#include -#endif /* APPLE_GETCONF_UNDERSCORE */ #include "getconf.h" @@ -73,16 +70,9 @@ _POSIX2_C_VERSION, _SC_2_C_VERSION _POSIX2_FORT_DEV, _SC_2_FORT_DEV _POSIX2_FORT_RUN, _SC_2_FORT_RUN _POSIX2_LOCALEDEF, _SC_2_LOCALEDEF -_POSIX2_PBS, _SC_PBS -_POSIX2_PBS_ACCOUNTING, _SC_PBS_ACCOUNTING -_POSIX2_PBS_CHECKPOINT, _SC_PBS_CHECKPOINT -_POSIX2_PBS_LOCATE, _SC_PBS_LOCATE -_POSIX2_PBS_MESSAGE, _SC_PBS_MESSAGE -_POSIX2_PBS_TRACK, _SC_PBS_TRACK _POSIX2_SW_DEV, _SC_2_SW_DEV _POSIX2_UPE, _SC_2_UPE _POSIX2_VERSION, _SC_2_VERSION -_POSIX_ADVISORY_INFO, _SC_ADVISORY_INFO _POSIX_ASYNCHRONOUS_IO, _SC_ASYNCHRONOUS_IO _POSIX_BARRIERS, _SC_BARRIERS _POSIX_CLOCK_SELECTION, _SC_CLOCK_SELECTION @@ -99,7 +89,6 @@ _POSIX_MESSAGE_PASSING, _SC_MESSAGE_PASSING _POSIX_MONOTONIC_CLOCK, _SC_MONOTONIC_CLOCK _POSIX_PRIORITIZED_IO, _SC_PRIORITIZED_IO _POSIX_PRIORITY_SCHEDULING, _SC_PRIORITY_SCHEDULING -_POSIX_RAW_SOCKETS, _SC_RAW_SOCKETS _POSIX_READER_WRITER_LOCKS, _SC_READER_WRITER_LOCKS _POSIX_REALTIME_SIGNALS, _SC_REALTIME_SIGNALS _POSIX_REGEXP, _SC_REGEXP @@ -110,7 +99,6 @@ _POSIX_SHELL, _SC_SHELL _POSIX_SPAWN, _SC_SPAWN _POSIX_SPIN_LOCKS, _SC_SPIN_LOCKS _POSIX_SPORADIC_SERVER, _SC_SPORADIC_SERVER -_POSIX_SS_REPL_MAX, _SC_SS_REPL_MAX _POSIX_SYNCHRONIZED_IO, _SC_SYNCHRONIZED_IO _POSIX_THREADS, _SC_THREADS _POSIX_THREAD_ATTR_STACKADDR, _SC_THREAD_ATTR_STACKADDR @@ -123,28 +111,23 @@ _POSIX_THREAD_PROCESS_SHARED, _SC_THREAD_PROCESS_SHARED _POSIX_THREAD_SAFE_FUNCTIONS, _SC_THREAD_SAFE_FUNCTIONS _POSIX_THREAD_SPORADIC_SERVER, _SC_THREAD_SPORADIC_SERVER _POSIX_TIMEOUTS, _SC_TIMEOUTS -_POSIX_TIMERS, _SC_TIMERS _POSIX_TRACE, _SC_TRACE _POSIX_TRACE_EVENT_FILTER, _SC_TRACE_EVENT_FILTER -_POSIX_TRACE_EVENT_NAME_MAX, _SC_TRACE_EVENT_NAME_MAX _POSIX_TRACE_INHERIT, _SC_TRACE_INHERIT _POSIX_TRACE_LOG, _SC_TRACE_LOG -_POSIX_TRACE_NAME_MAX, _SC_TRACE_NAME_MAX -_POSIX_TRACE_SYS_MAX, _SC_TRACE_SYS_MAX -_POSIX_TRACE_USER_EVENT_MAX, _SC_TRACE_USER_EVENT_MAX +_POSIX_TIMERS, _SC_TIMERS _POSIX_TYPED_MEMORY_OBJECTS, _SC_TYPED_MEMORY_OBJECTS +_POSIX_VERSION, _SC_VERSION _POSIX_V6_ILP32_OFF32, _SC_V6_ILP32_OFF32 _POSIX_V6_ILP32_OFFBIG, _SC_V6_ILP32_OFFBIG _POSIX_V6_LP64_OFF64, _SC_V6_LP64_OFF64 _POSIX_V6_LPBIG_OFFBIG, _SC_V6_LPBIG_OFFBIG -_POSIX_VERSION, _SC_VERSION _XOPEN_CRYPT, _SC_XOPEN_CRYPT _XOPEN_ENH_I18N, _SC_XOPEN_ENH_I18N _XOPEN_LEGACY, _SC_XOPEN_LEGACY _XOPEN_REALTIME, _SC_XOPEN_REALTIME _XOPEN_REALTIME_THREADS, _SC_XOPEN_REALTIME_THREADS _XOPEN_SHM, _SC_XOPEN_SHM -_XOPEN_STREAMS, _SC_XOPEN_STREAMS _XOPEN_UNIX, _SC_XOPEN_UNIX _XOPEN_VERSION, _SC_XOPEN_VERSION _XOPEN_XCU_VERSION, _SC_XCU_VERSION @@ -153,9 +136,6 @@ int find_sysconf(const char *name, int *key) { const struct map *rv; -#ifdef APPLE_GETCONF_UNDERSCORE - char *alt; -#endif /* APPLE_GETCONF_UNDERSCORE */ rv = in_word_set(name); if (rv != NULL) { @@ -165,23 +145,5 @@ find_sysconf(const char *name, int *key) } return -1; } -#ifdef APPLE_GETCONF_UNDERSCORE - if(*name == '_') - alt = (char *)name + 1; - else { - if((alt = (char *)alloca(strlen(name) + 2)) == NULL) - return 0; - *alt = '_'; - strcpy(alt + 1, name); - } - rv = in_word_set(alt); - if (rv != NULL) { - if (rv->valid) { - *key = rv->key; - return 1; - } - return -1; - } -#endif /* APPLE_GETCONF_UNDERSCORE */ return 0; } diff --git a/usr.sbin/nscd/nscd.c b/usr.sbin/nscd/nscd.c index 33b6aa52350a..6b5af943a500 100644 --- a/usr.sbin/nscd/nscd.c +++ b/usr.sbin/nscd/nscd.c @@ -167,7 +167,7 @@ init_runtime_env(struct configuration *config) retval = calloc(1, sizeof(*retval)); assert(retval != NULL); - retval->sockfd = socket(PF_LOCAL, SOCK_STREAM|SOCK_NONBLOCK, 0); + retval->sockfd = socket(PF_LOCAL, SOCK_STREAM, 0); if (config->force_unlink == 1) unlink(config->socket_path); @@ -198,6 +198,7 @@ init_runtime_env(struct configuration *config) */ chmod(config->socket_path, config->socket_mode); listen(retval->sockfd, -1); + fcntl(retval->sockfd, F_SETFL, O_NONBLOCK); retval->queue = kqueue(); assert(retval->queue != -1); diff --git a/usr.sbin/nscd/nscdcli.c b/usr.sbin/nscd/nscdcli.c index e43b658b79ef..9b0720116dc4 100644 --- a/usr.sbin/nscd/nscdcli.c +++ b/usr.sbin/nscd/nscdcli.c @@ -189,7 +189,7 @@ open_nscd_connection__(struct nscd_connection_params const *params) TRACE_IN(open_nscd_connection); assert(params != NULL); - client_socket = socket(PF_LOCAL, SOCK_STREAM|SOCK_NONBLOCK, 0); + client_socket = socket(PF_LOCAL, SOCK_STREAM, 0); client_address.sun_family = PF_LOCAL; strlcpy(client_address.sun_path, params->socket_path, sizeof(client_address.sun_path)); @@ -203,6 +203,7 @@ open_nscd_connection__(struct nscd_connection_params const *params) TRACE_OUT(open_nscd_connection); return (NULL); } + fcntl(client_socket, F_SETFL, O_NONBLOCK); retval = calloc(1, sizeof(*retval)); assert(retval != NULL); From b7a1807568f69758a824d7e451d6718bc5938a6f Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Sat, 28 Jan 2017 16:40:51 +0000 Subject: [PATCH 31/51] Really revert 312923 this time --- sys/dev/drm2/drm_agpsupport.c | 14 ++++++++------ sys/dev/drm2/drm_drv.c | 3 +-- sys/dev/drm2/drm_os_freebsd.c | 2 +- sys/dev/drm2/drm_os_freebsd.h | 1 + sys/dev/drm2/drm_stub.c | 5 ++--- sys/modules/drm2/drm2/Makefile | 2 -- 6 files changed, 13 insertions(+), 14 deletions(-) diff --git a/sys/dev/drm2/drm_agpsupport.c b/sys/dev/drm2/drm_agpsupport.c index 025350fc4bb7..131a9ad9cc91 100644 --- a/sys/dev/drm2/drm_agpsupport.c +++ b/sys/dev/drm2/drm_agpsupport.c @@ -35,7 +35,6 @@ __FBSDID("$FreeBSD$"); #include -#include #if __OS_HAS_AGP @@ -209,13 +208,15 @@ int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request) if (!dev->agp || !dev->agp->acquired) return -EINVAL; - if (!(entry = kzalloc(sizeof(*entry), GFP_KERNEL))) + if (!(entry = malloc(sizeof(*entry), DRM_MEM_AGPLISTS, M_NOWAIT))) return -ENOMEM; + memset(entry, 0, sizeof(*entry)); + pages = (request->size + PAGE_SIZE - 1) / PAGE_SIZE; type = (u32) request->type; if (!(memory = agp_alloc_memory(dev->agp->bridge, type, pages << PAGE_SHIFT))) { - kfree(entry); + free(entry, DRM_MEM_AGPLISTS); return -ENOMEM; } @@ -375,7 +376,7 @@ int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request) list_del(&entry->head); drm_free_agp(entry->memory, entry->pages); - kfree(entry); + free(entry, DRM_MEM_AGPLISTS); return 0; } EXPORT_SYMBOL(drm_agp_free); @@ -403,11 +404,12 @@ struct drm_agp_head *drm_agp_init(struct drm_device *dev) { struct drm_agp_head *head = NULL; - if (!(head = kzalloc(sizeof(*head), GFP_KERNEL))) + if (!(head = malloc(sizeof(*head), DRM_MEM_AGPLISTS, M_NOWAIT))) return NULL; + memset((void *)head, 0, sizeof(*head)); head->bridge = agp_find_device(); if (!head->bridge) { - kfree(head); + free(head, DRM_MEM_AGPLISTS); return NULL; } else { agp_get_info(head->bridge, &head->agp_info); diff --git a/sys/dev/drm2/drm_drv.c b/sys/dev/drm2/drm_drv.c index c220668bdb71..9529ac3dfa4b 100644 --- a/sys/dev/drm2/drm_drv.c +++ b/sys/dev/drm2/drm_drv.c @@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include #include @@ -212,7 +211,7 @@ int drm_lastclose(struct drm_device * dev) if (entry->bound) drm_unbind_agp(entry->memory); drm_free_agp(entry->memory, entry->pages); - kfree(entry); + free(entry, DRM_MEM_AGPLISTS); } INIT_LIST_HEAD(&dev->agp->memory); diff --git a/sys/dev/drm2/drm_os_freebsd.c b/sys/dev/drm2/drm_os_freebsd.c index 90d7319a2ea0..4ce8081887ba 100644 --- a/sys/dev/drm2/drm_os_freebsd.c +++ b/sys/dev/drm2/drm_os_freebsd.c @@ -24,6 +24,7 @@ MALLOC_DEFINE(DRM_MEM_QUEUES, "drm_queues", "DRM QUEUE Data Structures"); MALLOC_DEFINE(DRM_MEM_CMDS, "drm_cmds", "DRM COMMAND Data Structures"); MALLOC_DEFINE(DRM_MEM_MAPPINGS, "drm_mapping", "DRM MAPPING Data Structures"); MALLOC_DEFINE(DRM_MEM_BUFLISTS, "drm_buflists", "DRM BUFLISTS Data Structures"); +MALLOC_DEFINE(DRM_MEM_AGPLISTS, "drm_agplists", "DRM AGPLISTS Data Structures"); MALLOC_DEFINE(DRM_MEM_CTXBITMAP, "drm_ctxbitmap", "DRM CTXBITMAP Data Structures"); MALLOC_DEFINE(DRM_MEM_SGLISTS, "drm_sglists", "DRM SGLISTS Data Structures"); @@ -495,5 +496,4 @@ MODULE_VERSION(drmn, 1); MODULE_DEPEND(drmn, agp, 1, 1, 1); MODULE_DEPEND(drmn, pci, 1, 1, 1); MODULE_DEPEND(drmn, mem, 1, 1, 1); -MODULE_DEPEND(drmn, linuxkpi, 1, 1, 1); MODULE_DEPEND(drmn, iicbus, 1, 1, 1); diff --git a/sys/dev/drm2/drm_os_freebsd.h b/sys/dev/drm2/drm_os_freebsd.h index cedc7a25228d..11c9feb9b4aa 100644 --- a/sys/dev/drm2/drm_os_freebsd.h +++ b/sys/dev/drm2/drm_os_freebsd.h @@ -552,6 +552,7 @@ MALLOC_DECLARE(DRM_MEM_QUEUES); MALLOC_DECLARE(DRM_MEM_CMDS); MALLOC_DECLARE(DRM_MEM_MAPPINGS); MALLOC_DECLARE(DRM_MEM_BUFLISTS); +MALLOC_DECLARE(DRM_MEM_AGPLISTS); MALLOC_DECLARE(DRM_MEM_CTXBITMAP); MALLOC_DECLARE(DRM_MEM_SGLISTS); MALLOC_DECLARE(DRM_MEM_MM); diff --git a/sys/dev/drm2/drm_stub.c b/sys/dev/drm2/drm_stub.c index 54b1a80cb7a1..06663ac8ef70 100644 --- a/sys/dev/drm2/drm_stub.c +++ b/sys/dev/drm2/drm_stub.c @@ -36,7 +36,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #ifdef DRM_DEBUG_DEFAULT_ON unsigned int drm_debug = (DRM_DEBUGBITS_DEBUG | DRM_DEBUGBITS_KMS | @@ -316,7 +315,7 @@ void drm_cancel_fill_in_dev(struct drm_device *dev) DRM_MTRR_WC); DRM_DEBUG("mtrr_del=%d\n", retval); } - kfree(dev->agp); + free(dev->agp, DRM_MEM_AGPLISTS); dev->agp = NULL; drm_ht_remove(&dev->map_hash); @@ -468,7 +467,7 @@ void drm_put_dev(struct drm_device *dev) drm_sysctl_cleanup(dev); if (drm_core_has_AGP(dev) && dev->agp) { - kfree(dev->agp); + free(dev->agp, DRM_MEM_AGPLISTS); dev->agp = NULL; } diff --git a/sys/modules/drm2/drm2/Makefile b/sys/modules/drm2/drm2/Makefile index 75696466db6d..35bee2972091 100644 --- a/sys/modules/drm2/drm2/Makefile +++ b/sys/modules/drm2/drm2/Makefile @@ -48,8 +48,6 @@ SRCS = \ ati_pcigart.c #ttm_page_alloc_dma.c -CFLAGS+= -I${.CURDIR}/../../../compat/linuxkpi/common/include - .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_ARCH} == "powerpc64" SRCS += drm_ioc32.c .endif From 2bbd06fc33c99dcb6a725f3e428fc90f2341ab45 Mon Sep 17 00:00:00 2001 From: Andriy Voskoboinyk Date: Sat, 28 Jan 2017 17:08:40 +0000 Subject: [PATCH 32/51] Garbage collect IFT_IEEE80211 (but leave the define for possible reuse) This interface type ("a parent interface of wlanX") is not used since r287197 Reviewed by: adrian, glebius Differential Revision: https://reviews.freebsd.org/D9308 --- sys/net/if.c | 1 - sys/net/if_types.h | 2 +- sys/netinet6/in6.c | 1 - sys/netinet6/in6_ifattach.c | 1 - sys/netinet6/nd6.c | 2 -- sys/netinet6/nd6_nbr.c | 2 -- usr.sbin/rtsold/if.c | 2 -- 7 files changed, 1 insertion(+), 10 deletions(-) diff --git a/sys/net/if.c b/sys/net/if.c index 7f91a4dc6669..edd9469bb9a5 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -3530,7 +3530,6 @@ if_setlladdr(struct ifnet *ifp, const u_char *lladdr, int len) case IFT_BRIDGE: case IFT_ARCNET: case IFT_IEEE8023ADLAG: - case IFT_IEEE80211: bcopy(lladdr, LLADDR(sdl), len); ifa_free(ifa); break; diff --git a/sys/net/if_types.h b/sys/net/if_types.h index 92e101ac6af4..caa2c2711d49 100644 --- a/sys/net/if_types.h +++ b/sys/net/if_types.h @@ -113,7 +113,7 @@ typedef enum { IFT_QLLC = 0x44, /* SNA QLLC */ IFT_FASTETHERFX = 0x45, /* Fast Ethernet (100BaseFX) */ IFT_CHANNEL = 0x46, /* channel */ - IFT_IEEE80211 = 0x47, /* radio spread spectrum */ + IFT_IEEE80211 = 0x47, /* radio spread spectrum (unused) */ IFT_IBM370PARCHAN = 0x48, /* IBM System 360/370 OEMI Channel */ IFT_ESCON = 0x49, /* IBM Enterprise Systems Connection */ IFT_DLSW = 0x4a, /* Data Link Switching */ diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 5a43d5005363..4ecd376f4c3b 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1962,7 +1962,6 @@ in6_if2idlen(struct ifnet *ifp) case IFT_ETHER: /* RFC2464 */ case IFT_PROPVIRTUAL: /* XXX: no RFC. treat it as ether */ case IFT_L2VLAN: /* ditto */ - case IFT_IEEE80211: /* ditto */ case IFT_BRIDGE: /* bridge(4) only does Ethernet-like links */ case IFT_INFINIBAND: return (64); diff --git a/sys/netinet6/in6_ifattach.c b/sys/netinet6/in6_ifattach.c index 6c282ce9db2b..03abc4018bda 100644 --- a/sys/netinet6/in6_ifattach.c +++ b/sys/netinet6/in6_ifattach.c @@ -276,7 +276,6 @@ in6_get_hw_ifid(struct ifnet *ifp, struct in6_addr *in6) case IFT_ISO88025: case IFT_ATM: case IFT_IEEE1394: - case IFT_IEEE80211: /* IEEE802/EUI64 cases - what others? */ /* IEEE1394 uses 16byte length address starting with EUI64 */ if (addrlen > 8) diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index ebaaedcd5f8d..aa46c1ae7bfb 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -2259,7 +2259,6 @@ nd6_resolve(struct ifnet *ifp, int is_gw, struct mbuf *m, case IFT_ETHER: case IFT_FDDI: case IFT_L2VLAN: - case IFT_IEEE80211: case IFT_BRIDGE: case IFT_ISO88025: ETHER_MAP_IPV6_MULTICAST(&dst6->sin6_addr, @@ -2527,7 +2526,6 @@ nd6_need_cache(struct ifnet *ifp) case IFT_FDDI: case IFT_IEEE1394: case IFT_L2VLAN: - case IFT_IEEE80211: case IFT_INFINIBAND: case IFT_BRIDGE: case IFT_PROPVIRTUAL: diff --git a/sys/netinet6/nd6_nbr.c b/sys/netinet6/nd6_nbr.c index eaa18d439a55..6f246db88dfc 100644 --- a/sys/netinet6/nd6_nbr.c +++ b/sys/netinet6/nd6_nbr.c @@ -1086,7 +1086,6 @@ nd6_ifptomac(struct ifnet *ifp) case IFT_FDDI: case IFT_IEEE1394: case IFT_L2VLAN: - case IFT_IEEE80211: case IFT_INFINIBAND: case IFT_BRIDGE: case IFT_ISO88025: @@ -1457,7 +1456,6 @@ nd6_dad_duplicated(struct ifaddr *ifa, struct dadq *dp) case IFT_FDDI: case IFT_ATM: case IFT_IEEE1394: - case IFT_IEEE80211: case IFT_INFINIBAND: in6 = ia->ia_addr.sin6_addr; if (in6_get_hw_ifid(ifp, &in6) == 0 && diff --git a/usr.sbin/rtsold/if.c b/usr.sbin/rtsold/if.c index 0d500622b7a6..821a307a7530 100644 --- a/usr.sbin/rtsold/if.c +++ b/usr.sbin/rtsold/if.c @@ -247,7 +247,6 @@ lladdropt_length(struct sockaddr_dl *sdl) { switch (sdl->sdl_type) { case IFT_ETHER: - case IFT_IEEE80211: return (ROUNDUP8(ETHER_ADDR_LEN + 2)); default: return (0); @@ -263,7 +262,6 @@ lladdropt_fill(struct sockaddr_dl *sdl, struct nd_opt_hdr *ndopt) switch (sdl->sdl_type) { case IFT_ETHER: - case IFT_IEEE80211: ndopt->nd_opt_len = (ROUNDUP8(ETHER_ADDR_LEN + 2)) >> 3; addr = (char *)(ndopt + 1); memcpy(addr, LLADDR(sdl), ETHER_ADDR_LEN); From 14dd14fc00e174818f8aee4d4dd013dcb6b8175f Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Sat, 28 Jan 2017 17:46:04 +0000 Subject: [PATCH 33/51] Use strexeq instead of needlessly branch. Suggested by: ian --- sys/arm/include/atomic-v6.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/arm/include/atomic-v6.h b/sys/arm/include/atomic-v6.h index 287ade9e3853..77de0d34d33e 100644 --- a/sys/arm/include/atomic-v6.h +++ b/sys/arm/include/atomic-v6.h @@ -201,9 +201,8 @@ atomic_fcmpset_32(volatile uint32_t *p, uint32_t *cmpval, uint32_t newval) "1: mov %0, #1 \n" " ldrex %1, [%2] \n" " cmp %1, %3 \n" - " it ne \n" - " bne 2f \n" - " strex %0, %4, [%2] \n" + " it eq \n" + " strexeq %0, %4, [%2] \n" "2:" : "=&r" (ret), "=&r" (tmp), "+r" (p), "+r" (_cmpval), "+r" (newval) : : "cc", "memory"); From 8406f869f421565db9462d330c036d5eef2ccc41 Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Sat, 28 Jan 2017 17:48:33 +0000 Subject: [PATCH 34/51] Remove useless labels. --- sys/arm/include/atomic-v6.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/arm/include/atomic-v6.h b/sys/arm/include/atomic-v6.h index 77de0d34d33e..422c2492efa6 100644 --- a/sys/arm/include/atomic-v6.h +++ b/sys/arm/include/atomic-v6.h @@ -198,12 +198,11 @@ atomic_fcmpset_32(volatile uint32_t *p, uint32_t *cmpval, uint32_t newval) int ret; __asm __volatile( - "1: mov %0, #1 \n" + " mov %0, #1 \n" " ldrex %1, [%2] \n" " cmp %1, %3 \n" " it eq \n" " strexeq %0, %4, [%2] \n" - "2:" : "=&r" (ret), "=&r" (tmp), "+r" (p), "+r" (_cmpval), "+r" (newval) : : "cc", "memory"); *cmpval = tmp; From 649702c5a34798b68a51305271a9099f83f4e34f Mon Sep 17 00:00:00 2001 From: "Pedro F. Giffuni" Date: Sat, 28 Jan 2017 20:54:43 +0000 Subject: [PATCH 35/51] Make use of clang nullability attributes. Replace uses of the GCC __nonnull__ attribute with the clang nullability qualifiers. The replacement should be transparent for clang developers as the new qualifiers will produce the same warnings and will be useful for static checkers but will not cause aggressive optimizations. GCC will not produce such warnings and developers will have to use upgraded GCC ports built with the system headers from r312538. Hinted by: Apple's Libc-1158.20.4, Bionic libc MFC after: 11.1 Release Differential Revision: https://reviews.freebsd.org/D9004 --- include/err.h | 5 +- include/pthread.h | 246 +++++++++++++++++--------------- include/signal.h | 12 +- include/stdio.h | 20 +-- include/stdlib.h | 21 +-- lib/libthr/thread/thr_private.h | 12 +- sys/sys/systm.h | 66 +++++---- 7 files changed, 212 insertions(+), 170 deletions(-) diff --git a/include/err.h b/include/err.h index b6ab2147ef0d..b0e312160f87 100644 --- a/include/err.h +++ b/include/err.h @@ -43,6 +43,8 @@ #include #include +__NULLABILITY_PRAGMA_PUSH + __BEGIN_DECLS void err(int, const char *, ...) __dead2 __printf0like(2, 3); void verr(int, const char *, __va_list) __dead2 __printf0like(2, 0); @@ -58,7 +60,8 @@ void vwarnc(int, const char *, __va_list) __printf0like(2, 0); void warnx(const char *, ...) __printflike(1, 2); void vwarnx(const char *, __va_list) __printflike(1, 0); void err_set_file(void *); -void err_set_exit(void (*)(int)); +void err_set_exit(void (* _Nullable)(int)); __END_DECLS +__NULLABILITY_PRAGMA_POP #endif /* !_ERR_H_ */ diff --git a/include/pthread.h b/include/pthread.h index ff74e0b4e8f6..3f45d6d84299 100644 --- a/include/pthread.h +++ b/include/pthread.h @@ -46,6 +46,8 @@ #include #include +__NULLABILITY_PRAGMA_PUSH + /* * Run-time invariant values: */ @@ -147,28 +149,35 @@ struct _pthread_cleanup_info { */ __BEGIN_DECLS int pthread_atfork(void (*)(void), void (*)(void), void (*)(void)); -int pthread_attr_destroy(pthread_attr_t *); -int pthread_attr_getstack(const pthread_attr_t * __restrict, - void ** __restrict, size_t * __restrict); -int pthread_attr_getstacksize(const pthread_attr_t *, size_t *); -int pthread_attr_getguardsize(const pthread_attr_t *, size_t *); +int pthread_attr_destroy(pthread_attr_t * _Nonnull); +int pthread_attr_getstack( + const pthread_attr_t * _Nonnull __restrict, + void ** _Nonnull __restrict, + size_t * _Nonnull __restrict); +int pthread_attr_getstacksize(const pthread_attr_t * _Nonnull, + size_t * _Nonnull); +int pthread_attr_getguardsize(const pthread_attr_t * _Nonnull, + size_t * _Nonnull); int pthread_attr_getstackaddr(const pthread_attr_t *, void **); -int pthread_attr_getdetachstate(const pthread_attr_t *, int *); -int pthread_attr_init(pthread_attr_t *); -int pthread_attr_setstacksize(pthread_attr_t *, size_t); -int pthread_attr_setguardsize(pthread_attr_t *, size_t); -int pthread_attr_setstack(pthread_attr_t *, void *, size_t); +int pthread_attr_getdetachstate(const pthread_attr_t * _Nonnull, + int * _Nonnull); +int pthread_attr_init(pthread_attr_t * _Nonnull); +int pthread_attr_setstacksize(pthread_attr_t * _Nonnull, size_t); +int pthread_attr_setguardsize(pthread_attr_t * _Nonnull, size_t); +int pthread_attr_setstack(pthread_attr_t * _Nonnull, void *, + size_t); int pthread_attr_setstackaddr(pthread_attr_t *, void *); -int pthread_attr_setdetachstate(pthread_attr_t *, int); -int pthread_barrier_destroy(pthread_barrier_t *); -int pthread_barrier_init(pthread_barrier_t *, +int pthread_attr_setdetachstate(pthread_attr_t * _Nonnull, int); +int pthread_barrier_destroy(pthread_barrier_t * _Nonnull); +int pthread_barrier_init(pthread_barrier_t * _Nonnull, const pthread_barrierattr_t *, unsigned); -int pthread_barrier_wait(pthread_barrier_t *); -int pthread_barrierattr_destroy(pthread_barrierattr_t *); -int pthread_barrierattr_getpshared(const pthread_barrierattr_t *, - int *); -int pthread_barrierattr_init(pthread_barrierattr_t *); -int pthread_barrierattr_setpshared(pthread_barrierattr_t *, int); +int pthread_barrier_wait(pthread_barrier_t * _Nonnull); +int pthread_barrierattr_destroy(pthread_barrierattr_t * _Nonnull); +int pthread_barrierattr_getpshared( + const pthread_barrierattr_t * _Nonnull, int * _Nonnull); +int pthread_barrierattr_init(pthread_barrierattr_t * _Nonnull); +int pthread_barrierattr_setpshared(pthread_barrierattr_t * _Nonnull, + int); #define pthread_cleanup_push(cleanup_routine, cleanup_arg) \ { \ @@ -183,100 +192,109 @@ int pthread_barrierattr_setpshared(pthread_barrierattr_t *, int); __pthread_cleanup_pop_imp(execute); \ } -int pthread_condattr_destroy(pthread_condattr_t *); -int pthread_condattr_getclock(const pthread_condattr_t *, - clockid_t *); -int pthread_condattr_getpshared(const pthread_condattr_t *, int *); -int pthread_condattr_init(pthread_condattr_t *); -int pthread_condattr_setclock(pthread_condattr_t *, clockid_t); -int pthread_condattr_setpshared(pthread_condattr_t *, int); -int pthread_cond_broadcast(pthread_cond_t *); -int pthread_cond_destroy(pthread_cond_t *); -int pthread_cond_init(pthread_cond_t *, +int pthread_condattr_destroy(pthread_condattr_t * _Nonnull); +int pthread_condattr_getclock(const pthread_condattr_t * _Nonnull, + clockid_t * _Nonnull); +int pthread_condattr_getpshared(const pthread_condattr_t * _Nonnull, + int * _Nonnull); +int pthread_condattr_init(pthread_condattr_t * _Nonnull); +int pthread_condattr_setclock(pthread_condattr_t * _Nonnull, + clockid_t); +int pthread_condattr_setpshared(pthread_condattr_t * _Nonnull, int); +int pthread_cond_broadcast(pthread_cond_t * _Nonnull); +int pthread_cond_destroy(pthread_cond_t * _Nonnull); +int pthread_cond_init(pthread_cond_t * _Nonnull, const pthread_condattr_t *); -int pthread_cond_signal(pthread_cond_t *); -int pthread_cond_timedwait(pthread_cond_t *, - pthread_mutex_t *__mutex, const struct timespec *) +int pthread_cond_signal(pthread_cond_t * _Nonnull); +int pthread_cond_timedwait(pthread_cond_t * _Nonnull, + pthread_mutex_t * _Nonnull __mutex, + const struct timespec * _Nonnull) __requires_exclusive(*__mutex); -int pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *__mutex) +int pthread_cond_wait(pthread_cond_t * _Nonnull, + pthread_mutex_t * _Nonnull __mutex) __requires_exclusive(*__mutex); -int pthread_create(pthread_t *, const pthread_attr_t *, - void *(*) (void *), void *); +int pthread_create(pthread_t * _Nonnull, const pthread_attr_t *, + void *(* _Nonnull) (void *), void *); int pthread_detach(pthread_t); int pthread_equal(pthread_t, pthread_t); void pthread_exit(void *) __dead2; void *pthread_getspecific(pthread_key_t); -int pthread_getcpuclockid(pthread_t, clockid_t *); +int pthread_getcpuclockid(pthread_t, clockid_t * _Nonnull); int pthread_join(pthread_t, void **); -int pthread_key_create(pthread_key_t *, - void (*) (void *)); +int pthread_key_create(pthread_key_t * _Nonnull, + void (*) (void *)); int pthread_key_delete(pthread_key_t); -int pthread_mutexattr_init(pthread_mutexattr_t *); -int pthread_mutexattr_destroy(pthread_mutexattr_t *); -int pthread_mutexattr_getpshared(const pthread_mutexattr_t *, - int *); -int pthread_mutexattr_gettype(pthread_mutexattr_t *, int *); -int pthread_mutexattr_settype(pthread_mutexattr_t *, int); -int pthread_mutexattr_setpshared(pthread_mutexattr_t *, int); -int pthread_mutex_consistent(pthread_mutex_t *__mutex) - __nonnull(1) __requires_exclusive(*__mutex); -int pthread_mutex_destroy(pthread_mutex_t *__mutex) +int pthread_mutexattr_init(pthread_mutexattr_t * _Nonnull); +int pthread_mutexattr_destroy(pthread_mutexattr_t * _Nonnull); +int pthread_mutexattr_getpshared( + const pthread_mutexattr_t * _Nonnull, int * _Nonnull); +int pthread_mutexattr_gettype(pthread_mutexattr_t * _Nonnull, + int * _Nonnull); +int pthread_mutexattr_settype(pthread_mutexattr_t * _Nonnull, int); +int pthread_mutexattr_setpshared(pthread_mutexattr_t * _Nonnull, + int); +int pthread_mutex_consistent(pthread_mutex_t * _Nonnull __mutex) + __requires_exclusive(*__mutex); +int pthread_mutex_destroy(pthread_mutex_t * _Nonnull __mutex) __requires_unlocked(*__mutex); -int pthread_mutex_init(pthread_mutex_t *__mutex, - const pthread_mutexattr_t *) +int pthread_mutex_init(pthread_mutex_t * _Nonnull __mutex, + const pthread_mutexattr_t *) __requires_unlocked(*__mutex); -int pthread_mutex_lock(pthread_mutex_t *__mutex) - __locks_exclusive(*__mutex); -int pthread_mutex_trylock(pthread_mutex_t *__mutex) - __trylocks_exclusive(0, *__mutex); -int pthread_mutex_timedlock(pthread_mutex_t *__mutex, - const struct timespec *) - __trylocks_exclusive(0, *__mutex); -int pthread_mutex_unlock(pthread_mutex_t *__mutex) +int pthread_mutex_lock(pthread_mutex_t * _Nonnull __mutex) + __locks_exclusive(*__mutex); +int pthread_mutex_trylock(pthread_mutex_t * _Nonnull __mutex) + __trylocks_exclusive(0, *__mutex); +int pthread_mutex_timedlock(pthread_mutex_t * _Nonnull __mutex, + const struct timespec * _Nonnull) + __trylocks_exclusive(0, *__mutex); +int pthread_mutex_unlock(pthread_mutex_t * _Nonnull __mutex) __unlocks(*__mutex); -int pthread_once(pthread_once_t *, void (*) (void)); -int pthread_rwlock_destroy(pthread_rwlock_t *__rwlock) +int pthread_once(pthread_once_t * _Nonnull, + void (* _Nonnull) (void)); +int pthread_rwlock_destroy(pthread_rwlock_t * _Nonnull __rwlock) __requires_unlocked(*__rwlock); -int pthread_rwlock_init(pthread_rwlock_t *__rwlock, - const pthread_rwlockattr_t *) +int pthread_rwlock_init(pthread_rwlock_t * _Nonnull __rwlock, + const pthread_rwlockattr_t *) __requires_unlocked(*__rwlock); -int pthread_rwlock_rdlock(pthread_rwlock_t *__rwlock) - __locks_shared(*__rwlock); -int pthread_rwlock_timedrdlock(pthread_rwlock_t *__rwlock, - const struct timespec *) - __trylocks_shared(0, *__rwlock); -int pthread_rwlock_timedwrlock(pthread_rwlock_t *__rwlock, - const struct timespec *) - __trylocks_exclusive(0, *__rwlock); -int pthread_rwlock_tryrdlock(pthread_rwlock_t *__rwlock) - __trylocks_shared(0, *__rwlock); -int pthread_rwlock_trywrlock(pthread_rwlock_t *__rwlock) - __trylocks_exclusive(0, *__rwlock); -int pthread_rwlock_unlock(pthread_rwlock_t *__rwlock) +int pthread_rwlock_rdlock(pthread_rwlock_t * _Nonnull __rwlock) + __locks_shared(*__rwlock); +int pthread_rwlock_timedrdlock(pthread_rwlock_t * _Nonnull __rwlock, + const struct timespec * _Nonnull) + __trylocks_shared(0, *__rwlock); +int pthread_rwlock_timedwrlock(pthread_rwlock_t * _Nonnull __rwlock, + const struct timespec * _Nonnull) + __trylocks_exclusive(0, *__rwlock); +int pthread_rwlock_tryrdlock(pthread_rwlock_t * _Nonnull __rwlock) + __trylocks_shared(0, *__rwlock); +int pthread_rwlock_trywrlock(pthread_rwlock_t * _Nonnull __rwlock) + __trylocks_exclusive(0, *__rwlock); +int pthread_rwlock_unlock(pthread_rwlock_t * _Nonnull __rwlock) __unlocks(*__rwlock); -int pthread_rwlock_wrlock(pthread_rwlock_t *__rwlock) - __locks_exclusive(*__rwlock); -int pthread_rwlockattr_destroy(pthread_rwlockattr_t *); -int pthread_rwlockattr_getkind_np(const pthread_rwlockattr_t *, - int *); -int pthread_rwlockattr_getpshared(const pthread_rwlockattr_t *, - int *); -int pthread_rwlockattr_init(pthread_rwlockattr_t *); -int pthread_rwlockattr_setkind_np(pthread_rwlockattr_t *, int); -int pthread_rwlockattr_setpshared(pthread_rwlockattr_t *, int); +int pthread_rwlock_wrlock(pthread_rwlock_t * _Nonnull __rwlock) + __locks_exclusive(*__rwlock); +int pthread_rwlockattr_destroy(pthread_rwlockattr_t * _Nonnull); +int pthread_rwlockattr_getkind_np( + const pthread_rwlockattr_t * _Nonnull, int *); +int pthread_rwlockattr_getpshared( + const pthread_rwlockattr_t * _Nonnull, int * _Nonnull); +int pthread_rwlockattr_init(pthread_rwlockattr_t * _Nonnull); +int pthread_rwlockattr_setkind_np(pthread_rwlockattr_t * _Nonnull, + int); +int pthread_rwlockattr_setpshared(pthread_rwlockattr_t * _Nonnull, + int); pthread_t pthread_self(void); int pthread_setspecific(pthread_key_t, const void *); -int pthread_spin_init(pthread_spinlock_t *__spin, int) +int pthread_spin_init(pthread_spinlock_t * _Nonnull __spin, int) __requires_unlocked(*__spin); -int pthread_spin_destroy(pthread_spinlock_t *__spin) +int pthread_spin_destroy(pthread_spinlock_t * _Nonnull __spin) __requires_unlocked(*__spin); -int pthread_spin_lock(pthread_spinlock_t *__spin) - __locks_exclusive(*__spin); -int pthread_spin_trylock(pthread_spinlock_t *__spin) - __trylocks_exclusive(0, *__spin); -int pthread_spin_unlock(pthread_spinlock_t *__spin) - __unlocks(*__spin); +int pthread_spin_lock(pthread_spinlock_t * _Nonnull __spin) + __locks_exclusive(*__spin); +int pthread_spin_trylock(pthread_spinlock_t * _Nonnull __spin) + __trylocks_exclusive(0, *__spin); +int pthread_spin_unlock(pthread_spinlock_t * _Nonnull __spin) + __unlocks(*__spin); int pthread_cancel(pthread_t); int pthread_setcancelstate(int, int *); int pthread_setcanceltype(int, int *); @@ -288,35 +306,36 @@ int pthread_setprio(pthread_t, int); void pthread_yield(void); #endif -int pthread_mutexattr_getprioceiling(pthread_mutexattr_t *, - int *); -int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, - int); +int pthread_mutexattr_getprioceiling(pthread_mutexattr_t *, int *); +int pthread_mutexattr_setprioceiling(pthread_mutexattr_t *, int); int pthread_mutex_getprioceiling(pthread_mutex_t *, int *); int pthread_mutex_setprioceiling(pthread_mutex_t *, int, int *); int pthread_mutexattr_getprotocol(pthread_mutexattr_t *, int *); int pthread_mutexattr_setprotocol(pthread_mutexattr_t *, int); -int pthread_mutexattr_getrobust(pthread_mutexattr_t *__restrict, - int *__restrict) __nonnull_all; -int pthread_mutexattr_setrobust(pthread_mutexattr_t *, int) - __nonnull(1); +int pthread_mutexattr_getrobust( + pthread_mutexattr_t * _Nonnull __restrict, + int * _Nonnull __restrict); +int pthread_mutexattr_setrobust(pthread_mutexattr_t * _Nonnull, + int); int pthread_attr_getinheritsched(const pthread_attr_t *, int *); -int pthread_attr_getschedparam(const pthread_attr_t *, - struct sched_param *); -int pthread_attr_getschedpolicy(const pthread_attr_t *, int *); -int pthread_attr_getscope(const pthread_attr_t *, int *); +int pthread_attr_getschedparam(const pthread_attr_t * _Nonnull, + struct sched_param * _Nonnull); +int pthread_attr_getschedpolicy(const pthread_attr_t * _Nonnull, + int * _Nonnull); +int pthread_attr_getscope(const pthread_attr_t * _Nonnull, + int * _Nonnull); int pthread_attr_setinheritsched(pthread_attr_t *, int); -int pthread_attr_setschedparam(pthread_attr_t *, - const struct sched_param *); -int pthread_attr_setschedpolicy(pthread_attr_t *, int); -int pthread_attr_setscope(pthread_attr_t *, int); -int pthread_getschedparam(pthread_t pthread, int *, - struct sched_param *); +int pthread_attr_setschedparam(pthread_attr_t * _Nonnull, + const struct sched_param * _Nonnull); +int pthread_attr_setschedpolicy(pthread_attr_t * _Nonnull, int); +int pthread_attr_setscope(pthread_attr_t * _Nonnull, int); +int pthread_getschedparam(pthread_t pthread, int * _Nonnull, + struct sched_param * _Nonnull); int pthread_setschedparam(pthread_t, int, - const struct sched_param *); + const struct sched_param * _Nonnull); #if __XSI_VISIBLE int pthread_getconcurrency(void); int pthread_setconcurrency(int); @@ -326,5 +345,6 @@ void __pthread_cleanup_push_imp(void (*)(void *), void *, struct _pthread_cleanup_info *); void __pthread_cleanup_pop_imp(int); __END_DECLS +__NULLABILITY_PRAGMA_POP -#endif +#endif /* _PTHREAD_H_ */ diff --git a/include/signal.h b/include/signal.h index 9d874de3632a..f9b6923c4345 100644 --- a/include/signal.h +++ b/include/signal.h @@ -41,6 +41,8 @@ #include #endif +__NULLABILITY_PRAGMA_PUSH + #if __BSD_VISIBLE /* * XXX should enlarge these, if only to give empty names instead of bounds @@ -82,10 +84,11 @@ int sigdelset(sigset_t *, int); int sigemptyset(sigset_t *); int sigfillset(sigset_t *); int sigismember(const sigset_t *, int); -int sigpending(sigset_t *); +int sigpending(sigset_t * _Nonnull); int sigprocmask(int, const sigset_t * __restrict, sigset_t * __restrict); -int sigsuspend(const sigset_t *); -int sigwait(const sigset_t * __restrict, int * __restrict); +int sigsuspend(const sigset_t * _Nonnull); +int sigwait(const sigset_t * _Nonnull __restrict, + int * _Nonnull __restrict); #endif #if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE >= 600 @@ -104,7 +107,7 @@ int sighold(int); int sigignore(int); int sigpause(int); int sigrelse(int); -void (*sigset(int, void (*)(int)))(int); +void (* _Nullable sigset(int, void (* _Nullable)(int)))(int); int xsi_sigpause(int); #endif @@ -124,5 +127,6 @@ int sigstack(const struct sigstack *, struct sigstack *); int sigvec(int, struct sigvec *, struct sigvec *); #endif __END_DECLS +__NULLABILITY_PRAGMA_POP #endif /* !_SIGNAL_H_ */ diff --git a/include/stdio.h b/include/stdio.h index 5950625ec2f6..99773885f1f5 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -40,6 +40,8 @@ #include #include +__NULLABILITY_PRAGMA_PUSH + typedef __off_t fpos_t; #ifndef _SIZE_T_DECLARED @@ -123,10 +125,10 @@ struct __sFILE { /* operations */ void *_cookie; /* (*) cookie passed to io functions */ - int (*_close)(void *); - int (*_read)(void *, char *, int); - fpos_t (*_seek)(void *, fpos_t, int); - int (*_write)(void *, const char *, int); + int (* _Nullable _close)(void *); + int (* _Nullable _read)(void *, char *, int); + fpos_t (* _Nullable _seek)(void *, fpos_t, int); + int (* _Nullable _write)(void *, const char *, int); /* separate buffer for long sequences of ungetc() */ struct __sbuf _ub; /* ungetc buffer */ @@ -390,10 +392,10 @@ extern const char * const sys_errlist[]; * Stdio function-access interface. */ FILE *funopen(const void *, - int (*)(void *, char *, int), - int (*)(void *, const char *, int), - fpos_t (*)(void *, fpos_t, int), - int (*)(void *)); + int (* _Nullable)(void *, char *, int), + int (* _Nullable)(void *, const char *, int), + fpos_t (* _Nullable)(void *, fpos_t, int), + int (* _Nullable)(void *)); #define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0) #define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0) @@ -506,4 +508,6 @@ extern int __isthreaded; #endif /* __cplusplus */ __END_DECLS +__NULLABILITY_PRAGMA_POP + #endif /* !_STDIO_H_ */ diff --git a/include/stdlib.h b/include/stdlib.h index e27f3a220c47..0a2874d99e7a 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -37,6 +37,8 @@ #include #include +__NULLABILITY_PRAGMA_PUSH + #if __BSD_VISIBLE #ifndef _RUNE_T_DECLARED typedef __rune_t rune_t; @@ -81,12 +83,12 @@ extern int ___mb_cur_max(void); _Noreturn void abort(void); int abs(int) __pure2; -int atexit(void (*)(void)); +int atexit(void (* _Nonnull)(void)); double atof(const char *); int atoi(const char *); long atol(const char *); void *bsearch(const void *, const void *, size_t, - size_t, int (*)(const void *, const void *)); + size_t, int (*)(const void * _Nonnull, const void *)); void *calloc(size_t, size_t) __malloc_like __result_use_check __alloc_size(1) __alloc_size(2); div_t div(int, int) __pure2; @@ -100,7 +102,7 @@ int mblen(const char *, size_t); size_t mbstowcs(wchar_t * __restrict , const char * __restrict, size_t); int mbtowc(wchar_t * __restrict, const char * __restrict, size_t); void qsort(void *, size_t, size_t, - int (*)(const void *, const void *)); + int (* _Nonnull)(const void *, const void *)); int rand(void); void *realloc(void *, size_t) __result_use_check __alloc_size(2); void srand(unsigned); @@ -256,9 +258,9 @@ void arc4random_stir(void); __uint32_t arc4random_uniform(__uint32_t); #ifdef __BLOCKS__ -int atexit_b(void (^)(void)); +int atexit_b(void (^ _Nonnull)(void)); void *bsearch_b(const void *, const void *, size_t, - size_t, int (^)(const void *, const void *)); + size_t, int (^ _Nonnull)(const void *, const void *)); #endif char *getbsize(int *, long *); /* getcap(3) functions */ @@ -282,11 +284,13 @@ int getloadavg(double [], int); const char * getprogname(void); -int heapsort(void *, size_t, size_t, int (*)(const void *, const void *)); +int heapsort(void *, size_t, size_t, + int (* _Nonnull)(const void *, const void *)); #ifdef __BLOCKS__ -int heapsort_b(void *, size_t, size_t, int (^)(const void *, const void *)); +int heapsort_b(void *, size_t, size_t, + int (^ _Nonnull)(const void *, const void *)); void qsort_b(void *, size_t, size_t, - int (^)(const void *, const void *)); + int (^ _Nonnull)(const void *, const void *)); #endif int l64a_r(long, char *, int); int mergesort(void *, size_t, size_t, int (*)(const void *, const void *)); @@ -320,5 +324,6 @@ __uint64_t extern char *suboptarg; /* getsubopt(3) external variable */ #endif /* __BSD_VISIBLE */ __END_DECLS +__NULLABILITY_PRAGMA_POP #endif /* !_STDLIB_H_ */ diff --git a/lib/libthr/thread/thr_private.h b/lib/libthr/thread/thr_private.h index e61ee99dcb77..9bea65f38491 100644 --- a/lib/libthr/thread/thr_private.h +++ b/lib/libthr/thread/thr_private.h @@ -53,6 +53,8 @@ #include #include +__NULLABILITY_PRAGMA_PUSH + #define SYM_FB10(sym) __CONCAT(sym, _fb10) #define SYM_FBP10(sym) __CONCAT(sym, _fbp10) #define WEAK_REF(sym, alias) __weak_reference(sym, alias) @@ -835,11 +837,10 @@ void _pthread_cleanup_pop(int); void _pthread_exit_mask(void *status, sigset_t *mask) __dead2 __hidden; void _pthread_cancel_enter(int maycancel); void _pthread_cancel_leave(int maycancel); -int _pthread_mutex_consistent(pthread_mutex_t *) __nonnull(1); -int _pthread_mutexattr_getrobust(pthread_mutexattr_t *__restrict, - int *__restrict) __nonnull_all; -int _pthread_mutexattr_setrobust(pthread_mutexattr_t *, int) - __nonnull(1); +int _pthread_mutex_consistent(pthread_mutex_t * _Nonnull); +int _pthread_mutexattr_getrobust(pthread_mutexattr_t * _Nonnull __restrict, + int * _Nonnull __restrict); +int _pthread_mutexattr_setrobust(pthread_mutexattr_t * _Nonnull, int); /* #include */ #ifdef _SYS_FCNTL_H_ @@ -984,5 +985,6 @@ void __thr_pshared_atfork_pre(void) __hidden; void __thr_pshared_atfork_post(void) __hidden; __END_DECLS +__NULLABILITY_PRAGMA_POP #endif /* !_THR_PRIVATE_H */ diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 6537b7bbbdc1..2329621b5ae4 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -45,6 +45,8 @@ #include #include /* for people using printf mainly */ +__NULLABILITY_PRAGMA_PUSH + extern int cold; /* nonzero if we are doing a cold boot */ extern int suspend_blocked; /* block suspend due to pending shutdown */ extern int rebooting; /* kern_reboot() has been called. */ @@ -233,12 +235,12 @@ int vsnprintf(char *, size_t, const char *, __va_list) __printflike(3, 0); int vsnrprintf(char *, size_t, int, const char *, __va_list) __printflike(4, 0); int vsprintf(char *buf, const char *, __va_list) __printflike(2, 0); int ttyprintf(struct tty *, const char *, ...) __printflike(2, 3); -int sscanf(const char *, char const *, ...) __nonnull(1) __nonnull(2) __scanflike(2, 3); -int vsscanf(const char *, char const *, __va_list) __nonnull(1) __nonnull(2) __scanflike(2, 0); -long strtol(const char *, char **, int) __nonnull(1); -u_long strtoul(const char *, char **, int) __nonnull(1); -quad_t strtoq(const char *, char **, int) __nonnull(1); -u_quad_t strtouq(const char *, char **, int) __nonnull(1); +int sscanf(const char *, char const * _Nonnull, ...) __scanflike(2, 3); +int vsscanf(const char * _Nonnull, char const * _Nonnull, __va_list) __scanflike(2, 0); +long strtol(const char *, char **, int); +u_long strtoul(const char *, char **, int); +quad_t strtoq(const char *, char **, int); +u_quad_t strtouq(const char *, char **, int); void tprintf(struct proc *p, int pri, const char *, ...) __printflike(3, 4); void vtprintf(struct proc *, int, const char *, __va_list) __printflike(3, 0); void hexdump(const void *ptr, int length, const char *hdr, int flags); @@ -249,27 +251,27 @@ void hexdump(const void *ptr, int length, const char *hdr, int flags); #define HD_OMIT_CHARS (1 << 18) #define ovbcopy(f, t, l) bcopy((f), (t), (l)) -void bcopy(const void *from, void *to, size_t len) __nonnull(1) __nonnull(2); -void bzero(void *buf, size_t len) __nonnull(1); -void explicit_bzero(void *, size_t) __nonnull(1); +void bcopy(const void * _Nonnull from, void * _Nonnull to, size_t len); +void bzero(void * _Nonnull buf, size_t len); +void explicit_bzero(void * _Nonnull, size_t); -void *memcpy(void *to, const void *from, size_t len) __nonnull(1) __nonnull(2); -void *memmove(void *dest, const void *src, size_t n) __nonnull(1) __nonnull(2); +void *memcpy(void * _Nonnull to, const void * _Nonnull from, size_t len); +void *memmove(void * _Nonnull dest, const void * _Nonnull src, size_t n); -int copystr(const void * __restrict kfaddr, void * __restrict kdaddr, - size_t len, size_t * __restrict lencopied) - __nonnull(1) __nonnull(2); -int copyinstr(const void * __restrict udaddr, void * __restrict kaddr, - size_t len, size_t * __restrict lencopied) - __nonnull(1) __nonnull(2); -int copyin(const void * __restrict udaddr, void * __restrict kaddr, - size_t len) __nonnull(1) __nonnull(2); -int copyin_nofault(const void * __restrict udaddr, void * __restrict kaddr, - size_t len) __nonnull(1) __nonnull(2); -int copyout(const void * __restrict kaddr, void * __restrict udaddr, - size_t len) __nonnull(1) __nonnull(2); -int copyout_nofault(const void * __restrict kaddr, void * __restrict udaddr, - size_t len) __nonnull(1) __nonnull(2); +int copystr(const void * _Nonnull __restrict kfaddr, + void * _Nonnull __restrict kdaddr, size_t len, + size_t * __restrict lencopied); +int copyinstr(const void * __restrict udaddr, + void * _Nonnull __restrict kaddr, size_t len, + size_t * __restrict lencopied); +int copyin(const void * _Nonnull __restrict udaddr, + void * _Nonnull __restrict kaddr, size_t len); +int copyin_nofault(const void * _Nonnull __restrict udaddr, + void * _Nonnull __restrict kaddr, size_t len); +int copyout(const void * _Nonnull __restrict kaddr, + void * _Nonnull __restrict udaddr, size_t len); +int copyout_nofault(const void * _Nonnull __restrict kaddr, + void * _Nonnull __restrict udaddr, size_t len); int fubyte(volatile const void *base); long fuword(volatile const void *base); @@ -380,16 +382,16 @@ static __inline void splx(intrmask_t ipl __unused) { return; } * Common `proc' functions are declared here so that proc.h can be included * less often. */ -int _sleep(void *chan, struct lock_object *lock, int pri, const char *wmesg, - sbintime_t sbt, sbintime_t pr, int flags) __nonnull(1); +int _sleep(void * _Nonnull chan, struct lock_object *lock, int pri, + const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags); #define msleep(chan, mtx, pri, wmesg, timo) \ _sleep((chan), &(mtx)->lock_object, (pri), (wmesg), \ tick_sbt * (timo), 0, C_HARDCLOCK) #define msleep_sbt(chan, mtx, pri, wmesg, bt, pr, flags) \ _sleep((chan), &(mtx)->lock_object, (pri), (wmesg), (bt), (pr), \ (flags)) -int msleep_spin_sbt(void *chan, struct mtx *mtx, const char *wmesg, - sbintime_t sbt, sbintime_t pr, int flags) __nonnull(1); +int msleep_spin_sbt(void * _Nonnull chan, struct mtx *mtx, + const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags); #define msleep_spin(chan, mtx, wmesg, timo) \ msleep_spin_sbt((chan), (mtx), (wmesg), tick_sbt * (timo), \ 0, C_HARDCLOCK) @@ -402,8 +404,8 @@ int pause_sbt(const char *wmesg, sbintime_t sbt, sbintime_t pr, 0, C_HARDCLOCK) #define tsleep_sbt(chan, pri, wmesg, bt, pr, flags) \ _sleep((chan), NULL, (pri), (wmesg), (bt), (pr), (flags)) -void wakeup(void *chan) __nonnull(1); -void wakeup_one(void *chan) __nonnull(1); +void wakeup(void * chan); +void wakeup_one(void * chan); /* * Common `struct cdev *' stuff are declared here to avoid #include poisoning @@ -451,4 +453,6 @@ extern void (*softdep_ast_cleanup)(void); void counted_warning(unsigned *counter, const char *msg); +__NULLABILITY_PRAGMA_POP + #endif /* !_SYS_SYSTM_H_ */ From dd59a8d033354c1aea32c2c5dc8a29ad5fabf6bc Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 28 Jan 2017 23:41:38 +0000 Subject: [PATCH 36/51] Remove duplicate bhnd SUBDIR entry MFC after: 1 week PR: 216413 Reported by: mail@fbsd.e4m.org --- sys/modules/Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 8a832b9a3588..e866e9c49894 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -51,7 +51,6 @@ SUBDIR= \ ${_auxio} \ ${_bce} \ bfe \ - bhnd \ bge \ bhnd \ ${_bxe} \ From 17fc11dde6f5832f504c7177178b72eadf513288 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 28 Jan 2017 23:47:17 +0000 Subject: [PATCH 37/51] Garbage collect pc98-only variables still referenced in sys/modules/Makefile These should have been removed with r312910 --- sys/modules/Makefile | 5 ----- 1 file changed, 5 deletions(-) diff --git a/sys/modules/Makefile b/sys/modules/Makefile index e866e9c49894..f6859228cf64 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -64,8 +64,6 @@ SUBDIR= \ bwn_pci \ ${_bytgpio} \ cam \ - ${_canbepm} \ - ${_canbus} \ ${_cardbus} \ ${_carp} \ cas \ @@ -91,7 +89,6 @@ SUBDIR= \ ${_crypto} \ ${_cryptodev} \ ${_cs} \ - ${_ct} \ ${_ctau} \ ctl \ ${_cxgb} \ @@ -295,7 +292,6 @@ SUBDIR= \ ${_pflog} \ ${_pfsync} \ plip \ - ${_pmc} \ ${_pms} \ ppbus \ ppc \ @@ -344,7 +340,6 @@ SUBDIR= \ sk \ smbfs \ sn \ - ${_snc} \ snp \ sound \ ${_speaker} \ From bc53c94f823e4681b56e1517582106fe927d9652 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 28 Jan 2017 23:51:03 +0000 Subject: [PATCH 38/51] Fix typo in lib/Makefile The SUBDIR_DEPEND variable should be for librpcsec_gss, not liblibrpc_gss MFC after: 1 week PR: 216409 Reported by: mail@fbsd.e4m.org --- lib/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Makefile b/lib/Makefile index f2f3b8594c4a..d9965a9e3397 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -106,7 +106,7 @@ SUBDIR_DEPEND_libdevstat= libkvm SUBDIR_DEPEND_libdpv= libfigpar ncurses libutil SUBDIR_DEPEND_libedit= ncurses SUBDIR_DEPEND_libgeom= libexpat libsbuf -SUBDIR_DEPEND_liblibrpcsec_gss= libgssapi +SUBDIR_DEPEND_librpcsec_gss= libgssapi SUBDIR_DEPEND_libmagic= libz SUBDIR_DEPEND_libmemstat= libkvm SUBDIR_DEPEND_libopie= libmd From 2f6a7e426ed026cf0baefc880f694799ce3fa011 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sat, 28 Jan 2017 23:58:17 +0000 Subject: [PATCH 39/51] Update TARGET/TARGET_ARCH examples to use arm64/aarch64 instead of i386/pc98 pc98 support was removed in r312910 --- share/man/man7/build.7 | 8 ++++---- share/man/man7/release.7 | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/share/man/man7/build.7 b/share/man/man7/build.7 index 11054689ca31..463215d0a130 100644 --- a/share/man/man7/build.7 +++ b/share/man/man7/build.7 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 20, 2016 +.Dd January 28, 2017 .Dt BUILD 7 .Os .Sh NAME @@ -517,10 +517,10 @@ This is analogous to the .Dq Nm uname Fl m output. This is necessary to cross-build some target architectures. -For example, cross-building for PC98 machines requires -.Va TARGET_ARCH Ns = Ns Li i386 +For example, cross-building for ARM64 machines requires +.Va TARGET_ARCH Ns = Ns Li aarch64 and -.Va TARGET Ns = Ns Li pc98 . +.Va TARGET Ns = Ns Li arm64 . If not set, .Va TARGET defaults to the current hardware platform. diff --git a/share/man/man7/release.7 b/share/man/man7/release.7 index f9a0b9b08488..2bc5c237562b 100644 --- a/share/man/man7/release.7 +++ b/share/man/man7/release.7 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 20, 2015 +.Dd January 28, 2017 .Dt RELEASE 7 .Os .Sh NAME @@ -620,10 +620,10 @@ This is analogous to the .Dq Nm uname Fl m output. This is necessary to cross-build some target architectures. -For example, cross-building for PC98 machines requires -.Ev TARGET_ARCH Ns = Ns Li i386 +For example, cross-building for ARM64 machines requires +.Ev TARGET_ARCH Ns = Ns Li aarch64 and -.Ev TARGET Ns = Ns Li pc98 . +.Ev TARGET Ns = Ns Li arm64 . If not set, .Ev TARGET defaults to the current hardware platform. From 1bacf3be8c223d504576d984c558abcc75974300 Mon Sep 17 00:00:00 2001 From: Marius Strobl Date: Sun, 29 Jan 2017 00:05:49 +0000 Subject: [PATCH 40/51] Fix overly long lines, whitespace and other bugs according to style(9). --- sys/dev/mmc/mmc.c | 48 +++++++++----- sys/dev/mmc/mmcsd.c | 39 ++++++------ sys/dev/sdhci/sdhci.c | 127 +++++++++++++++++++++---------------- sys/dev/sdhci/sdhci.h | 23 ++++--- sys/dev/sdhci/sdhci_acpi.c | 19 +++--- sys/dev/sdhci/sdhci_pci.c | 40 ++++++------ 6 files changed, 169 insertions(+), 127 deletions(-) diff --git a/sys/dev/mmc/mmc.c b/sys/dev/mmc/mmc.c index d5e5256ebecd..521a23746266 100644 --- a/sys/dev/mmc/mmc.c +++ b/sys/dev/mmc/mmc.c @@ -259,7 +259,7 @@ mmc_suspend(device_t dev) err = bus_generic_suspend(dev); if (err) - return (err); + return (err); mmc_power_down(sc); return (0); } @@ -980,10 +980,14 @@ mmc_decode_csd_sd(uint32_t *raw_csd, struct mmc_csd *csd) csd->write_blk_misalign = mmc_get_bits(raw_csd, 128, 78, 1); csd->read_blk_misalign = mmc_get_bits(raw_csd, 128, 77, 1); csd->dsr_imp = mmc_get_bits(raw_csd, 128, 76, 1); - csd->vdd_r_curr_min = cur_min[mmc_get_bits(raw_csd, 128, 59, 3)]; - csd->vdd_r_curr_max = cur_max[mmc_get_bits(raw_csd, 128, 56, 3)]; - csd->vdd_w_curr_min = cur_min[mmc_get_bits(raw_csd, 128, 53, 3)]; - csd->vdd_w_curr_max = cur_max[mmc_get_bits(raw_csd, 128, 50, 3)]; + csd->vdd_r_curr_min = + cur_min[mmc_get_bits(raw_csd, 128, 59, 3)]; + csd->vdd_r_curr_max = + cur_max[mmc_get_bits(raw_csd, 128, 56, 3)]; + csd->vdd_w_curr_min = + cur_min[mmc_get_bits(raw_csd, 128, 53, 3)]; + csd->vdd_w_curr_max = + cur_max[mmc_get_bits(raw_csd, 128, 50, 3)]; m = mmc_get_bits(raw_csd, 128, 62, 12); e = mmc_get_bits(raw_csd, 128, 47, 3); csd->capacity = ((1 + m) << (e + 2)) * csd->read_bl_len; @@ -1008,8 +1012,8 @@ mmc_decode_csd_sd(uint32_t *raw_csd, struct mmc_csd *csd) csd->write_blk_misalign = mmc_get_bits(raw_csd, 128, 78, 1); csd->read_blk_misalign = mmc_get_bits(raw_csd, 128, 77, 1); csd->dsr_imp = mmc_get_bits(raw_csd, 128, 76, 1); - csd->capacity = ((uint64_t)mmc_get_bits(raw_csd, 128, 48, 22) + 1) * - 512 * 1024; + csd->capacity = ((uint64_t)mmc_get_bits(raw_csd, 128, 48, 22) + + 1) * 512 * 1024; csd->erase_blk_en = mmc_get_bits(raw_csd, 128, 46, 1); csd->erase_sector = mmc_get_bits(raw_csd, 128, 39, 7) + 1; csd->wp_grp_size = mmc_get_bits(raw_csd, 128, 32, 7); @@ -1307,18 +1311,21 @@ mmc_discover_cards(struct mmc_softc *sc) break; } newcard = 1; - if ((err = device_get_children(sc->dev, &devlist, &devcount)) != 0) + if ((err = device_get_children(sc->dev, &devlist, + &devcount)) != 0) return; for (i = 0; i < devcount; i++) { ivar = device_get_ivars(devlist[i]); - if (memcmp(ivar->raw_cid, raw_cid, sizeof(raw_cid)) == 0) { + if (memcmp(ivar->raw_cid, raw_cid, sizeof(raw_cid)) == + 0) { newcard = 0; break; } } free(devlist, M_TEMP); if (bootverbose || mmc_debug) { - device_printf(sc->dev, "%sard detected (CID %08x%08x%08x%08x)\n", + device_printf(sc->dev, + "%sard detected (CID %08x%08x%08x%08x)\n", newcard ? "New c" : "C", raw_cid[0], raw_cid[1], raw_cid[2], raw_cid[3]); } @@ -1370,7 +1377,7 @@ mmc_discover_cards(struct mmc_softc *sc) mmc_app_decode_scr(ivar->raw_scr, &ivar->scr); /* Get card switch capabilities (command class 10). */ if ((ivar->scr.sda_vsn >= 1) && - (ivar->csd.ccc & (1<<10))) { + (ivar->csd.ccc & (1 << 10))) { mmc_sd_switch(sc, SD_SWITCH_MODE_CHECK, SD_SWITCH_GROUP1, SD_SWITCH_NOCHANGE, switch_res); @@ -1537,7 +1544,8 @@ mmc_rescan_cards(struct mmc_softc *sc) ivar = device_get_ivars(devlist[i]); if (mmc_select_card(sc, ivar->rca)) { if (bootverbose || mmc_debug) - device_printf(sc->dev, "Card at relative address %d lost.\n", + device_printf(sc->dev, + "Card at relative address %d lost.\n", ivar->rca); device_delete_child(sc->dev, devlist[i]); free(ivar, M_DEVBUF); @@ -1559,7 +1567,8 @@ mmc_delete_cards(struct mmc_softc *sc) for (i = 0; i < devcount; i++) { ivar = device_get_ivars(devlist[i]); if (bootverbose || mmc_debug) - device_printf(sc->dev, "Card at relative address %d deleted.\n", + device_printf(sc->dev, + "Card at relative address %d deleted.\n", ivar->rca); device_delete_child(sc->dev, devlist[i]); free(ivar, M_DEVBUF); @@ -1589,7 +1598,8 @@ mmc_go_discovery(struct mmc_softc *sc) mmc_idle_cards(sc); err = mmc_send_if_cond(sc, 1); if ((bootverbose || mmc_debug) && err == 0) - device_printf(sc->dev, "SD 2.0 interface conditions: OK\n"); + device_printf(sc->dev, + "SD 2.0 interface conditions: OK\n"); if (mmc_send_app_op_cond(sc, 0, &ocr) != MMC_ERR_NONE) { if (bootverbose || mmc_debug) device_printf(sc->dev, "SD probe: failed\n"); @@ -1599,13 +1609,15 @@ mmc_go_discovery(struct mmc_softc *sc) mmcbr_set_mode(dev, mode_mmc); if (mmc_send_op_cond(sc, 0, &ocr) != MMC_ERR_NONE) { if (bootverbose || mmc_debug) - device_printf(sc->dev, "MMC probe: failed\n"); + device_printf(sc->dev, + "MMC probe: failed\n"); ocr = 0; /* Failed both, powerdown. */ } else if (bootverbose || mmc_debug) device_printf(sc->dev, "MMC probe: OK (OCR: 0x%08x)\n", ocr); } else if (bootverbose || mmc_debug) - device_printf(sc->dev, "SD probe: OK (OCR: 0x%08x)\n", ocr); + device_printf(sc->dev, "SD probe: OK (OCR: 0x%08x)\n", + ocr); sc->squelched--; mmcbr_set_ocr(dev, mmc_select_vdd(sc, ocr)); @@ -1622,7 +1634,8 @@ mmc_go_discovery(struct mmc_softc *sc) * one card on the bus. */ if (bootverbose || mmc_debug) - device_printf(sc->dev, "Current OCR: 0x%08x\n", mmcbr_get_ocr(dev)); + device_printf(sc->dev, "Current OCR: 0x%08x\n", + mmcbr_get_ocr(dev)); if (mmcbr_get_ocr(dev) == 0) { device_printf(sc->dev, "No compatible cards found on bus\n"); mmc_delete_cards(sc); @@ -1760,6 +1773,7 @@ mmc_read_ivar(device_t bus, device_t child, int which, uintptr_t *result) static int mmc_write_ivar(device_t bus, device_t child, int which, uintptr_t value) { + /* * None are writable ATM */ diff --git a/sys/dev/mmc/mmcsd.c b/sys/dev/mmc/mmcsd.c index ac697a3cf814..65005c98bc41 100644 --- a/sys/dev/mmc/mmcsd.c +++ b/sys/dev/mmc/mmcsd.c @@ -113,7 +113,7 @@ static int mmcsd_probe(device_t dev); /* disk routines */ static int mmcsd_close(struct disk *dp); static int mmcsd_dump(void *arg, void *virtual, vm_offset_t physical, - off_t offset, size_t length); + off_t offset, size_t length); static int mmcsd_open(struct disk *dp); static void mmcsd_strategy(struct bio *bp); static void mmcsd_task(void *arg); @@ -122,14 +122,14 @@ static int mmcsd_bus_bit_width(device_t dev); static daddr_t mmcsd_delete(struct mmcsd_softc *sc, struct bio *bp); static daddr_t mmcsd_rw(struct mmcsd_softc *sc, struct bio *bp); -#define MMCSD_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) +#define MMCSD_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) #define MMCSD_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) -#define MMCSD_LOCK_INIT(_sc) \ +#define MMCSD_LOCK_INIT(_sc) \ mtx_init(&_sc->sc_mtx, device_get_nameunit(_sc->dev), \ "mmcsd", MTX_DEF) -#define MMCSD_LOCK_DESTROY(_sc) mtx_destroy(&_sc->sc_mtx); -#define MMCSD_ASSERT_LOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_OWNED); -#define MMCSD_ASSERT_UNLOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_NOTOWNED); +#define MMCSD_LOCK_DESTROY(_sc) mtx_destroy(&_sc->sc_mtx); +#define MMCSD_ASSERT_LOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_OWNED); +#define MMCSD_ASSERT_UNLOCKED(_sc) mtx_assert(&_sc->sc_mtx, MA_NOTOWNED); static int mmcsd_probe(device_t dev) @@ -208,7 +208,7 @@ mmcsd_attach(device_t dev) sc->running = 1; sc->suspend = 0; sc->eblock = sc->eend = 0; - kproc_create(&mmcsd_task, sc, &sc->p, 0, 0, "%s: mmc/sd card", + kproc_create(&mmcsd_task, sc, &sc->p, 0, 0, "%s: mmc/sd card", device_get_nameunit(dev)); return (0); @@ -311,6 +311,7 @@ mmcsd_strategy(struct bio *bp) static const char * mmcsd_errmsg(int e) { + if (e < 0 || e > MMC_ERR_MAX) return "Bad error code"; return errmsg[e]; @@ -325,17 +326,18 @@ mmcsd_rw(struct mmcsd_softc *sc, struct bio *bp) struct mmc_request req; struct mmc_data data; device_t dev = sc->dev; - int sz = sc->disk->d_sectorsize; + int numblocks, sz; device_t mmcbr = device_get_parent(dev); + char *vaddr; block = bp->bio_pblkno; + sz = sc->disk->d_sectorsize; end = bp->bio_pblkno + (bp->bio_bcount / sz); while (block < end) { - char *vaddr = bp->bio_data + - (block - bp->bio_pblkno) * sz; - int numblocks = min(end - block, mmc_get_max_data(dev)); + vaddr = bp->bio_data + (block - bp->bio_pblkno) * sz; + numblocks = min(end - block, mmc_get_max_data(dev)); memset(&req, 0, sizeof(req)); - memset(&cmd, 0, sizeof(cmd)); + memset(&cmd, 0, sizeof(cmd)); memset(&stop, 0, sizeof(stop)); memset(&data, 0, sizeof(data)); cmd.mrq = &req; @@ -373,10 +375,11 @@ mmcsd_rw(struct mmcsd_softc *sc, struct bio *bp) } MMCBUS_WAIT_FOR_REQUEST(mmcbr, dev, &req); if (req.cmd->error != MMC_ERR_NONE) { - if (ppsratecheck(&sc->log_time, &sc->log_count, LOG_PPS)) { + if (ppsratecheck(&sc->log_time, &sc->log_count, + LOG_PPS)) device_printf(dev, "Error indicated: %d %s\n", - req.cmd->error, mmcsd_errmsg(req.cmd->error)); - } + req.cmd->error, + mmcsd_errmsg(req.cmd->error)); break; } block += numblocks; @@ -407,7 +410,7 @@ mmcsd_delete(struct mmcsd_softc *sc, struct bio *bp) start = block + erase_sector - 1; /* Round up. */ start -= start % erase_sector; stop = end; /* Round down. */ - stop -= end % erase_sector; + stop -= end % erase_sector; /* We can't erase area smaller then sector, store it for later. */ if (start >= stop) { sc->eblock = block; @@ -475,8 +478,8 @@ mmcsd_delete(struct mmcsd_softc *sc, struct bio *bp) } static int -mmcsd_dump(void *arg, void *virtual, vm_offset_t physical, - off_t offset, size_t length) +mmcsd_dump(void *arg, void *virtual, vm_offset_t physical, off_t offset, + size_t length) { struct disk *disk = arg; struct mmcsd_softc *sc = (struct mmcsd_softc *)disk->d_drv1; diff --git a/sys/dev/sdhci/sdhci.c b/sys/dev/sdhci/sdhci.c index 94db7ebc8b1d..681b7d947326 100644 --- a/sys/dev/sdhci/sdhci.c +++ b/sys/dev/sdhci/sdhci.c @@ -96,8 +96,10 @@ static void sdhci_card_task(void *, int); /* * Broadcom BCM577xx Controller Constants */ -#define BCM577XX_DEFAULT_MAX_DIVIDER 256 /* Maximum divider supported by the default clock source. */ -#define BCM577XX_ALT_CLOCK_BASE 63000000 /* Alternative clock's base frequency. */ +/* Maximum divider supported by the default clock source. */ +#define BCM577XX_DEFAULT_MAX_DIVIDER 256 +/* Alternative clock's base frequency. */ +#define BCM577XX_ALT_CLOCK_BASE 63000000 #define BCM577XX_HOST_CONTROL 0x198 #define BCM577XX_CTRL_CLKSEL_MASK 0xFFFFCFFF @@ -122,7 +124,7 @@ slot_printf(struct sdhci_slot *slot, const char * fmt, ...) va_list ap; int retval; - retval = printf("%s-slot%d: ", + retval = printf("%s-slot%d: ", device_get_nameunit(slot->bus), slot->num); va_start(ap, fmt); @@ -266,20 +268,25 @@ sdhci_set_clock(struct sdhci_slot *slot, uint32_t clock) /* If no clock requested - left it so. */ if (clock == 0) return; - + /* Determine the clock base frequency */ clk_base = slot->max_clk; if (slot->quirks & SDHCI_QUIRK_BCM577XX_400KHZ_CLKSRC) { - clk_sel = RD2(slot, BCM577XX_HOST_CONTROL) & BCM577XX_CTRL_CLKSEL_MASK; + clk_sel = RD2(slot, BCM577XX_HOST_CONTROL) & + BCM577XX_CTRL_CLKSEL_MASK; - /* Select clock source appropriate for the requested frequency. */ + /* + * Select clock source appropriate for the requested frequency. + */ if ((clk_base / BCM577XX_DEFAULT_MAX_DIVIDER) > clock) { clk_base = BCM577XX_ALT_CLOCK_BASE; - clk_sel |= (BCM577XX_CTRL_CLKSEL_64MHZ << BCM577XX_CTRL_CLKSEL_SHIFT); + clk_sel |= (BCM577XX_CTRL_CLKSEL_64MHZ << + BCM577XX_CTRL_CLKSEL_SHIFT); } else { - clk_sel |= (BCM577XX_CTRL_CLKSEL_DEFAULT << BCM577XX_CTRL_CLKSEL_SHIFT); + clk_sel |= (BCM577XX_CTRL_CLKSEL_DEFAULT << + BCM577XX_CTRL_CLKSEL_SHIFT); } - + WR2(slot, BCM577XX_HOST_CONTROL, clk_sel); } @@ -303,8 +310,8 @@ sdhci_set_clock(struct sdhci_slot *slot, uint32_t clock) if (clock >= clk_base) div = 0; else { - for (div = 2; div < SDHCI_300_MAX_DIVIDER; div += 2) { - if ((clk_base / div) <= clock) + for (div = 2; div < SDHCI_300_MAX_DIVIDER; div += 2) { + if ((clk_base / div) <= clock) break; } } @@ -312,7 +319,7 @@ sdhci_set_clock(struct sdhci_slot *slot, uint32_t clock) } if (bootverbose || sdhci_debug) - slot_printf(slot, "Divider %d for freq %d (base %d)\n", + slot_printf(slot, "Divider %d for freq %d (base %d)\n", div, clock, clk_base); /* Now we have got divider, set it. */ @@ -329,7 +336,7 @@ sdhci_set_clock(struct sdhci_slot *slot, uint32_t clock) while (!((clk = RD2(slot, SDHCI_CLOCK_CONTROL)) & SDHCI_CLOCK_INT_STABLE)) { if (timeout == 0) { - slot_printf(slot, + slot_printf(slot, "Internal clock never stabilised.\n"); sdhci_dumpregs(slot); return; @@ -555,7 +562,7 @@ sdhci_handle_card_present(struct sdhci_slot *slot, bool is_present) SDHCI_UNLOCK(slot); } -static void +static void sdhci_card_poll(void *arg) { struct sdhci_slot *slot = arg; @@ -565,7 +572,7 @@ sdhci_card_poll(void *arg) callout_reset(&slot->card_poll_callout, SDHCI_CARD_PRESENT_TICKS, sdhci_card_poll, slot); } - + int sdhci_init_slot(device_t dev, struct sdhci_slot *slot, int num) { @@ -611,7 +618,7 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, int num) /* Initialize slot. */ sdhci_init(slot); - slot->version = (RD2(slot, SDHCI_HOST_VERSION) + slot->version = (RD2(slot, SDHCI_HOST_VERSION) >> SDHCI_SPEC_VER_SHIFT) & SDHCI_SPEC_VER_MASK; if (slot->quirks & SDHCI_QUIRK_MISSING_CAPS) caps = slot->caps; @@ -621,7 +628,7 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, int num) if (slot->version >= SDHCI_SPEC_300) freq = (caps & SDHCI_CLOCK_V3_BASE_MASK) >> SDHCI_CLOCK_BASE_SHIFT; - else + else freq = (caps & SDHCI_CLOCK_BASE_MASK) >> SDHCI_CLOCK_BASE_SHIFT; if (freq != 0) @@ -634,7 +641,8 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, int num) if (slot->max_clk == 0) { slot->max_clk = SDHCI_DEFAULT_MAX_FREQ * 1000000; device_printf(dev, "Hardware doesn't specify base clock " - "frequency, using %dMHz as default.\n", SDHCI_DEFAULT_MAX_FREQ); + "frequency, using %dMHz as default.\n", + SDHCI_DEFAULT_MAX_FREQ); } /* Calculate/set timeout clock frequency. */ if (slot->quirks & SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK) { @@ -642,8 +650,8 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, int num) } else if (slot->quirks & SDHCI_QUIRK_DATA_TIMEOUT_1MHZ) { slot->timeout_clk = 1000; } else { - slot->timeout_clk = - (caps & SDHCI_TIMEOUT_CLK_MASK) >> SDHCI_TIMEOUT_CLK_SHIFT; + slot->timeout_clk = (caps & SDHCI_TIMEOUT_CLK_MASK) >> + SDHCI_TIMEOUT_CLK_SHIFT; if (caps & SDHCI_TIMEOUT_CLK_UNIT) slot->timeout_clk *= 1000; } @@ -687,7 +695,7 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, int num) if (slot->quirks & SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE) slot->opt |= SDHCI_NON_REMOVABLE; - /* + /* * Use platform-provided transfer backend * with PIO as a fallback mechanism */ @@ -825,7 +833,7 @@ sdhci_generic_update_ios(device_t brdev, device_t reqdev) } else { panic("Invalid bus width: %d", ios->bus_width); } - if (ios->timing == bus_timing_hs && + if (ios->timing == bus_timing_hs && !(slot->quirks & SDHCI_QUIRK_DONT_SET_HISPD_BIT)) slot->hostctrl |= SDHCI_CTRL_HISPD; else @@ -839,7 +847,7 @@ sdhci_generic_update_ios(device_t brdev, device_t reqdev) return (0); } -static void +static void sdhci_req_done(struct sdhci_slot *slot) { struct mmc_request *req; @@ -852,8 +860,8 @@ sdhci_req_done(struct sdhci_slot *slot) req->done(req); } } - -static void + +static void sdhci_timeout(void *arg) { struct sdhci_slot *slot = arg; @@ -868,7 +876,7 @@ sdhci_timeout(void *arg) slot_printf(slot, " Spurious timeout - no active command\n"); } } - + static void sdhci_set_transfer_mode(struct sdhci_slot *slot, struct mmc_data *data) @@ -970,7 +978,7 @@ sdhci_start_command(struct sdhci_slot *slot, struct mmc_command *cmd) flags |= SDHCI_CMD_TYPE_ABORT; /* Prepare data. */ sdhci_start_data(slot, cmd->data); - /* + /* * Interrupt aggregation: To reduce total number of interrupts * group response interrupt with data interrupt when possible. * If there going to be data interrupt, mask response one. @@ -994,6 +1002,8 @@ static void sdhci_finish_command(struct sdhci_slot *slot) { int i; + uint32_t val; + uint8_t extra; slot->cmd_done = 1; /* Interrupt aggregation: Restore command interrupt. @@ -1011,13 +1021,14 @@ sdhci_finish_command(struct sdhci_slot *slot) if (slot->curcmd->flags & MMC_RSP_PRESENT) { if (slot->curcmd->flags & MMC_RSP_136) { /* CRC is stripped so we need one byte shift. */ - uint8_t extra = 0; + extra = 0; for (i = 0; i < 4; i++) { - uint32_t val = RD4(slot, SDHCI_RESPONSE + i * 4); - if (slot->quirks & SDHCI_QUIRK_DONT_SHIFT_RESPONSE) + val = RD4(slot, SDHCI_RESPONSE + i * 4); + if (slot->quirks & + SDHCI_QUIRK_DONT_SHIFT_RESPONSE) slot->curcmd->resp[3 - i] = val; else { - slot->curcmd->resp[3 - i] = + slot->curcmd->resp[3 - i] = (val << 8) | extra; extra = val >> 24; } @@ -1056,7 +1067,7 @@ sdhci_start_data(struct sdhci_slot *slot, struct mmc_data *data) current_timeout <<= 1; } /* Compensate for an off-by-one error in the CaFe chip.*/ - if (div < 0xE && + if (div < 0xE && (slot->quirks & SDHCI_QUIRK_INCR_TIMEOUT_CONTROL)) { ++div; } @@ -1080,13 +1091,13 @@ sdhci_start_data(struct sdhci_slot *slot, struct mmc_data *data) /* Load DMA buffer. */ if (slot->flags & SDHCI_USE_DMA) { if (data->flags & MMC_DATA_READ) - bus_dmamap_sync(slot->dmatag, slot->dmamap, + bus_dmamap_sync(slot->dmatag, slot->dmamap, BUS_DMASYNC_PREREAD); else { memcpy(slot->dmamem, data->data, - (data->len < DMA_BLOCK_SIZE) ? + (data->len < DMA_BLOCK_SIZE) ? data->len : DMA_BLOCK_SIZE); - bus_dmamap_sync(slot->dmatag, slot->dmamap, + bus_dmamap_sync(slot->dmatag, slot->dmamap, BUS_DMASYNC_PREWRITE); } WR4(slot, SDHCI_DMA_ADDRESS, slot->paddr); @@ -1101,8 +1112,8 @@ sdhci_start_data(struct sdhci_slot *slot, struct mmc_data *data) /* Current data offset for both PIO and DMA. */ slot->offset = 0; /* Set block size and request IRQ on 4K border. */ - WR2(slot, SDHCI_BLOCK_SIZE, - SDHCI_MAKE_BLKSZ(DMA_BOUNDARY, (data->len < 512)?data->len:512)); + WR2(slot, SDHCI_BLOCK_SIZE, SDHCI_MAKE_BLKSZ(DMA_BOUNDARY, + (data->len < 512) ? data->len : 512)); /* Set block count. */ WR2(slot, SDHCI_BLOCK_COUNT, (data->len + 511) / 512); } @@ -1123,12 +1134,12 @@ sdhci_finish_data(struct sdhci_slot *slot) if (!slot->data_done && (slot->flags & SDHCI_USE_DMA)) { if (data->flags & MMC_DATA_READ) { size_t left = data->len - slot->offset; - bus_dmamap_sync(slot->dmatag, slot->dmamap, + bus_dmamap_sync(slot->dmatag, slot->dmamap, BUS_DMASYNC_POSTREAD); memcpy((u_char*)data->data + slot->offset, slot->dmamem, - (left < DMA_BLOCK_SIZE)?left:DMA_BLOCK_SIZE); + (left < DMA_BLOCK_SIZE) ? left : DMA_BLOCK_SIZE); } else - bus_dmamap_sync(slot->dmatag, slot->dmamap, + bus_dmamap_sync(slot->dmatag, slot->dmamap, BUS_DMASYNC_POSTWRITE); } slot->data_done = 1; @@ -1187,9 +1198,10 @@ sdhci_generic_request(device_t brdev, device_t reqdev, struct mmc_request *req) return (EBUSY); } if (sdhci_debug > 1) { - slot_printf(slot, "CMD%u arg %#x flags %#x dlen %u dflags %#x\n", - req->cmd->opcode, req->cmd->arg, req->cmd->flags, - (req->cmd->data)?(u_int)req->cmd->data->len:0, + slot_printf(slot, + "CMD%u arg %#x flags %#x dlen %u dflags %#x\n", + req->cmd->opcode, req->cmd->arg, req->cmd->flags, + (req->cmd->data)?(u_int)req->cmd->data->len:0, (req->cmd->data)?req->cmd->data->flags:0); } slot->req = req; @@ -1270,6 +1282,8 @@ sdhci_cmd_irq(struct sdhci_slot *slot, uint32_t intmask) static void sdhci_data_irq(struct sdhci_slot *slot, uint32_t intmask) { + struct mmc_data *data; + size_t left; if (!slot->curcmd) { slot_printf(slot, "Got data interrupt 0x%08x, but " @@ -1304,17 +1318,17 @@ sdhci_data_irq(struct sdhci_slot *slot, uint32_t intmask) /* Handle PIO interrupt. */ if (intmask & (SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL)) { - if ((slot->opt & SDHCI_PLATFORM_TRANSFER) && + if ((slot->opt & SDHCI_PLATFORM_TRANSFER) && SDHCI_PLATFORM_WILL_HANDLE(slot->bus, slot)) { - SDHCI_PLATFORM_START_TRANSFER(slot->bus, slot, &intmask); + SDHCI_PLATFORM_START_TRANSFER(slot->bus, slot, + &intmask); slot->flags |= PLATFORM_DATA_STARTED; } else sdhci_transfer_pio(slot); } /* Handle DMA border. */ if (intmask & SDHCI_INT_DMA_END) { - struct mmc_data *data = slot->curcmd->data; - size_t left; + data = slot->curcmd->data; /* Unload DMA buffer... */ left = data->len - slot->offset; @@ -1322,7 +1336,7 @@ sdhci_data_irq(struct sdhci_slot *slot, uint32_t intmask) bus_dmamap_sync(slot->dmatag, slot->dmamap, BUS_DMASYNC_POSTREAD); memcpy((u_char*)data->data + slot->offset, slot->dmamem, - (left < DMA_BLOCK_SIZE)?left:DMA_BLOCK_SIZE); + (left < DMA_BLOCK_SIZE) ? left : DMA_BLOCK_SIZE); } else { bus_dmamap_sync(slot->dmatag, slot->dmamap, BUS_DMASYNC_POSTWRITE); @@ -1335,7 +1349,7 @@ sdhci_data_irq(struct sdhci_slot *slot, uint32_t intmask) BUS_DMASYNC_PREREAD); } else { memcpy(slot->dmamem, (u_char*)data->data + slot->offset, - (left < DMA_BLOCK_SIZE)?left:DMA_BLOCK_SIZE); + (left < DMA_BLOCK_SIZE)? left : DMA_BLOCK_SIZE); bus_dmamap_sync(slot->dmatag, slot->dmamap, BUS_DMASYNC_PREWRITE); } @@ -1363,7 +1377,6 @@ sdhci_data_irq(struct sdhci_slot *slot, uint32_t intmask) SDHCI_PLATFORM_FINISH_TRANSFER(slot->bus, slot); } else sdhci_finish_data(slot); - return; } } @@ -1371,7 +1384,7 @@ static void sdhci_acmd_irq(struct sdhci_slot *slot) { uint16_t err; - + err = RD4(slot, SDHCI_ACMD12_ERR); if (!slot->curcmd) { slot_printf(slot, "Got AutoCMD12 error 0x%04x, but " @@ -1387,7 +1400,7 @@ void sdhci_generic_intr(struct sdhci_slot *slot) { uint32_t intmask, present; - + SDHCI_LOCK(slot); /* Read slot interrupt status. */ intmask = RD4(slot, SDHCI_INT_STATUS); @@ -1407,7 +1420,7 @@ sdhci_generic_intr(struct sdhci_slot *slot) SDHCI_INT_CARD_INSERT; WR4(slot, SDHCI_INT_ENABLE, slot->intmask); WR4(slot, SDHCI_SIGNAL_ENABLE, slot->intmask); - WR4(slot, SDHCI_INT_STATUS, intmask & + WR4(slot, SDHCI_INT_STATUS, intmask & (SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE)); sdhci_handle_card_present_locked(slot, present); intmask &= ~(SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE); @@ -1446,12 +1459,13 @@ sdhci_generic_intr(struct sdhci_slot *slot) intmask); sdhci_dumpregs(slot); } - + SDHCI_UNLOCK(slot); } int -sdhci_generic_read_ivar(device_t bus, device_t child, int which, uintptr_t *result) +sdhci_generic_read_ivar(device_t bus, device_t child, int which, + uintptr_t *result) { struct sdhci_slot *slot = device_get_ivars(child); @@ -1505,7 +1519,8 @@ sdhci_generic_read_ivar(device_t bus, device_t child, int which, uintptr_t *resu } int -sdhci_generic_write_ivar(device_t bus, device_t child, int which, uintptr_t value) +sdhci_generic_write_ivar(device_t bus, device_t child, int which, + uintptr_t value) { struct sdhci_slot *slot = device_get_ivars(child); diff --git a/sys/dev/sdhci/sdhci.h b/sys/dev/sdhci/sdhci.h index 4626816a538c..9c9f831fb8bd 100644 --- a/sys/dev/sdhci/sdhci.h +++ b/sys/dev/sdhci/sdhci.h @@ -130,7 +130,7 @@ #define SDHCI_STATE_DAT_MASK 0x00f00000 #define SDHCI_STATE_CMD 0x01000000 -#define SDHCI_HOST_CONTROL 0x28 +#define SDHCI_HOST_CONTROL 0x28 #define SDHCI_CTRL_LED 0x01 #define SDHCI_CTRL_4BITBUS 0x02 #define SDHCI_CTRL_HISPD 0x04 @@ -204,7 +204,7 @@ #define SDHCI_INT_NORMAL_MASK 0x00007FFF #define SDHCI_INT_ERROR_MASK 0xFFFF8000 -#define SDHCI_INT_CMD_ERROR_MASK (SDHCI_INT_TIMEOUT | \ +#define SDHCI_INT_CMD_ERROR_MASK (SDHCI_INT_TIMEOUT | \ SDHCI_INT_CRC | SDHCI_INT_END_BIT | SDHCI_INT_INDEX) #define SDHCI_INT_CMD_MASK (SDHCI_INT_RESPONSE | SDHCI_INT_CMD_ERROR_MASK) @@ -288,19 +288,19 @@ struct sdhci_slot { int timeout; /* Transfer timeout */ uint32_t max_clk; /* Max possible freq */ uint32_t timeout_clk; /* Timeout freq */ - bus_dma_tag_t dmatag; - bus_dmamap_t dmamap; + bus_dma_tag_t dmatag; + bus_dmamap_t dmamap; u_char *dmamem; bus_addr_t paddr; /* DMA buffer address */ struct task card_task; /* Card presence check task */ - struct timeout_task + struct timeout_task card_delayed_task;/* Card insert delayed task */ struct callout card_poll_callout;/* Card present polling callout */ struct callout timeout_callout;/* Card command/data response timeout */ struct mmc_host host; /* Host parameters */ struct mmc_request *req; /* Current request */ struct mmc_command *curcmd; /* Current command of current request */ - + uint32_t intmask; /* Current interrupt mask */ uint32_t clock; /* Current clock freq. */ size_t offset; /* Data buffer offset */ @@ -313,12 +313,14 @@ struct sdhci_slot { #define CMD_STARTED 1 #define STOP_STARTED 2 #define SDHCI_USE_DMA 4 /* Use DMA for this req. */ -#define PLATFORM_DATA_STARTED 8 /* Data transfer is handled by platform */ +#define PLATFORM_DATA_STARTED 8 /* Data xfer is handled by platform */ struct mtx mtx; /* Slot mutex */ }; -int sdhci_generic_read_ivar(device_t bus, device_t child, int which, uintptr_t *result); -int sdhci_generic_write_ivar(device_t bus, device_t child, int which, uintptr_t value); +int sdhci_generic_read_ivar(device_t bus, device_t child, int which, + uintptr_t *result); +int sdhci_generic_write_ivar(device_t bus, device_t child, int which, + uintptr_t value); int sdhci_init_slot(device_t dev, struct sdhci_slot *slot, int num); void sdhci_start_slot(struct sdhci_slot *slot); /* performs generic clean-up for platform transfers */ @@ -327,7 +329,8 @@ int sdhci_cleanup_slot(struct sdhci_slot *slot); int sdhci_generic_suspend(struct sdhci_slot *slot); int sdhci_generic_resume(struct sdhci_slot *slot); int sdhci_generic_update_ios(device_t brdev, device_t reqdev); -int sdhci_generic_request(device_t brdev, device_t reqdev, struct mmc_request *req); +int sdhci_generic_request(device_t brdev, device_t reqdev, + struct mmc_request *req); int sdhci_generic_get_ro(device_t brdev, device_t reqdev); int sdhci_generic_acquire_host(device_t brdev, device_t reqdev); int sdhci_generic_release_host(device_t brdev, device_t reqdev); diff --git a/sys/dev/sdhci/sdhci_acpi.c b/sys/dev/sdhci/sdhci_acpi.c index a2a2cab0ffd2..a0560ecd8467 100644 --- a/sys/dev/sdhci/sdhci_acpi.c +++ b/sys/dev/sdhci/sdhci_acpi.c @@ -77,7 +77,7 @@ static char *sdhci_ids[] = { struct sdhci_acpi_softc { u_int quirks; /* Chip specific quirks */ struct resource *irq_res; /* IRQ resource */ - void *intrhand; /* Interrupt handle */ + void *intrhand; /* Interrupt handle */ struct sdhci_slot slot; struct resource *mem_res; /* Memory resource */ @@ -97,7 +97,8 @@ sdhci_acpi_read_1(device_t dev, struct sdhci_slot *slot, bus_size_t off) } static void -sdhci_acpi_write_1(device_t dev, struct sdhci_slot *slot, bus_size_t off, uint8_t val) +sdhci_acpi_write_1(device_t dev, struct sdhci_slot *slot, bus_size_t off, + uint8_t val) { struct sdhci_acpi_softc *sc = device_get_softc(dev); @@ -117,7 +118,8 @@ sdhci_acpi_read_2(device_t dev, struct sdhci_slot *slot, bus_size_t off) } static void -sdhci_acpi_write_2(device_t dev, struct sdhci_slot *slot, bus_size_t off, uint16_t val) +sdhci_acpi_write_2(device_t dev, struct sdhci_slot *slot, bus_size_t off, + uint16_t val) { struct sdhci_acpi_softc *sc = device_get_softc(dev); @@ -137,7 +139,8 @@ sdhci_acpi_read_4(device_t dev, struct sdhci_slot *slot, bus_size_t off) } static void -sdhci_acpi_write_4(device_t dev, struct sdhci_slot *slot, bus_size_t off, uint32_t val) +sdhci_acpi_write_4(device_t dev, struct sdhci_slot *slot, bus_size_t off, + uint32_t val) { struct sdhci_acpi_softc *sc = device_get_softc(dev); @@ -237,7 +240,7 @@ sdhci_acpi_attach(device_t dev) sdhci_acpi_detach(dev); return (ENOMEM); } - + sc->slot.quirks = sc->quirks; err = sdhci_init_slot(dev, &sc->slot, 0); @@ -337,9 +340,9 @@ static device_method_t sdhci_methods[] = { DEVMETHOD(bus_write_ivar, sdhci_generic_write_ivar), /* mmcbr_if */ - DEVMETHOD(mmcbr_update_ios, sdhci_generic_update_ios), - DEVMETHOD(mmcbr_request, sdhci_generic_request), - DEVMETHOD(mmcbr_get_ro, sdhci_generic_get_ro), + DEVMETHOD(mmcbr_update_ios, sdhci_generic_update_ios), + DEVMETHOD(mmcbr_request, sdhci_generic_request), + DEVMETHOD(mmcbr_get_ro, sdhci_generic_get_ro), DEVMETHOD(mmcbr_acquire_host, sdhci_generic_acquire_host), DEVMETHOD(mmcbr_release_host, sdhci_generic_release_host), diff --git a/sys/dev/sdhci/sdhci_pci.c b/sys/dev/sdhci/sdhci_pci.c index aec4000dc168..2e6961a3f9fd 100644 --- a/sys/dev/sdhci/sdhci_pci.c +++ b/sys/dev/sdhci/sdhci_pci.c @@ -81,28 +81,28 @@ static const struct sdhci_device { const char *desc; u_int quirks; } sdhci_devices[] = { - { 0x08221180, 0xffff, "RICOH R5C822 SD", + { 0x08221180, 0xffff, "RICOH R5C822 SD", SDHCI_QUIRK_FORCE_DMA }, - { 0xe8221180, 0xffff, "RICOH R5CE822 SD", + { 0xe8221180, 0xffff, "RICOH R5CE822 SD", SDHCI_QUIRK_FORCE_DMA | SDHCI_QUIRK_LOWER_FREQUENCY }, - { 0xe8231180, 0xffff, "RICOH R5CE823 SD", + { 0xe8231180, 0xffff, "RICOH R5CE823 SD", SDHCI_QUIRK_LOWER_FREQUENCY }, - { 0x8034104c, 0xffff, "TI XX21/XX11 SD", + { 0x8034104c, 0xffff, "TI XX21/XX11 SD", SDHCI_QUIRK_FORCE_DMA }, - { 0x05501524, 0xffff, "ENE CB712 SD", + { 0x05501524, 0xffff, "ENE CB712 SD", SDHCI_QUIRK_BROKEN_TIMINGS }, - { 0x05511524, 0xffff, "ENE CB712 SD 2", + { 0x05511524, 0xffff, "ENE CB712 SD 2", SDHCI_QUIRK_BROKEN_TIMINGS }, - { 0x07501524, 0xffff, "ENE CB714 SD", + { 0x07501524, 0xffff, "ENE CB714 SD", SDHCI_QUIRK_RESET_ON_IOS | SDHCI_QUIRK_BROKEN_TIMINGS }, - { 0x07511524, 0xffff, "ENE CB714 SD 2", + { 0x07511524, 0xffff, "ENE CB714 SD 2", SDHCI_QUIRK_RESET_ON_IOS | SDHCI_QUIRK_BROKEN_TIMINGS }, - { 0x410111ab, 0xffff, "Marvell CaFe SD", + { 0x410111ab, 0xffff, "Marvell CaFe SD", SDHCI_QUIRK_INCR_TIMEOUT_CONTROL }, - { 0x2381197B, 0xffff, "JMicron JMB38X SD", + { 0x2381197B, 0xffff, "JMicron JMB38X SD", SDHCI_QUIRK_32BIT_DMA_SIZE | SDHCI_QUIRK_RESET_AFTER_REQUEST }, { 0x16bc14e4, 0xffff, "Broadcom BCM577xx SDXC/MMC Card Reader", @@ -127,7 +127,7 @@ static const struct sdhci_device { struct sdhci_pci_softc { u_int quirks; /* Chip specific quirks */ struct resource *irq_res; /* IRQ resource */ - void *intrhand; /* Interrupt handle */ + void *intrhand; /* Interrupt handle */ int num_slots; /* Number of slots on this controller */ struct sdhci_slot slots[6]; @@ -151,7 +151,8 @@ sdhci_pci_read_1(device_t dev, struct sdhci_slot *slot, bus_size_t off) } static void -sdhci_pci_write_1(device_t dev, struct sdhci_slot *slot, bus_size_t off, uint8_t val) +sdhci_pci_write_1(device_t dev, struct sdhci_slot *slot, bus_size_t off, + uint8_t val) { struct sdhci_pci_softc *sc = device_get_softc(dev); @@ -171,7 +172,8 @@ sdhci_pci_read_2(device_t dev, struct sdhci_slot *slot, bus_size_t off) } static void -sdhci_pci_write_2(device_t dev, struct sdhci_slot *slot, bus_size_t off, uint16_t val) +sdhci_pci_write_2(device_t dev, struct sdhci_slot *slot, bus_size_t off, + uint16_t val) { struct sdhci_pci_softc *sc = device_get_softc(dev); @@ -191,7 +193,8 @@ sdhci_pci_read_4(device_t dev, struct sdhci_slot *slot, bus_size_t off) } static void -sdhci_pci_write_4(device_t dev, struct sdhci_slot *slot, bus_size_t off, uint32_t val) +sdhci_pci_write_4(device_t dev, struct sdhci_slot *slot, bus_size_t off, + uint32_t val) { struct sdhci_pci_softc *sc = device_get_softc(dev); @@ -346,7 +349,8 @@ sdhci_pci_attach(device_t dev) sc->mem_res[i] = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); if (sc->mem_res[i] == NULL) { - device_printf(dev, "Can't allocate memory for slot %d\n", i); + device_printf(dev, + "Can't allocate memory for slot %d\n", i); continue; } @@ -463,9 +467,9 @@ static device_method_t sdhci_methods[] = { DEVMETHOD(bus_write_ivar, sdhci_generic_write_ivar), /* mmcbr_if */ - DEVMETHOD(mmcbr_update_ios, sdhci_generic_update_ios), - DEVMETHOD(mmcbr_request, sdhci_generic_request), - DEVMETHOD(mmcbr_get_ro, sdhci_generic_get_ro), + DEVMETHOD(mmcbr_update_ios, sdhci_generic_update_ios), + DEVMETHOD(mmcbr_request, sdhci_generic_request), + DEVMETHOD(mmcbr_get_ro, sdhci_generic_get_ro), DEVMETHOD(mmcbr_acquire_host, sdhci_generic_acquire_host), DEVMETHOD(mmcbr_release_host, sdhci_generic_release_host), From 5832bcdca8538d1b41c9b95510d7debdc252b13b Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sun, 29 Jan 2017 00:12:06 +0000 Subject: [PATCH 41/51] Remove non-existent ct(4) dependency for scsi_low.c ct(4) was removed with pc98 in r312910 --- sys/conf/files | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/conf/files b/sys/conf/files index a6eee9547178..3009d1515315 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -111,7 +111,7 @@ cam/ctl/ctl_error.c optional ctl cam/ctl/ctl_util.c optional ctl cam/ctl/scsi_ctl.c optional ctl cam/scsi/scsi_da.c optional da -cam/scsi/scsi_low.c optional ct | ncv | nsp | stg +cam/scsi/scsi_low.c optional ncv | nsp | stg cam/scsi/scsi_pass.c optional pass cam/scsi/scsi_pt.c optional pt cam/scsi/scsi_sa.c optional sa From dad206bd677ac53b3b1eeba486f97752c1b75338 Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Sun, 29 Jan 2017 00:24:34 +0000 Subject: [PATCH 42/51] Update MACHINE/MACHINE_ARCH examples to use arm64/aarch64 instead of i386/pc98 pc98 support was removed in r312910 --- usr.bin/man/man.1 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/usr.bin/man/man.1 b/usr.bin/man/man.1 index 5647b6c74915..79626562d7d2 100644 --- a/usr.bin/man/man.1 +++ b/usr.bin/man/man.1 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 26, 2014 +.Dd January 28, 2017 .Dt MAN 1 .Os .Sh NAME @@ -242,20 +242,20 @@ environment variables. For example, if .Ev MACHINE_ARCH is set to -.Dq Li i386 +.Dq Li aarch64 and .Ev MACHINE is set to -.Dq Li pc98 , +.Dq Li arm64 , .Nm will search the following paths when considering section 4 manual pages in .Pa /usr/share/man : .Pp .Bl -item -offset indent -compact .It -.Pa /usr/share/man/man4/pc98 +.Pa /usr/share/man/man4/aarch64 .It -.Pa /usr/share/man/man4/i386 +.Pa /usr/share/man/man4/arm64 .It .Pa /usr/share/man/man4 .El From 4ceff30f9520b82732540e5b523ac438fbf36db7 Mon Sep 17 00:00:00 2001 From: "Pedro F. Giffuni" Date: Sun, 29 Jan 2017 00:45:52 +0000 Subject: [PATCH 43/51] Remove GCC's __nonnull() attribute definition. While GCC's __nonnull__ attribute is generally useful to prevent misuse of some functions it also tends to do rather dangerous "optimizations". Now that we have replaced (r312934) all such uses with the clang nullability qualifiers, the GCC attribute is unnecessary. Remove the definition completely to prevent its use in system's headers. --- sys/sys/cdefs.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index 179a60955d1c..8eec7f9c5107 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -375,14 +375,6 @@ #define __noinline #endif -#if __GNUC_PREREQ__(3, 3) -#define __nonnull(x) __attribute__((__nonnull__(x))) -#define __nonnull_all __attribute__((__nonnull__)) -#else -#define __nonnull(x) -#define __nonnull_all -#endif - #if __GNUC_PREREQ__(3, 4) #define __fastcall __attribute__((__fastcall__)) #define __result_use_check __attribute__((__warn_unused_result__)) From a5c1a50a26ced05031cc256c7b01ca395489328c Mon Sep 17 00:00:00 2001 From: Luiz Otavio O Souza Date: Sun, 29 Jan 2017 02:17:52 +0000 Subject: [PATCH 44/51] Do not run the pf purge thread while the VNET variables are not initialized, this can cause a divide by zero (if the VNET initialization takes to long to complete). Obtained from: pfSense MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC (Netgate) --- sys/netpfil/pf/pf.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index f8acce55d978..627133ce221f 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -129,6 +129,8 @@ VNET_DEFINE(int, pf_tcp_secret_init); #define V_pf_tcp_secret_init VNET(pf_tcp_secret_init) VNET_DEFINE(int, pf_tcp_iss_off); #define V_pf_tcp_iss_off VNET(pf_tcp_iss_off) +VNET_DECLARE(int, pf_vnet_active); +#define V_pf_vnet_active VNET(pf_vnet_active) /* * Queue for pf_intr() sends. @@ -1441,6 +1443,12 @@ pf_purge_thread(void *unused __unused) kproc_exit(0); } + /* Wait while V_pf_default_rule.timeout is initialized. */ + if (V_pf_vnet_active == 0) { + CURVNET_RESTORE(); + continue; + } + /* Process 1/interval fraction of the state table every run. */ idx = pf_purge_expired_states(idx, pf_hashmask / (V_pf_default_rule.timeout[PFTM_INTERVAL] * 10)); From 794e3f9ae0b09c8411cd7de46ef66b4921b79cb5 Mon Sep 17 00:00:00 2001 From: Yoshihiro Takahashi Date: Sun, 29 Jan 2017 03:34:49 +0000 Subject: [PATCH 45/51] - Remove i8255.h because it's pc98 device. - rsa.h is for both RSA-DV/S ISA and RSA-98III CBUS, but there is no RSA-DV/S support. So it can be removed. --- ObsoleteFiles.inc | 2 + sys/dev/ic/i8255.h | 46 ---------------- sys/dev/ic/rsa.h | 128 --------------------------------------------- 3 files changed, 2 insertions(+), 174 deletions(-) delete mode 100644 sys/dev/ic/i8255.h delete mode 100644 sys/dev/ic/rsa.h diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index ef441e97696d..ab53478778d7 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -40,6 +40,8 @@ # 20170128: remove pc98 support OLD_FILES+=usr/include/dev/ic/i8251.h +OLD_FILES+=usr/include/dev/ic/i8255.h +OLD_FILES+=usr/include/dev/ic/rsa.h OLD_FILES+=usr/include/dev/ic/wd33c93reg.h OLD_FILES+=usr/include/sys/disk/pc98.h OLD_FILES+=usr/include/sys/diskpc98.h diff --git a/sys/dev/ic/i8255.h b/sys/dev/ic/i8255.h deleted file mode 100644 index 1ecfe50f5603..000000000000 --- a/sys/dev/ic/i8255.h +++ /dev/null @@ -1,46 +0,0 @@ -/*- - * Copyright (c) 2008 TAKAHASHI Yoshihiro - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef _DEV_IC_I8255_H_ -#define _DEV_IC_I8255_H_ - -/* - * modem status via SYSTM_PORTB - */ -#define CICSCD_CD 0x20 /* CD */ -#define CICSCD_CS 0x40 /* CS */ -#define CICSCD_CI 0x80 /* CI */ - -/* - * control intrline via SYSTM_PORTC - */ -#define IEN_Rx 0x01 -#define IEN_TxEMP 0x02 -#define IEN_Tx 0x04 - -#endif /* _DEV_IC_I8255_H_ */ diff --git a/sys/dev/ic/rsa.h b/sys/dev/ic/rsa.h deleted file mode 100644 index 6f9376af2f23..000000000000 --- a/sys/dev/ic/rsa.h +++ /dev/null @@ -1,128 +0,0 @@ -/*- - * Copyright (c) 1999 FreeBSD Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD$ - */ - -/* - * RSA Mode Driver Data Sheet - * - * <> - * Base + 0x00 - * Mode Select Register(Read/Write) - * bit4=interrupt type(1: level, 0: edge) - * bit3=Auto RTS-CTS Flow Control Enable - * bit2=External FIFO Enable - * bit1=Reserved(Default 0)Don't Change!! - * bit0=Swap Upper 8byte and Lower 8byte in 16byte space. - * - * Base + 0x01 - * Interrupt Enable Register(Read/Write) - * bit4=Hardware Timer Interrupt Enable - * bit3=Character Time-Out Interrupt Enable - * bit2=Tx FIFO Empty Interrupt Enable - * bit1=Tx FIFO Half Full Interrupt Enable - * bit0=Rx FIFO Half Full Interrupt Enable - * - * Base + 0x02 - * Status Read Register(Read) - * bit7=Hardware Time Out Interrupt Status(1: True, 0: False) - * bit6=Character Time Out Interrupt Status - * bit5=Rx FIFO Full Flag(0: True, 1: False) - * bit4=Rx FIFO Half Full Flag - * bit3=Rx FIFO Empty Flag - * bit2=Tx FIFO Full Flag - * bit1=Tx FIFO Half Full Flag - * bit0=Tx FIFO Empty Flag - * - * Base + 0x02 - * FIFO Reset Register(Write) - * Reset Extrnal FIFO - * - * Base + 0x03 - * Timer Interval Value Set Register(Read/Write) - * Range of n: 1-255 - * Interval Value: n * 0.2ms - * - * Base + 0x04 - * Timer Control Register(Read/Write) - * bit0=Timer Enable - * - * Base + 0x08 - 0x0f - * Same as UART 16550 - * - * Special Regisgter in RSA Mode - * UART Data Register(Base + 0x08) - * Data transfer between Extrnal FIFO - * - * UART MCR(Base + 0x0c) - * bit3(OUT2[MCR_IENABLE])=1: Diable 16550 to Rx FIFO transfer - * bit2(OUT1[MCR_DRS])=1: Diable Tx FIFO to 16550 transfer - * - * <> - * o Reciver Line Status(from UART16550) - * Reset: Read LSR - * - * o Modem Status(from UART16550) - * Reset: Read MSR - * - * o Rx FIFO Half Full(from Extrnal FIFO) - * Reset: Read Rx FIFO under Hall Full - * - * o Character Time Out(from Extrnal FIFO) - * Reset: Read Rx FIFO or SRR - * - * o Tx FIFO Empty(from Extrnal FIFO) - * Reset: Write Tx FIFO or Read SRR - * - * o Tx FIFO Half Full(from Extrnal FIFO) - * Reset: Write Tx FIFO until Hall Full or Read SRR - * - * o Hardware Timer(from Extrnal FIFO) - * Reset: Disable Timer in TCR - * Notes: If you want to use Timer for next intrrupt, - * you must enable Timer in TCR - * - * <> - * Auto RTS-CTS: Enable or Disable - * External FIFO: Enable - * Swap 8bytes: Disable - * Haredware Timer: Disable - * interrupt type: edge - * interrupt source: - * Hareware Timer - * Character Time Out - * Tx FIFO Empty - * Rx FIFO Half Full - * - */ - -/* I/O-DATA RSA Serise Exrension Register */ -#define rsa_msr 0 /* Mode Status Register (R/W) */ -#define rsa_ier 1 /* Interrupt Enable Register (R/W) */ -#define rsa_srr 2 /* Status Read Register (R) */ -#define rsa_frr 2 /* FIFO Reset Register (W) */ -#define rsa_tivsr 3 /* Timer Interval Value Set Register (R/W) */ -#define rsa_tcr 4 /* Timer Control Register (W) */ From a692daff3151b55bf53a384fa9fbd5e1dae42995 Mon Sep 17 00:00:00 2001 From: Brooks Davis Date: Sun, 29 Jan 2017 11:52:36 +0000 Subject: [PATCH 46/51] Remove "-Xassembler -G0" from CFLAGS. -G0 is sufficent except on old version of clang (<3.8) and such versions are unlikely to be generally useful on mips64. Reported by: sbruno Sponsored by: DARPA, AFRL --- sys/boot/mips/beri/boot2/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/boot/mips/beri/boot2/Makefile b/sys/boot/mips/beri/boot2/Makefile index 46af76298e96..dec7d6110e95 100644 --- a/sys/boot/mips/beri/boot2/Makefile +++ b/sys/boot/mips/beri/boot2/Makefile @@ -52,7 +52,7 @@ CFLAGS= -ffreestanding \ -I${.CURDIR}/../../../.. \ -D_KERNEL \ -Wall \ - -G0 -Xassembler -G0 \ + -G0 \ -fno-pic -mno-abicalls \ -msoft-float \ -g From 142c750ace5bb7e711c55b11ccc84718746fa873 Mon Sep 17 00:00:00 2001 From: Edward Tomasz Napierala Date: Sun, 29 Jan 2017 12:31:24 +0000 Subject: [PATCH 47/51] Remove unused kern_sendfile() declaration. --- sys/sys/syscallsubr.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/sys/sys/syscallsubr.h b/sys/sys/syscallsubr.h index eff7aca1f18a..7df9570db70f 100644 --- a/sys/sys/syscallsubr.h +++ b/sys/sys/syscallsubr.h @@ -52,7 +52,6 @@ struct ogetdirentries_args; struct rlimit; struct rusage; union semun; -struct sendfile_args; struct sockaddr; struct stat; struct thr_param; @@ -197,8 +196,6 @@ int kern_semctl(struct thread *td, int semid, int semnum, int cmd, union semun *arg, register_t *rval); int kern_select(struct thread *td, int nd, fd_set *fd_in, fd_set *fd_ou, fd_set *fd_ex, struct timeval *tvp, int abi_nfdbits); -int kern_sendfile(struct thread *td, struct sendfile_args *uap, - struct uio *hdr_uio, struct uio *trl_uio, int compat); int kern_sendit(struct thread *td, int s, struct msghdr *mp, int flags, struct mbuf *control, enum uio_seg segflg); int kern_setgroups(struct thread *td, u_int ngrp, gid_t *groups); From 4943dc2d2c46a4c0f67e7f532ceb3a4b02fe7e25 Mon Sep 17 00:00:00 2001 From: Olivier Houchard Date: Sun, 29 Jan 2017 13:31:56 +0000 Subject: [PATCH 48/51] Correct the IT instruction in atomic_fcmpset_64(). Reported by: andrew --- sys/arm/include/atomic-v6.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm/include/atomic-v6.h b/sys/arm/include/atomic-v6.h index 422c2492efa6..2a579dbd0a67 100644 --- a/sys/arm/include/atomic-v6.h +++ b/sys/arm/include/atomic-v6.h @@ -220,7 +220,7 @@ atomic_fcmpset_64(volatile uint64_t *p, uint64_t *cmpval, uint64_t newval) "1: mov %[ret], #1 \n" " ldrexd %Q[tmp], %R[tmp], [%[ptr]] \n" " teq %Q[tmp], %Q[_cmpval] \n" - " itee eq \n" + " ite eq \n" " teqeq %R[tmp], %R[_cmpval] \n" " bne 2f \n" " strexd %[ret], %Q[newval], %R[newval], [%[ptr]]\n" From d9864508596e984f89a78d2acbcce11369748e21 Mon Sep 17 00:00:00 2001 From: "Jason A. Harmening" Date: Sun, 29 Jan 2017 16:54:55 +0000 Subject: [PATCH 49/51] Implement get_pcpu() for i386 and use it to replace pcpu_find(curcpu) in the i386 pmap. The curcpu macro loads the per-cpu data pointer as its first step, so the remaining steps of pcpu_find(curcpu) are circular. get_pcpu() is already implemented for arm, arm64, and risc-v. My plan is to implement it for the remaining architectures and use it to replace several instances of pcpu_find(curcpu) in MI code. Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D9370 --- sys/i386/i386/pmap.c | 12 ++++++------ sys/i386/include/pcpu.h | 10 ++++++++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index 763c711ad8b3..305caae2e7bc 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -440,7 +440,7 @@ pmap_bootstrap(vm_paddr_t firstaddr) * CMAP1/CMAP2 are used for zeroing and copying pages. * CMAP3 is used for the boot-time memory test. */ - pc = pcpu_find(curcpu); + pc = get_pcpu(); mtx_init(&pc->pc_cmap_lock, "SYSMAPS", NULL, MTX_DEF); SYSMAP(caddr_t, pc->pc_cmap_pte1, pc->pc_cmap_addr1, 1) SYSMAP(caddr_t, pc->pc_cmap_pte2, pc->pc_cmap_addr2, 1) @@ -4206,7 +4206,7 @@ pmap_zero_page(vm_page_t m) struct pcpu *pc; sched_pin(); - pc = pcpu_find(curcpu); + pc = get_pcpu(); cmap_pte2 = pc->pc_cmap_pte2; mtx_lock(&pc->pc_cmap_lock); if (*cmap_pte2) @@ -4237,7 +4237,7 @@ pmap_zero_page_area(vm_page_t m, int off, int size) struct pcpu *pc; sched_pin(); - pc = pcpu_find(curcpu); + pc = get_pcpu(); cmap_pte2 = pc->pc_cmap_pte2; mtx_lock(&pc->pc_cmap_lock); if (*cmap_pte2) @@ -4264,7 +4264,7 @@ pmap_copy_page(vm_page_t src, vm_page_t dst) struct pcpu *pc; sched_pin(); - pc = pcpu_find(curcpu); + pc = get_pcpu(); cmap_pte1 = pc->pc_cmap_pte1; cmap_pte2 = pc->pc_cmap_pte2; mtx_lock(&pc->pc_cmap_lock); @@ -4299,7 +4299,7 @@ pmap_copy_pages(vm_page_t ma[], vm_offset_t a_offset, vm_page_t mb[], int cnt; sched_pin(); - pc = pcpu_find(curcpu); + pc = get_pcpu(); cmap_pte1 = pc->pc_cmap_pte1; cmap_pte2 = pc->pc_cmap_pte2; mtx_lock(&pc->pc_cmap_lock); @@ -5288,7 +5288,7 @@ pmap_flush_page(vm_page_t m) useclflushopt = (cpu_stdext_feature & CPUID_STDEXT_CLFLUSHOPT) != 0; if (useclflushopt || (cpu_feature & CPUID_CLFSH) != 0) { sched_pin(); - pc = pcpu_find(curcpu); + pc = get_pcpu(); cmap_pte2 = pc->pc_cmap_pte2; mtx_lock(&pc->pc_cmap_lock); if (*cmap_pte2) diff --git a/sys/i386/include/pcpu.h b/sys/i386/include/pcpu.h index 3110f9ffe7ab..1ec6f580ea0f 100644 --- a/sys/i386/include/pcpu.h +++ b/sys/i386/include/pcpu.h @@ -76,6 +76,7 @@ extern struct pcpu *pcpup; +#define get_pcpu() (pcpup) #define PCPU_GET(member) (pcpup->pc_ ## member) #define PCPU_ADD(member, val) (pcpup->pc_ ## member += (val)) #define PCPU_INC(member) PCPU_ADD(member, 1) @@ -196,6 +197,15 @@ extern struct pcpu *pcpup; } \ } while (0) +#define get_pcpu() __extension__ ({ \ + struct pcpu *__pc; \ + \ + __asm __volatile("movl %%fs:%1,%0" \ + : "=r" (__pc) \ + : "m" (*(struct pcpu *)(__pcpu_offset(pc_prvspace)))); \ + __pc; \ +}) + #define PCPU_GET(member) __PCPU_GET(pc_ ## member) #define PCPU_ADD(member, val) __PCPU_ADD(pc_ ## member, val) #define PCPU_INC(member) __PCPU_INC(pc_ ## member) From d177868c1644054de9ce4cf7ec8224c37de51cae Mon Sep 17 00:00:00 2001 From: Luiz Otavio O Souza Date: Sun, 29 Jan 2017 18:41:09 +0000 Subject: [PATCH 50/51] The stf(4) interface name does not conform with the default naming convention for interfaces, because only one stf(4) interface can exist in the system. This disallow the use of unit numbers different than 0, however, it is possible to create the clone without specify the unit number (wildcard). In the wildcard case we must update the interface name before return. This fix an infinite recursion in pf code that keeps track of network interfaces and groups: 1 - a group for the cloned type of the interface is added (stf in this case); 2 - the system will now try to add an interface named stf (instead of stf0) to stf group; 3 - when pfi_kif_attach() tries to search for an already existing 'stf' interface, the 'stf' group is returned and thus the group is added as an interface of itself; This will now cause a crash at the first attempt to traverse the groups which the stf interface belongs (which loops over itself). Obtained from: pfSense MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC (Netgate) --- sys/net/if_stf.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/sys/net/if_stf.c b/sys/net/if_stf.c index 5209bc838f25..d11ec54de59b 100644 --- a/sys/net/if_stf.c +++ b/sys/net/if_stf.c @@ -202,10 +202,16 @@ stf_clone_match(struct if_clone *ifc, const char *name) static int stf_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params) { - int err, unit; + char *dp; + int err, unit, wildcard; struct stf_softc *sc; struct ifnet *ifp; + err = ifc_name2unit(name, &unit); + if (err != 0) + return (err); + wildcard = (unit < 0); + /* * We can only have one unit, but since unit allocation is * already locked, we use it to keep from allocating extra @@ -229,7 +235,20 @@ stf_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params) /* * Set the name manually rather then using if_initname because * we don't conform to the default naming convention for interfaces. + * In the wildcard case, we need to update the name. */ + if (wildcard) { + for (dp = name; *dp != '\0'; dp++); + if (snprintf(dp, len - (dp-name), "%d", unit) > + len - (dp-name) - 1) { + /* + * This can only be a programmer error and + * there's no straightforward way to recover if + * it happens. + */ + panic("if_clone_create(): interface name too long"); + } + } strlcpy(ifp->if_xname, name, IFNAMSIZ); ifp->if_dname = stfname; ifp->if_dunit = IF_DUNIT_NONE; From a0f64f38a1829b7c26bf801b96d7cff65d3c4c24 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Sun, 29 Jan 2017 19:14:48 +0000 Subject: [PATCH 51/51] Do not leave stale 4K TLB entries on pde (superpage) removal or protection change. On superpage promotion, x86 pmaps do not invalidate existing 4K entries for the superpage range, because they are compatible with the promoted 2/4M entry. But the invalidation on superpage removal or protection change only did single INVLPG with the base address of the superpage. This reliably flushed superpage TLB entry, and 4K entry for the first page of the superpage, potentially leaving other 4K TLB entries lingering. Do the invalidation of the whole superpage range to correct the problem. Note that the precise invalidation is done by x86 code for kernel_pmap only, for user pmaps whole (per-AS) TLB is flushed. This made the bug well hidden, because promotions of the kernel mappings require specific load. Reported and tested by: Jonathan Looney (previous version) Reviewed by: alc Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/amd64/amd64/pmap.c | 45 +++++++++++++++++++++++++++---------- sys/i386/i386/pmap.c | 50 ++++++++++++++++++++++++++++++++++-------- 2 files changed, 75 insertions(+), 20 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 5d09929bd84b..1a6fb1a5de3e 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -1040,7 +1040,12 @@ pmap_bootstrap(vm_paddr_t *firstaddr) virtual_avail = va; - /* Initialize the PAT MSR. */ + /* + * Initialize the PAT MSR. + * pmap_init_pat() clears and sets CR4_PGE, which, as a + * side-effect, invalidates stale PG_G TLB entries that might + * have been created in our pre-boot environment. + */ pmap_init_pat(); /* Initialize TLB Context Id. */ @@ -3428,6 +3433,7 @@ pmap_demote_pde_locked(pmap_t pmap, pd_entry_t *pde, vm_offset_t va, vm_paddr_t mptepa; vm_page_t mpte; struct spglist free; + vm_offset_t sva; int PG_PTE_CACHE; PG_G = pmap_global_bit(pmap); @@ -3464,9 +3470,9 @@ pmap_demote_pde_locked(pmap_t pmap, pd_entry_t *pde, vm_offset_t va, DMAP_MAX_ADDRESS ? VM_ALLOC_INTERRUPT : VM_ALLOC_NORMAL) | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED)) == NULL) { SLIST_INIT(&free); - pmap_remove_pde(pmap, pde, trunc_2mpage(va), &free, - lockp); - pmap_invalidate_page(pmap, trunc_2mpage(va)); + sva = trunc_2mpage(va); + pmap_remove_pde(pmap, pde, sva, &free, lockp); + pmap_invalidate_range(pmap, sva, sva + NBPDR - 1); pmap_free_zero_pages(&free); CTR2(KTR_PMAP, "pmap_demote_pde: failure for va %#lx" " in pmap %p", va, pmap); @@ -3608,11 +3614,23 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t *pdq, vm_offset_t sva, pmap->pm_stats.wired_count -= NBPDR / PAGE_SIZE; /* - * Machines that don't support invlpg, also don't support - * PG_G. + * When workaround_erratum383 is false, a promotion to a 2M + * page mapping does not invalidate the 512 4K page mappings + * from the TLB. Consequently, at this point, the TLB may + * hold both 4K and 2M page mappings. Therefore, the entire + * range of addresses must be invalidated here. In contrast, + * when workaround_erratum383 is true, a promotion does + * invalidate the 512 4K page mappings, and so a single INVLPG + * suffices to invalidate the 2M page mapping. */ - if (oldpde & PG_G) - pmap_invalidate_page(kernel_pmap, sva); + if ((oldpde & PG_G) != 0) { + if (workaround_erratum383) + pmap_invalidate_page(kernel_pmap, sva); + else + pmap_invalidate_range(kernel_pmap, sva, + sva + NBPDR - 1); + } + pmap_resident_count_dec(pmap, NBPDR / PAGE_SIZE); if (oldpde & PG_MANAGED) { CHANGE_PV_LIST_LOCK_TO_PHYS(lockp, oldpde & PG_PS_FRAME); @@ -3994,9 +4012,14 @@ pmap_protect_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t sva, vm_prot_t prot) if (newpde != oldpde) { if (!atomic_cmpset_long(pde, oldpde, newpde)) goto retry; - if (oldpde & PG_G) - pmap_invalidate_page(pmap, sva); - else + if (oldpde & PG_G) { + /* See pmap_remove_pde() for explanation. */ + if (workaround_erratum383) + pmap_invalidate_page(kernel_pmap, sva); + else + pmap_invalidate_range(kernel_pmap, sva, + sva + NBPDR - 1); + } else anychanged = TRUE; } return (anychanged); diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index 305caae2e7bc..665debeebba6 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -507,7 +507,14 @@ pmap_bootstrap(vm_paddr_t firstaddr) for (i = 1; i < NKPT; i++) PTD[i] = 0; - /* Initialize the PAT MSR if present. */ + /* + * Initialize the PAT MSR if present. + * pmap_init_pat() clears and sets CR4_PGE, which, as a + * side-effect, invalidates stale PG_G TLB entries that might + * have been created in our pre-boot environment. We assume + * that PAT support implies PGE and in reverse, PGE presence + * comes with PAT. Both features were added for Pentium Pro. + */ pmap_init_pat(); /* Turn on PG_G on kernel page(s) */ @@ -564,7 +571,10 @@ pmap_init_pat(void) pat_table[PAT_WRITE_PROTECTED] = 3; pat_table[PAT_UNCACHED] = 3; - /* Bail if this CPU doesn't implement PAT. */ + /* + * Bail if this CPU doesn't implement PAT. + * We assume that PAT support implies PGE. + */ if ((cpu_feature & CPUID_PAT) == 0) { for (i = 0; i < PAT_INDEX_SIZE; i++) pat_index[i] = pat_table[i]; @@ -2620,6 +2630,7 @@ pmap_demote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va) vm_paddr_t mptepa; vm_page_t mpte; struct spglist free; + vm_offset_t sva; PMAP_LOCK_ASSERT(pmap, MA_OWNED); oldpde = *pde; @@ -2640,8 +2651,9 @@ pmap_demote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va) va >> PDRSHIFT, VM_ALLOC_NOOBJ | VM_ALLOC_NORMAL | VM_ALLOC_WIRED)) == NULL) { SLIST_INIT(&free); - pmap_remove_pde(pmap, pde, trunc_4mpage(va), &free); - pmap_invalidate_page(pmap, trunc_4mpage(va)); + sva = trunc_4mpage(va); + pmap_remove_pde(pmap, pde, sva, &free); + pmap_invalidate_range(pmap, sva, sva + NBPDR - 1); pmap_free_zero_pages(&free); CTR2(KTR_PMAP, "pmap_demote_pde: failure for va %#x" " in pmap %p", va, pmap); @@ -2811,9 +2823,24 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t *pdq, vm_offset_t sva, /* * Machines that don't support invlpg, also don't support * PG_G. + * + * When workaround_erratum383 is false, a promotion to a 2M/4M + * page mapping does not invalidate the 512/1024 4K page mappings + * from the TLB. Consequently, at this point, the TLB may + * hold both 4K and 2M/4M page mappings. Therefore, the entire + * range of addresses must be invalidated here. In contrast, + * when workaround_erratum383 is true, a promotion does + * invalidate the 512/1024 4K page mappings, and so a single INVLPG + * suffices to invalidate the 2M/4M page mapping. */ - if (oldpde & PG_G) - pmap_invalidate_page(kernel_pmap, sva); + if ((oldpde & PG_G) != 0) { + if (workaround_erratum383) + pmap_invalidate_page(kernel_pmap, sva); + else + pmap_invalidate_range(kernel_pmap, sva, + sva + NBPDR - 1); + } + pmap->pm_stats.resident_count -= NBPDR / PAGE_SIZE; if (oldpde & PG_MANAGED) { pvh = pa_to_pvh(oldpde & PG_PS_FRAME); @@ -3122,9 +3149,14 @@ pmap_protect_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t sva, vm_prot_t prot) if (newpde != oldpde) { if (!pde_cmpset(pde, oldpde, newpde)) goto retry; - if (oldpde & PG_G) - pmap_invalidate_page(pmap, sva); - else + if (oldpde & PG_G) { + /* See pmap_remove_pde() for explanation. */ + if (workaround_erratum383) + pmap_invalidate_page(kernel_pmap, sva); + else + pmap_invalidate_range(kernel_pmap, sva, + sva + NBPDR - 1); + } else anychanged = TRUE; } return (anychanged);