18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* io-unit.h: Definitions for the sun4d IO-UNIT. 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Copyright (C) 1997,1998 Jakub Jelinek (jj@sunsite.mff.cuni.cz) 58c2ecf20Sopenharmony_ci */ 68c2ecf20Sopenharmony_ci#ifndef _SPARC_IO_UNIT_H 78c2ecf20Sopenharmony_ci#define _SPARC_IO_UNIT_H 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#include <linux/spinlock.h> 108c2ecf20Sopenharmony_ci#include <linux/pgtable.h> 118c2ecf20Sopenharmony_ci#include <asm/page.h> 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci/* The io-unit handles all virtual to physical address translations 148c2ecf20Sopenharmony_ci * that occur between the SBUS and physical memory. Access by 158c2ecf20Sopenharmony_ci * the cpu to IO registers and similar go over the xdbus so are 168c2ecf20Sopenharmony_ci * translated by the on chip SRMMU. The io-unit and the srmmu do 178c2ecf20Sopenharmony_ci * not need to have the same translations at all, in fact most 188c2ecf20Sopenharmony_ci * of the time the translations they handle are a disjunct set. 198c2ecf20Sopenharmony_ci * Basically the io-unit handles all dvma sbus activity. 208c2ecf20Sopenharmony_ci */ 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci/* AIEEE, unlike the nice sun4m, these monsters have 238c2ecf20Sopenharmony_ci fixed DMA range 64M */ 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci#define IOUNIT_DMA_BASE 0xfc000000 /* TOP - 64M */ 268c2ecf20Sopenharmony_ci#define IOUNIT_DMA_SIZE 0x04000000 /* 64M */ 278c2ecf20Sopenharmony_ci/* We use last 1M for sparc_dvma_malloc */ 288c2ecf20Sopenharmony_ci#define IOUNIT_DVMA_SIZE 0x00100000 /* 1M */ 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci/* The format of an iopte in the external page tables */ 318c2ecf20Sopenharmony_ci#define IOUPTE_PAGE 0xffffff00 /* Physical page number (PA[35:12]) */ 328c2ecf20Sopenharmony_ci#define IOUPTE_CACHE 0x00000080 /* Cached (in Viking/MXCC) */ 338c2ecf20Sopenharmony_ci/* XXX Jakub, find out how to program SBUS streaming cache on XDBUS/sun4d. 348c2ecf20Sopenharmony_ci * XXX Actually, all you should need to do is find out where the registers 358c2ecf20Sopenharmony_ci * XXX are and copy over the sparc64 implementation I wrote. There may be 368c2ecf20Sopenharmony_ci * XXX some horrible hwbugs though, so be careful. -DaveM 378c2ecf20Sopenharmony_ci */ 388c2ecf20Sopenharmony_ci#define IOUPTE_STREAM 0x00000040 /* Translation can use streaming cache */ 398c2ecf20Sopenharmony_ci#define IOUPTE_INTRA 0x00000008 /* SBUS direct slot->slot transfer */ 408c2ecf20Sopenharmony_ci#define IOUPTE_WRITE 0x00000004 /* Writeable */ 418c2ecf20Sopenharmony_ci#define IOUPTE_VALID 0x00000002 /* IOPTE is valid */ 428c2ecf20Sopenharmony_ci#define IOUPTE_PARITY 0x00000001 /* Parity is checked during DVMA */ 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_cistruct iounit_struct { 458c2ecf20Sopenharmony_ci unsigned long bmap[(IOUNIT_DMA_SIZE >> (PAGE_SHIFT + 3)) / sizeof(unsigned long)]; 468c2ecf20Sopenharmony_ci spinlock_t lock; 478c2ecf20Sopenharmony_ci iopte_t __iomem *page_table; 488c2ecf20Sopenharmony_ci unsigned long rotor[3]; 498c2ecf20Sopenharmony_ci unsigned long limit[4]; 508c2ecf20Sopenharmony_ci}; 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ci#define IOUNIT_BMAP1_START 0x00000000 538c2ecf20Sopenharmony_ci#define IOUNIT_BMAP1_END (IOUNIT_DMA_SIZE >> (PAGE_SHIFT + 1)) 548c2ecf20Sopenharmony_ci#define IOUNIT_BMAP2_START IOUNIT_BMAP1_END 558c2ecf20Sopenharmony_ci#define IOUNIT_BMAP2_END IOUNIT_BMAP2_START + (IOUNIT_DMA_SIZE >> (PAGE_SHIFT + 2)) 568c2ecf20Sopenharmony_ci#define IOUNIT_BMAPM_START IOUNIT_BMAP2_END 578c2ecf20Sopenharmony_ci#define IOUNIT_BMAPM_END ((IOUNIT_DMA_SIZE - IOUNIT_DVMA_SIZE) >> PAGE_SHIFT) 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ci#endif /* !(_SPARC_IO_UNIT_H) */ 60