Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/atari/pci Misc KNF.
details: https://anonhg.NetBSD.org/src/rev/07376b3cb1ba
branches: trunk
changeset: 451027:07376b3cb1ba
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Sat May 04 08:20:05 2019 +0000
description:
Misc KNF.
No binary changes on HADES and MILAN-PCIIDE kernels.
diffstat:
sys/arch/atari/pci/pci_hades.c | 80 ++-
sys/arch/atari/pci/pci_machdep.c | 657 ++++++++++++++++++-----------------
sys/arch/atari/pci/pci_milan.c | 36 +-
sys/arch/atari/pci/pci_tseng.c | 53 +-
sys/arch/atari/pci/pci_vga.c | 31 +-
sys/arch/atari/pci/pci_vga.h | 13 +-
sys/arch/atari/pci/pciide_machdep.c | 6 +-
7 files changed, 467 insertions(+), 409 deletions(-)
diffs (truncated from 1375 to 300 lines):
diff -r ab9714df77dc -r 07376b3cb1ba sys/arch/atari/pci/pci_hades.c
--- a/sys/arch/atari/pci/pci_hades.c Sat May 04 08:04:13 2019 +0000
+++ b/sys/arch/atari/pci/pci_hades.c Sat May 04 08:20:05 2019 +0000
@@ -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 @@
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 @@
/*
* 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 @@
*/
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 @@
* 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 @@
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 @@
}
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 @@
*/
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_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 @@
*/
#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 uint8_t seq_tab[] = {
+ 0x03, 0x00, 0x03, 0x00, 0x02, 0x00, 0x00, 0x00
+};
-static u_char attr_tab[] = {
- 0x0c, 0x00, 0x0f, 0x08, 0x00, 0x00, 0x00, 0x00 };
+static uint8_t 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 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);
diff -r ab9714df77dc -r 07376b3cb1ba sys/arch/atari/pci/pci_machdep.c
--- a/sys/arch/atari/pci/pci_machdep.c Sat May 04 08:04:13 2019 +0000
+++ b/sys/arch/atari/pci/pci_machdep.c Sat May 04 08:20:05 2019 +0000
@@ -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 @@
* 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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));
Home |
Main Index |
Thread Index |
Old Index