Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/proto/proto.h
/*- | /*- | ||||
* Copyright (c) 2014, 2015 Marcel Moolenaar | * Copyright (c) 2014, 2015, 2019 Marcel Moolenaar | ||||
* All rights reserved. | * All rights reserved. | ||||
* | * | ||||
* Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | ||||
* modification, are permitted provided that the following conditions | * modification, are permitted provided that the following conditions | ||||
* are met: | * are met: | ||||
* | * | ||||
* 1. Redistributions of source code must retain the above copyright | * 1. Redistributions of source code must retain the above copyright | ||||
* notice, this list of conditions and the following disclaimer. | * notice, this list of conditions and the following disclaimer. | ||||
Show All 20 Lines | |||||
#define PROTO_RES_MAX 16 | #define PROTO_RES_MAX 16 | ||||
#define PROTO_RES_UNUSED 0 | #define PROTO_RES_UNUSED 0 | ||||
#define PROTO_RES_PCICFG 10 | #define PROTO_RES_PCICFG 10 | ||||
#define PROTO_RES_BUSDMA 11 | #define PROTO_RES_BUSDMA 11 | ||||
struct proto_res { | struct proto_res { | ||||
int r_type; | u_int r_type:8; | ||||
u_int r_opened:1; | |||||
markj: The two values of a signed 1-bit bitfield are 0 and -1. I don't think that causes any problems… | |||||
int r_rid; | int r_rid; | ||||
union { | union { | ||||
struct resource *res; | struct resource *res; | ||||
void *busdma; | void *busdma; | ||||
} r_d; | } r_d; | ||||
u_long r_size; | u_long r_size; | ||||
union { | union { | ||||
void *cookie; | void *cookie; | ||||
struct cdev *cdev; | struct cdev *cdev; | ||||
} r_u; | } r_u; | ||||
uintptr_t r_opened; | |||||
}; | }; | ||||
struct proto_softc { | struct proto_softc { | ||||
device_t sc_dev; | device_t sc_dev; | ||||
struct proto_res sc_res[PROTO_RES_MAX]; | struct proto_res sc_res[PROTO_RES_MAX]; | ||||
int sc_rescnt; | int sc_rescnt; | ||||
int sc_opencnt; | |||||
struct mtx sc_mtx; | |||||
}; | }; | ||||
extern devclass_t proto_devclass; | extern devclass_t proto_devclass; | ||||
extern char proto_driver_name[]; | extern char proto_driver_name[]; | ||||
int proto_add_resource(struct proto_softc *, int, int, struct resource *); | int proto_add_resource(struct proto_softc *, int, int, struct resource *); | ||||
int proto_probe(device_t dev, const char *prefix, char ***devnamesp); | int proto_probe(device_t dev, const char *prefix, char ***devnamesp); | ||||
int proto_attach(device_t dev); | int proto_attach(device_t dev); | ||||
int proto_detach(device_t dev); | int proto_detach(device_t dev); | ||||
#endif /* _DEV_PROTO_H_ */ | #endif /* _DEV_PROTO_H_ */ |
The two values of a signed 1-bit bitfield are 0 and -1. I don't think that causes any problems in this diff, but it's probably better to use unsigned fields just in case.