/*-1* SPDX-License-Identifier: BSD-4-Clause2*3* Copyright (c) 1996, Sujal M. Patel4* All rights reserved.5*6* Redistribution and use in source and binary forms, with or without7* modification, are permitted provided that the following conditions8* are met:9* 1. Redistributions of source code must retain the above copyright10* notice, this list of conditions and the following disclaimer.11* 2. Redistributions in binary form must reproduce the above copyright12* notice, this list of conditions and the following disclaimer in the13* documentation and/or other materials provided with the distribution.14* 3. All advertising materials mentioning features or use of this software15* must display the following acknowledgement:16* This product includes software developed by Sujal M. Patel17* 4. Neither the name of the author nor the names of any co-contributors18* may be used to endorse or promote products derived from this software19* without specific prior written permission.20*21* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND22* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE23* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE24* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE25* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL26* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS27* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)28* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT29* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY30* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF31* SUCH DAMAGE.32* from: pnp.h,v 1.7 1998/09/13 22:15:44 eivind Exp33*/3435#ifndef _ISA_PNPREG_H_36#define _ISA_PNPREG_H_3738/* Maximum Number of PnP Devices. 8 should be plenty */39#define PNP_MAX_CARDS 84041/* Static ports to access PnP state machine */42#define _PNP_ADDRESS 0x27943#define _PNP_WRITE_DATA 0xa794445/* PnP Registers. Write to ADDRESS and then use WRITE/READ_DATA */46#define PNP_SET_RD_DATA 0x0047/***48Writing to this location modifies the address of the port used for49reading from the Plug and Play ISA cards. Bits[7:0] become I/O50read port address bits[9:2]. Reads from this register are ignored.51***/5253#define PNP_SERIAL_ISOLATION 0x0154/***55A read to this register causes a Plug and Play cards in the Isolation56state to compare one bit of the boards ID.57This register is read only.58***/5960#define PNP_CONFIG_CONTROL 0x0261#define PNP_CONFIG_CONTROL_RESET_CSN 0x0462#define PNP_CONFIG_CONTROL_WAIT_FOR_KEY 0x0263#define PNP_CONFIG_CONTROL_RESET 0x0164/***65Bit[2] Reset CSN to 066Bit[1] Return to the Wait for Key state67Bit[0] Reset all logical devices and restore configuration68registers to their power-up values.6970A write to bit[0] of this register performs a reset function on71all logical devices. This resets the contents of configuration72registers to their default state. All card's logical devices73enter their default state and the CSN is preserved.7475A write to bit[1] of this register causes all cards to enter the76Wait for Key state but all CSNs are preserved and logical devices77are not affected.7879A write to bit[2] of this register causes all cards to reset their80CSN to zero .8182This register is write-only. The values are not sticky, that is,83hardware will automatically clear them and there is no need for84software to clear the bits.85***/8687#define PNP_WAKE 0x0388/***89A write to this port will cause all cards that have a CSN that90matches the write data[7:0] to go from the Sleep state to the either91the Isolation state if the write data for this command is zero or92the Config state if the write data is not zero. Additionally, the93pointer to the byte-serial device is reset. This register is94writeonly.95***/9697#define PNP_RESOURCE_DATA 0x0498/***99A read from this address reads the next byte of resource information.100The Status register must be polled until bit[0] is set before this101register may be read. This register is read only.102***/103104#define PNP_STATUS 0x05105/***106Bit[0] when set indicates it is okay to read the next data byte107from the Resource Data register. This register is readonly.108***/109110#define PNP_SET_CSN 0x06111/***112A write to this port sets a card's CSN. The CSN is a value uniquely113assigned to each ISA card after the serial identification process114so that each card may be individually selected during a Wake[CSN]115command. This register is read/write.116***/117118#define PNP_SET_LDN 0x07119/***120Selects the current logical device. All reads and writes of memory,121I/O, interrupt and DMA configuration information access the registers122of the logical device written here. In addition, the I/O Range123Check and Activate commands operate only on the selected logical124device. This register is read/write. If a card has only 1 logical125device, this location should be a read-only value of 0x00.126***/127128/*** addresses 0x08 - 0x1F Card Level Reserved for future use ***/129/*** addresses 0x20 - 0x2F Card Level, Vendor Defined ***/130131#define PNP_ACTIVATE 0x30132/***133For each logical device there is one activate register that controls134whether or not the logical device is active on the ISA bus. Bit[0],135if set, activates the logical device. Bits[7:1] are reserved and136must return 0 on reads. This is a read/write register. Before a137logical device is activated, I/O range check must be disabled.138***/139140#define PNP_IO_RANGE_CHECK 0x31141#define PNP_IO_RANGE_CHECK_ENABLE 0x02142#define PNP_IO_RANGE_CHECK_READ_AS_55 0x01143/***144This register is used to perform a conflict check on the I/O port145range programmed for use by a logical device.146147Bit[7:2] Reserved and must return 0 on reads148Bit[1] Enable I/O Range check, if set then I/O Range Check149is enabled. I/O range check is only valid when the logical150device is inactive.151152Bit[0], if set, forces the logical device to respond to I/O reads153of the logical device's assigned I/O range with a 0x55 when I/O154range check is in operation. If clear, the logical device drives1550xAA. This register is read/write.156***/157158/*** addr 0x32 - 0x37 Logical Device Control Reserved for future use ***/159/*** addr 0x38 - 0x3F Logical Device Control Vendor Define ***/160161#define PNP_MEM_BASE_HIGH(i) (0x40 + 8*(i))162#define PNP_MEM_BASE_LOW(i) (0x41 + 8*(i))163#define PNP_MEM_CONTROL(i) (0x42 * 8*(i))164#define PNP_MEM_CONTROL_16BIT 0x2165#define PNP_MEM_CONTROL_LIMIT 0x1166#define PNP_MEM_RANGE_HIGH(i) (0x43 + 8*(i))167#define PNP_MEM_RANGE_LOW(i) (0x44 + 8*(i))168/***169Four memory resource registers per range, four ranges.170Fill with 0 if no ranges are enabled.171172Offset 0: RW Memory base address bits[23:16]173Offset 1: RW Memory base address bits[15:8]174Offset 2: Memory control175Bit[1] specifies 8/16-bit control. This bit is set to indicate17616-bit memory, and cleared to indicate 8-bit memory.177Bit[0], if cleared, indicates the next field can be used as a range178length for decode (implies range length and base alignment of memory179descriptor are equal).180Bit[0], if set, indicates the next field is the upper limit for181the address. - - Bit[0] is read-only.182Offset 3: RW upper limit or range len, bits[23:16]183Offset 4: RW upper limit or range len, bits[15:8]184Offset 5-Offset 7: filler, unused.185***/186187#define PNP_IO_BASE_HIGH(i) (0x60 + 2*(i))188#define PNP_IO_BASE_LOW(i) (0x61 + 2*(i))189/***190Eight ranges, two bytes per range.191Offset 0: I/O port base address bits[15:8]192Offset 1: I/O port base address bits[7:0]193***/194195#define PNP_IRQ_LEVEL(i) (0x70 + 2*(i))196#define PNP_IRQ_TYPE(i) (0x71 + 2*(i))197/***198Two entries, two bytes per entry.199Offset 0: RW interrupt level (1..15, 0=unused).200Offset 1: Bit[1]: level(1:hi, 0:low),201Bit[0]: type (1:level, 0:edge)202byte 1 can be readonly if 1 type of int is used.203***/204205#define PNP_DMA_CHANNEL(i) (0x74 + 1*(i))206/***207Two entries, one byte per entry. Bits[2:0] select208which DMA channel is in use for DMA 0. Zero selects DMA channel2090, seven selects DMA channel 7. DMA channel 4, the cascade channel210is used to indicate no DMA channel is active.211***/212213/*** 32-bit memory accesses are at 0x76 ***/214215/* Macros to parse Resource IDs */216#define PNP_RES_TYPE(a) (a >> 7)217#define PNP_SRES_NUM(a) (a >> 3)218#define PNP_SRES_LEN(a) (a & 0x07)219#define PNP_LRES_NUM(a) (a & 0x7f)220221/* Small Resource Item names */222#define PNP_TAG_VERSION 0x1223#define PNP_TAG_LOGICAL_DEVICE 0x2224#define PNP_TAG_COMPAT_DEVICE 0x3225#define PNP_TAG_IRQ_FORMAT 0x4226#define PNP_TAG_DMA_FORMAT 0x5227#define PNP_TAG_START_DEPENDANT 0x6228#define PNP_TAG_END_DEPENDANT 0x7229#define PNP_TAG_IO_RANGE 0x8230#define PNP_TAG_IO_FIXED 0x9231#define PNP_TAG_RESERVED 0xa-0xd232#define PNP_TAG_VENDOR 0xe233#define PNP_TAG_END 0xf234235/* Large Resource Item names */236#define PNP_TAG_MEMORY_RANGE 0x1237#define PNP_TAG_ID_ANSI 0x2238#define PNP_TAG_ID_UNICODE 0x3239#define PNP_TAG_LARGE_VENDOR 0x4240#define PNP_TAG_MEMORY32_RANGE 0x5241#define PNP_TAG_MEMORY32_FIXED 0x6242#define PNP_TAG_LARGE_RESERVED 0x7-0x7f243244#endif /* !_ISA_PNPREG_H_ */245246247