@@ -49,11 +49,7 @@ static int
49
49
nvme_ctrlr_allocate_bar (struct nvme_controller * ctrlr )
50
50
{
51
51
52
- /* Chatham puts the NVMe MMRs behind BAR 2/3, not BAR 0/1. */
53
- if (pci_get_devid (ctrlr -> dev ) == CHATHAM_PCI_ID )
54
- ctrlr -> resource_id = PCIR_BAR (2 );
55
- else
56
- ctrlr -> resource_id = PCIR_BAR (0 );
52
+ ctrlr -> resource_id = PCIR_BAR (0 );
57
53
58
54
ctrlr -> resource = bus_alloc_resource (ctrlr -> dev , SYS_RES_MEMORY ,
59
55
& ctrlr -> resource_id , 0 , ~0 , 1 , RF_ACTIVE );
@@ -81,117 +77,6 @@ nvme_ctrlr_allocate_bar(struct nvme_controller *ctrlr)
81
77
return (0 );
82
78
}
83
79
84
- #ifdef CHATHAM2
85
- static int
86
- nvme_ctrlr_allocate_chatham_bar (struct nvme_controller * ctrlr )
87
- {
88
-
89
- ctrlr -> chatham_resource_id = PCIR_BAR (CHATHAM_CONTROL_BAR );
90
- ctrlr -> chatham_resource = bus_alloc_resource (ctrlr -> dev ,
91
- SYS_RES_MEMORY , & ctrlr -> chatham_resource_id , 0 , ~0 , 1 ,
92
- RF_ACTIVE );
93
-
94
- if (ctrlr -> chatham_resource == NULL ) {
95
- nvme_printf (ctrlr , "unable to alloc pci resource\n" );
96
- return (ENOMEM );
97
- }
98
-
99
- ctrlr -> chatham_bus_tag = rman_get_bustag (ctrlr -> chatham_resource );
100
- ctrlr -> chatham_bus_handle =
101
- rman_get_bushandle (ctrlr -> chatham_resource );
102
-
103
- return (0 );
104
- }
105
-
106
- static void
107
- nvme_ctrlr_setup_chatham (struct nvme_controller * ctrlr )
108
- {
109
- uint64_t reg1 , reg2 , reg3 ;
110
- uint64_t temp1 , temp2 ;
111
- uint32_t temp3 ;
112
- uint32_t use_flash_timings = 0 ;
113
-
114
- DELAY (10000 );
115
-
116
- temp3 = chatham_read_4 (ctrlr , 0x8080 );
117
-
118
- device_printf (ctrlr -> dev , "Chatham version: 0x%x\n" , temp3 );
119
-
120
- ctrlr -> chatham_lbas = chatham_read_4 (ctrlr , 0x8068 ) - 0x110 ;
121
- ctrlr -> chatham_size = ctrlr -> chatham_lbas * 512 ;
122
-
123
- device_printf (ctrlr -> dev , "Chatham size: %jd\n" ,
124
- (intmax_t )ctrlr -> chatham_size );
125
-
126
- reg1 = reg2 = reg3 = ctrlr -> chatham_size - 1 ;
127
-
128
- TUNABLE_INT_FETCH ("hw.nvme.use_flash_timings" , & use_flash_timings );
129
- if (use_flash_timings ) {
130
- device_printf (ctrlr -> dev , "Chatham: using flash timings\n" );
131
- temp1 = 0x00001b58000007d0LL ;
132
- temp2 = 0x000000cb00000131LL ;
133
- } else {
134
- device_printf (ctrlr -> dev , "Chatham: using DDR timings\n" );
135
- temp1 = temp2 = 0x0LL ;
136
- }
137
-
138
- chatham_write_8 (ctrlr , 0x8000 , reg1 );
139
- chatham_write_8 (ctrlr , 0x8008 , reg2 );
140
- chatham_write_8 (ctrlr , 0x8010 , reg3 );
141
-
142
- chatham_write_8 (ctrlr , 0x8020 , temp1 );
143
- temp3 = chatham_read_4 (ctrlr , 0x8020 );
144
-
145
- chatham_write_8 (ctrlr , 0x8028 , temp2 );
146
- temp3 = chatham_read_4 (ctrlr , 0x8028 );
147
-
148
- chatham_write_8 (ctrlr , 0x8030 , temp1 );
149
- chatham_write_8 (ctrlr , 0x8038 , temp2 );
150
- chatham_write_8 (ctrlr , 0x8040 , temp1 );
151
- chatham_write_8 (ctrlr , 0x8048 , temp2 );
152
- chatham_write_8 (ctrlr , 0x8050 , temp1 );
153
- chatham_write_8 (ctrlr , 0x8058 , temp2 );
154
-
155
- DELAY (10000 );
156
- }
157
-
158
- static void
159
- nvme_chatham_populate_cdata (struct nvme_controller * ctrlr )
160
- {
161
- struct nvme_controller_data * cdata ;
162
-
163
- cdata = & ctrlr -> cdata ;
164
-
165
- cdata -> vid = 0x8086 ;
166
- cdata -> ssvid = 0x2011 ;
167
-
168
- /*
169
- * Chatham2 puts garbage data in these fields when we
170
- * invoke IDENTIFY_CONTROLLER, so we need to re-zero
171
- * the fields before calling bcopy().
172
- */
173
- memset (cdata -> sn , 0 , sizeof (cdata -> sn ));
174
- memcpy (cdata -> sn , "2012" , strlen ("2012" ));
175
- memset (cdata -> mn , 0 , sizeof (cdata -> mn ));
176
- memcpy (cdata -> mn , "CHATHAM2" , strlen ("CHATHAM2" ));
177
- memset (cdata -> fr , 0 , sizeof (cdata -> fr ));
178
- memcpy (cdata -> fr , "0" , strlen ("0" ));
179
- cdata -> rab = 8 ;
180
- cdata -> aerl = 3 ;
181
- cdata -> lpa .ns_smart = 1 ;
182
- cdata -> sqes .min = 6 ;
183
- cdata -> sqes .max = 6 ;
184
- cdata -> cqes .min = 4 ;
185
- cdata -> cqes .max = 4 ;
186
- cdata -> nn = 1 ;
187
-
188
- /* Chatham2 doesn't support DSM command */
189
- cdata -> oncs .dsm = 0 ;
190
-
191
- cdata -> vwc .present = 1 ;
192
- }
193
- #endif /* CHATHAM2 */
194
-
195
80
static void
196
81
nvme_ctrlr_construct_admin_qpair (struct nvme_controller * ctrlr )
197
82
{
@@ -461,11 +346,6 @@ nvme_ctrlr_identify(struct nvme_controller *ctrlr)
461
346
return (ENXIO );
462
347
}
463
348
464
- #ifdef CHATHAM2
465
- if (pci_get_devid (ctrlr -> dev ) == CHATHAM_PCI_ID )
466
- nvme_chatham_populate_cdata (ctrlr );
467
- #endif
468
-
469
349
/*
470
350
* Use MDTS to ensure our default max_xfer_size doesn't exceed what the
471
351
* controller supports.
@@ -779,10 +659,6 @@ nvme_ctrlr_configure_aer(struct nvme_controller *ctrlr)
779
659
/* aerl is a zero-based value, so we need to add 1 here. */
780
660
ctrlr -> num_aers = min (NVME_MAX_ASYNC_EVENTS , (ctrlr -> cdata .aerl + 1 ));
781
661
782
- /* Chatham doesn't support AERs. */
783
- if (pci_get_devid (ctrlr -> dev ) == CHATHAM_PCI_ID )
784
- ctrlr -> num_aers = 0 ;
785
-
786
662
for (i = 0 ; i < ctrlr -> num_aers ; i ++ ) {
787
663
aer = & ctrlr -> aer [i ];
788
664
nvme_ctrlr_construct_and_submit_aer (ctrlr , aer );
@@ -1034,27 +910,6 @@ nvme_ctrlr_ioctl(struct cdev *cdev, u_long cmd, caddr_t arg, int flag,
1034
910
break ;
1035
911
case NVME_PASSTHROUGH_CMD :
1036
912
pt = (struct nvme_pt_command * )arg ;
1037
- #ifdef CHATHAM2
1038
- /*
1039
- * Chatham IDENTIFY data is spoofed, so copy the spoofed data
1040
- * rather than issuing the command to the Chatham controller.
1041
- */
1042
- if (pci_get_devid (ctrlr -> dev ) == CHATHAM_PCI_ID &&
1043
- pt -> cmd .opc == NVME_OPC_IDENTIFY ) {
1044
- if (pt -> cmd .cdw10 == 1 ) {
1045
- if (pt -> len != sizeof (ctrlr -> cdata ))
1046
- return (EINVAL );
1047
- return (copyout (& ctrlr -> cdata , pt -> buf ,
1048
- pt -> len ));
1049
- } else {
1050
- if (pt -> len != sizeof (ctrlr -> ns [0 ].data ) ||
1051
- pt -> cmd .nsid != 1 )
1052
- return (EINVAL );
1053
- return (copyout (& ctrlr -> ns [0 ].data , pt -> buf ,
1054
- pt -> len ));
1055
- }
1056
- }
1057
- #endif
1058
913
return (nvme_ctrlr_passthrough_cmd (ctrlr , pt , pt -> cmd .nsid ,
1059
914
1 /* is_user_buffer */ , 1 /* is_admin_cmd */ ));
1060
915
default :
@@ -1087,15 +942,6 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, device_t dev)
1087
942
if (status != 0 )
1088
943
return (status );
1089
944
1090
- #ifdef CHATHAM2
1091
- if (pci_get_devid (dev ) == CHATHAM_PCI_ID ) {
1092
- status = nvme_ctrlr_allocate_chatham_bar (ctrlr );
1093
- if (status != 0 )
1094
- return (status );
1095
- nvme_ctrlr_setup_chatham (ctrlr );
1096
- }
1097
- #endif
1098
-
1099
945
/*
1100
946
* Software emulators may set the doorbell stride to something
1101
947
* other than zero, but this driver is not set up to handle that.
@@ -1244,14 +1090,8 @@ nvme_ctrlr_destruct(struct nvme_controller *ctrlr, device_t dev)
1244
1090
* during shutdown). This ensures the controller receives a
1245
1091
* shutdown notification in case the system is shutdown before
1246
1092
* reloading the driver.
1247
- *
1248
- * Chatham does not let you re-enable the controller after shutdown
1249
- * notification has been received, so do not send it in this case.
1250
- * This is OK because Chatham does not depend on the shutdown
1251
- * notification anyways.
1252
1093
*/
1253
- if (pci_get_devid (ctrlr -> dev ) != CHATHAM_PCI_ID )
1254
- nvme_ctrlr_shutdown (ctrlr );
1094
+ nvme_ctrlr_shutdown (ctrlr );
1255
1095
1256
1096
nvme_ctrlr_disable (ctrlr );
1257
1097
taskqueue_free (ctrlr -> taskqueue );
@@ -1280,13 +1120,6 @@ nvme_ctrlr_destruct(struct nvme_controller *ctrlr, device_t dev)
1280
1120
ctrlr -> bar4_resource_id , ctrlr -> bar4_resource );
1281
1121
}
1282
1122
1283
- #ifdef CHATHAM2
1284
- if (ctrlr -> chatham_resource != NULL ) {
1285
- bus_release_resource (dev , SYS_RES_MEMORY ,
1286
- ctrlr -> chatham_resource_id , ctrlr -> chatham_resource );
1287
- }
1288
- #endif
1289
-
1290
1123
if (ctrlr -> tag )
1291
1124
bus_teardown_intr (ctrlr -> dev , ctrlr -> res , ctrlr -> tag );
1292
1125
0 commit comments