Module Name: src
Committed By: tsutsui
Date: Sat May 4 08:20:06 UTC 2019
Modified Files:
src/sys/arch/atari/pci: pci_hades.c pci_machdep.c pci_milan.c
pci_tseng.c pci_vga.c pci_vga.h pciide_machdep.c
Log Message:
Misc KNF.
No binary changes on HADES and MILAN-PCIIDE kernels.
To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/atari/pci/pci_hades.c \
src/sys/arch/atari/pci/pci_vga.c
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/atari/pci/pci_machdep.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/atari/pci/pci_milan.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/atari/pci/pci_tseng.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/atari/pci/pci_vga.h
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/atari/pci/pciide_machdep.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/atari/pci/pci_hades.c
diff -u src/sys/arch/atari/pci/pci_hades.c:1.14 src/sys/arch/atari/pci/pci_hades.c:1.15
--- src/sys/arch/atari/pci/pci_hades.c:1.14 Fri Oct 2 05:22:50 2015
+++ src/sys/arch/atari/pci/pci_hades.c Sat May 4 08:20:05 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_hades.c,v 1.14 2015/10/02 05:22:50 msaitoh Exp $ */
+/* $NetBSD: pci_hades.c,v 1.15 2019/05/04 08:20:05 tsutsui Exp $ */
/*
* Copyright (c) 1996 Leo Weppelman. All rights reserved.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_hades.c,v 1.14 2015/10/02 05:22:50 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_hades.c,v 1.15 2019/05/04 08:20:05 tsutsui Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -58,7 +58,8 @@ __KERNEL_RCSID(0, "$NetBSD: pci_hades.c,
int
pci_bus_maxdevs(pci_chipset_tag_t pc, int busno)
{
- return (4);
+
+ return 4;
}
static int pci_config_offset(pcitag_t);
@@ -66,35 +67,37 @@ static int pci_config_offset(pcitag_t);
/*
* Atari_init.c maps the config areas PAGE_SIZE bytes apart....
*/
-static int pci_config_offset(pcitag_t tag)
+static int
+pci_config_offset(pcitag_t tag)
{
- int device;
+ int device;
device = (tag >> 11) & 0x1f;
- return(device * PAGE_SIZE);
+
+ return device * PAGE_SIZE;
}
pcireg_t
pci_conf_read(pci_chipset_tag_t pc, pcitag_t tag, int reg)
{
- u_long data;
+ uint32_t data;
- if ((unsigned int)reg >= PCI_CONF_SIZE)
- return ((pcireg_t) -1);
+ if ((uint32_t)reg >= PCI_CONF_SIZE)
+ return 0xffffffff;
- data = *(u_long *)(pci_conf_addr + pci_config_offset(tag) + reg);
- return (bswap32(data));
+ data = *(uint32_t *)(pci_conf_addr + pci_config_offset(tag) + reg);
+ return bswap32(data);
}
void
pci_conf_write(pci_chipset_tag_t pc, pcitag_t tag, int reg, pcireg_t data)
{
- if ((unsigned int)reg >= PCI_CONF_SIZE)
+ if ((uint32_t)reg >= PCI_CONF_SIZE)
return;
- *((u_long *)(pci_conf_addr + pci_config_offset(tag) + reg))
- = bswap32(data);
+ *((uint32_t *)(pci_conf_addr + pci_config_offset(tag) + reg))
+ = bswap32(data);
}
/*
@@ -105,13 +108,13 @@ pci_conf_write(pci_chipset_tag_t pc, pci
*/
static pci_intr_info_t iinfo[4] = { { -1 }, { -1 }, { -1 }, { -1 } };
-static int iifun(int, int);
+static int iifun(int, int);
static int
iifun(int slot, int sr)
{
pci_intr_info_t *iinfo_p;
- int s;
+ int s;
iinfo_p = &iinfo[slot];
@@ -125,10 +128,9 @@ iifun(int slot, int sr)
* We're running at a too high priority now.
*/
add_sicallback((si_farg)iifun, (void*)slot, 0);
- }
- else {
+ } else {
s = splx(iinfo_p->ipl);
- (void) (iinfo_p->ifunc)(iinfo_p->iarg);
+ (void)(iinfo_p->ifunc)(iinfo_p->iarg);
splx(s);
/*
@@ -141,7 +143,7 @@ iifun(int slot, int sr)
int
pci_intr_setattr(pci_chipset_tag_t pc, pci_intr_handle_t *ih,
- int attr, uint64_t data)
+ int attr, uint64_t data)
{
switch (attr) {
@@ -153,20 +155,21 @@ pci_intr_setattr(pci_chipset_tag_t pc, p
}
void *
-pci_intr_establish(pci_chipset_tag_t pc, pci_intr_handle_t ih, int level, int (*ih_fun)(void *), void *ih_arg)
+pci_intr_establish(pci_chipset_tag_t pc, pci_intr_handle_t ih, int level,
+ int (*ih_fun)(void *), void *ih_arg)
{
pci_intr_info_t *iinfo_p;
struct intrhand *ihand;
- int slot;
+ int slot;
slot = ih;
iinfo_p = &iinfo[slot];
if (iinfo_p->ipl > 0)
- panic("pci_intr_establish: interrupt was already established");
+ panic("pci_intr_establish: interrupt was already established");
ihand = intr_establish((slot == 3) ? 23 : 16 + slot, USER_VEC, 0,
- (hw_ifun_t)iifun, (void *)slot);
+ (hw_ifun_t)iifun, (void *)slot);
if (ihand != NULL) {
iinfo_p->ipl = level;
iinfo_p->imask = (slot == 3) ? 0x80 : (0x01 << slot);
@@ -179,7 +182,7 @@ pci_intr_establish(pci_chipset_tag_t pc,
*/
MFP2->mf_imrb |= iinfo_p->imask;
MFP2->mf_ierb |= iinfo_p->imask;
- return(iinfo_p);
+ return iinfo_p;
}
return NULL;
}
@@ -190,11 +193,11 @@ pci_intr_disestablish(pci_chipset_tag_t
pci_intr_info_t *iinfo_p = (pci_intr_info_t *)cookie;
if (iinfo->ipl < 0)
- panic("pci_intr_disestablish: interrupt was not established");
+ panic("pci_intr_disestablish: interrupt was not established");
MFP2->mf_imrb &= ~iinfo->imask;
MFP2->mf_ierb &= ~iinfo->imask;
- (void) intr_disestablish(iinfo_p->ihand);
+ (void)intr_disestablish(iinfo_p->ihand);
iinfo_p->ipl = -1;
}
@@ -203,25 +206,30 @@ pci_intr_disestablish(pci_chipset_tag_t
*/
#define PCI_LINMEMBASE 0x0e000000
-static u_char crt_tab[] = {
+static uint8_t crt_tab[] = {
0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f,
0x00, 0x4f, 0x0d, 0x0e, 0x00, 0x00, 0x00, 0x00,
0x9c, 0x8e, 0x8f, 0x28, 0x1f, 0x96, 0xb9, 0xa3,
0xff };
-static u_char seq_tab[] = {
- 0x03, 0x00, 0x03, 0x00, 0x02, 0x00, 0x00, 0x00 };
-
-static u_char attr_tab[] = {
- 0x0c, 0x00, 0x0f, 0x08, 0x00, 0x00, 0x00, 0x00 };
-
-static u_char gdc_tab[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00, 0xff };
+static uint8_t seq_tab[] = {
+ 0x03, 0x00, 0x03, 0x00, 0x02, 0x00, 0x00, 0x00
+};
+
+static uint8_t attr_tab[] = {
+ 0x0c, 0x00, 0x0f, 0x08, 0x00, 0x00, 0x00, 0x00
+};
+
+static uint8_t gdc_tab[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x00, 0xff
+};
void
-ati_vga_init(pci_chipset_tag_t pc, pcitag_t tag, int id, volatile u_char *ba, u_char *fb)
+ati_vga_init(pci_chipset_tag_t pc, pcitag_t tag, int id, volatile uint8_t *ba,
+ uint8_t *fb)
{
- int i, csr;
+ uint32_t csr;
+ int i;
/* Turn on the card */
pci_conf_write(pc, tag, PCI_MAPREG_START, PCI_LINMEMBASE);
Index: src/sys/arch/atari/pci/pci_vga.c
diff -u src/sys/arch/atari/pci/pci_vga.c:1.14 src/sys/arch/atari/pci/pci_vga.c:1.15
--- src/sys/arch/atari/pci/pci_vga.c:1.14 Tue Oct 20 19:10:11 2009
+++ src/sys/arch/atari/pci/pci_vga.c Sat May 4 08:20:05 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_vga.c,v 1.14 2009/10/20 19:10:11 snj Exp $ */
+/* $NetBSD: pci_vga.c,v 1.15 2019/05/04 08:20:05 tsutsui Exp $ */
/*
* Copyright (c) 1999 Leo Weppelman. All rights reserved.
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_vga.c,v 1.14 2009/10/20 19:10:11 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_vga.c,v 1.15 2019/05/04 08:20:05 tsutsui Exp $");
#include <sys/param.h>
#include <sys/queue.h>
@@ -48,14 +48,14 @@ __KERNEL_RCSID(0, "$NetBSD: pci_vga.c,v
#include <dev/ic/vgavar.h>
#endif
-static void loadfont(volatile u_char *, u_char *fb);
+static void loadfont(volatile uint8_t *, uint8_t *fb);
/* XXX: Shouldn't these be in font.h???? */
extern font_info font_info_8x8;
extern font_info font_info_8x16;
/* Console colors */
-static u_char conscolors[3][3] = { /* background, foreground, hilite */
+static uint8_t conscolors[3][3] = { /* background, foreground, hilite */
{0x0, 0x0, 0x0}, {0x30, 0x30, 0x30}, { 0x3f, 0x3f, 0x3f}
};
@@ -77,9 +77,10 @@ check_for_vga(bus_space_tag_t iot, bus_s
bus_space_handle_t ioh_regs, memh_fb;
pcitag_t tag;
int device, found, id, maxndevs, i, j;
- int class, got_ioh, got_memh, rv;
- volatile u_char *regs;
- u_char *fb;
+ int got_ioh, got_memh, rv;
+ int class;
+ volatile uint8_t *regs;
+ uint8_t *fb;
const char *nbd = "NetBSD/Atari";
found = 0;
@@ -198,12 +199,12 @@ check_for_vga(bus_space_tag_t iot, bus_s
vga_memt = memt;
rv = tags_valid = 1;
-bad:
+ bad:
if (got_memh)
bus_space_unmap(memt, memh_fb, VGA_FB_SIZE);
if (got_ioh)
bus_space_unmap(iot, ioh_regs, VGA_REG_SIZE);
- return (rv);
+ return rv;
}
#if NVGA_PCI > 0
@@ -213,6 +214,7 @@ void vgacninit(struct consdev *);
void
vgacnprobe(struct consdev *cp)
{
+
if (tags_valid)
cp->cn_pri = CN_NORMAL;
}
@@ -220,6 +222,7 @@ vgacnprobe(struct consdev *cp)
void
vgacninit(struct consdev *cp)
{
+
if (tags_valid) {
/* XXX: Are those arguments correct? Leo */
vga_cnattach(vga_iot, vga_memt, 8, 0);
@@ -232,13 +235,13 @@ vgacninit(struct consdev *cp)
* place the card into textmode.
*/
static void
-loadfont(volatile u_char *ba, u_char *fb)
+loadfont(volatile uint8_t *ba, uint8_t *fb)
/* ba: Register area KVA */
- /* fb: Frame buffer KVA */
+ /* fb: Frame buffer KVA */
{
font_info *fd;
- u_char *c, *f, tmp;
- u_short z, y;
+ uint8_t *c, *f, tmp;
+ uint16_t z, y;
#if defined(KFONT_8X8)
fd = &font_info_8x8;
@@ -260,7 +263,7 @@ loadfont(volatile u_char *ba, u_char *fb
for (z = 0, c = fb; z < 256 * 32; z++)
*c++ = 0;
- c = (unsigned char *) (fb) + (32 * fd->font_lo);
+ c = (uint8_t *)(fb) + (32 * fd->font_lo);
f = fd->font_p;
z = fd->font_lo;
for (; z <= fd->font_hi; z++, c += (32 - fd->height))
Index: src/sys/arch/atari/pci/pci_machdep.c
diff -u src/sys/arch/atari/pci/pci_machdep.c:1.56 src/sys/arch/atari/pci/pci_machdep.c:1.57
--- src/sys/arch/atari/pci/pci_machdep.c:1.56 Fri Feb 9 15:24:35 2018
+++ src/sys/arch/atari/pci/pci_machdep.c Sat May 4 08:20:05 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_machdep.c,v 1.56 2018/02/09 15:24:35 tsutsui Exp $ */
+/* $NetBSD: pci_machdep.c,v 1.57 2019/05/04 08:20:05 tsutsui Exp $ */
/*
* Copyright (c) 1996 Leo Weppelman. All rights reserved.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.56 2018/02/09 15:24:35 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.57 2019/05/04 08:20:05 tsutsui Exp $");
#include "opt_mbtype.h"
@@ -89,12 +89,12 @@ __KERNEL_RCSID(0, "$NetBSD: pci_machdep.
* Struct to hold the memory and I/O datas of the pci devices
*/
struct pci_memreg {
- LIST_ENTRY(pci_memreg) link;
- int dev;
- pcitag_t tag;
- pcireg_t reg, address, mask;
- u_int32_t size;
- u_int32_t csr;
+ LIST_ENTRY(pci_memreg) link;
+ int dev;
+ pcitag_t tag;
+ pcireg_t reg, address, mask;
+ uint32_t size;
+ uint32_t csr;
};
typedef LIST_HEAD(pci_memreg_head, pci_memreg) PCI_MEMREG;
@@ -128,7 +128,7 @@ void pcibusattach(device_t, device_t, vo
static void enable_pci_devices(void);
static void insert_into_list(PCI_MEMREG *head, struct pci_memreg *elem);
static int overlap_pci_areas(struct pci_memreg *p,
- struct pci_memreg *self, u_int addr, u_int size, u_int what);
+ struct pci_memreg *self, u_int addr, u_int size, u_int what);
CFATTACH_DECL_NEW(pcib, 0,
pcibusmatch, pcibusattach, NULL, NULL);
@@ -142,7 +142,7 @@ static struct atari_bus_space bs_storage
int
pcibusmatch(device_t parent, cfdata_t cf, void *aux)
{
- static int nmatched = 0;
+ static int nmatched = 0;
if (strcmp((char *)aux, "pcib"))
return 0; /* Wrong number... */
@@ -150,7 +150,7 @@ pcibusmatch(device_t parent, cfdata_t cf
if (atari_realconfig == 0)
return 1;
- if (machineid & (ATARI_HADES|ATARI_MILAN)) {
+ if ((machineid & (ATARI_HADES|ATARI_MILAN)) != 0) {
/*
* Both Hades and Milan have only one pci bus
*/
@@ -165,7 +165,7 @@ pcibusmatch(device_t parent, cfdata_t cf
void
pcibusattach(device_t parent, device_t self, void *aux)
{
- struct pcibus_attach_args pba;
+ struct pcibus_attach_args pba;
pba.pba_pc = NULL;
pba.pba_bus = 0;
@@ -227,7 +227,8 @@ init_pci_bus(void)
pci_chipset_tag_t pc = NULL; /* XXX */
pcitag_t tag;
pcireg_t csr;
- int device, id, maxndevs;
+ int device, maxndevs;
+ int id;
tag = 0;
id = 0;
@@ -255,18 +256,20 @@ init_pci_bus(void)
static void
insert_into_list(PCI_MEMREG *head, struct pci_memreg *elem)
{
- struct pci_memreg *p, *q;
+ struct pci_memreg *p, *q;
- p = LIST_FIRST(head);
- q = NULL;
+ p = LIST_FIRST(head);
+ q = NULL;
- for (; p != NULL && p->size < elem->size; q = p, p = LIST_NEXT(p, link));
-
- if (q == NULL) {
- LIST_INSERT_HEAD(head, elem, link);
- } else {
- LIST_INSERT_AFTER(q, elem, link);
- }
+ for (; p != NULL && p->size < elem->size;
+ q = p, p = LIST_NEXT(p, link))
+ ;
+
+ if (q == NULL) {
+ LIST_INSERT_HEAD(head, elem, link);
+ } else {
+ LIST_INSERT_AFTER(q, elem, link);
+ }
}
/*
@@ -274,34 +277,39 @@ insert_into_list(PCI_MEMREG *head, struc
* pci area.
*/
static int
-overlap_pci_areas(struct pci_memreg *p, struct pci_memreg *self, u_int addr, u_int size, u_int what)
+overlap_pci_areas(struct pci_memreg *p, struct pci_memreg *self, u_int addr,
+ u_int size, u_int what)
{
- struct pci_memreg *q;
+ struct pci_memreg *q;
- if (p == NULL)
- return 0;
+ if (p == NULL)
+ return 0;
- q = p;
- while (q != NULL) {
- if ((q != self) && (q->csr & what)) {
- if ((addr >= q->address) && (addr < (q->address + q->size))) {
+ q = p;
+ while (q != NULL) {
+ if ((q != self) && (q->csr & what)) {
+ if ((addr >= q->address) &&
+ (addr < (q->address + q->size))) {
#ifdef DEBUG_PCI_MACHDEP
- printf("\noverlap area dev %d reg 0x%02x with dev %d reg 0x%02x",
- self->dev, self->reg, q->dev, q->reg);
+ printf("\noverlap area dev %d reg 0x%02x "
+ "with dev %d reg 0x%02x",
+ self->dev, self->reg, q->dev, q->reg);
#endif
- return 1;
- }
- if ((q->address >= addr) && (q->address < (addr + size))) {
+ return 1;
+ }
+ if ((q->address >= addr) &&
+ (q->address < (addr + size))) {
#ifdef DEBUG_PCI_MACHDEP
- printf("\noverlap area dev %d reg 0x%02x with dev %d reg 0x%02x",
- self->dev, self->reg, q->dev, q->reg);
+ printf("\noverlap area dev %d reg 0x%02x "
+ "with dev %d reg 0x%02x",
+ self->dev, self->reg, q->dev, q->reg);
#endif
- return 1;
+ return 1;
+ }
+ }
+ q = LIST_NEXT(q, link);
}
- }
- q = LIST_NEXT(q, link);
- }
- return 0;
+ return 0;
}
/*
@@ -316,303 +324,328 @@ overlap_pci_areas(struct pci_memreg *p,
static void
enable_pci_devices(void)
{
- PCI_MEMREG memlist;
- PCI_MEMREG iolist;
- struct pci_memreg *p, *q;
- int dev, reg, id, class;
- pcitag_t tag;
- pcireg_t csr, address, mask;
- pci_chipset_tag_t pc;
- int sizecnt, membase_1m;
-
- pc = 0;
- csr = 0;
- tag = 0;
-
- LIST_INIT(&memlist);
- LIST_INIT(&iolist);
-
- /*
- * first step: go through all devices and gather memory and I/O
- * sizes
- */
- for (dev = 0; dev < pci_bus_maxdevs(pc,0); dev++) {
-
- tag = pci_make_tag(pc, 0, dev, 0);
- id = pci_conf_read(pc, tag, PCI_ID_REG);
- if (id == 0 || id == 0xffffffff)
- continue;
+ PCI_MEMREG memlist;
+ PCI_MEMREG iolist;
+ struct pci_memreg *p, *q;
+ int dev, reg;
+ int id, class;
+ pcitag_t tag;
+ pcireg_t csr, address, mask;
+ pci_chipset_tag_t pc;
+ int sizecnt, membase_1m;
+
+ pc = 0;
+ csr = 0;
+ tag = 0;
- csr = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG);
+ LIST_INIT(&memlist);
+ LIST_INIT(&iolist);
/*
- * special case: if a display card is found and memory is enabled
- * preserve 128k at 0xa0000 as vga memory.
- * XXX: if a display card is found without being enabled, leave
- * it alone! You will usually only create conflicts by enabeling
- * it.
+ * first step: go through all devices and gather memory and I/O
+ * sizes
*/
- class = pci_conf_read(pc, tag, PCI_CLASS_REG);
- switch (PCI_CLASS(class)) {
- case PCI_CLASS_PREHISTORIC:
- case PCI_CLASS_DISPLAY:
- if (csr & (PCI_COMMAND_MEM_ENABLE | PCI_COMMAND_MASTER_ENABLE)) {
- p = (struct pci_memreg *)malloc(sizeof(struct pci_memreg),
- M_TEMP, M_WAITOK);
- memset(p, '\0', sizeof(struct pci_memreg));
- p->dev = dev;
- p->csr = csr;
- p->tag = tag;
- p->reg = 0; /* there is no register about this */
- p->size = 0x20000; /* 128kByte */
- p->mask = 0xfffe0000;
- p->address = 0xa0000;
-
- insert_into_list(&memlist, p);
- }
- else continue;
- }
-
- for (reg = PCI_MAPREG_START; reg < PCI_MAPREG_END; reg += 4) {
-
- address = pci_conf_read(pc, tag, reg);
- pci_conf_write(pc, tag, reg, 0xffffffff);
- mask = pci_conf_read(pc, tag, reg);
- pci_conf_write(pc, tag, reg, address);
- if (mask == 0)
- continue; /* Register unused */
-
- p = (struct pci_memreg *)malloc(sizeof(struct pci_memreg),
- M_TEMP, M_WAITOK);
- memset(p, '\0', sizeof(struct pci_memreg));
- p->dev = dev;
- p->csr = csr;
- p->tag = tag;
- p->reg = reg;
- p->mask = mask;
- p->address = 0;
+ for (dev = 0; dev < pci_bus_maxdevs(pc,0); dev++) {
+
+ tag = pci_make_tag(pc, 0, dev, 0);
+ id = pci_conf_read(pc, tag, PCI_ID_REG);
+ if (id == 0 || id == 0xffffffff)
+ continue;
- if (mask & PCI_MAPREG_TYPE_IO) {
- p->size = PCI_MAPREG_IO_SIZE(mask);
+ csr = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG);
/*
- * Align IO if necessary
+ * special case: if a display card is found and memory is
+ * enabled preserve 128k at 0xa0000 as vga memory.
+ * XXX: if a display card is found without being enabled,
+ * leave it alone! You will usually only create conflicts
+ * by enabeling it.
*/
- if (p->size < PCI_MAPREG_IO_SIZE(PCI_MACHDEP_IO_ALIGN_MASK)) {
- p->mask = PCI_MACHDEP_IO_ALIGN_MASK;
- p->size = PCI_MAPREG_IO_SIZE(p->mask);
+ class = pci_conf_read(pc, tag, PCI_CLASS_REG);
+ switch (PCI_CLASS(class)) {
+ case PCI_CLASS_PREHISTORIC:
+ case PCI_CLASS_DISPLAY:
+ if (csr & (PCI_COMMAND_MEM_ENABLE |
+ PCI_COMMAND_MASTER_ENABLE)) {
+ p = malloc(sizeof(struct pci_memreg),
+ M_TEMP, M_WAITOK);
+ memset(p, 0, sizeof(struct pci_memreg));
+ p->dev = dev;
+ p->csr = csr;
+ p->tag = tag;
+ p->reg = 0; /* there is no register
+ about this */
+ p->size = 0x20000; /* 128kByte */
+ p->mask = 0xfffe0000;
+ p->address = 0xa0000;
+
+ insert_into_list(&memlist, p);
+ } else
+ continue;
}
- /*
- * if I/O is already enabled (probably by the console driver)
- * save the address in order to take care about it later.
- */
- if (csr & PCI_COMMAND_IO_ENABLE)
- p->address = address;
-
- insert_into_list(&iolist, p);
- } else {
- p->size = PCI_MAPREG_MEM_SIZE(mask);
-
- /*
- * Align memory if necessary
- */
- if (p->size < PCI_MAPREG_IO_SIZE(PCI_MACHDEP_MEM_ALIGN_MASK)) {
- p->mask = PCI_MACHDEP_MEM_ALIGN_MASK;
- p->size = PCI_MAPREG_MEM_SIZE(p->mask);
+ for (reg = PCI_MAPREG_START; reg < PCI_MAPREG_END; reg += 4) {
+ address = pci_conf_read(pc, tag, reg);
+ pci_conf_write(pc, tag, reg, 0xffffffff);
+ mask = pci_conf_read(pc, tag, reg);
+ pci_conf_write(pc, tag, reg, address);
+ if (mask == 0)
+ continue; /* Register unused */
+
+ p = malloc(sizeof(struct pci_memreg),
+ M_TEMP, M_WAITOK);
+ memset(p, 0, sizeof(struct pci_memreg));
+ p->dev = dev;
+ p->csr = csr;
+ p->tag = tag;
+ p->reg = reg;
+ p->mask = mask;
+ p->address = 0;
+
+ if ((mask & PCI_MAPREG_TYPE_IO) != 0) {
+ p->size = PCI_MAPREG_IO_SIZE(mask);
+
+ /*
+ * Align IO if necessary
+ */
+ if (p->size < PCI_MAPREG_IO_SIZE(
+ PCI_MACHDEP_IO_ALIGN_MASK)) {
+ p->mask = PCI_MACHDEP_IO_ALIGN_MASK;
+ p->size = PCI_MAPREG_IO_SIZE(p->mask);
+ }
+
+ /*
+ * if I/O is already enabled
+ * (probably by the console driver)
+ * save the address in order to take care
+ * about it later.
+ */
+ if ((csr & PCI_COMMAND_IO_ENABLE) != 0)
+ p->address = address;
+
+ insert_into_list(&iolist, p);
+ } else {
+ p->size = PCI_MAPREG_MEM_SIZE(mask);
+
+ /*
+ * Align memory if necessary
+ */
+ if (p->size < PCI_MAPREG_IO_SIZE(
+ PCI_MACHDEP_MEM_ALIGN_MASK)) {
+ p->mask = PCI_MACHDEP_MEM_ALIGN_MASK;
+ p->size = PCI_MAPREG_MEM_SIZE(p->mask);
+ }
+
+ /*
+ * if memory is already enabled
+ * (probably by the console driver)
+ * save the address in order to take care
+ * about it later.
+ */
+ if ((csr & PCI_COMMAND_MEM_ENABLE) != 0)
+ p->address = address;
+
+ insert_into_list(&memlist, p);
+
+ if (PCI_MAPREG_MEM_TYPE(mask) ==
+ PCI_MAPREG_MEM_TYPE_64BIT)
+ reg++;
+ }
}
+#if defined(_ATARIHW_)
/*
- * if memory is already enabled (probably by the console driver)
- * save the address in order to take care about it later.
+ * Both interrupt pin & line are set to the device (== slot)
+ * number. This makes sense on the atari Hades because the
+ * individual slots are hard-wired to a specific MFP-pin.
*/
- if (csr & PCI_COMMAND_MEM_ENABLE)
- p->address = address;
-
- insert_into_list(&memlist, p);
-
- if (PCI_MAPREG_MEM_TYPE(mask) == PCI_MAPREG_MEM_TYPE_64BIT)
- reg++;
- }
- }
-
-
-#if defined(_ATARIHW_)
- /*
- * Both interrupt pin & line are set to the device (== slot)
- * number. This makes sense on the atari Hades because the
- * individual slots are hard-wired to a specific MFP-pin.
- */
- csr = (DEV2SLOT(dev) << PCI_INTERRUPT_PIN_SHIFT);
- csr |= (DEV2SLOT(dev) << PCI_INTERRUPT_LINE_SHIFT);
- pci_conf_write(pc, tag, PCI_INTERRUPT_REG, csr);
+ csr = (DEV2SLOT(dev) << PCI_INTERRUPT_PIN_SHIFT);
+ csr |= (DEV2SLOT(dev) << PCI_INTERRUPT_LINE_SHIFT);
+ pci_conf_write(pc, tag, PCI_INTERRUPT_REG, csr);
#else
- /*
- * On the Milan, we accept the BIOS's choice.
- */
- /* ..except the secondary IDE interrupt that the BIOS doesn't setup. */
-#define PIIX_PCIB_MBIRQ0 0x70
- if ((PCI_VENDOR(id) == PCI_VENDOR_INTEL) &&
- (PCI_PRODUCT(id) == PCI_PRODUCT_INTEL_82371FB_ISA)) {
/*
- * Set Interrupt Routing for MBIRQ0 to IRQ15.
- * Note Milan's ROM bootloader v1.2 and v1.4 incorrectly
- * set MBIRQ0 to IRQ14 (not 15) and unused MBIRQ1 to IRQ 15,
- * so explicitly disable MBIRQ1.
+ * On the Milan, we accept the BIOS's choice.
*/
- csr = pci_conf_read(pc, tag, PIIX_PCIB_MBIRQ0);
- csr &= ~0x000ffff;
- csr |= 0x000800f; /* MBIRQ1: disable, MBIRQ0: IRQ15 */
- pci_conf_write(pc, tag, PIIX_PCIB_MBIRQ0, csr);
+ /*
+ * ..except the secondary IDE interrupt that
+ * the BIOS doesn't setup.
+ */
+#define PIIX_PCIB_MBIRQ0 0x70
+ if ((PCI_VENDOR(id) == PCI_VENDOR_INTEL) &&
+ (PCI_PRODUCT(id) == PCI_PRODUCT_INTEL_82371FB_ISA)) {
+ /*
+ * Set Interrupt Routing for MBIRQ0 to IRQ15.
+ * Note Milan's ROM bootloader v1.2 and v1.4
+ * incorrectly set MBIRQ0 to IRQ14 (not 15)
+ * and unused MBIRQ1 to IRQ 15,
+ * so explicitly disable MBIRQ1.
+ */
+ csr = pci_conf_read(pc, tag, PIIX_PCIB_MBIRQ0);
+ csr &= ~0x0000ffff;
+ /* MBIRQ1: disable, MBIRQ0: IRQ15 */
+ csr |= 0x0000800f;
+ pci_conf_write(pc, tag, PIIX_PCIB_MBIRQ0, csr);
#ifdef DEBUG_PCI_MACHDEP
- printf("\npcib0: enable and route MBIRQ0 to irq 15\n");
+ printf("\npcib0: enable and route MBIRQ0 to irq 15\n");
#endif
- }
+ }
#endif
- }
+ }
- /*
- * second step: calculate the memory and I/O addresses beginning from
- * PCI_MEM_START and PCI_IO_START. Care about already mapped areas.
- *
- * begin with memory list
- */
-
- address = PCI_MEM_START;
- sizecnt = 0;
- membase_1m = 0;
- p = LIST_FIRST(&memlist);
- while (p != NULL) {
- if (!(p->csr & PCI_COMMAND_MEM_ENABLE)) {
- if (PCI_MAPREG_MEM_TYPE(p->mask) == PCI_MAPREG_MEM_TYPE_32BIT_1M) {
- if (p->size > membase_1m)
- membase_1m = p->size;
- do {
- p->address = membase_1m;
- membase_1m += p->size;
- } while (overlap_pci_areas(LIST_FIRST(&memlist), p, p->address,
- p->size, PCI_COMMAND_MEM_ENABLE));
- if (membase_1m > 0x00100000) {
- /*
- * Should we panic here?
- */
- printf("\npcibus0: dev %d reg %d: memory not configured",
- p->dev, p->reg);
- p->reg = 0;
- }
- } else {
+ /*
+ * second step: calculate the memory and I/O addresses beginning from
+ * PCI_MEM_START and PCI_IO_START. Care about already mapped areas.
+ *
+ * begin with memory list
+ */
- if (sizecnt && (p->size > sizecnt))
- sizecnt = ((p->size + sizecnt) & p->mask) &
- PCI_MAPREG_MEM_ADDR_MASK;
- if (sizecnt > address) {
- address = sizecnt;
- sizecnt = 0;
+ address = PCI_MEM_START;
+ sizecnt = 0;
+ membase_1m = 0;
+ p = LIST_FIRST(&memlist);
+ while (p != NULL) {
+ if ((p->csr & PCI_COMMAND_MEM_ENABLE) == 0) {
+ if (PCI_MAPREG_MEM_TYPE(p->mask) ==
+ PCI_MAPREG_MEM_TYPE_32BIT_1M) {
+ if (p->size > membase_1m)
+ membase_1m = p->size;
+ do {
+ p->address = membase_1m;
+ membase_1m += p->size;
+ } while (overlap_pci_areas(LIST_FIRST(&memlist),
+ p, p->address, p->size,
+ PCI_COMMAND_MEM_ENABLE));
+ if (membase_1m > 0x00100000) {
+ /*
+ * Should we panic here?
+ */
+ printf("\npcibus0: dev %d reg %d:"
+ " memory not configured",
+ p->dev, p->reg);
+ p->reg = 0;
+ }
+ } else {
+ if (sizecnt && (p->size > sizecnt))
+ sizecnt =
+ ((p->size + sizecnt) & p->mask) &
+ PCI_MAPREG_MEM_ADDR_MASK;
+ if (sizecnt > address) {
+ address = sizecnt;
+ sizecnt = 0;
+ }
+
+ do {
+ p->address = address + sizecnt;
+ sizecnt += p->size;
+ } while (overlap_pci_areas(LIST_FIRST(&memlist),
+ p, p->address, p->size,
+ PCI_COMMAND_MEM_ENABLE));
+
+ if ((address + sizecnt) > PCI_MEM_END) {
+ /*
+ * Should we panic here?
+ */
+ printf("\npcibus0: dev %d reg %d:"
+ " memory not configured",
+ p->dev, p->reg);
+ p->reg = 0;
+ }
+ }
+ if (p->reg > 0) {
+ pci_conf_write(pc, p->tag, p->reg, p->address);
+ csr = pci_conf_read(pc, p->tag,
+ PCI_COMMAND_STATUS_REG);
+ csr |= PCI_COMMAND_MEM_ENABLE |
+ PCI_COMMAND_MASTER_ENABLE;
+ pci_conf_write(pc, p->tag,
+ PCI_COMMAND_STATUS_REG, csr);
+ p->csr = csr;
+ }
}
+ p = LIST_NEXT(p, link);
+ }
- do {
- p->address = address + sizecnt;
- sizecnt += p->size;
- } while (overlap_pci_areas(LIST_FIRST(&memlist), p, p->address,
- p->size, PCI_COMMAND_MEM_ENABLE));
-
- if ((address + sizecnt) > PCI_MEM_END) {
- /*
- * Should we panic here?
- */
- printf("\npcibus0: dev %d reg %d: memory not configured",
- p->dev, p->reg);
- p->reg = 0;
- }
- }
- if (p->reg > 0) {
- pci_conf_write(pc, p->tag, p->reg, p->address);
- csr = pci_conf_read(pc, p->tag, PCI_COMMAND_STATUS_REG);
- csr |= PCI_COMMAND_MEM_ENABLE | PCI_COMMAND_MASTER_ENABLE;
- pci_conf_write(pc, p->tag, PCI_COMMAND_STATUS_REG, csr);
- p->csr = csr;
- }
- }
- p = LIST_NEXT(p, link);
- }
-
- /*
- * now the I/O list
- */
-
- address = PCI_IO_START;
- sizecnt = 0;
- p = LIST_FIRST(&iolist);
- while (p != NULL) {
- if (!(p->csr & PCI_COMMAND_IO_ENABLE)) {
-
- if (sizecnt && (p->size > sizecnt))
- sizecnt = ((p->size + sizecnt) & p->mask) &
- PCI_MAPREG_IO_ADDR_MASK;
- if (sizecnt > address) {
- address = sizecnt;
- sizecnt = 0;
- }
-
- do {
- p->address = address + sizecnt;
- sizecnt += p->size;
- } while (overlap_pci_areas(LIST_FIRST(&iolist), p, p->address,
- p->size, PCI_COMMAND_IO_ENABLE));
+ /*
+ * now the I/O list
+ */
- if ((address + sizecnt) > PCI_IO_END) {
- /*
- * Should we panic here?
- */
- printf("\npcibus0: dev %d reg %d: io not configured",
- p->dev, p->reg);
- } else {
- pci_conf_write(pc, p->tag, p->reg, p->address);
- csr = pci_conf_read(pc, p->tag, PCI_COMMAND_STATUS_REG);
- csr |= PCI_COMMAND_IO_ENABLE | PCI_COMMAND_MASTER_ENABLE;
- pci_conf_write(pc, p->tag, PCI_COMMAND_STATUS_REG, csr);
- p->csr = csr;
- }
+ address = PCI_IO_START;
+ sizecnt = 0;
+ p = LIST_FIRST(&iolist);
+ while (p != NULL) {
+ if (!(p->csr & PCI_COMMAND_IO_ENABLE)) {
+
+ if (sizecnt && (p->size > sizecnt))
+ sizecnt = ((p->size + sizecnt) & p->mask) &
+ PCI_MAPREG_IO_ADDR_MASK;
+ if (sizecnt > address) {
+ address = sizecnt;
+ sizecnt = 0;
+ }
+
+ do {
+ p->address = address + sizecnt;
+ sizecnt += p->size;
+ } while (overlap_pci_areas(LIST_FIRST(&iolist), p,
+ p->address, p->size, PCI_COMMAND_IO_ENABLE));
+
+ if ((address + sizecnt) > PCI_IO_END) {
+ /*
+ * Should we panic here?
+ */
+ printf("\npcibus0: dev %d reg %d:"
+ " io not configured",
+ p->dev, p->reg);
+ } else {
+ pci_conf_write(pc, p->tag, p->reg, p->address);
+ csr = pci_conf_read(pc, p->tag,
+ PCI_COMMAND_STATUS_REG);
+ csr |= PCI_COMMAND_IO_ENABLE |
+ PCI_COMMAND_MASTER_ENABLE;
+ pci_conf_write(pc, p->tag,
+ PCI_COMMAND_STATUS_REG, csr);
+ p->csr = csr;
+ }
+ }
+ p = LIST_NEXT(p, link);
}
- p = LIST_NEXT(p, link);
- }
#ifdef DEBUG_PCI_MACHDEP
- printf("\nI/O List:\n");
- p = LIST_FIRST(&iolist);
+ printf("\nI/O List:\n");
+ p = LIST_FIRST(&iolist);
- while (p != NULL) {
- printf("\ndev: %d, reg: 0x%02x, size: 0x%08x, addr: 0x%08x", p->dev,
- p->reg, p->size, p->address);
- p = LIST_NEXT(p, link);
- }
- printf("\nMemlist:");
- p = LIST_FIRST(&memlist);
-
- while (p != NULL) {
- printf("\ndev: %d, reg: 0x%02x, size: 0x%08x, addr: 0x%08x", p->dev,
- p->reg, p->size, p->address);
- p = LIST_NEXT(p, link);
- }
+ while (p != NULL) {
+ printf("\ndev: %d, reg: 0x%02x, size: 0x%08x, addr: 0x%08x",
+ p->dev, p->reg, p->size, p->address);
+ p = LIST_NEXT(p, link);
+ }
+ printf("\nMemlist:");
+ p = LIST_FIRST(&memlist);
+
+ while (p != NULL) {
+ printf("\ndev: %d, reg: 0x%02x, size: 0x%08x, addr: 0x%08x",
+ p->dev, p->reg, p->size, p->address);
+ p = LIST_NEXT(p, link);
+ }
#endif
- /*
- * Free the lists
- */
- p = LIST_FIRST(&iolist);
- while (p != NULL) {
- q = p;
- LIST_REMOVE(q, link);
- free(p, M_WAITOK);
+ /*
+ * Free the lists
+ */
p = LIST_FIRST(&iolist);
- }
- p = LIST_FIRST(&memlist);
- while (p != NULL) {
- q = p;
- LIST_REMOVE(q, link);
- free(p, M_WAITOK);
+ while (p != NULL) {
+ q = p;
+ LIST_REMOVE(q, link);
+ free(p, M_WAITOK);
+ p = LIST_FIRST(&iolist);
+ }
p = LIST_FIRST(&memlist);
- }
+ while (p != NULL) {
+ q = p;
+ LIST_REMOVE(q, link);
+ free(p, M_WAITOK);
+ p = LIST_FIRST(&memlist);
+ }
}
pcitag_t
@@ -692,8 +725,10 @@ bad:
}
const char *
-pci_intr_string(pci_chipset_tag_t pc, pci_intr_handle_t ih, char *buf, size_t len)
+pci_intr_string(pci_chipset_tag_t pc, pci_intr_handle_t ih, char *buf,
+ size_t len)
{
+
if (ih == -1)
panic("pci_intr_string: bogus handle 0x%x", ih);
Index: src/sys/arch/atari/pci/pci_milan.c
diff -u src/sys/arch/atari/pci/pci_milan.c:1.15 src/sys/arch/atari/pci/pci_milan.c:1.16
--- src/sys/arch/atari/pci/pci_milan.c:1.15 Sun Jan 28 14:22:23 2018
+++ src/sys/arch/atari/pci/pci_milan.c Sat May 4 08:20:05 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_milan.c,v 1.15 2018/01/28 14:22:23 tsutsui Exp $ */
+/* $NetBSD: pci_milan.c,v 1.16 2019/05/04 08:20:05 tsutsui Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_milan.c,v 1.15 2018/01/28 14:22:23 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_milan.c,v 1.16 2019/05/04 08:20:05 tsutsui Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -52,32 +52,33 @@ __KERNEL_RCSID(0, "$NetBSD: pci_milan.c,
int
pci_bus_maxdevs(pci_chipset_tag_t pc, int busno)
{
- return (6);
+
+ return 6;
}
/*
* These are defined in locore.s:
*/
pcireg_t milan_pci_confread(pcitag_t);
-void milan_pci_confwrite(u_long, pcireg_t);
-extern u_long plx_status;
+void milan_pci_confwrite(uint32_t, pcireg_t);
+extern uint32_t plx_status;
pcireg_t
pci_conf_read(pci_chipset_tag_t pc, pcitag_t tag, int reg)
{
- u_long data;
+ uint32_t data;
- if ((unsigned int)reg >= PCI_CONF_SIZE)
+ if ((uint32_t)reg >= PCI_CONF_SIZE)
return 0xffffffff;
data = bswap32(milan_pci_confread(tag | reg));
- if ((plx_status) & 0xf9000000) {
+ if ((plx_status & 0xf9000000) != 0) {
/*
* Access error, assume nothing there...
*/
data = 0xffffffff;
}
- return(data);
+ return data;
}
@@ -85,15 +86,15 @@ void
pci_conf_write(pci_chipset_tag_t pc, pcitag_t tag, int reg, pcireg_t data)
{
- if ((unsigned int)reg >= PCI_CONF_SIZE)
+ if ((uint32_t)reg >= PCI_CONF_SIZE)
return;
milan_pci_confwrite(tag | reg, bswap32(data));
}
int
-pci_intr_setattr(pci_chipset_tag_t pc, pci_intr_handle_t *ih,
- int attr, uint64_t data)
+pci_intr_setattr(pci_chipset_tag_t pc, pci_intr_handle_t *ih, int attr,
+ uint64_t data)
{
switch (attr) {
@@ -105,8 +106,10 @@ pci_intr_setattr(pci_chipset_tag_t pc, p
}
void *
-pci_intr_establish(pci_chipset_tag_t pc, pci_intr_handle_t ih, int level, int (*ih_fun)(void *), void *ih_arg)
+pci_intr_establish(pci_chipset_tag_t pc, pci_intr_handle_t ih, int level,
+ int (*ih_fun)(void *), void *ih_arg)
{
+
if (ih == 0 || ih >= 16 || ih == 2)
panic("pci_intr_establish: bogus handle 0x%x", ih);
return isa_intr_establish(NULL, ih, IST_LEVEL, level, ih_fun, ih_arg);
@@ -115,6 +118,7 @@ pci_intr_establish(pci_chipset_tag_t pc,
void
pci_intr_disestablish(pci_chipset_tag_t pc, void *cookie)
{
+
isa_intr_disestablish(NULL, cookie);
}
@@ -162,9 +166,11 @@ static const uint8_t crt_tab[] = {
#define PCI_LINMEMBASE 0x0e000000
void
-milan_vga_init(pci_chipset_tag_t pc, pcitag_t tag, int id, volatile u_char *ba, u_char *fb)
+milan_vga_init(pci_chipset_tag_t pc, pcitag_t tag, int id,
+ volatile uint8_t *ba, uint8_t *fb)
{
- int i, csr;
+ uint32_t csr;
+ int i;
/* Turn on the card */
pci_conf_write(pc, tag, PCI_MAPREG_START, PCI_LINMEMBASE);
Index: src/sys/arch/atari/pci/pci_tseng.c
diff -u src/sys/arch/atari/pci/pci_tseng.c:1.11 src/sys/arch/atari/pci/pci_tseng.c:1.12
--- src/sys/arch/atari/pci/pci_tseng.c:1.11 Tue Oct 20 19:10:11 2009
+++ src/sys/arch/atari/pci/pci_tseng.c Sat May 4 08:20:05 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_tseng.c,v 1.11 2009/10/20 19:10:11 snj Exp $ */
+/* $NetBSD: pci_tseng.c,v 1.12 2019/05/04 08:20:05 tsutsui Exp $ */
/*
* Copyright (c) 1999 Leo Weppelman. All rights reserved.
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_tseng.c,v 1.11 2009/10/20 19:10:11 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_tseng.c,v 1.12 2019/05/04 08:20:05 tsutsui Exp $");
#include <sys/param.h>
#include <sys/queue.h>
@@ -39,21 +39,24 @@ __KERNEL_RCSID(0, "$NetBSD: pci_tseng.c,
#define PCI_LINMEMBASE 0x0e000000
#define PCI_IOBASE 0x800
-static void et6000_init(volatile u_char *, u_char *, int);
+static void et6000_init(volatile uint8_t *, uint8_t *, int);
/*
* Use tables for the card init...
*/
-static u_char seq_tab[] = {
- 0x03, 0x01, 0x03, 0x00, 0x02, 0x00, 0x00, 0xb4 };
+static uint8_t seq_tab[] = {
+ 0x03, 0x01, 0x03, 0x00, 0x02, 0x00, 0x00, 0xb4
+};
+
+static uint8_t gfx_tab[] = {
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x0f, 0xff
+};
+
+static uint8_t attr_tab[] = {
+ 0x0a, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00
+};
-static u_char gfx_tab[] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x0e, 0x0f, 0xff };
-
-static u_char attr_tab[] = {
- 0x0a, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00 };
-
-static u_char crt_tab[] = {
+static uint8_t crt_tab[] = {
0x60, 0x53, 0x4f, 0x94, 0x56, 0x05, 0xc1, 0x1f,
0x00, 0x4f, 0x00, 0x0f, 0x00, 0x00, 0x07, 0x80,
0x98, 0x3d, 0x8f, 0x28, 0x0f, 0x8f, 0xc2, 0xa3,
@@ -65,24 +68,28 @@ static u_char crt_tab[] = {
#else
0x00, 0x80, 0x28, 0x00, 0x00, 0x10, 0x43, 0x09, /* 1 MB video memory */
#endif
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
-static u_char ras_cas_tab[] = {
- 0x11, 0x14, 0x15 };
+static uint8_t ras_cas_tab[] = {
+ 0x11, 0x14, 0x15
+};
void
-tseng_init(pci_chipset_tag_t pc, pcitag_t tag, int id, volatile u_char *ba, u_char *fb)
+tseng_init(pci_chipset_tag_t pc, pcitag_t tag, int id, volatile uint8_t *ba,
+ uint8_t *fb)
{
- int i, j, csr;
- int is_et6000 = 0;
+ int i, j;
+ int is_et6000 = 0;
+ uint32_t csr;
is_et6000 = (id == PCI_PRODUCT_TSENG_ET6000) ? 1 : 0;
/* Turn on the card */
pci_conf_write(pc, tag, PCI_MAPREG_START, PCI_LINMEMBASE);
if (is_et6000)
- pci_conf_write(pc, tag, PCI_MAPREG_START+4,
- PCI_IOBASE | PCI_MAPREG_TYPE_IO);
+ pci_conf_write(pc, tag, PCI_MAPREG_START + 4,
+ PCI_IOBASE | PCI_MAPREG_TYPE_IO);
csr = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG);
csr |= (PCI_COMMAND_MEM_ENABLE|PCI_COMMAND_IO_ENABLE);
csr |= PCI_COMMAND_MASTER_ENABLE;
@@ -158,11 +165,10 @@ tseng_init(pci_chipset_tag_t pc, pcitag_
*/
static void
-et6000_init(volatile u_char *ba, u_char *fb, int iter)
+et6000_init(volatile uint8_t *ba, uint8_t *fb, int iter)
{
-
int i;
- u_char dac_tab[] = { 0x7d,0x67, 0x5d,0x64, 0x56,0x63,
+ uint8_t dac_tab[] = { 0x7d,0x67, 0x5d,0x64, 0x56,0x63,
0x28,0x22, 0x79,0x49, 0x6f,0x47,
0x28,0x41, 0x6b,0x44, 0x00,0x00,
0x00,0x00, 0x5d,0x25, 0x00,0x00,
@@ -170,7 +176,6 @@ et6000_init(volatile u_char *ba, u_char
ba += 0x800;
-
ba[0x40] = 0x06; /* Use standard vga addressing */
ba[0x41] = 0x2a; /* Performance control */
ba[0x43] = 0x02; /* XCLK/SCLK config */
@@ -189,8 +194,8 @@ et6000_init(volatile u_char *ba, u_char
ba[0x69] = dac_tab[i];
if (ba[8] == 0x70) { /* et6100, right? */
- volatile u_char *ma = (volatile u_char *)fb;
- u_char bv;
+ volatile uint8_t *ma = (volatile uint8_t *)fb;
+ uint8_t bv;
/*
* XXX Black magic to get the bloody MDRAM's to function...
Index: src/sys/arch/atari/pci/pci_vga.h
diff -u src/sys/arch/atari/pci/pci_vga.h:1.5 src/sys/arch/atari/pci/pci_vga.h:1.6
--- src/sys/arch/atari/pci/pci_vga.h:1.5 Tue Oct 20 19:10:11 2009
+++ src/sys/arch/atari/pci/pci_vga.h Sat May 4 08:20:05 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_vga.h,v 1.5 2009/10/20 19:10:11 snj Exp $ */
+/* $NetBSD: pci_vga.h,v 1.6 2019/05/04 08:20:05 tsutsui Exp $ */
/*
* Copyright (c) 1999 Leo Weppelman. All rights reserved.
@@ -28,8 +28,9 @@ int check_for_vga(bus_space_tag_t, bus_s
/*
* Card specific functions
*/
-void ati_vga_init (pci_chipset_tag_t, pcitag_t, int, volatile u_char *,
- u_char *);
-void tseng_init (pci_chipset_tag_t, pcitag_t, int, volatile u_char *, u_char *);
-void milan_vga_init(pci_chipset_tag_t, pcitag_t, int, volatile u_char *,
- u_char *);
+void ati_vga_init(pci_chipset_tag_t, pcitag_t, int, volatile uint8_t *,
+ uint8_t *);
+void tseng_init(pci_chipset_tag_t, pcitag_t, int, volatile uint8_t *,
+ uint8_t *);
+void milan_vga_init(pci_chipset_tag_t, pcitag_t, int, volatile uint8_t *,
+ uint8_t *);
Index: src/sys/arch/atari/pci/pciide_machdep.c
diff -u src/sys/arch/atari/pci/pciide_machdep.c:1.7 src/sys/arch/atari/pci/pciide_machdep.c:1.8
--- src/sys/arch/atari/pci/pciide_machdep.c:1.7 Sat Oct 27 17:17:43 2012
+++ src/sys/arch/atari/pci/pciide_machdep.c Sat May 4 08:20:05 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: pciide_machdep.c,v 1.7 2012/10/27 17:17:43 chs Exp $ */
+/* $NetBSD: pciide_machdep.c,v 1.8 2019/05/04 08:20:05 tsutsui Exp $ */
/*
* Copyright (c) 1998 Christopher G. Demetriou. All rights reserved.
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pciide_machdep.c,v 1.7 2012/10/27 17:17:43 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pciide_machdep.c,v 1.8 2019/05/04 08:20:05 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -67,5 +67,5 @@ pciide_machdep_compat_intr_establish(dev
return (NULL);
printf("%s: %s channel interrupting at irq %d\n", device_xname(dev),
PCIIDE_CHANNEL_NAME(chan), irq);
- return (cookie);
+ return cookie;
}