diff options
author | Ian Moffett <ian@osmora.org> | 2024-06-24 22:55:29 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2024-06-24 22:55:29 -0400 |
commit | 236963e7563be3e3f8220dac7bb4af446928e194 (patch) | |
tree | e521ea226db0345bbb3679fffe09d96254b7dc73 /sys/include/dev | |
parent | 214eadc62b5578f76c98a38a28f8b3d80ac4d6ad (diff) |
Clean out for expt
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/include/dev')
-rw-r--r-- | sys/include/dev/ic/ahciregs.h | 142 | ||||
-rw-r--r-- | sys/include/dev/ic/ahcivar.h | 146 | ||||
-rw-r--r-- | sys/include/dev/ic/nvmevar.h | 280 | ||||
-rw-r--r-- | sys/include/dev/pci/pci.h | 83 | ||||
-rw-r--r-- | sys/include/dev/pci/pciregs.h | 66 | ||||
-rw-r--r-- | sys/include/dev/pci/pcivar.h | 40 | ||||
-rw-r--r-- | sys/include/dev/usb/xhciregs.h | 110 | ||||
-rw-r--r-- | sys/include/dev/usb/xhcivar.h | 113 | ||||
-rw-r--r-- | sys/include/dev/vcons/vcons.h | 72 | ||||
-rw-r--r-- | sys/include/dev/vcons/vcons_io.h | 37 | ||||
-rw-r--r-- | sys/include/dev/video/fbdev.h | 51 |
11 files changed, 0 insertions, 1140 deletions
diff --git a/sys/include/dev/ic/ahciregs.h b/sys/include/dev/ic/ahciregs.h deleted file mode 100644 index b2da5b7..0000000 --- a/sys/include/dev/ic/ahciregs.h +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora 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. - * 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. Neither the name of Hyra 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. - */ - -#ifndef _AHCIREGS_H_ -#define _AHCIREGS_H_ - -#include <sys/types.h> -#include <sys/cdefs.h> - -struct hba_port { - volatile uint64_t clb; /* Command list base (1k-byte aligned) */ - volatile uint64_t fb; /* FIS base (256-byte aligned) */ - volatile uint32_t is; /* Interrupt status */ - volatile uint32_t ie; /* Interrupt enable */ - volatile uint32_t cmd; /* Command and status */ - volatile uint32_t rsvd0; /* Reserved */ - volatile uint32_t tfd; /* Task file data */ - volatile uint32_t sig; /* Signature */ - volatile uint32_t ssts; /* SATA status */ - volatile uint32_t sctl; /* SATA control */ - volatile uint32_t serr; /* SATA error */ - volatile uint32_t sact; /* SATA active */ - volatile uint32_t ci; /* Command issue */ - volatile uint32_t sntf; /* SATA notification */ - volatile uint32_t fbs; /* FIS-based switch control */ - volatile uint32_t rsvd1[11]; - volatile uint32_t vendor[4]; -}; - -struct hba_memspace { - volatile uint32_t cap; /* Host Capabilities */ - volatile uint32_t ghc; /* Global host control */ - volatile uint32_t is; /* Interrupt status */ - volatile uint32_t pi; /* Ports implemented */ - volatile uint32_t vs; /* Version */ - volatile uint32_t ccc_ctl; /* Command completion coalescing control */ - volatile uint32_t ccc_pts; /* Command completion coalescing ports */ - volatile uint32_t em_loc; /* Enclosure management location */ - volatile uint32_t em_ctl; /* Enclosure management control */ - volatile uint32_t cap2; /* Host capabilities extended */ - volatile uint32_t bohc; /* BIOS/OS Handoff Control and Status */ - volatile uint8_t rsvd[0x74]; /* Reserved */ - volatile uint8_t vendor[0x60]; /* Vendor specific */ - struct hba_port ports[1]; -}; - -/* Global host control bits */ -#define AHCI_GHC_AE __BIT(31) /* AHCI enable */ -#define AHCI_GHC_IE __BIT(1) /* Interrupt enable */ -#define AHCI_GHC_HR __BIT(0) /* HBA reset */ - -/* AHCI port signatures */ -#define AHCI_SIG_ATA 0x00000101 -#define AHCI_SIG_SEMB 0xC33C0101 -#define AHCI_SIG_PM 0x96690101 - -/* - * Port SATA status - * See section 3.3.10 of the AHCI spec. - */ -#define AHCI_PXSSTS_DET(SSTS) (SSTS & 0xF) -#define AHCI_PXSSTS_IPM(SSTS) ((SSTS >> 8) & 0xF) - -/* - * Port SATA control bits - * See section 3.3.11 of the AHCI spec. - */ -#define AHCI_PXSCTL_DET(SCTL) (SCTL & 0xF) - -/* - * Port command and status bits - * See section 3.3.7 of the AHCI spec. - */ -#define AHCI_PXCMD_ST __BIT(0) /* Start */ -#define AHCI_PXCMD_FRE __BIT(4) /* FIS Receive Enable */ -#define AHCI_PXCMD_FR __BIT(14) /* FIS Receive Running */ -#define AHCI_PXCMD_CR __BIT(15) /* Command List Running */ - -/* - * Interrupt status bits - * See section 3.3.5 of the AHCI spec. - */ -#define AHCI_PXIS_TFES __BIT(31) - -/* - * Task file data bits - * See section 3.3.8 of the AHCI spec. - */ -#define AHCI_PXTFD_ERR __BIT(0) -#define AHCI_PXTFD_DRQ __BIT(3) -#define AHCI_PXTFD_BSY __BIT(7) - -/* - * Capability bits - * See section 3.1.1 of the AHCI spec. - */ -#define AHCI_CAP_NP(CAP) (CAP & 0x1F) /* Number of ports */ -#define AHCI_CAP_NCS(CAP) ((CAP >> 8) & 0x1F) /* Number of command slots */ - -/* - * Device detection (DET) and Interface power - * management (IPM) values - * See section 3.3.10 of the AHCI spec. - */ -#define AHCI_DET_NULL 0 /* No device detected */ -#define AHCI_DET_PRESENT 1 /* Device present (no PHY comm) */ -#define AHCI_DET_COMM 3 /* Device present and phy comm established */ -#define AHCI_IPM_ACTIVE 1 - -/* - * Device detection initialization values - * See section 3.3.11 of the AHCI spec. - */ -#define AHCI_DET_COMRESET 1 - -#endif /* !_AHCIREGS_H_ */ diff --git a/sys/include/dev/ic/ahcivar.h b/sys/include/dev/ic/ahcivar.h deleted file mode 100644 index edef4f6..0000000 --- a/sys/include/dev/ic/ahcivar.h +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora 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. - * 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. Neither the name of Hyra 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. - */ - -#ifndef _AHCIVAR_H_ -#define _AHCIVAR_H_ - -#include <sys/types.h> -#include <sys/cdefs.h> -#include <sys/mutex.h> -#include <sys/queue.h> -#include <dev/ic/ahciregs.h> - -struct ata_identity { - uint16_t rsvd0 : 1; - uint16_t unused0 : 1; - uint16_t incomplete : 1; - uint16_t unused1 : 3; - uint16_t fixed_dev : 1; - uint16_t removable : 1; - uint16_t unused2 : 7; - uint16_t device_type : 1; - uint16_t ncylinders; - uint16_t specific_config; - uint16_t nheads; - uint16_t unused3[2]; - uint16_t sectors_per_track; - uint16_t vendor[3]; - char serial_number[20]; - uint16_t unused4[2]; - uint16_t unused5; - char firmware_rev[8]; - char model_number[40]; - char pad[256]; -}; - -/* Physical region descriptor table entry */ -struct ahci_prdt_entry { - uintptr_t dba; /* Data base address */ - uint32_t rsvd0; /* Reserved */ - uint32_t dbc : 22; /* Count */ - uint16_t rsvd1 : 9; /* Reserved */ - uint8_t i : 1; /* Interrupt on completion */ -}; - -/* Command header */ -struct ahci_cmd_hdr { - uint8_t cfl : 5; /* Command FIS length */ - uint8_t a : 1; /* ATAPI */ - uint8_t w : 1; /* Write */ - uint8_t p : 1; /* Prefetchable */ - uint8_t r : 1; /* Reset */ - uint8_t c : 1; /* Clear busy upon R_OK */ - uint8_t rsvd0 : 1; /* Reserved */ - uint8_t pmp : 4; /* Port multiplier port */ - uint16_t prdtl; /* PRDT length (in entries) */ - volatile uint32_t prdbc; /* PRDT bytes transferred count */ - uintptr_t ctba; /* Command table descriptor base addr */ - uint32_t rsvd1[4]; /* Reserved */ -}; - -/* Command table */ -struct ahci_cmdtab { - uint8_t cfis[64]; - uint8_t acmd[16]; - uint8_t rsvd[48]; - struct ahci_prdt_entry prdt[1]; -}; - -struct ahci_fis_h2d { - uint8_t type; - uint8_t pmp : 4; - uint8_t rsvd0 : 3; - uint8_t c : 1; - uint8_t command; - uint8_t featurel; - uint8_t lba0; - uint8_t lba1; - uint8_t lba2; - uint8_t device; - uint8_t lba3; - uint8_t lba4; - uint8_t lba5; - uint8_t featureh; - uint8_t countl; - uint8_t counth; - uint8_t icc; - uint8_t control; - uint8_t rsvd1[4]; -}; - -struct ahci_device { - struct ahci_hba *hba; - struct hba_port *port; - dev_t minor; - TAILQ_ENTRY(ahci_device) link; -}; - -struct ahci_hba { - struct hba_memspace *abar; - struct ahci_cmd_hdr *cmdlist; - uint32_t ncmdslots; - uint32_t nports; -}; - -/* Commands */ -#define ATA_CMD_NOP 0x00 -#define ATA_CMD_IDENTIFY 0xEC -#define ATA_CMD_READ_DMA 0x25 -#define ATA_CMD_WRITE_DMA 0x35 - -/* FIS types */ -#define FIS_TYPE_H2D 0x27 -#define FIS_TYPE_D2H 0x34 - -#define AHCI_TIMEOUT 500 -#define AHCI_FIS_SIZE 256 -#define AHCI_CMDTAB_SIZE 256 -#define AHCI_CMDENTRY_SIZE 32 - -#endif /* !_AHCIVAR_H_ */ diff --git a/sys/include/dev/ic/nvmevar.h b/sys/include/dev/ic/nvmevar.h deleted file mode 100644 index 4a40071..0000000 --- a/sys/include/dev/ic/nvmevar.h +++ /dev/null @@ -1,280 +0,0 @@ -/* - * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora 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. - * 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. Neither the name of Hyra 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. - */ - -#ifndef _IC_NVMEVAR_H_ -#define _IC_NVMEVAR_H_ - -#include <sys/cdefs.h> - -/* Admin commands */ -#define NVME_OP_CREATE_IOSQ 0x01 -#define NVME_OP_CREATE_IOCQ 0x05 -#define NVME_OP_IDENTIFY 0x06 - -/* I/O commands */ -#define NVME_OP_WRITE 0x01 -#define NVME_OP_READ 0x02 - -/* Controller Capabilities */ -#define CAP_MPSMIN(caps) ((caps >> 48) & 0xF) -#define CAP_MPSMAX(caps) ((caps >> 52) & 0xF) -#define CAP_TIMEOUT(caps) ((caps >> 24) & 0xFF) -#define CAP_STRIDE(caps) ((caps >> 32) & 0xF) -#define CAP_MQES(caps) (caps & 0xFFFF) -#define CAP_CSS(caps) (caps & 0xFF) - -/* Controller Configuration */ -#define CONFIG_EN __BIT(0) -#define CONFIG_CSS_SHIFT 4 -#define CONFIG_IOSQES_SHIFT 16 -#define CONFIG_IOCQES_SHIFT 20 - -#define COMMAND_SIZE 64 /* In bytes (defined by spec) */ -#define STATUS_READY(status) (status & 1) - -struct nvme_common_cmd { - uint8_t opcode; - uint8_t flags; - uint16_t cid; - uint32_t nsid; - uint32_t cdw1[2]; - uint64_t metadata; - uint64_t prp1; - uint64_t prp2; - uint32_t cdw2[6]; -}; - -struct nvme_identify_cmd { - uint8_t opcode; - uint8_t flags; - uint16_t cid; - uint32_t nsid; - uint64_t unused1; - uint64_t unused2; - uint64_t prp1; - uint64_t prp2; - uint32_t cns; - uint32_t unused3[5]; -}; - -/* Read/write */ -struct nvme_rw_cmd { - uint8_t opcode; - uint8_t flags; - uint16_t cid; - uint32_t nsid; - uint64_t unused; - uint64_t metadata; - uint64_t prp1; - uint64_t prp2; - uint64_t slba; - uint16_t len; - uint16_t control; - uint32_t dsmgmt; - uint32_t ref; - uint16_t apptag; - uint16_t appmask; -}; - -/* Create I/O completion queue */ -struct nvme_create_iocq_cmd { - uint8_t opcode; - uint8_t flags; - uint16_t cid; - uint32_t unused1[5]; - uint64_t prp1; - uint64_t unused2; - uint16_t qid; - uint16_t qsize; - uint16_t qflags; - uint16_t irqvec; - uint64_t unused3[2]; -}; - -struct nvme_create_iosq_cmd { - uint8_t opcode; - uint8_t flags; - uint16_t cid; - uint32_t unused1[5]; - uint64_t prp1; - uint64_t unused2; - uint16_t sqid; - uint16_t qsize; - uint16_t qflags; - uint16_t cqid; - uint64_t unused3[2]; -}; - -struct nvme_cmd { - union { - struct nvme_identify_cmd identify; - struct nvme_common_cmd common; - struct nvme_create_iocq_cmd create_iocq; - struct nvme_create_iosq_cmd create_iosq; - struct nvme_rw_cmd rw; - }; -}; - -struct nvme_id { - uint16_t vid; - uint16_t ssvid; - char sn[20]; - char mn[40]; - char fr[8]; - uint8_t rab; - uint8_t ieee[3]; - uint8_t mic; - uint8_t mdts; - uint16_t ctrlid; - uint32_t version; - uint32_t unused1[43]; - uint16_t oacs; - uint8_t acl; - uint8_t aerl; - uint8_t fw; - uint8_t lpa; - uint8_t elpe; - uint8_t npss; - uint8_t avscc; - uint8_t apsta; - uint16_t wctemp; - uint16_t cctemp; - uint16_t unused2[121]; - uint8_t sqes; - uint8_t cqes; - uint16_t unused3; - uint32_t nn; - uint16_t oncs; - uint16_t fuses; - uint8_t fna; - uint8_t vwc; - uint16_t awun; - uint16_t awupf; - uint8_t nvscc; - uint8_t unused4; - uint16_t acwu; - uint16_t unused5; - uint32_t sgls; - uint32_t unused6[1401]; - uint8_t vs[1024]; -}; - -/* Command completion queue entry */ -struct nvme_cq_entry { - uint32_t res; - uint32_t unused; - uint16_t sqhead; - uint16_t sqid; - uint16_t cid; - uint16_t status; -}; - -/* NVMe controller */ -struct __packed nvme_bar { - uint64_t caps; - uint32_t version; - uint32_t intms; /* Interrupt mask set */ - uint32_t intmc; /* Interrupt mask clear */ - uint32_t config; - uint32_t unused1; - uint32_t status; - uint32_t unused2; - uint32_t aqa; /* Admin queue attributes */ - uint64_t asq; /* Admin submission queue */ - uint64_t acq; /* Admin completion queue */ -}; - -struct nvme_lbaf { - uint16_t ms; /* Number of metadata bytes per LBA */ - uint8_t ds; /* Data size */ - uint8_t rp; -}; - -/* Identify namespace data */ -struct nvme_id_ns { - uint64_t size; - uint64_t capabilities; - uint64_t nuse; - uint8_t features; - uint8_t nlbaf; - uint8_t flbas; - uint8_t mc; - uint8_t dpc; - uint8_t dps; - uint8_t nmic; - uint8_t rescap; - uint8_t fpi; - uint8_t unused1; - uint16_t nawun; - uint16_t nawupf; - uint16_t nacwu; - uint16_t nabsn; - uint16_t nabo; - uint16_t nabspf; - uint16_t unused2; - uint64_t nvmcap[2]; - uint64_t unusued3[5]; - uint8_t nguid[16]; - uint8_t eui64[8]; - struct nvme_lbaf lbaf[16]; - uint64_t unused3[24]; - uint8_t vs[3712]; -}; - -struct nvme_queue { - struct nvme_cmd *sq; /* Submission queue */ - struct nvme_cq_entry *cq; /* Completion queue */ - uint16_t sq_head; /* Submission queue head */ - uint16_t sq_tail; /* Submission queue tail */ - uint16_t cq_head; /* Completion queue head */ - uint8_t cq_phase : 1; /* Completion queue phase bit */ - uint16_t size; /* Size in elements */ - volatile uint32_t *sq_db; /* Submission doorbell */ - volatile uint32_t *cq_db; /* Completion doorbell */ -}; - -struct nvme_state { - struct nvme_queue adminq; - struct nvme_bar *bar; - dev_t major; -}; - -/* NVMe namespace */ -struct nvme_ns { - size_t nsid; /* Namespace ID */ - size_t lba_bsize; /* LBA block size */ - size_t size; /* Size in logical blocks */ - struct nvme_queue ioq; /* I/O queue */ - struct nvme_lbaf lba_fmt; /* LBA format */ - struct nvme_state *cntl; /* NVMe controller */ - dev_t dev_id; - TAILQ_ENTRY(nvme_ns) link; -}; - -#endif diff --git a/sys/include/dev/pci/pci.h b/sys/include/dev/pci/pci.h deleted file mode 100644 index d6edf3b..0000000 --- a/sys/include/dev/pci/pci.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora 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. - * 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. Neither the name of Hyra 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. - */ - -#ifndef _DEV_PCI_H_ -#define _DEV_PCI_H_ - -#include <sys/syscall.h> -#include <sys/queue.h> -#include <sys/cdefs.h> -#include <dev/pci/pciregs.h> -#include <vm/vm.h> - -/* Lookup bits */ -#define PCI_DEVICE_ID __BIT(0) -#define PCI_VENDOR_ID __BIT(1) -#define PCI_CLASS __BIT(2) -#define PCI_SUBCLASS __BIT(3) - -/* Base address masks for BARs */ -#define PCI_BAR_MEMMASK ~7 -#define PCI_BAR_IOMASK ~3 - -/* Macros to fetch base address from BAR */ -#define PCI_BAR_MEMBASE(BAR) PHYS_TO_VIRT(BAR & PCI_BAR_MEMMASK) -#define PCI_BAR_IOBASE(BAR) PHYS_TO_VIRT(BAR & PCI_BAR_IOMASK) - -/* For PCI lookups */ -struct pci_lookup { - uint16_t device_id; - uint16_t vendor_id; - uint8_t pci_class; - uint8_t pci_subclass; -}; - -struct pci_device { - uint8_t bus; - uint8_t slot; - uint8_t func; - - uint16_t device_id; - uint16_t vendor_id; - uint8_t pci_class; - uint8_t pci_subclass; - uint8_t prog_if; - uintptr_t bar[6]; - uint8_t irq_line; - TAILQ_ENTRY(pci_device) link; -}; - -int pci_init(void); -uint32_t pci_readl(struct pci_device *dev, uint32_t offset); -uint32_t pci_bar_size(struct pci_device *dev, uint8_t bar); -void pci_writel(struct pci_device *dev, uint32_t offset, uint32_t val); -void pci_set_cmdreg(struct pci_device *dev, uint16_t bits); -struct pci_device *pci_get_device(struct pci_lookup lookup, uint16_t lookup_type); - -#endif /* !_DEV_PCI_H_ */ diff --git a/sys/include/dev/pci/pciregs.h b/sys/include/dev/pci/pciregs.h deleted file mode 100644 index 13a9fc0..0000000 --- a/sys/include/dev/pci/pciregs.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora 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. - * 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. Neither the name of Hyra 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. - */ - -#ifndef _PCIREGS_H_ -#define _PCIREGS_H_ - -#include <sys/cdefs.h> - -#define PCIREG_VENDOR_ID 0x00 /* 16 bits */ -#define PCIREG_DEVICE_ID 0x02 /* 16 bits */ -#define PCIREG_CLASSREV 0x08 /* 32 bits */ -#define PCIREG_BAR0 0x10 /* 32 bits */ -#define PCIREG_BAR1 0x14 /* 32 bits */ -#define PCIREG_BAR2 0x18 /* 32 bits */ -#define PCIREG_BAR3 0x1C /* 32 bits */ -#define PCIREG_BAR4 0x20 /* 32 bits */ -#define PCIREG_BAR5 0x24 /* 32 bits */ -#define PCIREG_IRQLINE 0x3C /* 8 bits */ -#define PCIREG_CMDSTATUS 0x04 /* command (15:0), status (31:16) */ - -/* Macros to extract PCIREG_CLASSREV bits */ -#define PCIREG_CLASS(CLASSREV) (CLASSREV >> 24) -#define PCIREG_SUBCLASS(CLASSREV) ((CLASSREV >> 16) & 0xFF) -#define PCIREG_REVID(CLASSREV) (CLASSREV & 0xFF) -#define PCIREG_PROGIF(CLASSREV) ((CLASSREV >> 8) & 0xFF) - -/* Macros to extract PCIREG_CMDSTATUS bits */ -#define PCIREG_COMMAND(CMDSTATUS) (CMDSTATUS & 0xFFFF) -#define PCIREG_STATUS(CMDSTATUS) (CMDSTATUS >> 16) - -/* PCI command register bits */ -#define PCI_IO_SPACE __BIT(0) /* Respond to I/O space accesses */ -#define PCI_MEM_SPACE __BIT(1) /* Respond to mem space accesses */ -#define PCI_BUS_MASTERING __BIT(2) /* Enable bus mastering */ - -/* PCI status register bits */ -#define PCI_STATUS_CAPLIST __BIT(4) -#define PCI_STATUS_66MHZ __BIT(5) - -#endif /* !_PCIREGS_H_ */ diff --git a/sys/include/dev/pci/pcivar.h b/sys/include/dev/pci/pcivar.h deleted file mode 100644 index ba45a53..0000000 --- a/sys/include/dev/pci/pcivar.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora 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. - * 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. Neither the name of Hyra 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. - */ - -#ifndef _DEV_PCIVAR_H_ -#define _DEV_PCIVAR_H_ - -#include <sys/types.h> - -enum { - PCI_ACCESS_CAM, - PCI_ACCESS_ECAM -}; - -#endif /* !_DEV_PCIVAR_H_ */ diff --git a/sys/include/dev/usb/xhciregs.h b/sys/include/dev/usb/xhciregs.h deleted file mode 100644 index 0b07524..0000000 --- a/sys/include/dev/usb/xhciregs.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora 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. - * 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. Neither the name of Hyra 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. - */ - -#ifndef _USB_XHCIREGS_H_ -#define _USB_XHCIREGS_H_ - -#include <sys/types.h> -#include <sys/cdefs.h> - -/* - * Host Controller Capability Registers - * - * See xHCI spec, section 5.3, table 5-9 - */ -struct __packed xhci_caps { - volatile uint8_t caplength; - volatile uint8_t reserved; - volatile uint16_t hciversion; - volatile uint32_t hcsparams1; - volatile uint32_t hcsparams2; - volatile uint32_t hcsparams3; - volatile uint32_t hccparams1; - volatile uint32_t dboff; - volatile uint32_t rtsoff; - volatile uint32_t hccparams2; -}; - -/* - * Host Controller Operational Registers - * - * See xHCI spec, section 5.4, table 5-18 - */ -struct __packed xhci_opregs { - volatile uint32_t usbcmd; - volatile uint32_t usbsts; - volatile uint32_t pagesize; - volatile uint32_t reserved; - volatile uint32_t reserved1; - volatile uint32_t dnctrl; - volatile uint64_t cmd_ring; - volatile uint32_t reserved2[4]; - volatile uint64_t dcbaa_ptr; - volatile uint32_t config; -}; - -/* USBCMD bits */ -#define USBCMD_RUN __BIT(0) /* Run/stop */ -#define USBCMD_HCRST __BIT(1) /* xHC reset */ - -/* USBSTS bits */ -#define USBSTS_HCH __BIT(0) /* HC halted */ - -/* CAPS.HCSPARAMS1 fields */ -#define XHCI_MAXSLOTS(HCSPARAMS1) (HCSPARAMS1 & 0xFF) -#define XHCI_MAXPORTS(HCSPARAMS1) ((HCSPARAMS1 >> 24) & 0xFF) -#define XHCI_ECP(HCCPARAMS1) ((HCCPARAMS1 >> 16) & 0xFFFF) - -/* CAPS.HCSPARAMS2 fields */ -#define XHCI_MAX_SP_HI(HCSPARAMS2) ((HCSPARAMS2 >> 25) & 0x1F) -#define XHCI_MAX_SP_LO(HCSPARAMS2) ((HCSPARAMS2 >> 31) & 0x1F) - -/* PORTSC bits */ -#define XHCI_PORTSC_CCS __BIT(0) /* Current connect status */ -#define XHCI_PORTSC_PR __BIT(4) /* Port reset */ - -/* Registers */ -#define XHCI_BASE_OFF(BASE, OFF) (void *)((uintptr_t)BASE + OFF) -#define XHCI_CAPS(BASE) XHCI_BASE_OFF(BASE, 0) -#define XHCI_OPBASE(BASE, CAP_LEN) XHCI_BASE_OFF(BASE, CAP_LEN) -#define XHCI_RTS(BASE, RTSOFF) XHCI_BASE_OFF(BASE, RTSOFF) -#define XHCI_CMD_DB(BASE, DBOFF) XHCI_BASE_OFF(BASE, DBOFF) - -/* Support protocol cap fields */ -#define XHCI_PROTO_ID(PROTO) (PROTO & 0xFF) -#define XHCI_PROTO_MINOR(PROTO) ((PROTO >> 16) & 0xFF) -#define XHCI_PROTO_MAJOR(PROTO) ((PROTO >> 24) & 0xFF) -#define XHCI_PROTO_NEXT(PROTO) ((PROTO >> 8) & 0xFF) -#define XHCI_PROTO_PORTOFF(PROTO2) (PROTO2 & 0xFF) -#define XHCI_PROTO_PORTCNT(PROTO2) ((PROTO2 >> 8) & 0xFF) - -/* Extended cap IDs */ -#define XHCI_ECAP_PROTO 2 - -#endif /* !_USB_XHCIREGS_H_ */ diff --git a/sys/include/dev/usb/xhcivar.h b/sys/include/dev/usb/xhcivar.h deleted file mode 100644 index 71c1f20..0000000 --- a/sys/include/dev/usb/xhcivar.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora 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. - * 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. Neither the name of Hyra 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. - */ - -#ifndef _USB_XHCIVAR_H_ -#define _USB_XHCIVAR_H_ - -#include <sys/types.h> -#include <sys/cdefs.h> -#include <dev/usb/xhciregs.h> - -#define XHCI_TIMEOUT 500 /* In ms */ -#define XHCI_CMDRING_LEN 16 -#define XHCI_EVRING_LEN 16 -#define XHCI_TRB_SIZE 16 /* In bytes */ -#define XHCI_EVENTRING_LEN XHCI_CMDRING_LEN -#define XHCI_MAX_PROTOS 4 - -struct xhci_nop_trb { - uint32_t reserved; - uint32_t reserved1; - uint32_t reserved2; - uint8_t cycle : 1; - uint16_t reserved3 : 9; - uint8_t type : 6; - uint16_t reserved4; -}; - -/* - * xHCI Transfer Request Block - */ -struct xhci_trb { - union { - struct xhci_nop_trb nop; - struct { - uint32_t dword0; - uint32_t dword1; - uint32_t dword2; - uint32_t dword3; - }; - }; -}; - -/* - * USB proto (USB 2.0 or 3.0) - */ -struct xhci_proto { - uint8_t major; /* Revision major */ - uint8_t port_start; /* Port offset start */ - uint8_t port_count; /* Number of ports */ -}; - -/* - * xHCI event ring segment - * - * See xHCI spec, section 6.5, table 6-40 - */ -struct __packed xhci_evring_segment { - uint64_t base; - uint32_t size; - uint32_t reserved; -}; - -/* - * Host controller. - */ -struct xhci_hc { - void *base; - uint8_t caplen; - uint8_t maxslots; - size_t maxports; - size_t protocnt; - uintptr_t *dcbaap; - uint8_t cycle : 1; - uint16_t cmd_ptr; /* Command ring index */ - uint16_t cmd_count; /* Command ring entry count */ - uint32_t *cmd_ring; - uint32_t *event_ring; - struct xhci_opregs *opregs; - struct xhci_proto protos[XHCI_MAX_PROTOS]; - struct xhci_evring_segment *evring_seg; -}; - -/* TRB types */ -#define XHCI_ENABLE_SLOT 9 -#define XHCI_LINK 6 - -#endif /* !_USB_XHCIVAR_H_ */ diff --git a/sys/include/dev/vcons/vcons.h b/sys/include/dev/vcons/vcons.h deleted file mode 100644 index 492940f..0000000 --- a/sys/include/dev/vcons/vcons.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora 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. - * 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. Neither the name of Hyra 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. - */ - -#ifndef _DEV_VCONS_H_ -#define _DEV_VCONS_H_ - -#include <sys/types.h> -#include <sys/termios.h> -#include <dev/video/fbdev.h> -#include <sysfont.h> - -#define VCONS_TAB_WIDTH 4 -#define VCONS_CURSOR_WIDTH FONT_WIDTH -#define VCONS_CURSOR_HEIGHT FONT_HEIGHT - -struct vcons_cursor { - size_t xpos, ypos; - uint32_t rgb; - - /* Internal */ - uint32_t old_xpos, old_ypos; - volatile bool is_drawing; - volatile bool is_drawn; /* If it has been drawn before */ -}; - -struct vcons_screen { - size_t nrows, ncols; - size_t cpy_x, cpy_y; /* In chars */ - size_t cpy_len; - - uint32_t bg; - uint32_t fg; - void *fbdev_mem; - - struct fbdev fbdev; - struct vcons_cursor cursor; -}; - -#define is_cursor_drawing(screenptr) (screenptr)->cursor.is_drawing - -void vcons_attach(struct vcons_screen *scr); -int vcons_putch(struct vcons_screen *scr, char c); -int vcons_putstr(struct vcons_screen *scr, const char *s, size_t len); -void vcons_update_cursor(struct vcons_screen *scr); - -#endif /* !_DEV_VCONS_H_ */ diff --git a/sys/include/dev/vcons/vcons_io.h b/sys/include/dev/vcons/vcons_io.h deleted file mode 100644 index a75d811..0000000 --- a/sys/include/dev/vcons/vcons_io.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora 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. - * 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. Neither the name of Hyra 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. - */ - -#ifndef _VCONS_IO_H_ -#define _VCONS_IO_H_ - -#include <dev/vcons/vcons.h> - -int vcons_process_output(struct vcons_screen *scr, int c); - -#endif /* !_VCONS_IO_H_ */ diff --git a/sys/include/dev/video/fbdev.h b/sys/include/dev/video/fbdev.h deleted file mode 100644 index 5ad6bf6..0000000 --- a/sys/include/dev/video/fbdev.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2023-2024 Ian Marco Moffett and the Osmora 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. - * 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. Neither the name of Hyra 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 COPYRIGHT HOLDERS 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 COPYRIGHT OWNER 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. - */ - -#ifndef _FBDEV_H_ -#define _FBDEV_H_ - -#include <sys/types.h> -#include <sys/fbdev.h> - -struct fbdev { - void *mem; - uint32_t width; - uint32_t height; - uint32_t pitch; -}; - -static inline size_t -fbdev_get_index(const struct fbdev *fbdev, uint32_t x, uint32_t y) -{ - return x + y * (fbdev->pitch/4); -} - -struct fbdev fbdev_get_front(void); - -#endif /* !_FBDEV_H_ */ |