/* SPDX-License-Identifier: GPL-2.0 */ /* header file for DIO boards for the HP300 architecture. *MaybethisshouldhandleDIO-IIlater? *Thegeneralstructureofthisisvaguelybasedonhow *theAmigaporthandlesZorroboards. *Copyright(C)PeterMaydell05/1998<pmaydell@chiark.greenend.org.uk> *ConvertedtodrivermodelJochenFriedrich<jochen@scram.de> * *TheboardIDsarefromtheNetBSDkernel,whichforonceprovided *helpfulcomments... * *Thisgoeswithdrivers/dio/dio.c
*/
#ifndef _LINUX_DIO_H #define _LINUX_DIO_H
/* The DIO boards in a system are distinguished by 'select codes' which *rangefrom0-63(DIO)and132-255(DIO-II). *TheDIOboardwithselectcodescislocatedatphysicaladdress *0x600000+sc*0x10000 *SoDIOcardscover[0x600000-0x800000);theareas[0x200000-0x400000)and *[0x800000-0x1000000)areforadditionalspacerequiredbythings *likeframebuffers.[0x400000-0x600000)isformiscellaneousinternalI/O. *OnLinux,thisiscurrentlyallmappedintothevirtualaddressspace *at0xf0000000onbootup. *DIO-IIboardsareat0x1000000+(sc-132)*0x400000 *whichisaddressrange[0x1000000-0x20000000)--toobigtomapcompletely, *socurrentlywejustdon'thandleDIO-IIboards.Itwouldn'tbehardto *dowithioremap()though.
*/
#include <linux/device.h>
#ifdef __KERNEL__
#include <asm/hp300hw.h>
typedef __u16 dio_id;
/* *DIOdevices
*/
struct dio_dev { struct dio_bus *bus;
dio_id id; int scode; struct dio_driver *driver; /* which driver has allocated this device */ struct device dev; /* Generic device interface */
u8 ipl; char name[64]; struct resource resource;
};
struct dio_bus { struct list_head devices; /* list of devices on this bus */ unsignedint num_resources; /* number of resources */ struct resource resources[2]; /* address space routed to this bus */ struct device dev; char name[10];
};
externstruct dio_bus dio_bus; /* Single DIO bus */ externconststruct bus_type dio_bus_type;
/* *DIOdeviceIDs
*/
struct dio_device_id {
dio_id id; /* Device ID or DIO_WILDCARD */ unsignedlong driver_data; /* Data private to the driver */
};
/* *DIOdevicedrivers
*/
struct dio_driver { struct list_head node; char *name; conststruct dio_device_id *id_table; /* NULL if wants all devices */ int (*probe)(struct dio_dev *z, conststruct dio_device_id *id); /* New device inserted */ void (*remove)(struct dio_dev *z); /* Device removed (NULL if not a hot-plug capable driver) */ struct device_driver driver;
};
/* DIO/DIO-II boards all have the following 8bit registers. *Theseareoffsetsfromthebaseofthedevice.
*/ #define DIO_IDOFF 0x01 /* primary device ID */ #define DIO_IPLOFF 0x03 /* interrupt priority level */ #define DIO_SECIDOFF 0x15 /* secondary device ID */ #define DIOII_SIZEOFF 0x101 /* device size, DIO-II only */ #define DIO_VIRADDRBASE 0xf0000000UL /* vir addr where IOspace is mapped */
#define DIO_BASE 0x600000 /* start of DIO space */ #define DIO_END 0x1000000 /* end of DIO space */ #define DIO_DEVSIZE 0x10000 /* size of a DIO device */
#define DIOII_BASE 0x01000000 /* start of DIO-II space */ #define DIOII_END 0x20000000 /* end of DIO-II space */ #define DIOII_DEVSIZE 0x00400000 /* size of a DIO-II device */
/* Highest valid select code. If we add DIO-II support this should become *256foreverythingexceptHP320,whichonlyhasDIO.
*/ #define DIO_SCMAX (hp300_model == HP_320 ? 32 : 256) #define DIOII_SCBASE 132/* lowest DIO-II select code */ #define DIO_SCINHOLE(scode) (((scode) >= 32) && ((scode) < DIOII_SCBASE)) #define DIO_ISDIOII(scode) ((scode) >= 132 && (scode) < 256)
/* macros to read device IDs, given base address */ #define DIO_ID(baseaddr) in_8((baseaddr) + DIO_IDOFF) #define DIO_SECID(baseaddr) in_8((baseaddr) + DIO_SECIDOFF)
/* find the size of a DIO-II board's address space. *DIOboardsareallfixedlength.
*/ #define DIOII_SIZE(baseaddr) ((in_8((baseaddr) + DIOII_SIZEOFF) + 1) * 0x100000)
/* general purpose macro for both DIO and DIO-II */ #define DIO_SIZE(scode, base) (DIO_ISDIOII((scode)) ? DIOII_SIZE((base)) : DIO_DEVSIZE)
/* The hardware has primary and secondary IDs; we encode these in a single *intasPRIMARYID&(SECONDARYID<<8). *Inpracticethisisonlyimportantforframebuffers, *andeverybodyelsejustsetsIDfieldsequaltotheDIO_ID_FOOvalue.
*/ #define DIO_ENCODE_ID(pr,sec) ((((int)sec & 0xff) << 8) | ((int)pr & 0xff)) /* macro to determine whether a given primary ID requires a secondary ID byte */ #define DIO_NEEDSSECID(id) ((id) == DIO_ID_FBUFFER) #define DIO_WILDCARD 0xff
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.